Added fading animation to Play/Pause Button.
[bangarang:bangarang-kde-mirror.git] / src / app / common / mainwindow.cpp
1 /* BANGARANG MEDIA PLAYER
2 * Copyright (C) 2009 Andrew Lake (jamboarder@yahoo.com)
3 * <http://gitorious.org/bangarang>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "mainwindow.h"
20 #include "bangarangapplication.h"
21 #include "bangarangnotifieritem.h"
22 #include "actionsmanager.h"
23 #include "ui_mainwindow.h"
24 #include "../nowplaying/bangarangvideowidget.h"
25 #include "../nowplaying/nowplayingmanager.h"
26 #include "../medialists/medialistsmanager.h"
27 #include "../medialists/infomanager.h"
28 #include "../medialists/medialistsettings.h"
29 #include "../../platform/utilities/utilities.h"
30
31 #include <KAction>
32 #include <KAcceleratorManager>
33 #include <KCursor>
34 #include <KIcon>
35 #include <KColorScheme>
36 #include <KGlobalSettings>
37 #include <KDebug>
38 #include <KHelpMenu>
39 #include <KMenu>
40
41 #include <Nepomuk/ResourceManager>
42 #include <QVBoxLayout>
43 #include <QStackedLayout>
44 #include <QtGlobal>
45 #include <QPalette>
46 #include <QPushButton>
47 #include <QScrollBar>
48 #include <QTimer>
49 #include <QPropertyAnimation>
50
51 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindowClass)
52 {
53     m_application = (BangarangApplication *)KApplication::kApplication();
54
55     ui->setupUi(this);
56     m_audioListsStack = new AudioListsStack(0);
57     m_videoListsStack = new VideoListsStack(0);
58     KAcceleratorManager::setNoAccel(ui->audioListSelect);
59     KAcceleratorManager::setNoAccel(ui->videoListSelect);
60     
61     //Set up menu hiding timer
62     m_menuTimer = new QTimer(this);
63     m_menuTimer->setInterval(3000);
64     m_menuTimer->setSingleShot(true);
65     connect(m_menuTimer, SIGNAL(timeout()), ui->floatingMenuHolder, SLOT(hide()));
66
67     //Setup interface icons
68     setupIcons();
69
70     // Hide certain widgets
71     ui->previous->setVisible(false);
72     ui->contextStackHolder->setVisible(false);
73     ui->playSelected->setVisible(false);
74     m_audioListsStack->ui->configureAudioList->setVisible(false);
75     m_videoListsStack->ui->configureVideoList->setVisible(false);
76     ui->semanticsHolder->setVisible(false);
77     ui->loadingIndicator->setVisible(false);
78     ui->extSubtitle->setVisible(false);
79     ui->playbackMessage->setVisible(false);
80     ui->notificationWidget->setVisible(false);
81     ui->videoListsStackHolder->hide();
82     ui->videoListsSelectHolder->show();
83     ui->videoListLabel->hide();
84     ui->audioListsStackHolder->layout()->addWidget(m_audioListsStack);
85     ui->audioListsStackHolder->show();
86     ui->audioListsSelectHolder->hide();
87     ui->audioListLabel->show();
88
89     //Initialize Nepomuk
90     m_nepomukInited = Utilities::nepomukInited();
91     if (!m_nepomukInited) {
92         ui->Filter->setVisible(false);
93     }
94
95     //Set up video widget
96     m_videoWidget =  new BangarangVideoWidget(ui->videoFrame);
97     connect(m_videoWidget,SIGNAL(fullscreenChanged(bool)),this,SLOT(on_fullScreen_toggled(bool)));
98     
99     //Add video widget to video frame
100     QVBoxLayout *layout = new QVBoxLayout();
101     layout->addWidget(m_videoWidget);
102     layout->setContentsMargins(0,0,0,0);
103     ui->videoFrame->setLayout(layout);
104     ui->videoFrame->setFrameShape(QFrame::NoFrame);
105     
106     //Set up volume and seek slider
107     ui->volumeSlider->setMuteVisible( false );
108     ui->seekSlider->setIconVisible(false);
109     ui->seekTime->setToolButtonStyle(Qt::ToolButtonTextOnly);
110     KAcceleratorManager::setNoAccel(ui->seekTime);
111     
112     //Set up playlist view
113     ui->playlistView->setMainWindow(this);
114     ui->playlistFilterProxyLine->lineEdit()->setClickMessage(QString());
115     ui->playlistFilter->setVisible(false);
116     ui->playlistNotification->setVisible(false);
117     ui->playlistNotificationNo->setText(i18n("No"));
118     ui->playlistNotificationYes->setText(i18n("Yes"));
119     
120     //Setup Now Playing view
121     ui->nowPlayingView->setMainWindow( this );
122     updateCustomColors();
123     connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SLOT(updateCustomColors()));
124     m_videoSize = Normal;
125     ui->videoFrame->setVisible(false);
126     ui->nowPlayingView->move(0,0);
127     ui->nowPlayingView->resize(ui->nowPlayingHolder->size());
128     ui->videoFrame->move(0,0);
129     ui->videoFrame->resize(ui->nowPlayingHolder->size());
130     KAcceleratorManager::setNoAccel(ui->showPlaylist);
131     KAcceleratorManager::setNoAccel(ui->showPlaylist_2);
132     
133     //Setup Media List Settings
134     m_mediaListSettings =  new MediaListSettings(this);
135     
136     //Set up defaults
137     ui->nowPlayingSplitter->setCollapsible(0,true);
138     ui->nowPlayingSplitter->setCollapsible(1,false);
139     ui->stackedWidget->setCurrentIndex((int) MainNowPlaying);
140     ui->mediaViewHolder->setCurrentIndex(0);
141     m_audioListsStack->ui->audioListsStack->setCurrentIndex(0);
142     m_videoListsStack->ui->videoListsStack->setCurrentIndex(0);
143     ui->contextStack->setCurrentIndex(0);
144     ui->mediaPlayPause->setHoldDelay(1000);
145     ui->mediaPlayPause->disableHold();
146     ui->listSummary->setFont(KGlobalSettings::smallestReadableFont());
147     ui->playlistDuration->setFont(KGlobalSettings::smallestReadableFont());
148     ui->playbackMessage->clear();
149     ui->collectionButton->setFocus();
150
151     //Install event filter for hiding widgets in Now Playing view
152     ui->nowPlayingView->setMouseTracking(true);
153     m_videoWidget->setMouseTracking(true);
154     ui->nowPlayingView->viewport()->installEventFilter(this);
155     m_videoWidget->installEventFilter(this);
156     
157
158     // Set up cursor hiding and context menu for videos.
159     m_videoWidget->setFocusPolicy(Qt::ClickFocus);
160     KCursor::setAutoHideCursor(m_videoWidget, true);
161     
162 }
163
164 MainWindow::~MainWindow()
165 {
166     delete ui;
167 }
168
169 void MainWindow::completeSetup()
170 {
171     setupActions();
172     ui->playlistView->setupActions();
173     resetTabOrder();
174 }
175
176 /*---------------
177   -- Accessors --
178   ---------------*/
179 AudioListsStack *MainWindow::audioListsStack() {
180     return m_audioListsStack;
181 }
182
183 VideoListsStack *MainWindow::videoListsStack() {
184     return m_videoListsStack;
185 }
186
187 MediaListSettings *MainWindow::mediaListSettings()
188 {
189     return m_mediaListSettings;
190 }
191
192 BangarangVideoWidget * MainWindow::videoWidget()
193 {
194     return m_videoWidget;
195 }
196
197 MainWindow::VideoSize MainWindow::videoSize()
198 {
199     return m_videoSize;
200 }
201
202 void MainWindow::setVideoSize(VideoSize size)
203 {
204     m_videoSize = size;
205     if (m_videoSize == Normal) {
206         ui->nowPlayingView->hideInfo();
207         QPoint topLeft = ui->videoFrame->mapToParent(ui->videoFrame->rect().topLeft());
208         QPropertyAnimation *animation = new QPropertyAnimation(ui->videoFrame, "geometry");
209         animation->setDuration(500);
210         animation->setStartValue(QRect(topLeft, ui->videoFrame->size()));
211         animation->setEndValue(ui->nowPlayingHolder->rect());
212         animation->setEasingCurve(QEasingCurve::InOutQuad);
213         animation->start();
214     } else {
215         int width = qMax(200, ui->nowPlayingHolder->width()/3);
216         int height = qMax(150, width*3/4);
217         int left = ui->nowPlayingHolder->width() - width - 20;
218         int top = ui->nowPlayingHolder->height() - height - 20;
219         QPropertyAnimation *animation = new QPropertyAnimation(ui->videoFrame, "geometry");
220         connect(animation, SIGNAL(finished()), ui->nowPlayingView, SLOT(showInfo()));
221         animation->setDuration(500);
222         animation->setStartValue(ui->videoFrame->rect());
223         animation->setEndValue(QRect(left, top, width, height));
224         animation->setEasingCurve(QEasingCurve::InOutQuad);
225         animation->start();
226     }
227 }
228
229
230 /*---------------------
231  -- UI widget slots  --
232  ----------------------*/
233 void MainWindow::on_nowPlayingHolder_resized()
234 {
235     ui->nowPlayingView->move(0,0);
236     ui->nowPlayingView->resize(ui->nowPlayingHolder->size());
237
238     QFont extSubtitleFont = ui->extSubtitle->font();
239     extSubtitleFont.setPixelSize(qMax(int(ui->nowPlayingHolder->height()*0.045), KGlobalSettings::smallestReadableFont().pixelSize()));
240     ui->extSubtitle->setFont(extSubtitleFont);
241     ui->extSubtitle->setMaximumWidth(0.8*ui->nowPlayingHolder->width());
242     ui->extSubtitle->move((ui->nowPlayingHolder->width() - ui->extSubtitle->width())/2,
243                           ui->nowPlayingHolder->geometry().bottom() - 20 - ui->extSubtitle->height());
244
245     if (m_videoSize == Normal && !this->isFullScreen()) {
246         ui->videoFrame->setGeometry(QRect(QPoint(0, 0), ui->nowPlayingHolder->size()));
247     } else if (m_videoSize == Normal && this->isFullScreen()) {
248         ui->videoFrame->setGeometry(QRect(QPoint(0, 0), QSize(ui->nowPlayingHolder->width(), this->height())));
249     } else {
250         int width = qMax(200, ui->nowPlayingHolder->width()/3);
251         int height = qMax(150, width*3/4);
252         int left = ui->nowPlayingHolder->width() - width - 20;
253         int top = ui->nowPlayingHolder->height() - height - 20;
254         ui->videoFrame->setGeometry(left, top, width, height);
255     }
256
257     if (ui->contextStackHolder->isVisible()) {
258         ui->floatingMenuHolder->setVisible(false);
259         m_menuTimer->stop();
260     } else {
261         QFontMetrics fm(ui->showPlaylist_2->font());
262         QRect textRect = fm.boundingRect(i18n("Playlist"));
263         int width = textRect.width() + 36;
264         ui->showPlaylist_2->setGeometry(QRect(ui->showPlaylist_2->rect().topLeft(),
265                                               QSize(width,
266                                                     qMax(24, textRect.height() + 8))));
267         int left = ui->nowPlayingHolder->width() - (width + qMax(24, textRect.height() + 8));
268         ui->floatingMenuHolder->setGeometry(QRect(QPoint(left, 0),
269                                                   QSize(width + qMax(24, textRect.height() + 8),
270                                                         qMax(24, textRect.height() + 8))));
271         ui->floatingMenuHolder->setVisible(true);
272         ui->floatingMenuHolder->raise();
273         m_menuTimer->start();
274     }
275 }
276
277 void MainWindow::on_nowPlaying_clicked()
278 {
279     switchMainWidget(MainNowPlaying); // Show Now Playing page
280 }
281
282 void MainWindow::on_collectionButton_clicked()
283 {
284     switchMainWidget(MainMediaList); // Show Collection page
285     ui->collectionButton->setFocus();
286 }
287
288 void MainWindow::on_showPlaylist_clicked()
289 {
290     if (ui->contextStackHolder->isVisible() && ui->contextStack->currentIndex() == 0) {
291         ui->contextStackHolder->setVisible(false);
292     } else {
293         ui->contextStack->setCurrentIndex(0);
294         ui->contextStackHolder->setVisible(true);
295         QFrame *filter = currentFilterFrame();
296         KFilterProxySearchLine *line = currentFilterProxyLine();
297         if (filter->isVisible() && line->lineEdit()->text().isEmpty()) {
298             m_application->actionsManager()->action("toggle_filter")->trigger();
299         }
300     }
301     m_application->actionsManager()->action("show_video_settings")->setText(i18n("Show video settings"));
302     m_application->actionsManager()->action("show_audio_settings")->setText(i18n("Show audio settings"));
303     m_application->actionsManager()->action("show_shortcuts_editor")->setText(i18n("Show shortcuts editor"));
304 }
305
306 void MainWindow::on_showPlaylist_2_clicked()
307 {
308     on_showPlaylist_clicked();
309 }
310
311 void MainWindow::on_fullScreen_toggled(bool fullScreen)
312 {
313     if (fullScreen) {
314         showFullScreen();
315         ui->widgetSet->setPalette(ui->contextStackHolder->palette());
316         ui->widgetSet->setAutoFillBackground(true);
317         ui->fullScreen->setIcon(KIcon("view-restore"));
318         ui->fullScreen->setToolTip(i18n("<b>Fullscreen</b><br>Click to exit fullscreen"));
319         ui->fullScreen->setChecked(true);
320         ui->widgetSet->setVisible(false);
321     } else {
322         showNormal();
323         ui->widgetSet->setPalette(this->palette());
324         ui->widgetSet->setAutoFillBackground(false);
325         ui->fullScreen->setIcon(KIcon("view-fullscreen"));
326         ui->fullScreen->setToolTip(i18n("Show fullscreen"));
327         ui->fullScreen->setChecked(false);
328         if (m_application->actionsManager()->m_controlsVisible) {
329           ui->widgetSet->setVisible(true);
330         }
331     }
332 }
333
334 void MainWindow::on_seekTime_clicked()
335 {
336     QPoint menuLocation = ui->seekTime->mapToGlobal(QPoint(0,ui->showMenu->height()));
337     m_application->actionsManager()->bookmarksMenu()->popup(menuLocation);
338 }
339
340
341 void MainWindow::on_showMenu_clicked()
342 {
343     m_application->nowPlayingManager()->showMenu();
344 }
345
346 void MainWindow::on_showMenu_2_clicked()
347 {
348     m_application->nowPlayingManager()->showMenu();
349 }
350
351 void MainWindow::on_showMediaViewMenu_clicked()
352 {
353     m_application->mediaListsManager()->showMenu();
354 }
355
356
357 /*----------------------
358   -- Helper functions --
359   ----------------------*/
360 void MainWindow::setupIcons()
361 {
362     //Main Window Icon
363     setWindowIcon(KIcon("bangarang"));
364     
365     //Audio List Icons
366     m_audioListsStack->ui->addAudioList->setIcon(KIcon("list-add"));
367     m_audioListsStack->ui->removeAudioList->setIcon(KIcon("list-remove"));
368     m_audioListsStack->ui->configureAudioList->setIcon(KIcon("configure"));
369     m_audioListsStack->ui->saveAudioList->setIcon(KIcon("document-save"));
370     m_audioListsStack->ui->aslsSave->setIcon(KIcon("document-save"));
371     m_audioListsStack->ui->aslsExport->setIcon(KIcon("document-export"));
372     m_audioListsStack->ui->semAConfigSave->setIcon(KIcon("document-save"));
373     
374     //Video List Icons
375     m_videoListsStack->ui->addVideoList->setIcon(KIcon("list-add"));
376     m_videoListsStack->ui->removeVideoList->setIcon(KIcon("list-remove"));
377     m_videoListsStack->ui->configureVideoList->setIcon(KIcon("configure"));
378     m_videoListsStack->ui->saveVideoList->setIcon(KIcon("document-save"));
379     m_videoListsStack->ui->vslsSave->setIcon(KIcon("document-save"));
380     m_videoListsStack->ui->vslsExport->setIcon(KIcon("document-export"));
381     m_videoListsStack->ui->semVConfigSave->setIcon(KIcon("document-save"));
382     
383     //Media View Icons
384     ui->seekTime->setIcon(KIcon("bookmarks-organize"));
385     ui->playSelected->setIcon(KIcon("media-playback-start"));
386     ui->playAll->setIcon(KIcon("media-playback-start"));
387     ui->nowPlaying->setIcon(KIcon("tool-animator"));
388     ui->closeMediaListFilter->setIcon(KIcon("dialog-close"));
389     ui->infoIndexSelected->setIcon(KIcon("system-run"));
390     ui->showInfoFetcherExpander->setIcon(KIcon("help-about"));
391     ui->infoFetcherLink->setIcon(KIcon("emblem-symbolic-link"));
392
393
394     //Now Playing View bottom bar
395     ui->collectionButton->setIcon(KIcon("view-media-playlist"));
396     ui->fullScreen->setIcon(KIcon("view-fullscreen"));
397     ui->volumeIcon->setIcon(KIcon("speaker"));
398     ui->mediaPlayPause->setIcon(KIcon("media-playback-start"));
399     
400     //Now Playing View top bar
401     ui->showPlaylist->setIcon(KIcon("dialog-ok-apply"));
402     ui->showPlaylist_2->setIcon(KIcon("dialog-ok-apply"));
403
404     //Playlist View
405     ui->repeat->setIcon(Utilities::turnIconOff(KIcon("bangarang-repeat"), QSize(22, 22)));
406     ui->shuffle->setIcon(Utilities::turnIconOff(KIcon("bangarang-shuffle"), QSize(22, 22)));
407     ui->showQueue->setIcon(Utilities::turnIconOff(KIcon("bangarang-preview"), QSize(22, 22)));
408     ui->clearPlaylist->setIcon(Utilities::turnIconOff(KIcon("bangarang-clearplaylist"), QSize(22, 22)));
409     ui->closePlaylistFilter->setIcon(KIcon("dialog-close"));
410     ui->closePlaylistNotification->setIcon(KIcon("dialog-close"));
411     
412     //Audio settings
413     ui->restoreDefaultAudioSettings->setIcon(KIcon("edit-undo"));
414     ui->restoreDefaultVideoSettings->setIcon(KIcon("edit-undo"));
415 }
416
417 void MainWindow::setupActions()
418 {
419     ui->mediaPrevious->setDefaultAction(m_application->actionsManager()->action("play_previous"));
420     ui->mediaNext->setDefaultAction(m_application->actionsManager()->action("play_next"));
421 }
422
423 bool MainWindow::eventFilter(QObject *obj, QEvent *event)
424 {
425     if (isFullScreen() &&
426         !m_application->isTouchEnabled() &&
427         currentMainWidget() == MainNowPlaying &&
428         event->type() == QEvent::MouseMove) {
429
430         QMouseEvent * mouseEvent = (QMouseEvent *)event;
431         QWidget* widget = (QWidget* )obj;
432
433         if (widget->height() - mouseEvent->y() <= ui->widgetSet->height()) {
434             //Show the widgets in the Now Playing view
435             ui->widgetSet->setVisible(true);
436         } else {
437             //Hide the widgets in the Now Playing view
438             ui->widgetSet->setVisible(false);
439         }
440     }
441
442     //Show floating menu
443     if (event->type() == QEvent::MouseMove) {
444         if (!ui->contextStackHolder->isVisible()) {
445             ui->floatingMenuHolder->setVisible(true);
446             ui->floatingMenuHolder->raise();
447             QPoint pos = ((QMouseEvent *)event)->globalPos();
448             if (ui->floatingMenuHolder->rect().contains(ui->floatingMenuHolder->mapFromGlobal(pos))) {
449                 m_menuTimer->stop();
450             } else {
451                 m_menuTimer->start();
452             }
453         }
454     }
455
456     // standard event processing
457     return QObject::eventFilter(obj, event);
458 }
459
460 /*-------------------------
461 -- Device Notifier Slots --
462 ---------------------------*/
463
464 void MainWindow::updateCustomColors()
465 {
466     //Update custom colors in Now Playing View
467     QColor highlightColor = QApplication::palette().color(QPalette::Highlight);
468     int r = highlightColor.red();
469     int g = highlightColor.green();
470     int b = highlightColor.blue();
471     QString styleSheet = QString("background-color: qlineargradient(spread:reflect, x1:0.494, y1:0, x2:0.505682, y2:1, stop:0 rgba(0, 0, 0, 0), stop:0.20 rgba(%1, %2, %3, 25), stop:0.5 rgba(%1, %2, %3, 55), stop:0.75 rgba(%1, %2, %3, 30), stop:1 rgba(0, 0, 0, 0)); color: rgb(255, 255, 255);").arg(r).arg(g).arg(b);
472     ui->nowPlayingView->setStyleSheet(styleSheet);
473
474     //Update custom colors in Media Lists View
475     QPalette viewPalette = ui->mediaViewHolder->palette();
476     viewPalette.setColor(QPalette::Window, viewPalette.color(QPalette::Base));
477     ui->mediaListHolder->setPalette(viewPalette);
478     ui->semanticsHolder->setPalette(viewPalette);
479     viewPalette.setColor(QPalette::Window, palette().color(QPalette::Window));
480     ui->mediaListFilter->setPalette(viewPalette);
481     viewPalette.setColor(QPalette::Window, viewPalette.color(QPalette::AlternateBase));
482     ui->infoFetcherExpander->setPalette(viewPalette);
483 }
484
485
486 QFrame* MainWindow::currentFilterFrame()
487 {
488   return (currentMainWidget() == MainMediaList) ? ui->mediaListFilter : ui->playlistFilter;
489 }
490
491 KFilterProxySearchLine* MainWindow::currentFilterProxyLine()
492 {
493   return (currentMainWidget() == MainMediaList) ?
494     ui->mediaListFilterProxyLine : ui->playlistFilterProxyLine;
495 }
496
497 void MainWindow::switchMainWidget(MainWindow::MainWidget which)
498 {
499     ui->stackedWidget->setCurrentIndex((int) which);
500     m_application->actionsManager()->updateToggleFilterText();
501     emit switchedMainWidget(which);
502 }
503
504 MainWindow::MainWidget MainWindow::currentMainWidget()
505 {
506     return (MainWidget) ui->stackedWidget->currentIndex();
507 }
508
509 void MainWindow::enableTouch() {
510     kDebug() << "ENABLING TOUCH";
511     int tTouchable = BangarangApplication::TOUCH_TOUCHABLE_METRIC;
512     int tVisual = BangarangApplication::TOUCH_VISUAL_METRIC;
513     ui->widgetSet->setMinimumHeight(48);
514     ui->widgetSet->setMaximumHeight(48);
515     ui->mediaListWidgetSet->setMinimumHeight(48);
516     ui->mediaListWidgetSet->setMaximumHeight(48);
517     ui->mediaListWidgetSet1->setMinimumHeight(48);
518     ui->mediaListWidgetSet1->setMaximumHeight(48);
519     ui->showMediaViewMenu->setMinimumSize(tTouchable, tTouchable);
520     ui->audioListSelect->setMinimumSize(tTouchable, tTouchable);
521     ui->videoListSelect->setMinimumSize(tTouchable, tTouchable);
522     m_audioListsStack->enableTouch();
523     m_videoListsStack->enableTouch();
524     ui->Filter->setMinimumHeight(tTouchable);
525     ui->closeMediaListFilter->setMinimumSize(tTouchable, tTouchable);
526     ui->mediaListFilterProxyLine->setMinimumHeight(tTouchable);
527     ui->mediaView->enableTouch();
528     m_application->infoManager()->enableTouch();
529     ui->playlistView->enableTouch();
530     ui->closePlaylistFilter->setMinimumSize(tTouchable, tTouchable);
531     ui->playlistFilterProxyLine->setMinimumHeight(tTouchable);
532     ui->nowPlayingView->enableTouch();
533     ui->fullScreen->setMinimumSize(tTouchable, tTouchable);
534     ui->fullScreen->setIconSize(QSize(tVisual, tVisual));
535     ui->seekTime->setMinimumHeight(tTouchable);
536     ui->volumeIcon->setMinimumSize(tTouchable, tTouchable);
537     ui->volumeIcon->setIconSize(QSize(tVisual, tVisual));
538     ui->volumeSlider->setMaximumWidth(110);
539     ui->volumeSlider->setMinimumWidth(110);
540     ui->mediaPrevious->setMinimumSize(tTouchable + 8, tTouchable);
541     ui->mediaNext->setMinimumSize(tTouchable + 8, tTouchable);
542     ui->mediaPlayPause->setMinimumSize(50, 46);
543     ui->mediaPlayPause->setIconSize(QSize(40, 40));
544     ui->clearPlaylist->setMinimumSize(tTouchable, tTouchable);
545     ui->shuffle->setMinimumSize(tTouchable, tTouchable);
546     ui->repeat->setMinimumSize(tTouchable, tTouchable);
547     ui->showQueue->setMinimumSize(tTouchable, tTouchable);
548     ui->showPlaylist->setMinimumHeight(tTouchable);
549     ui->showPlaylist_2->setMinimumHeight(tTouchable);
550     ui->showMenu->setMinimumSize(tTouchable, tTouchable);
551     ui->showMenu_2->setMinimumSize(tTouchable, tTouchable);
552     ui->floatingMenuHolder->setMinimumSize(tTouchable, tTouchable);
553     ui->widgetSet->setPalette(ui->contextStackHolder->palette());
554     ui->widgetSet->setAutoFillBackground(true);
555 }
556
557 void MainWindow::resetTabOrder()
558 {
559     //Set Tab Order for Media Lists view
560     QWidget* visibleList = m_audioListsStack->ui->audioLists;
561     if (ui->videoListsStackHolder->isVisible()) {
562         visibleList = m_videoListsStack->ui->videoLists;
563     }
564     setTabOrder(visibleList, ui->mediaView);
565 }
566
567 void MainWindow::toggleMainWidget()
568 {
569     if (currentMainWidget() == MainMediaList) {
570         switchMainWidget(MainNowPlaying);
571     } else {
572         switchMainWidget(MainMediaList);
573     }
574 }
575
576 void MainWindow::stopMenuTimer()
577 {
578     m_menuTimer->stop();
579 }