feat: add more items in macOS menu bar (#5266)

Co-authored-by: pajlada <rasmus.karlsson+github@pajlada.com>
This commit is contained in:
Maverick 2024-03-29 20:50:43 +01:00 committed by GitHub
parent 515a92d6f7
commit b6d75fd867
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 51 additions and 3 deletions

View file

@ -29,6 +29,7 @@
- Minor: Added the ability to configure the color of highlighted AutoMod caught messages. (#5215)
- Minor: Updated to Emoji v15.1. Google emojis are now used as the fallback instead of Twitter emojis. (#5182)
- Minor: Added icons for newer versions of macOS. (#5148)
- Minor: Added more menu items in macOS menu bar. (#5266)
- Minor: Improved color selection and display. (#5057)
- Minor: Added a _System_ theme setting that updates according to the system's color scheme (requires Qt 6.5). (#5118)
- Minor: Normalized the input padding between light & dark themes. (#5095)

View file

@ -8,6 +8,10 @@
#include <optional>
#include <string>
#define LINK_CHATTERINO_WIKI "https://wiki.chatterino.com"
#define LINK_CHATTERINO_DISCORD "https://discord.gg/7Y5AYhAK4z"
#define LINK_CHATTERINO_SOURCE "https://github.com/Chatterino/chatterino2"
namespace chatterino {
enum class HighlightState {

View file

@ -2,6 +2,7 @@
#include "Application.hpp"
#include "common/Args.hpp"
#include "common/Common.hpp"
#include "common/Credentials.hpp"
#include "common/Modes.hpp"
#include "common/QLogging.hpp"
@ -702,6 +703,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] {
@ -711,6 +720,13 @@ void Window::addMenuBar()
// Window menu.
QMenu *windowMenu = mainMenu->addMenu(QString("Window"));
// Window->Minimize item
QAction *minimizeWindow = windowMenu->addAction(QString("Minimize"));
minimizeWindow->setShortcuts({QKeySequence("Meta+M")});
connect(minimizeWindow, &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] {
@ -722,6 +738,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(LINK_CHATTERINO_WIKI));
});
// Help->Chatterino Github
QAction *helpGithub = helpMenu->addAction(QString("Chatterino GitHub"));
connect(helpGithub, &QAction::triggered, this, []() {
QDesktopServices::openUrl(QUrl(LINK_CHATTERINO_SOURCE));
});
// Help->Chatterino Discord
QAction *helpDiscord = helpMenu->addAction(QString("Chatterino Discord"));
connect(helpDiscord, &QAction::triggered, this, []() {
QDesktopServices::openUrl(QUrl(LINK_CHATTERINO_DISCORD));
});
}
void Window::onAccountSelected()

View file

@ -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
}
@ -366,6 +366,11 @@ void SettingsDialog::showDialog(QWidget *parent,
}
break;
case SettingsDialogPreference::About: {
instance->selectTab(SettingsTabId::About);
}
break;
default:;
}

View file

@ -30,6 +30,7 @@ enum class SettingsDialogPreference {
StreamerMode,
Accounts,
ModerationActions,
About,
};
class SettingsDialog : public BaseWindow

View file

@ -18,6 +18,7 @@ enum class SettingsTabId {
General,
Accounts,
Moderation,
About,
};
class SettingsDialogTab : public BaseWidget

View file

@ -1,5 +1,6 @@
#include "AboutPage.hpp"
#include "common/Common.hpp"
#include "common/Modes.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
@ -18,10 +19,8 @@
#define PIXMAP_WIDTH 500
#define LINK_CHATTERINO_WIKI "https://wiki.chatterino.com"
#define LINK_DONATE "https://streamelements.com/fourtf/tip"
#define LINK_CHATTERINO_FEATURES "https://chatterino.com/#features"
#define LINK_CHATTERINO_DISCORD "https://discord.gg/7Y5AYhAK4z"
namespace chatterino {