feat: support enforce windowed mode on start-up

This feature is sponsored by @EdgarHartel.

Issue: https://github.com/BLumia/pineapple-pictures/issues/143
This commit is contained in:
Gary Wang 2025-03-26 22:45:12 +08:00
parent bfaf702606
commit 4de03dd02e
No known key found for this signature in database
GPG Key ID: 5D30A4F15EA78760
3 changed files with 6 additions and 1 deletions

View File

@ -193,6 +193,9 @@ void MainWindow::initWindowSize()
case Settings::WindowSizeBehavior::Maximized: case Settings::WindowSizeBehavior::Maximized:
showMaximized(); showMaximized();
break; break;
case Settings::WindowSizeBehavior::Windowed:
showNormal();
break;
default: default:
adjustWindowSizeBySceneRect(); adjustWindowSizeBySceneRect();
break; break;

View File

@ -28,6 +28,7 @@ public:
enum WindowSizeBehavior { enum WindowSizeBehavior {
Auto, Auto,
Maximized, Maximized,
Windowed,
}; };
Q_ENUM(WindowSizeBehavior) Q_ENUM(WindowSizeBehavior)

View File

@ -86,7 +86,8 @@ SettingsDialog::SettingsDialog(QWidget *parent)
static QList< QPair<Settings::WindowSizeBehavior, QString> > _iws_options { static QList< QPair<Settings::WindowSizeBehavior, QString> > _iws_options {
{ Settings::WindowSizeBehavior::Auto, tr("Auto size") }, { Settings::WindowSizeBehavior::Auto, tr("Auto size") },
{ Settings::WindowSizeBehavior::Maximized, tr("Maximized") } { Settings::WindowSizeBehavior::Maximized, tr("Maximized") },
{ Settings::WindowSizeBehavior::Windowed, tr("Windowed") }
}; };
static QList< QPair<Qt::HighDpiScaleFactorRoundingPolicy, QString> > _hidpi_options { static QList< QPair<Qt::HighDpiScaleFactorRoundingPolicy, QString> > _hidpi_options {