Added Preferences item in menu bar for OS X.

This commit is contained in:
23rd 2019-06-09 17:13:06 +03:00 committed by pajlada
parent 98611b46f3
commit d2645b03f8
2 changed files with 18 additions and 0 deletions

View file

@ -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)

View file

@ -38,6 +38,7 @@ private:
void addShortcuts();
void addLayout();
void onAccountSelected();
void addMenuBar();
WindowType type_;