The right end of the display toolbar now carries three "A" buttons for the 100/125/150 % font sizes and a light/dark switch (a sun with a half-filled disc), so both settings are visible without opening the View menu. The size buttons and View > Font size stay in sync through JFJochViewerMenu's new SetFontZoom / fontZoomChanged; the View > Theme tick follows ThemeNotifier, so it moves when the toolbar switches the theme. With Qt 6.8+ an explicit Light or Dark choice is also requested from the OS (QStyleHints::setColorScheme), so the title bar macOS and Windows draw matches the window, as apps with their own theme switch do. Follow system withdraws the request first, since Qt otherwise reports the requested scheme instead of the desktop's. The image counter reads "1 / 1800" instead of "1/1800". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
2.7 KiB
C++
80 lines
2.7 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <QActionGroup>
|
|
#include <QFont>
|
|
#include <QMenuBar>
|
|
|
|
#include "windows/JFJochHelperWindow.h"
|
|
|
|
class JFJochLicenseWindow;
|
|
class JFJochMouseShortcutsWindow;
|
|
class JFJochAcknowledgementWindow;
|
|
class QDockWidget;
|
|
|
|
class JFJochViewerMenu : public QMenuBar {
|
|
Q_OBJECT
|
|
QAction *toggleImageWindowAction = nullptr;
|
|
QAction *toggleMetadataWindowAction = nullptr;
|
|
QAction *toggleSpotWindowAction = nullptr;
|
|
QAction *toggleReflectionWindowAction = nullptr;
|
|
QAction *toggleProcessingWindowAction = nullptr;
|
|
QAction *toggleCalibrationWindowAction = nullptr;
|
|
|
|
QMenu *windowMenu = nullptr;
|
|
QActionGroup *fontZoomGroup = nullptr;
|
|
QFont baseFont; // the font the desktop handed us; the zoom is a multiple of it
|
|
int fontZoom = 100; // per cent: 100, 125 or 150
|
|
JFJochLicenseWindow *licenseWindow = nullptr;
|
|
JFJochMouseShortcutsWindow *mouseShortcutsWindow = nullptr;
|
|
JFJochAcknowledgementWindow *acknowledgementWindow = nullptr;
|
|
public:
|
|
explicit JFJochViewerMenu(QWidget *parent = nullptr);
|
|
~JFJochViewerMenu() override = default;
|
|
|
|
void AddWindowEntry(JFJochHelperWindow *window, const QString &name);
|
|
// Adds a dock's show/hide toggle to the Window menu (for docked panels).
|
|
void AddDockEntry(QDockWidget *dock, const QString &name);
|
|
// Back to 100 %, for "Reset all settings to defaults".
|
|
void ResetFontZoom();
|
|
// 100, 125 or 150 per cent; also reachable from the display toolbar's size buttons.
|
|
void SetFontZoom(int percent);
|
|
[[nodiscard]] int FontZoom() const { return fontZoom; }
|
|
|
|
public slots:
|
|
void openSelected(); // also reachable from the toolbar's open-dataset button
|
|
void openHttpSelected(); // also reachable from the toolbar's HTTP-sync button
|
|
|
|
signals:
|
|
void fileOpenSelected(const QString &filename, qint64 image_number, qint64 summation, bool retry);
|
|
void fileCloseSelected();
|
|
|
|
void saveUserMaskTiffSelected(const QString &filename);
|
|
void loadUserMaskTiffSelected(const QString &filename, bool replace);
|
|
void uploadUserMaskSelected();
|
|
void clearUserMaskSelected();
|
|
void openDatasetInfo();
|
|
|
|
void imageLayoutSelected();
|
|
void processingLayoutSelected();
|
|
void resetLayoutSelected();
|
|
void resetSettingsSelected();
|
|
void fontZoomChanged(int percent);
|
|
|
|
private slots:
|
|
void aboutSelected();
|
|
void licensesSelected();
|
|
void mouseShortcutsSelected();
|
|
void acknowledgementsSelected();
|
|
void quitSelected();
|
|
void closeSelected();
|
|
|
|
void saveUserMaskAsTiffSelected();
|
|
void uploadUserMaskAction();
|
|
|
|
private:
|
|
void openLoadUserMaskTiff(bool replace);
|
|
};
|