ecc06d9abd
First pass of the viewer redesign (see docs/review/VIEWER_REDESIGN.md), no structural change: - TitleLabel: replace the 50px solid #FA7268 section bars with a slim 26px navy-bold header + coral accent rule, removing the "venetian blind" stack while keeping the salmon identity. - Palette: switch the accent (QPalette::Highlight) from teal to navy #1F3A5F. - Image toolbar: replace the unicode arrow glyphs (|<= <= => =>|) with flat media icons (first/prev/next/last) + tooltips, and a play icon on Movie. - Bottom dock: give the per-dataset plot more default height (340 -> 420). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
101 lines
3.8 KiB
C++
101 lines
3.8 KiB
C++
#include <QApplication>
|
|
#include <QCommandLineParser>
|
|
#include <QCommandLineOption>
|
|
#include <QSplashScreen>
|
|
#include <QTimer>
|
|
#include <QPalette>
|
|
|
|
#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);
|
|
|
|
// Theme via the palette (robust across widgets): salmon panels, white entry fields that fall back
|
|
// to salmon when disabled, and a navy accent for selections and progress-bar chunks.
|
|
app.setStyle("Fusion");
|
|
QPalette pal = app.palette();
|
|
pal.setColor(QPalette::Window, QColor(255, 235, 230));
|
|
pal.setColor(QPalette::Base, Qt::white);
|
|
pal.setColor(QPalette::AlternateBase, QColor(255, 245, 242));
|
|
pal.setColor(QPalette::Button, QColor(255, 235, 230));
|
|
pal.setColor(QPalette::Disabled, QPalette::Base, QColor(255, 235, 230));
|
|
pal.setColor(QPalette::Highlight, QColor(0x1f, 0x3a, 0x5f));
|
|
pal.setColor(QPalette::HighlightedText, Qt::white);
|
|
app.setPalette(pal);
|
|
// Fusion fills QGroupBox interiors with a flat light colour; make them transparent so they show
|
|
// the salmon window background like the rest of the UI (entry widgets stay white via the palette).
|
|
app.setStyleSheet("QGroupBox { background-color: transparent; }");
|
|
|
|
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();
|
|
}
|