Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to always show window maximized #719

Merged
merged 4 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading