diff --git a/docs/changelog.md b/docs/changelog.md index 9f08072ca..20f63e19e 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -7,6 +7,7 @@ Description * UI(Commit List): Added a right-click menu entry to rename branches. * UI(Main Menu): Added a menu-entry to rename the current branch. * UI(Diff View): Added line wrapping option in Tools - Options - Diff +* Option to open Gittyup maximized at startup #### Changed diff --git a/src/conf/Setting.cpp b/src/conf/Setting.cpp index 4ff5b8713..2d1af02e1 100644 --- a/src/conf/Setting.cpp +++ b/src/conf/Setting.cpp @@ -19,6 +19,7 @@ void Setting::initialize(QMap &keys) { keys[Id::OpenAllReposInTabs] = "window/tabs/repository"; keys[Id::HideMenuBar] = "window/view/menuBarHidden"; keys[Id::ShowAvatars] = "window/view/avatarsVisible"; + keys[Id::ShowMaximized] = "window/view/showMaximized"; keys[Id::AutoCollapseAddedFiles] = "collapse/added"; keys[Id::AutoCollapseDeletedFiles] = "collapse/deleted"; keys[Id::FilemanagerCommand] = "filemanager/command"; diff --git a/src/conf/Setting.h b/src/conf/Setting.h index b3f9f1252..a6ebe9aa5 100644 --- a/src/conf/Setting.h +++ b/src/conf/Setting.h @@ -43,6 +43,7 @@ class Setting : public SettingsTempl { OpenAllReposInTabs, HideMenuBar, ShowAvatars, + ShowMaximized, AutoCollapseAddedFiles, AutoCollapseDeletedFiles, FilemanagerCommand, diff --git a/src/dialogs/SettingsDialog.cpp b/src/dialogs/SettingsDialog.cpp index 81dc303fe..a246755db 100644 --- a/src/dialogs/SettingsDialog.cpp +++ b/src/dialogs/SettingsDialog.cpp @@ -565,6 +565,13 @@ class WindowPanel : public QWidget { connect(showAvatars, &QCheckBox::toggled, [](bool checked) { Settings::instance()->setValue(Setting::Id::ShowAvatars, checked); }); + QCheckBox *showMaximized = + new QCheckBox(tr("Show Window Maximized when opened")); + showMaximized->setChecked( + settings->value(Setting::Id::ShowMaximized).toBool()); + connect(showMaximized, &QCheckBox::toggled, [](bool checked) { + Settings::instance()->setValue(Setting::Id::ShowMaximized, checked); + }); QString mergeText = settings->promptDescription(Prompt::Kind::Merge); QCheckBox *merge = new QCheckBox(mergeText, this); @@ -619,6 +626,7 @@ class WindowPanel : public QWidget { layout->addRow(QString(), repoTabs); layout->addRow(tr("View:"), hideMenuBar); layout->addRow(QString(), showAvatars); + layout->addRow(QString(), showMaximized); layout->addRow(tr("Prompt:"), merge); layout->addRow(QString(), revert); layout->addRow(QString(), cherryPick); diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index 46586b5f5..5b6971a90 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -386,7 +386,15 @@ MainWindow *MainWindow::open(const git::Repository &repo) { // Create the window. MainWindow *window = new MainWindow(repo); - window->show(); + + const bool showMaximized = + Settings::instance()->value(Setting::Id::ShowMaximized).toBool(); + + if (showMaximized) { + window->showMaximized(); + } else { + window->show(); + } return window; }