X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=20430f15de736ecab6372244303e7fece5e270e8;hp=747da66a9c68a485fd473ef9859f337d6cb9986c;hb=f9116672c22abbb19817eb2ff7d93272927515f7;hpb=f84a3fd303cbea73a7c9b3839e417862fea43baa diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 747da66a..20430f15 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -140,6 +140,7 @@ #include "settingspages/bufferviewsettingspage.h" #include "settingspages/chatmonitorsettingspage.h" #include "settingspages/chatviewsettingspage.h" +#include "settingspages/chatviewcolorsettingspage.h" #include "settingspages/connectionsettingspage.h" #include "settingspages/coreaccountsettingspage.h" #include "settingspages/coreconnectionsettingspage.h" @@ -172,7 +173,8 @@ MainWin::MainWin(QWidget *parent) _titleSetter(this), _awayLog(0), _layoutLoaded(false), - _activeBufferViewIndex(-1) + _activeBufferViewIndex(-1), + _aboutToQuit(false) { setAttribute(Qt::WA_DeleteOnClose, false); // we delete the mainwin manually @@ -353,6 +355,15 @@ void MainWin::restoreStateFromSettings(UiSettings &s) show(); } +QMenu *MainWin::createPopupMenu() +{ + QMenu *popupMenu = QMainWindow::createPopupMenu(); + popupMenu->addSeparator(); + ActionCollection *coll = QtUi::actionCollection("General"); + popupMenu->addAction(coll->action("ToggleMenuBar")); + return popupMenu; +} + void MainWin::updateIcon() { @@ -370,9 +381,9 @@ void MainWin::setupActions() { ActionCollection *coll = QtUi::actionCollection("General", tr("General")); // File - coll->addAction("ConnectCore", new Action(QIcon::fromTheme("network-connect"), tr("&Connect to Core..."), coll, + coll->addAction("ConnectCore", new Action(QIcon(":/icons/quassel-128.png"), tr("&Connect to Core..."), coll, this, SLOT(showCoreConnectionDlg()))); - coll->addAction("DisconnectCore", new Action(QIcon::fromTheme("network-disconnect"), tr("&Disconnect from Core"), coll, + coll->addAction("DisconnectCore", new Action(QIcon(":/icons/quassel-disconnect.png"), tr("&Disconnect from Core"), coll, Client::instance(), SLOT(disconnectFromCore()))); coll->addAction("ChangePassword", new Action(QIcon::fromTheme("dialog-password"), tr("Change &Password..."), coll, this, SLOT(showPasswordChangeDlg()))); @@ -397,7 +408,7 @@ void MainWin::setupActions() coll->addAction("ShowAwayLog", new Action(tr("Show Away Log"), coll, this, SLOT(showAwayLog()))); coll->addAction("ToggleMenuBar", new Action(QIcon::fromTheme("show-menu"), tr("Show &Menubar"), coll, - 0, 0, QKeySequence(Qt::CTRL + Qt::Key_M)))->setCheckable(true); + 0, 0))->setCheckable(true); coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll, 0, 0))->setCheckable(true); @@ -1050,9 +1061,28 @@ void MainWin::setupToolBars() _mainToolBar->setWindowTitle(tr("Main Toolbar")); addToolBar(_mainToolBar); + if (Quassel::runMode() != Quassel::Monolithic) { + ActionCollection *coll = QtUi::actionCollection("General"); + _mainToolBar->addAction(coll->action("ConnectCore")); + _mainToolBar->addAction(coll->action("DisconnectCore")); + } + QtUi::toolBarActionProvider()->addActions(_mainToolBar, ToolBarActionProvider::MainToolBar); _toolbarMenu->addAction(_mainToolBar->toggleViewAction()); +#ifdef HAVE_KDE + _nickToolBar = new KToolBar("NickToolBar", this, Qt::TopToolBarArea, false, true, true); +#else + _nickToolBar = new QToolBar(this); + _nickToolBar->setObjectName("NickToolBar"); +#endif + _nickToolBar->setWindowTitle(tr("Nick Toolbar")); + _nickToolBar->setVisible(false); //default: not visible + addToolBar(_nickToolBar); + + QtUi::toolBarActionProvider()->addActions(_nickToolBar, ToolBarActionProvider::NickToolBar); + _toolbarMenu->addAction(_nickToolBar->toggleViewAction()); + #ifdef Q_OS_MAC QtUiSettings uiSettings; @@ -1375,6 +1405,7 @@ void MainWin::showSettingsDlg() //Category: Interface dlg->registerSettingsPage(new AppearanceSettingsPage(dlg)); dlg->registerSettingsPage(new ChatViewSettingsPage(dlg)); + dlg->registerSettingsPage(new ChatViewColorSettingsPage(dlg)); dlg->registerSettingsPage(new ChatMonitorSettingsPage(dlg)); dlg->registerSettingsPage(new ItemViewSettingsPage(dlg)); dlg->registerSettingsPage(new BufferViewSettingsPage(dlg)); @@ -1498,14 +1529,21 @@ void MainWin::closeEvent(QCloseEvent *event) QtUiSettings s; QtUiApplication *app = qobject_cast qApp; Q_ASSERT(app); - if (!app->isAboutToQuit() && QtUi::haveSystemTray() && s.value("MinimizeOnClose").toBool()) { + // On OSX it can happen that the closeEvent occurs twice. (Especially if packaged with Frameworks) + // This messes up MainWinState/MainWinHidden save/restore. + // It's a bug in Qt: https://bugreports.qt.io/browse/QTBUG-43344 + if (!_aboutToQuit && !app->isAboutToQuit() && QtUi::haveSystemTray() && s.value("MinimizeOnClose").toBool()) { QtUi::hideMainWidget(); event->ignore(); } - else { + else if(!_aboutToQuit) { + _aboutToQuit = true; event->accept(); quit(); } + else { + event->ignore(); + } }