mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Added Preferences item in menu bar for OS X.
This commit is contained in:
parent
98611b46f3
commit
d2645b03f8
2 changed files with 18 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <QShortcut>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <QMenuBar>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
namespace chatterino {
|
||||
|
@ -43,6 +44,10 @@ Window::Window(WindowType type)
|
|||
this->addShortcuts();
|
||||
this->addLayout();
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
this->addMenuBar();
|
||||
#endif
|
||||
|
||||
this->signalHolder_.managedConnect(
|
||||
getApp()->accounts->twitch.currentUserChanged,
|
||||
[this] { this->onAccountSelected(); });
|
||||
|
@ -336,6 +341,18 @@ void Window::addShortcuts()
|
|||
});
|
||||
}
|
||||
|
||||
void Window::addMenuBar()
|
||||
{
|
||||
QMenuBar *mainMenu = new QMenuBar();
|
||||
mainMenu->setNativeMenuBar(true);
|
||||
|
||||
QMenu *menu = new QMenu(QString());
|
||||
mainMenu->addMenu(menu);
|
||||
QAction *prefs = menu->addAction(QString());
|
||||
prefs->setMenuRole(QAction::PreferencesRole);
|
||||
connect(prefs, &QAction::triggered, this, [] { SettingsDialog::showDialog(); });
|
||||
}
|
||||
|
||||
#define UGLYMACROHACK1(s) #s
|
||||
#define UGLYMACROHACK(s) UGLYMACROHACK1(s)
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ private:
|
|||
void addShortcuts();
|
||||
void addLayout();
|
||||
void onAccountSelected();
|
||||
void addMenuBar();
|
||||
|
||||
WindowType type_;
|
||||
|
||||
|
|
Loading…
Reference in a new issue