]> git.sur5r.net Git - minitube/blobdiff - src/mainwindow.cpp
Imported Upstream version 2.3
[minitube] / src / mainwindow.cpp
index df6426171805e241c1376b1723d72cc948b48f86..b03d59a8e5ced29be72f7a5bfca84fd7310a04b6 100644 (file)
@@ -26,7 +26,7 @@ $END_LICENSE */
 #include "downloadview.h"
 #include "spacer.h"
 #include "constants.h"
-#include "utils.h"
+#include "iconutils.h"
 #include "global.h"
 #include "videodefinition.h"
 #include "fontutils.h"
@@ -34,10 +34,10 @@ $END_LICENSE */
 #include "searchparams.h"
 #include "videosource.h"
 #include "ytsearch.h"
-#ifdef Q_WS_X11
+#ifdef Q_OS_LINUX
 #include "gnomeglobalshortcutbackend.h"
 #endif
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
 #include "mac_startup.h"
 #include "macfullscreen.h"
 #include "macsupport.h"
@@ -83,8 +83,10 @@ MainWindow::MainWindow() :
     aboutView(0),
     downloadView(0),
     regionsView(0),
+    #ifdef APP_PHONON
     mediaObject(0),
     audioOutput(0),
+    #endif
     m_fullscreen(false),
     m_compact(false) {
 
@@ -150,9 +152,13 @@ MainWindow::~MainWindow() {
 }
 
 void MainWindow::lazyInit() {
+#ifdef APP_PHONON
     initPhonon();
+#endif
     mediaView->initialize();
+#ifdef APP_PHONON
     mediaView->setMediaObject(mediaObject);
+#endif
     qApp->processEvents();
 
     // CLI
@@ -170,11 +176,11 @@ void MainWindow::lazyInit() {
 
     // Global shortcuts
     GlobalShortcuts &shortcuts = GlobalShortcuts::instance();
-#ifdef Q_WS_X11
+#ifdef Q_OS_LINUX
     if (GnomeGlobalShortcutBackend::IsGsdAvailable())
         shortcuts.setBackend(new GnomeGlobalShortcutBackend(&shortcuts));
 #endif
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     mac::MacSetup();
 #endif
     connect(&shortcuts, SIGNAL(PlayPause()), pauseAct, SLOT(trigger()));
@@ -258,15 +264,15 @@ void MainWindow::createActions() {
 
     QHash<QString, QAction*> *actions = The::globalActions();
 
-    stopAct = new QAction(Utils::icon("media-playback-stop"), tr("&Stop"), this);
+    stopAct = new QAction(IconUtils::icon("media-playback-stop"), tr("&Stop"), this);
     stopAct->setStatusTip(tr("Stop playback and go back to the search view"));
     stopAct->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::Key_Escape) << QKeySequence(Qt::Key_MediaStop));
     stopAct->setEnabled(false);
     actions->insert("stop", stopAct);
-    connect(stopAct, SIGNAL(triggered()), this, SLOT(stop()));
+    connect(stopAct, SIGNAL(triggered()), SLOT(stop()));
 
     skipBackwardAct = new QAction(
-                Utils::icon("media-skip-backward"),
+                IconUtils::icon("media-skip-backward"),
                 tr("P&revious"), this);
     skipBackwardAct->setStatusTip(tr("Go back to the previous track"));
     skipBackwardAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left));
@@ -274,21 +280,21 @@ void MainWindow::createActions() {
     actions->insert("previous", skipBackwardAct);
     connect(skipBackwardAct, SIGNAL(triggered()), mediaView, SLOT(skipBackward()));
 
-    skipAct = new QAction(Utils::icon("media-skip-forward"), tr("S&kip"), this);
+    skipAct = new QAction(IconUtils::icon("media-skip-forward"), tr("S&kip"), this);
     skipAct->setStatusTip(tr("Skip to the next video"));
     skipAct->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_Right) << QKeySequence(Qt::Key_MediaNext));
     skipAct->setEnabled(false);
     actions->insert("skip", skipAct);
     connect(skipAct, SIGNAL(triggered()), mediaView, SLOT(skip()));
 
