#include #include #include #include #include #include "JFJochViewerWindow.h" #include "../writer/HDF5Objects.h" #include "../common/GitInfo.h" int main(int argc, char *argv[]) { qRegisterMetaType>("std::shared_ptr"); qRegisterMetaType>("std::shared_ptr"); RegisterHDF5Filter(); QApplication app(argc, argv); QIcon appIcon(":/jfjoch.png"); app.setWindowIcon(appIcon); app.setApplicationName("JFJoch Viewer"); app.setApplicationVersion(QString::fromStdString(jfjoch_version())); // Parse command line arguments QCommandLineParser parser; parser.setApplicationDescription("JFJoch Image Viewer"); parser.addHelpOption(); parser.addVersionOption(); // Add --dbus option with a value option that defaults to true QCommandLineOption dbusOption(QStringList() << "d" << "dbus", "Enable or disable D-Bus interface (default: enabled)", "enable", "true"); parser.addOption(dbusOption); // Process the actual command line arguments parser.process(app); // Get any positional arguments (files to open) QString fileToOpen; QStringList positionalArgs = parser.positionalArguments(); if (!positionalArgs.isEmpty()) { // Use the last argument as the file to open fileToOpen = positionalArgs.last(); } // Check if D-Bus should be enabled or disabled bool enableDBus = true; // Default is enabled QString dbusValue = parser.value(dbusOption).toLower(); if (dbusValue == "false" || dbusValue == "0" || dbusValue == "no" || dbusValue == "off") { enableDBus = false; qDebug() << "D-Bus interface disabled"; } else { qDebug() << "D-Bus interface enabled"; } // Create and show the main window with the appropriate settings JFJochViewerWindow mainWindow(nullptr, enableDBus, fileToOpen); mainWindow.show(); QPixmap pixmap(":/jfjoch.png"); QPixmap splash_pixmap(256+2*50, 256+50+50+30); splash_pixmap.fill(Qt::white); QPainter painter(&splash_pixmap); painter.drawPixmap(50, 50, pixmap); QSplashScreen *splash = new QSplashScreen(splash_pixmap); splash->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::SplashScreen); QString version(QString::fromStdString(jfjoch_version())); splash->showMessage( "Jungfrujoch image viewer
Version " + version + "
Paul Scherrer Institut", Qt::AlignBottom | Qt::AlignHCenter, Qt::black ); splash->show(); QTimer::singleShot(5000, splash, &QSplashScreen::close); return QApplication::exec(); }