]> git.sur5r.net Git - minitube/blobdiff - src/homeview.cpp
New upstream version 2.9
[minitube] / src / homeview.cpp
index a3b54350e04adaa4b45d40ae0642f4215276dfa9..a8f061b7f40e4dd575e500e5b5a9f167d8f688f8 100644 (file)
@@ -26,13 +26,13 @@ $END_LICENSE */
 #include "mainwindow.h"
 #include "mediaview.h"
 #include "ytstandardfeed.h"
-#include "utils.h"
+#include "iconutils.h"
 #include "channelaggregator.h"
 #ifdef APP_MAC
 #include "macutils.h"
 #endif
 
-HomeView::HomeView(QWidget *parent) : QWidget(parent),
+HomeView::HomeView(QWidget *parent) : View(parent),
     standardFeedsView(0),
     channelsView(0) {
 
@@ -46,7 +46,7 @@ HomeView::HomeView(QWidget *parent) : QWidget(parent),
     stackedWidget = new QStackedWidget();
     layout->addWidget(stackedWidget);
 
-    searchView = new SearchView();
+    searchView = new SearchView(this);
     connect(searchView, SIGNAL(search(SearchParams*)),
             MainWindow::instance(), SLOT(showMedia(SearchParams*)));
     stackedWidget->addWidget(searchView);
@@ -76,9 +76,10 @@ void HomeView::setupBar() {
     connect(ChannelAggregator::instance(), SIGNAL(unwatchedCountChanged(int)),
             SLOT(unwatchedCountChanged(int)));
 
-    foreach (QAction* action, bar->actions()) {
+    const auto a = bar->actions();
+    for (QAction* action : a) {
         addAction(action);
-        Utils::setupAction(action);
+        IconUtils::setupAction(action);
     }
 }
 
@@ -90,11 +91,16 @@ void HomeView::showWidget(QWidget *widget) {
     stackedWidget->setCurrentWidget(widget);
     widget->setEnabled(true);
     QMetaObject::invokeMethod(widget, "appear");
-    widget->setFocus();
+    QTimer::singleShot(0, widget, SLOT(setFocus()));
+
+#ifdef APP_MAC
+    // Workaround cursor bug on macOS
+    window()->unsetCursor();
+#endif
 }
 
 void HomeView::appear() {
-    QMetaObject::invokeMethod(stackedWidget->currentWidget(), "appear");
+    QMetaObject::invokeMethod(stackedWidget->currentWidget(), "appear", Qt::QueuedConnection);
 }
 
 void HomeView::disappear() {