From: Flavio Tordini Date: Fri, 22 Jan 2010 19:31:20 +0000 (+0100) Subject: Fixed shortcuts in fullscreen on the Mac X-Git-Tag: 0.9~9 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=19842097054923e19a90d6ee58ad3ba5101a3126;p=minitube Fixed shortcuts in fullscreen on the Mac Removed commented code --- diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 823301c..0c85e5f 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -60,15 +60,6 @@ void MainWindow::createActions() { QMap *actions = The::globalActions(); - /* - settingsAct = new QAction(tr("&Preferences..."), this); - settingsAct->setStatusTip(tr(QString("Configure ").append(Constants::APP_NAME).toUtf8())); - // Mac integration - settingsAct->setMenuRole(QAction::PreferencesRole); - actions->insert("settings", settingsAct); - connect(settingsAct, SIGNAL(triggered()), this, SLOT(showSettings())); - */ - backAct = new QAction(tr("&Back"), this); backAct->setEnabled(false); backAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Left)); @@ -112,16 +103,6 @@ void MainWindow::createActions() { actions->insert("compactView", compactViewAct); connect(compactViewAct, SIGNAL(toggled(bool)), this, SLOT(compactView(bool))); - /* - // icon should be document-save but it is ugly - downloadAct = new QAction(QtIconLoader::icon("go-down", QIcon(":/images/go-down.png")), tr("&Download"), this); - downloadAct->setStatusTip(tr("Download this video")); - downloadAct->setShortcut(tr("Ctrl+S")); - downloadAct->setEnabled(false); - actions->insert("download", downloadAct); - connect(downloadAct, SIGNAL(triggered()), this, SLOT(download())); - */ - webPageAct = new QAction(tr("&YouTube"), this); webPageAct->setStatusTip(tr("Open the YouTube video page")); webPageAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y)); @@ -236,10 +217,7 @@ void MainWindow::createActions() { // show keyboard shortcuts in the status bar if (!action->shortcut().isEmpty()) action->setStatusTip(action->statusTip() + " (" + action->shortcut().toString(QKeySequence::NativeText) + ")"); - - // make the actions work when video is fullscreen - action->setShortcutContext(Qt::ApplicationShortcut); - + // no icons in menus action->setIconVisibleInMenu(false); @@ -253,7 +231,6 @@ void MainWindow::createMenus() { fileMenu = menuBar()->addMenu(tr("&Application")); // menus->insert("file", fileMenu); - // fileMenu->addAction(settingsAct); fileMenu->addAction(clearAct); #ifndef Q_WS_MAC fileMenu->addSeparator(); @@ -412,19 +389,12 @@ void MainWindow::showWidget ( QWidget* widget ) { } // backAct->setEnabled(history->size() > 1); - // settingsAct->setEnabled(widget != settingsView); stopAct->setEnabled(widget == mediaView); fullscreenAct->setEnabled(widget == mediaView); compactViewAct->setEnabled(widget == mediaView); webPageAct->setEnabled(widget == mediaView); aboutAct->setEnabled(widget != aboutView); - - /* - // this is not the best place to enable downloads, but the user is informed - // if there really is no video is playing - downloadAct->setEnabled(widget == mediaView); - */ - + // toolbar only for the mediaView mainToolBar->setVisible(widget == mediaView && !compactViewAct->isChecked()); @@ -445,7 +415,7 @@ void MainWindow::showWidget ( QWidget* widget ) { void MainWindow::fadeInWidget(QWidget *oldWidget, QWidget *newWidget) { if (faderWidget) faderWidget->close(); if (!oldWidget || !newWidget) { - qDebug() << "no widgets"; + // qDebug() << "no widgets"; return; } faderWidget = new FaderWidget(newWidget); @@ -602,8 +572,20 @@ void MainWindow::fullscreen() { // it steals the Space key needed for Play/Pause mainToolBar->setEnabled(m_fullscreen); +#ifdef Q_WS_MAC + // make the actions work when video is fullscreen (on the Mac) + QMap *actions = The::globalActions(); + foreach (QAction *action, actions->values()) { + if (m_fullscreen) { + action->setShortcutContext(Qt::WindowShortcut); + } else { + action->setShortcutContext(Qt::ApplicationShortcut); + } + } +#endif + m_fullscreen = !m_fullscreen; - + setUpdatesEnabled(true); } diff --git a/src/MainWindow.h b/src/MainWindow.h index 675597f..67bf1e2 100755 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -11,11 +11,8 @@ #include "View.h" #include "SearchView.h" #include "MediaView.h" -#include "SettingsView.h" #include "AboutView.h" -// #include - class MainWindow : public QMainWindow { Q_OBJECT @@ -33,7 +30,6 @@ protected: private slots: void fadeInWidget(QWidget *oldWidget, QWidget *newWidget); void goBack(); - // void showSettings(); void showSearch(); void showMedia(QString query); void visitSite(); @@ -81,12 +77,10 @@ private: // view widgets QWidget *searchView; MediaView *mediaView; - // QWidget *settingsView; QWidget *aboutView; // actions QAction *addGadgetAct; - // QAction *settingsAct; QAction *backAct; QAction *quitAct; QAction *siteAct;