31 lines
979 B
C++
31 lines
979 B
C++
#include "app/MainWindow.h"
|
|
|
|
#include <QApplication>
|
|
#include <QTimer>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
QApplication app(argc, argv);
|
|
QCoreApplication::setOrganizationName(QStringLiteral("PipeDiagram"));
|
|
QCoreApplication::setApplicationName(QStringLiteral("PipeDiagram"));
|
|
|
|
diag::MainWindow window;
|
|
window.show();
|
|
const QStringList args = app.arguments();
|
|
if (args.contains(QStringLiteral("--sample")))
|
|
window.loadSample();
|
|
if (args.contains(QStringLiteral("--simulate")))
|
|
window.setSimulationRunning(true);
|
|
|
|
// Headless smoke check: --screenshot <file.png> renders and exits.
|
|
const int shotIdx = args.indexOf(QStringLiteral("--screenshot"));
|
|
if (shotIdx >= 0 && shotIdx + 1 < args.size()) {
|
|
const QString path = args.at(shotIdx + 1);
|
|
QTimer::singleShot(300, &window, [&window, path] {
|
|
window.grab().save(path);
|
|
QApplication::quit();
|
|
});
|
|
}
|
|
return app.exec();
|
|
}
|