From 410160d607907d95df925efe35a43bcba4e5e634 Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Tue, 4 Aug 2015 21:16:31 +0200 Subject: [PATCH] Less flicker and crossfades --- src/mainwindow.cpp | 30 ++++++++++++++---------------- src/searchview.cpp | 6 ++---- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ce5bedd..cfafa38 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -162,7 +162,7 @@ MainWindow::MainWindow() : showActivationView(false); #endif - QTimer::singleShot(100, this, SLOT(lazyInit())); + QTimer::singleShot(0, this, SLOT(lazyInit())); } MainWindow::~MainWindow() { @@ -225,6 +225,11 @@ void MainWindow::lazyInit() { // Hack to give focus to searchlineedit QMetaObject::invokeMethod(views->currentWidget(), "appear"); + View* view = dynamic_cast (views->currentWidget()); + QString desc = view->metadata().value("description").toString(); + if (!desc.isEmpty()) showMessage(desc); + + ChannelAggregator::instance()->start(); } void MainWindow::changeEvent(QEvent *e) { @@ -874,7 +879,8 @@ void MainWindow::showActionInStatusBar(QAction* action, bool show) { #endif if (show) { statusToolBar->insertAction(statusToolBar->actions().first(), action); - if (statusBar()->isHidden()) setStatusBarVisibility(true); + if (statusBar()->isHidden()) + setStatusBarVisibility(true); } else { statusToolBar->removeAction(action); if (statusBar()->isVisible() && !needStatusBar()) @@ -941,11 +947,11 @@ void MainWindow::goBack() { } void MainWindow::showWidget(QWidget* widget, bool transition) { + Q_UNUSED(transition); + if (compactViewAct->isChecked()) compactViewAct->toggle(); - setUpdatesEnabled(false); - // call hide method on the current view View* oldView = dynamic_cast (views->currentWidget()); if (oldView) { @@ -992,20 +998,12 @@ void MainWindow::showWidget(QWidget* widget, bool transition) { adjustStatusBarVisibility(); messageLabel->hide(); + /* QString desc = metadata.value("description").toString(); if (!desc.isEmpty()) showMessage(desc); + */ } - setUpdatesEnabled(true); - -#ifdef APP_EXTRA - if (transition && (oldWidget != mediaView)) // || !mediaView->getVideoArea()->isVideoShown() - // if (transition) - Extra::fadeInWidget(oldWidget, widget); -#else - Q_UNUSED(transition); -#endif - history->push(widget); } @@ -1206,6 +1204,8 @@ void MainWindow::fullscreen() { if (compactViewAct->isChecked()) compactViewAct->toggle(); + m_fullscreen = !m_fullscreen; + #ifdef APP_MAC WId handle = winId(); if (mac::CanGoFullScreen(handle)) { @@ -1215,8 +1215,6 @@ void MainWindow::fullscreen() { } #endif - m_fullscreen = !m_fullscreen; - if (m_fullscreen) { // Enter full screen diff --git a/src/searchview.cpp b/src/searchview.cpp index f72751b..d09c51e 100644 --- a/src/searchview.cpp +++ b/src/searchview.cpp @@ -197,14 +197,12 @@ SearchView::SearchView(QWidget *parent) : QWidget(parent) { } void SearchView::appear() { - setUpdatesEnabled(false); + MainWindow::instance()->showActionInStatusBar(The::globalActions()->value("definition"), true); + updateRecentKeywords(); updateRecentChannels(); queryEdit->selectAll(); queryEdit->enableSuggest(); - setUpdatesEnabled(true); - - MainWindow::instance()->showActionInStatusBar(The::globalActions()->value("definition"), true); if (!queryEdit->hasFocus()) queryEdit->setFocus(); } -- 2.39.5