Build Packages / Create release (push) Successful in 23s
Build Packages / build:rugnux:aarch64 (cross) (push) Successful in 7m30s
Build Packages / build:rugnux-tgz (x86_64) (push) Successful in 7m41s
Build Packages / build:viewer-tgz:cpu (push) Successful in 8m9s
Build Packages / build:viewer-tgz:cuda (push) Successful in 9m19s
Build Packages / build:windows:nocuda (push) Successful in 16m37s
Build Packages / build:windows:cuda (push) Successful in 19m3s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 21m50s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 17m19s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 16m7s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 17m53s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 17m51s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 16m21s
Build Packages / Generate python client (push) Successful in 31s
Build Packages / build:rugnux:windows (push) Successful in 10m4s
Build Packages / Build documentation (push) Successful in 47s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 14m44s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 16m11s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 16m22s
Build Packages / build:rpm (rocky8) (push) Successful in 16m33s
Build Packages / build:rpm (rocky9) (push) Successful in 17m12s
Build Packages / Unit tests (push) Successful in 1h54m27s
Written for the person this program is mostly used by: someone reading a diffraction pattern on a 4K monitor with eyesight that is no longer 25. The rotation-angle axis of the dataset plot showed four ellipses and nothing else. Qt Charts has truncated axis labels by default since 6.2, so the plot has been unreadable along that axis for as long as we have shipped it; turning truncation off then exposed the last label clipped by the widget edge, hence the right margin that now follows the font instead of a hard 8 px. The splitters were 10 px of the window's own salmon - a 1.00:1 contrast ratio, which is to say invisible. They are now a darker coral band, 3.31:1, past the 3:1 that WCAG asks of a control's boundary, with the brand coral as the hover state. The brand colour itself is 2.38:1 on salmon and cannot carry the idle band. View > Font size, Ctrl+plus and Ctrl+minus, 100/125/150 %. It multiplies whatever the desktop already set rather than replacing it, so a session already scaled by GNOME steps from there and steps back exactly. Qt does not deliver a runtime application font to widgets that already exist, so the change is broadcast to them; per-widget attributes survive it. The Inspector is the panel people read all day, and its value column was capped at a flat 600 px, which clipped as soon as the text grew. The bounds are character widths now, chosen to be exactly 600 at the default font and to grow with it. The dataset plot's curves are a fifth of the font height rather than 2 px, for the same reason: a curve is read at the distance the labels beside it are. Also the four QChart::axisX/axisY calls deprecated since 6.0, replaced by what they do internally, and the two button rows the larger fonts clipped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011GxZqDiFP3KqriBhNdcR56
111 lines
4.4 KiB
C++
111 lines
4.4 KiB
C++
#include <QApplication>
|
|
#include <QCommandLineParser>
|
|
#include <QCommandLineOption>
|
|
#include <QSplashScreen>
|
|
#include <QTimer>
|
|
#include <QPalette>
|
|
|
|
#include "JFJochViewerWindow.h"
|
|
#include "RemoteDisplayMode.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).
|
|
// Fusion paints the dock resize handles in the window colour, which leaves them invisible against
|
|
// the salmon background (1.00:1) and impossible to find; give them the coral accent instead, and
|
|
// the brand coral under the cursor.
|
|
app.setStyleSheet("QGroupBox { background-color: transparent; }"
|
|
"QMainWindow::separator { background-color: #D35F4E; width: 10px; height: 10px; }"
|
|
"QMainWindow::separator:hover { background-color: #FA7268; }");
|
|
|
|
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);
|
|
|
|
if (RemoteDisplayMode())
|
|
qInfo() << "Remote display session detected - repaints are throttled"
|
|
" (JFJOCH_VIEWER_REMOTE=0 or the View menu to override)";
|
|
|
|
// 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();
|
|
}
|