From dd7e515f9c0e48b4ab4ca787a799ef47cbfe36ea Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 7 Feb 2012 19:48:25 +0200 Subject: [PATCH] Cmd+M minimizes main window on Mac OS X (Closes #928216) --- src/mainwindow.cpp | 10 ++++++++++ src/mainwindow.h | 1 + src/mainwindow.ui | 7 ++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4fca06134..37fbe9ba8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -196,6 +196,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo connect(actionIncreasePriority, SIGNAL(triggered()), transferList, SLOT(increasePrioSelectedTorrents())); connect(actionDecreasePriority, SIGNAL(triggered()), transferList, SLOT(decreasePrioSelectedTorrents())); connect(actionToggleVisibility, SIGNAL(triggered()), this, SLOT(toggleVisibility())); + connect(actionMinimize, SIGNAL(triggered()), SLOT(minimizeWindow())); m_pwr = new PowerManagement(this); preventTimer = new QTimer(this); @@ -549,6 +550,10 @@ void MainWindow::createKeyboardShortcuts() { actionPause_All->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+Shift+P"))); actionDecreasePriority->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+-"))); actionIncreasePriority->setShortcut(QKeySequence(QString::fromUtf8("Ctrl++"))); +#ifdef Q_WS_MAC + actionMinimize->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+M"))); + addAction(actionMinimize); +#endif } // Keyboard shortcuts slots @@ -1332,6 +1337,11 @@ void MainWindow::showConnectionSettings() options->showConnectionTab(); } +void MainWindow::minimizeWindow() +{ + setWindowState(windowState() ^ Qt::WindowMinimized); +} + void MainWindow::on_actionExecution_Logs_triggered(bool checked) { if(checked) { diff --git a/src/mainwindow.h b/src/mainwindow.h index 63570c901..fabbb1496 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -110,6 +110,7 @@ protected slots: bool unlockUI(); void notifyOfUpdate(QString); void showConnectionSettings(); + void minimizeWindow(); // Keyboard shortcuts void createKeyboardShortcuts(); void displayTransferTab() const; diff --git a/src/mainwindow.ui b/src/mainwindow.ui index e2ce7565b..f5d29a35a 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -29,7 +29,7 @@ 0 0 914 - 25 + 22 @@ -370,6 +370,11 @@ Show + + + Minimize + +