Some checks failed
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 9m27s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 8m51s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 7m45s
Build Packages / Generate python client (push) Successful in 28s
Build Packages / Build documentation (push) Successful in 57s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 8m53s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 9m26s
Build Packages / build:rpm (rocky9) (push) Successful in 9m21s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 7m42s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 8m11s
Build Packages / build:rpm (rocky9_nocuda) (push) Failing after 7m7s
Build Packages / Unit tests (push) Has been skipped
This is an UNSTABLE release. * jfjoch_viewer: Remove 3D lattice viewer (not really useful at this moment) * jfjoch_viewer: Fix auto contrast not refreshing image Reviewed-on: #17 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch> Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
84 lines
2.8 KiB
C++
84 lines
2.8 KiB
C++
#include <QApplication>
|
|
#include <QCommandLineParser>
|
|
#include <QCommandLineOption>
|
|
#include <QSplashScreen>
|
|
#include <QTimer>
|
|
|
|
#include "JFJochViewerWindow.h"
|
|
#include "../writer/HDF5Objects.h"
|
|
#include "../common/GitInfo.h"
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
qRegisterMetaType<std::shared_ptr<const JFJochReaderDataset>>("std::shared_ptr<const JFJochReaderDataset>");
|
|
qRegisterMetaType<std::shared_ptr<const JFJochReaderImage>>("std::shared_ptr<const JFJochReaderImage>");
|
|
|
|
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(
|
|
"<b>Jungfrujoch image viewer</b><br/> Version " + version + "<br/>Paul Scherrer Institut",
|
|
Qt::AlignBottom | Qt::AlignHCenter,
|
|
Qt::black
|
|
);
|
|
|
|
splash->show();
|
|
|
|
QTimer::singleShot(5000, splash, &QSplashScreen::close);
|
|
return QApplication::exec();
|
|
}
|