Added Preferences item in menu bar for OS X.
This commit is contained in:
@@ -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_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user