-    pauseAct = new QAction(Utils::icon("media-playback-pause"), tr("&Pause"), this);
-    pauseAct->setStatusTip(tr("Pause playback"));
+    pauseAct = new QAction(IconUtils::icon("media-playback-start"), tr("&Play"), this);
+    pauseAct->setStatusTip(tr("Resume playback"));
     pauseAct->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::Key_Space) << QKeySequence(Qt::Key_MediaPlay));
     pauseAct->setEnabled(false);
     actions->insert("pause", pauseAct);
     connect(pauseAct, SIGNAL(triggered()), mediaView, SLOT(pause()));
 
-    fullscreenAct = new QAction(Utils::icon("view-fullscreen"), tr("&Full Screen"), this);
+    fullscreenAct = new QAction(IconUtils::icon("view-fullscreen"), tr("&Full Screen"), this);
     fullscreenAct->setStatusTip(tr("Go full screen"));
     QList<QKeySequence> fsShortcuts;
 #ifdef APP_MAC
@@ -422,7 +428,7 @@ void MainWindow::createActions() {
     addAction(volumeDownAct);
 
     volumeMuteAct = new QAction(this);
-    volumeMuteAct->setIcon(Utils::icon("audio-volume-high"));
+    volumeMuteAct->setIcon(IconUtils::icon("audio-volume-high"));
     volumeMuteAct->setStatusTip(tr("Mute volume"));
     volumeMuteAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_K));
     actions->insert("volume-mute", volumeMuteAct);
@@ -430,11 +436,11 @@ void MainWindow::createActions() {
     addAction(volumeMuteAct);
 
     QAction *definitionAct = new QAction(this);
-#ifdef Q_WS_X11
-    definitionAct->setIcon(Utils::tintedIcon("video-display", QColor(0, 0, 0),
+#ifdef Q_OS_LINUX
+    definitionAct->setIcon(IconUtils::tintedIcon("video-display", QColor(0, 0, 0),
                                              QList<QSize>() << QSize(16, 16)));
 #else
-    definitionAct->setIcon(Utils::icon("video-display"));
+    definitionAct->setIcon(IconUtils::icon("video-display"));
 #endif
     definitionAct->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_D));
     /*
@@ -450,9 +456,9 @@ void MainWindow::createActions() {
 
     QAction *action;
 
-    action = new QAction(Utils::icon("media-playback-start"), tr("&Manually Start Playing"), this);
+    action = new QAction(IconUtils::icon("media-playback-start"), tr("&Manually Start Playing"), this);
     action->setStatusTip(tr("Manually start playing videos"));
-    action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B));
+    action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T));
     action->setCheckable(true);
     connect(action, SIGNAL(toggled(bool)), SLOT(setManualPlay(bool)));
     actions->insert("manualplay", action);
@@ -461,7 +467,7 @@ void MainWindow::createActions() {
     action->setStatusTip(tr("Show details about video downloads"));
     action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_J));
     action->setCheckable(true);
-    action->setIcon(Utils::icon("document-save"));
+    action->setIcon(IconUtils::icon("document-save"));
     action->setVisible(false);
     connect(action, SIGNAL(toggled(bool)), SLOT(toggleDownloads(bool)));
     actions->insert("downloads", action);
@@ -469,19 +475,20 @@ void MainWindow::createActions() {
     action = new QAction(tr("&Download"), this);
     action->setStatusTip(tr("Download the current video"));
     action->setShortcut(QKeySequence::Save);
-    action->setIcon(Utils::icon("document-save"));
+    action->setIcon(IconUtils::icon("document-save"));
     action->setEnabled(false);
     action->setVisible(false);
     action->setPriority(QAction::LowPriority);
     connect(action, SIGNAL(triggered()), mediaView, SLOT(downloadVideo()));
     actions->insert("download", action);
 
-    /*
-    action = new QAction(tr("&Snapshot"), this);
-    action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
+#ifdef APP_SNAPSHOT
+    action = new QAction(tr("Take &Snapshot"), this);
+    action->setShortcut(QKeySequence(Qt::Key_F9));
+    action->setEnabled(false);
     actions->insert("snapshot", action);
     connect(action, SIGNAL(triggered()), mediaView, SLOT(snapshot()));
-    */
+#endif
 
     action = new QAction(tr("&Subscribe to Channel"), this);
     action->setProperty("originalText", action->text());
@@ -527,12 +534,12 @@ void MainWindow::createActions() {
     actions->insert("restore", action);
     connect(action, SIGNAL(triggered()), SLOT(restore()));
 
-    action = new QAction(Utils::icon("go-top"), tr("&Float on Top"), this);
+    action = new QAction(IconUtils::icon("go-top"), tr("&Float on Top"), this);
     action->setCheckable(true);
     actions->insert("ontop", action);
     connect(action, SIGNAL(toggled(bool)), SLOT(floatOnTop(bool)));
 
-    action = new QAction(Utils::icon("media-playback-stop"), tr("&Stop After This Video"), this);
+    action = new QAction(IconUtils::icon("media-playback-stop"), tr("&Stop After This Video"), this);
     action->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Escape));
     action->setCheckable(true);
     action->setEnabled(false);
