#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); 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(); return QApplication::exec(); }