Skip to content

Commit

Permalink
Merge pull request #719 from monks-dev/master
Browse files Browse the repository at this point in the history
Add option to always show window maximized
  • Loading branch information
Murmele authored Apr 20, 2024
2 parents ed47229 + c59da64 commit 64cecfa
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/conf/Setting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ void Setting::initialize(QMap<Id, QString> &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";
Expand Down
1 change: 1 addition & 0 deletions src/conf/Setting.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Setting : public SettingsTempl<Setting> {
OpenAllReposInTabs,
HideMenuBar,
ShowAvatars,
ShowMaximized,
AutoCollapseAddedFiles,
AutoCollapseDeletedFiles,
FilemanagerCommand,
Expand Down
8 changes: 8 additions & 0 deletions src/dialogs/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 9 additions & 1 deletion src/ui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 64cecfa

Please sign in to comment.