@@ -558,7 +565,7 @@ void MainWindow::createActions() {
     action = new QAction(tr("More..."), this);
     actions->insert("more-region", action);
 
-    action = new QAction(Utils::icon(QStringList() << "view-list-symbolic" << "view-list" << "format-justify-fill"), tr("&Related Videos"), this);
+    action = new QAction(IconUtils::icon("view-list"), tr("&Related Videos"), this);
     action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
     action->setStatusTip(tr("Watch videos related to the current one"));
     action->setEnabled(false);
@@ -567,10 +574,17 @@ void MainWindow::createActions() {
     actions->insert("related-videos", action);
 
     action = new QAction(tr("Open in &Browser..."), this);
+    action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B));
     action->setEnabled(false);
     actions->insert("open-in-browser", action);
     connect(action, SIGNAL(triggered()), mediaView, SLOT(openInBrowser()));
 
+#ifdef APP_MAC_STORE
+    action = new QAction(tr("&Love %1? Rate it!").arg(Constants::NAME), this);
+    actions->insert("app-store", action);
+    connect(action, SIGNAL(triggered()), SLOT(rateOnAppStore()));
+#endif
+
 #ifdef APP_ACTIVATION
     Extra::createActivationAction(tr("Buy %1...").arg(Constants::NAME));
 #endif
@@ -580,7 +594,7 @@ void MainWindow::createActions() {
         // add actions to the MainWindow so that they work
         // when the menu is hidden
         addAction(action);
-        Utils::setupAction(action);
+        IconUtils::setupAction(action);
     }
 }
 
