Change shortcut for hiding the current buffer to a standard keysequence
[quassel.git] / src / qtui / mainwin.cpp
index 00407ef..402f5eb 100644 (file)
@@ -352,16 +352,31 @@ void MainWin::setupActions() {
   coll->addAction("ToggleFullscreen", fullScreenAct);
 
   // Settings
-  coll->addAction("ConfigureShortcuts", new Action(SmallIcon("configure-shortcuts"), tr("Configure &Shortcuts..."), coll,
-                                                  this, SLOT(showShortcutsDlg())));
-  coll->addAction("ConfigureQuassel", new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll,
-                                                  this, SLOT(showSettingsDlg()), QKeySequence(Qt::Key_F7)));
+  QAction *configureShortcutsAct = new Action(SmallIcon("configure-shortcuts"), tr("Configure &Shortcuts..."), coll,
+                                             this, SLOT(showShortcutsDlg()));
+  configureShortcutsAct->setMenuRole(QAction::NoRole);
+  coll->addAction("ConfigureShortcuts", configureShortcutsAct);
+
+  #ifdef Q_WS_MAC
+  QAction *configureQuasselAct = new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll,
+                                           this, SLOT(showSettingsDlg()));
+  configureQuasselAct->setMenuRole(QAction::PreferencesRole);
+  #else
+  QAction *configureQuasselAct = new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll,
+                                            this, SLOT(showSettingsDlg()), QKeySequence(Qt::Key_F7));
+  #endif
+  coll->addAction("ConfigureQuassel", configureQuasselAct);
 
   // Help
-  coll->addAction("AboutQuassel", new Action(SmallIcon("quassel"), tr("&About Quassel"), coll,
-                                              this, SLOT(showAboutDlg())));
-  coll->addAction("AboutQt", new Action(QIcon(":/pics/qt-logo.png"), tr("About &Qt"), coll,
-                                         qApp, SLOT(aboutQt())));
+  QAction *aboutQuasselAct = new Action(SmallIcon("quassel"), tr("&About Quassel"), coll,
+                                       this, SLOT(showAboutDlg()));
+  aboutQuasselAct->setMenuRole(QAction::AboutRole);
+  coll->addAction("AboutQuassel", aboutQuasselAct);
+
+  QAction *aboutQtAct = new Action(QIcon(":/pics/qt-logo.png"), tr("About &Qt"), coll,
+                                  qApp, SLOT(aboutQt()));
+  aboutQtAct->setMenuRole(QAction::AboutQtRole);
+  coll->addAction("AboutQt", aboutQtAct);
   coll->addAction("DebugNetworkModel", new Action(SmallIcon("tools-report-bug"), tr("Debug &NetworkModel"), coll,
                                        this, SLOT(on_actionDebugNetworkModel_triggered())));
   coll->addAction("DebugBufferViewOverlay", new Action(SmallIcon("tools-report-bug"), tr("Debug &BufferViewOverlay"), coll,
@@ -375,6 +390,9 @@ void MainWin::setupActions() {
   coll->addAction("ReloadStyle", new Action(SmallIcon("view-refresh"), tr("Reload Stylesheet"), coll,
                                        QtUi::style(), SLOT(reload()), QKeySequence::Refresh));
 
+  coll->addAction("HideCurrentBuffer", new Action(tr("Hide Current Buffer"), coll,
+                                                  this, SLOT(hideCurrentBuffer()), QKeySequence::Close));
+
   // Navigation
   coll = QtUi::actionCollection("Navigation", tr("Navigation"));
 
@@ -698,6 +716,12 @@ void MainWin::previousBuffer() {
     view->previousBuffer();
 }
 
+void MainWin::hideCurrentBuffer() {
+  BufferView *view = activeBufferView();
+  if(view)
+    view->hideCurrentBuffer();
+}
+
 void MainWin::showNotificationsDlg() {
   SettingsPageDlg dlg(new NotificationsSettingsPage(this), this);
   dlg.exec();