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

feat: add more items in macOS menu bar #5266

Merged
36 changes: 36 additions & 0 deletions src/widgets/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,14 @@ void Window::addMenuBar()

// First menu.
QMenu *menu = mainMenu->addMenu(QString());

// About button that shows the About tab in the Settings Dialog.
QAction *about = menu->addAction(QString());
about->setMenuRole(QAction::AboutRole);
connect(about, &QAction::triggered, this, [this] {
SettingsDialog::showDialog(this, SettingsDialogPreference::About);
});

QAction *prefs = menu->addAction(QString());
prefs->setMenuRole(QAction::PreferencesRole);
connect(prefs, &QAction::triggered, this, [this] {
Expand All @@ -711,6 +719,13 @@ void Window::addMenuBar()
// Window menu.
QMenu *windowMenu = mainMenu->addMenu(QString("Window"));

// Window->Minimise item
QAction *minimiseWindow = windowMenu->addAction(QString("Minimise"));
minimiseWindow->setShortcuts({QKeySequence("Meta+M")});
Mm2PL marked this conversation as resolved.
Show resolved Hide resolved
connect(minimiseWindow, &QAction::triggered, this, [this] {
this->setWindowState(Qt::WindowMinimized);
});

QAction *nextTab = windowMenu->addAction(QString("Select next tab"));
nextTab->setShortcuts({QKeySequence("Meta+Tab")});
connect(nextTab, &QAction::triggered, this, [this] {
Expand All @@ -722,6 +737,27 @@ void Window::addMenuBar()
connect(prevTab, &QAction::triggered, this, [this] {
this->notebook_->selectPreviousTab();
});

// Help menu.
QMenu *helpMenu = mainMenu->addMenu(QString("Help"));

// Help->Chatterino Wiki item
QAction *helpWiki = helpMenu->addAction(QString("Chatterino Wiki"));
connect(helpWiki, &QAction::triggered, this, []() {
QDesktopServices::openUrl(QUrl("https://wiki.chatterino.com"));
});

// Help->Chatterino Github
QAction *helpGithub = helpMenu->addAction(QString("Chatterino Github"));
mavjs marked this conversation as resolved.
Show resolved Hide resolved
connect(helpGithub, &QAction::triggered, this, []() {
QDesktopServices::openUrl(QUrl("https://github.com/Chatterino/chatterino2"));
});

// Help->Chatterino Discord
QAction *helpDiscord = helpMenu->addAction(QString("Chatterino Discord"));
connect(helpDiscord, &QAction::triggered, this, []() {
QDesktopServices::openUrl(QUrl("https://discord.gg/7Y5AYhAK4z"));
mavjs marked this conversation as resolved.
Show resolved Hide resolved
});
}

void Window::onAccountSelected()
Expand Down
7 changes: 6 additions & 1 deletion src/widgets/dialogs/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void SettingsDialog::addTabs()
this->addTab([]{return new PluginsPage;}, "Plugins", ":/settings/plugins.svg");
#endif
this->ui_.tabContainer->addStretch(1);
this->addTab([]{return new AboutPage;}, "About", ":/settings/about.svg", SettingsTabId(), Qt::AlignBottom);
this->addTab([]{return new AboutPage;}, "About", ":/settings/about.svg", SettingsTabId::About, Qt::AlignBottom);
// clang-format on
}

Expand Down Expand Up @@ -366,6 +366,11 @@ void SettingsDialog::showDialog(QWidget *parent,
}
break;

case SettingsDialogPreference::About: {
instance->selectTab(SettingsTabId::About);
}
break;

default:;
}

Expand Down
1 change: 1 addition & 0 deletions src/widgets/dialogs/SettingsDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ enum class SettingsDialogPreference {
StreamerMode,
Accounts,
ModerationActions,
About,
};

class SettingsDialog : public BaseWindow
Expand Down
1 change: 1 addition & 0 deletions src/widgets/helper/SettingsDialogTab.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum class SettingsTabId {
General,
Accounts,
Moderation,
About,
};

class SettingsDialogTab : public BaseWidget
Expand Down
Loading