@@ -630,14 +644,16 @@ void MainWindow::createMenus() {
     videoMenu->addAction(The::globalActions()->value("related-videos"));
     videoMenu->addAction(findVideoPartsAct);
     videoMenu->addSeparator();
-    videoMenu->addAction(webPageAct);
-    videoMenu->addSeparator();
     videoMenu->addAction(The::globalActions()->value("subscribe-channel"));
+#ifdef APP_SNAPSHOT
     videoMenu->addSeparator();
-    videoMenu->addAction(The::globalActions()->value("download"));
+    videoMenu->addAction(The::globalActions()->value("snapshot"));
+#endif
+    videoMenu->addSeparator();
+    videoMenu->addAction(webPageAct);
     videoMenu->addAction(copyLinkAct);
     videoMenu->addAction(The::globalActions()->value("open-in-browser"));
-    // videoMenu->addAction(The::globalActions()->value("snapshot"));
+    videoMenu->addAction(The::globalActions()->value("download"));
 
     QMenu* viewMenu = menuBar()->addMenu(tr("&View"));
     menus->insert("view", viewMenu);
@@ -667,6 +683,11 @@ void MainWindow::createMenus() {
 #endif
     helpMenu->addAction(The::globalActions()->value("report-issue"));
     helpMenu->addAction(aboutAct);
+
+#ifdef APP_MAC_STORE
+    helpMenu->addSeparator();
+    helpMenu->addAction(The::globalActions()->value("app-store"));
+#endif
 }
 
 void MainWindow::createToolBars() {
@@ -690,7 +711,7 @@ void MainWindow::createToolBars() {
     mainToolBar->addAction(The::globalActions()->value("download"));
 
     bool addFullScreenAct = true;
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     addFullScreenAct = !mac::CanGoFullScreen(winId());
 #endif
     if (addFullScreenAct) mainToolBar->addAction(fullscreenAct);
@@ -702,16 +723,15 @@ void MainWindow::createToolBars() {
     currentTime->setFont(smallerFont);
     mainToolBar->addWidget(currentTime);
 
-#ifdef APP_PHONON_SEEK
     mainToolBar->addWidget(new Spacer());
+
+#ifdef APP_PHONON_SEEK
     seekSlider = new Phonon::SeekSlider(this);
-    seekSlider->setVisible(false);
+    seekSlider->setTracking(true);
     seekSlider->setIconVisible(false);
     seekSlider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
     mainToolBar->addWidget(seekSlider);
-#endif
-
-    mainToolBar->addWidget(new Spacer());
+#else
     slider = new SeekSlider(this);
     slider->setEnabled(false);
     slider->setTracking(false);
@@ -719,17 +739,19 @@ void MainWindow::createToolBars() {
     slider->setOrientation(Qt::Horizontal);
     slider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
     mainToolBar->addWidget(slider);
+#endif
 
+    /*
     mainToolBar->addWidget(new Spacer());
-
     totalTime = new QLabel(mainToolBar);
     totalTime->setFont(smallerFont);
     mainToolBar->addWidget(totalTime);
+    */
 
     mainToolBar->addWidget(new Spacer());
-
     mainToolBar->addAction(volumeMuteAct);
 
+#ifdef APP_PHONON
     volumeSlider = new Phonon::VolumeSlider(this);
     volumeSlider->setMuteVisible(false);
     // qDebug() << volumeSlider->children();
@@ -741,6 +763,7 @@ void MainWindow::createToolBars() {
     // this makes the volume slider smaller
     volumeSlider->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     mainToolBar->addWidget(volumeSlider);
+#endif
 
     mainToolBar->addWidget(new Spacer());
 
@@ -752,16 +775,14 @@ void MainWindow::createToolBars() {
 #endif
     toolbarSearch->setMinimumWidth(toolbarSearch->fontInfo().pixelSize()*15);
     toolbarSearch->setSuggester(new YTSuggester(this));
-    connect(toolbarSearch, SIGNAL(search(const QString&)), this, SLOT(startToolbarSearch(const QString&)));
-    connect(toolbarSearch, SIGNAL(suggestionAccepted(const QString&)), SLOT(startToolbarSearch(const QString&)));
+    connect(toolbarSearch, SIGNAL(search(const QString&)), SLOT(search(const QString&)));
+    connect(toolbarSearch, SIGNAL(suggestionAccepted(Suggestion*)), SLOT(suggestionAccepted(Suggestion*)));
     toolbarSearch->setStatusTip(searchFocusAct->statusTip());
 #ifdef APP_MAC
     mainToolBar->addWidget(searchWrapper);
 #else
     mainToolBar->addWidget(toolbarSearch);
-    Spacer* spacer = new Spacer();
-    // spacer->setWidth(4);
-    mainToolBar->addWidget(spacer);
+    mainToolBar->addWidget(new Spacer());
 #endif
 
     addToolBar(mainToolBar);
@@ -842,8 +863,12 @@ void MainWindow::writeSettings() {
     settings.setValue("geometry", saveGeometry());
     mediaView->saveSplitterState();
 
-    settings.setValue("volume", audioOutput->volume());
-    settings.setValue("volumeMute", audioOutput->isMuted());
+#ifdef APP_PHONON
+    if (audioOutput->volume() > 0.1)
+        settings.setValue("volume", audioOutput->volume());
+    // settings.setValue("volumeMute", audioOutput->isMuted());
+#endif
+
     settings.setValue("manualplay", The::globalActions()->value("manualplay")->isChecked());
 }
 
@@ -910,8 +935,8 @@ void MainWindow::showWidget(QWidget* widget, bool transition) {
     setUpdatesEnabled(true);
 
 #ifdef APP_EXTRA
-    if (transition && (oldWidget != mediaView ||
-                       !mediaView->getVideoArea()->isVideoShown()))
+    // if (transition && (oldWidget != mediaView || !mediaView->getVideoArea()->isVideoShown()))
+    if (transition)
         Extra::fadeInWidget(oldWidget, widget);
 #endif
 
@@ -1000,7 +1025,7 @@ bool MainWindow::confirmQuit() {
 void MainWindow::showHome(bool transition) {
     showWidget(homeView, transition);
     currentTime->clear();
-    totalTime->clear();
+    // totalTime->clear();
 }
 
 void MainWindow::showMedia(SearchParams *searchParams) {
@@ -1013,6 +1038,7 @@ void MainWindow::showMedia(VideoSource *videoSource) {
     mediaView->setVideoSource(videoSource);
 }
 
+#ifdef APP_PHONON
 void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState */) {
 
     // qDebug() << "Phonon state: " << newState;
@@ -1031,7 +1057,7 @@ void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState
 
     case Phonon::PlayingState:
         pauseAct->setEnabled(true);
-        pauseAct->setIcon(Utils::icon("media-playback-pause"));
+        pauseAct->setIcon(IconUtils::icon("media-playback-pause"));
         pauseAct->setText(tr("&Pause"));
         pauseAct->setStatusTip(tr("Pause playback") + " (" +  pauseAct->shortcut().toString(QKeySequence::NativeText) + ")");
         // stopAct->setEnabled(true);
@@ -1039,22 +1065,31 @@ void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState
 
     case Phonon::StoppedState:
         pauseAct->setEnabled(false);
+        pauseAct->setIcon(IconUtils::icon("media-playback-start"));
+        pauseAct->setText(tr("&Play"));
+        pauseAct->setStatusTip(tr("Resume playback") + " (" +  pauseAct->shortcut().toString(QKeySequence::NativeText) + ")");
         // stopAct->setEnabled(false);
         break;
 
     case Phonon::PausedState:
         pauseAct->setEnabled(true);
-        pauseAct->setIcon(Utils::icon("media-playback-start"));
+        pauseAct->setIcon(IconUtils::icon("media-playback-start"));
         pauseAct->setText(tr("&Play"));
         pauseAct->setStatusTip(tr("Resume playback") + " (" +  pauseAct->shortcut().toString(QKeySequence::NativeText) + ")");
         // stopAct->setEnabled(true);
         break;
 
     case Phonon::BufferingState:
+        pauseAct->setEnabled(false);
+        pauseAct->setIcon(IconUtils::icon("content-loading"));
+        pauseAct->setText(tr("&Loading..."));
+        pauseAct->setStatusTip(QString());
+        break;
+
     case Phonon::LoadingState:
         pauseAct->setEnabled(false);
         currentTime->clear();
-        totalTime->clear();
+        // totalTime->clear();
         // stopAct->setEnabled(true);
         break;
 
@@ -1062,14 +1097,15 @@ void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState
         ;
     }
 }
+#endif
 
 void MainWindow::stop() {
-    mediaView->stop();
     showHome();
+    mediaView->stop();
 }
 
 void MainWindow::resizeEvent(QResizeEvent*) {
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     if (mac::CanGoFullScreen(winId())) {
         bool isFullscreen = mac::IsFullScreen(winId());
         if (isFullscreen != m_fullscreen) {
@@ -1089,7 +1125,7 @@ void MainWindow::fullscreen() {
     if (compactViewAct->isChecked())
         compactViewAct->toggle();
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     WId handle = winId();
     if (mac::CanGoFullScreen(handle)) {
         mainToolBar->setVisible(true);
@@ -1109,7 +1145,7 @@ void MainWindow::fullscreen() {
         // geometry won't be saved
         writeSettings();
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
         MacSupport::enterFullScreen(this, views);
 #else
         mainToolBar->hide();
@@ -1119,7 +1155,7 @@ void MainWindow::fullscreen() {
     } else {
         // Exit full screen
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
         MacSupport::exitFullScreen(this, views);
 #else
         mainToolBar->show();
@@ -1146,11 +1182,11 @@ void MainWindow::updateUIForFullscreen() {
         fullscreenAct->setShortcuts(QList<QKeySequence>(fsShortcuts)
                                     << QKeySequence(Qt::Key_Escape));
         fullscreenAct->setText(tr("Leave &Full Screen"));
-        fullscreenAct->setIcon(Utils::icon("view-restore"));
+        fullscreenAct->setIcon(IconUtils::icon("view-restore"));
     } else {
         fullscreenAct->setShortcuts(fsShortcuts);
         fullscreenAct->setText(fsText);
-        fullscreenAct->setIcon(Utils::icon("view-fullscreen"));
+        fullscreenAct->setIcon(IconUtils::icon("view-fullscreen"));
     }
 
     // No compact view action when in full screen
@@ -1171,7 +1207,7 @@ void MainWindow::updateUIForFullscreen() {
         stopAct->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::Key_Escape) << QKeySequence(Qt::Key_MediaStop));
     }
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     MacSupport::fullScreenActions(The::globalActions()->values(), m_fullscreen);
 #endif
 
@@ -1187,7 +1223,7 @@ void MainWindow::updateUIForFullscreen() {
 }
 
 bool MainWindow::isReallyFullScreen() {
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     WId handle = winId();
     if (mac::CanGoFullScreen(handle)) return mac::IsFullScreen(handle);
     else return isFullScreen();
@@ -1211,7 +1247,7 @@ void MainWindow::compactView(bool enable) {
 
     if (enable) {
         setMinimumSize(320, 180);
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
         mac::RemoveFullScreenWindow(winId());
 #endif
         writeSettings();
@@ -1240,7 +1276,7 @@ void MainWindow::compactView(bool enable) {
     } else {
         // unset minimum size
         setMinimumSize(0, 0);
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
         mac::SetupFullScreenWindow(winId());
 #endif
         settings.setValue(key, saveGeometry());
@@ -1256,7 +1292,7 @@ void MainWindow::compactView(bool enable) {
     // auto float on top
     floatOnTop(enable);
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     mac::compactMode(winId(), enable);
 #endif
 }
@@ -1266,6 +1302,7 @@ void MainWindow::searchFocus() {
     toolbarSearch->setFocus();
 }
 
+#ifdef APP_PHONON
 void MainWindow::initPhonon() {
     // Phonon initialization
     if (mediaObject) delete mediaObject;
@@ -1288,6 +1325,7 @@ void MainWindow::initPhonon() {
     audioOutput->setVolume(settings.value("volume", 1).toDouble());
     // audioOutput->setMuted(settings.value("volumeMute").toBool());
 }
+#endif
 
 void MainWindow::tick(qint64 time) {
     if (time <= 0) {
@@ -1300,23 +1338,28 @@ void MainWindow::tick(qint64 time) {
     currentTime->setText(formatTime(time));
 
     // remaining time
+#ifdef APP_PHONON
     const qint64 remainingTime = mediaObject->remainingTime();
     currentTime->setStatusTip(tr("Remaining time: %1").arg(formatTime(remainingTime)));
 
-    slider->blockSignals(true);
+#ifndef APP_PHONON_SEEK
     const qint64 totalTime = mediaObject->totalTime();
+    slider->blockSignals(true);
     // qWarning() << totalTime << time << time * 100 / totalTime;
     if (totalTime > 0 && time > 0 && !slider->isSliderDown() && mediaObject->state() == Phonon::PlayingState)
         slider->setValue(time * slider->maximum() / totalTime);
     slider->blockSignals(false);
+#endif
+
+#endif
 }
 
 void MainWindow::totalTimeChanged(qint64 time) {
     if (time <= 0) {
-        totalTime->clear();
+        // totalTime->clear();
         return;
     }
-    totalTime->setText(formatTime(time));
+    // totalTime->setText(formatTime(time));
 
     /*
     slider->blockSignals(true);
@@ -1339,36 +1382,59 @@ QString MainWindow::formatTime(qint64 time) {
 }
 
 void MainWindow::volumeUp() {
+#ifdef APP_PHONON
     qreal newVolume = volumeSlider->audioOutput()->volume() + .1;
     if (newVolume > volumeSlider->maximumVolume())
         newVolume = volumeSlider->maximumVolume();
     volumeSlider->audioOutput()->setVolume(newVolume);
+#endif
 }
 
 void MainWindow::volumeDown() {
+#ifdef APP_PHONON
     qreal newVolume = volumeSlider->audioOutput()->volume() - .1;
-    if (newVolume < 0)
-        newVolume = 0;
+    if (newVolume < 0.)
+        newVolume = 0.;
     volumeSlider->audioOutput()->setVolume(newVolume);
+#endif
 }
 
 void MainWindow::volumeMute() {
+#ifdef APP_PHONON
     volumeSlider->audioOutput()->setMuted(!volumeSlider->audioOutput()->isMuted());
+#endif
 }
 
 void MainWindow::volumeChanged(qreal newVolume) {
+#ifdef APP_PHONON
     // automatically unmute when volume changes
     if (volumeSlider->audioOutput()->isMuted())
         volumeSlider->audioOutput()->setMuted(false);
+
+    bool isZero = volumeSlider->property("zero").toBool();
+    bool styleChanged = false;
+    if (newVolume == 0. && !isZero) {
+        volumeSlider->setProperty("zero", true);
+        styleChanged = true;
+    } else if (newVolume > 0. && isZero) {
+        volumeSlider->setProperty("zero", false);
+        styleChanged = true;
+    }
+    if (styleChanged) {
+        QSlider* volumeQSlider = volumeSlider->findChild<QSlider*>();
+        style()->unpolish(volumeQSlider);
+        style()->polish(volumeQSlider);
+    }
+#endif
     statusBar()->showMessage(tr("Volume at %1%").arg((int)(newVolume*100)));
 }
 
 void MainWindow::volumeMutedChanged(bool muted) {
     if (muted) {
-        volumeMuteAct->setIcon(Utils::icon("audio-volume-muted"));
+        volumeMuteAct->setIcon(IconUtils::icon("audio-volume-muted"));
         statusBar()->showMessage(tr("Volume is muted"));
     } else {
-        volumeMuteAct->setIcon(Utils::icon("audio-volume-high"));
+        volumeMuteAct->setIcon(IconUtils::icon("audio-volume-high"));
         statusBar()->showMessage(tr("Volume is unmuted"));
     }
 }
@@ -1456,29 +1522,25 @@ void MainWindow::toggleDownloads(bool show) {
     else goBack();
 }
 
-void MainWindow::startToolbarSearch(QString query) {
-    query = query.trimmed();
-
-    // check for empty query
-    if (query.length() == 0) {
-        return;
-    }
+void MainWindow::suggestionAccepted(Suggestion *suggestion) {
+    search(suggestion->value);
+}
 
+void MainWindow::search(const QString &query) {
+    QString q = query.trimmed();
+    if (q.length() == 0) return;
     SearchParams *searchParams = new SearchParams();
-    searchParams->setKeywords(query);
-
-    // go!
+    searchParams->setKeywords(q);
     showMedia(searchParams);
 }
 
 void MainWindow::dragEnterEvent(QDragEnterEvent *event) {
     if (event->mimeData()->hasFormat("text/uri-list")) {
         QList<QUrl> urls = event->mimeData()->urls();
-        if (urls.isEmpty())
-            return;
+        if (urls.isEmpty()) return;
         QUrl url = urls.first();
         QString videoId = YTSearch::videoIdFromUrl(url.toString());
-        if (!videoId.isNull())
+        if (!videoId.isEmpty())
             event->acceptProposedAction();
     }
 }
@@ -1491,7 +1553,7 @@ void MainWindow::dropEvent(QDropEvent *event) {
         return;
     QUrl url = urls.first();
     QString videoId = YTSearch::videoIdFromUrl(url.toString());
-    if (!videoId.isNull()) {
+    if (!videoId.isEmpty()) {
         setWindowTitle(url.toString());
         SearchParams *searchParams = new SearchParams();
         searchParams->setKeywords(videoId);
@@ -1603,6 +1665,14 @@ void MainWindow::hideMouse() {
 #endif
 }
 
+#ifdef APP_MAC_STORE
+void MainWindow::rateOnAppStore() {
+    QDesktopServices::openUrl(QUrl("macappstore://userpub.itunes.apple.com"
+                                   "/WebObjects/MZUserPublishing.woa/wa/addUserReview"
+                                   "?id=422006190&type=Purple+Software"));
+}
+#endif
+
 void MainWindow::printHelp() {
     QString msg = QString("%1 %2\n\n").arg(Constants::NAME, Constants::VERSION);
     msg += "Usage: minitube [options]\n";