From: Flavio Date: Mon, 28 Jan 2013 09:41:51 +0000 (+0100) Subject: Change global actions to QHash X-Git-Tag: 2.0~14 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2f28d10eff5eef70c1d85fed3c3e481dc11e868e;p=minitube Change global actions to QHash --- diff --git a/src/global.h b/src/global.h index 47872a1..d2aad7a 100644 --- a/src/global.h +++ b/src/global.h @@ -12,18 +12,14 @@ namespace The { - QMap* globalActions() { - static QMap *g_actions = 0; - if (!g_actions) - g_actions = new QMap; - return g_actions; + QHash* globalActions() { + static QHash *actions = new QHash; + return actions; } - QMap* globalMenus() { - static QMap *g_menus = 0; - if (!g_menus) - g_menus = new QMap; - return g_menus; + QHash* globalMenus() { + static QHash *menus = new QHash; + return menus; } void maybeSetSystemProxy() { @@ -138,8 +134,8 @@ namespace The { } NetworkAccess* http() { - static NetworkAccess *g_http = new NetworkAccess(); - return g_http; + static NetworkAccess *na = new NetworkAccess(); + return na; } } diff --git a/src/refinesearchwidget.cpp b/src/refinesearchwidget.cpp index 77a46b3..f1a140e 100644 --- a/src/refinesearchwidget.cpp +++ b/src/refinesearchwidget.cpp @@ -6,7 +6,7 @@ #endif namespace The { -QMap* globalActions(); +QHash* globalActions(); } RefineSearchWidget::RefineSearchWidget(QWidget *parent) : @@ -198,16 +198,17 @@ void RefineSearchWidget::actionTriggered(QAction *action) { QString paramName = bar->property("paramName").toString(); QVariant paramValue = action->property("paramValue"); - qDebug() << "param changed" << paramName << paramValue; + // qDebug() << "param changed" << paramName << paramValue; emit paramChanged(paramName, paramValue); - qDebug() << __PRETTY_FUNCTION__; dirty = true; } void RefineSearchWidget::setSearchParams(SearchParams *params) { setup(); + qDebug() << (params != 0); + The::globalActions()->value("refine-search")->setEnabled(params); setEnabled(params); diff --git a/src/sidebarwidget.cpp b/src/sidebarwidget.cpp index ceccad7..5a5647f 100644 --- a/src/sidebarwidget.cpp +++ b/src/sidebarwidget.cpp @@ -7,7 +7,7 @@ #endif namespace The { -QMap* globalActions(); +QHash* globalActions(); } SidebarWidget::SidebarWidget(QWidget *parent) : diff --git a/src/standardfeedsview.cpp b/src/standardfeedsview.cpp index f6fedd7..1aae3e3 100644 --- a/src/standardfeedsview.cpp +++ b/src/standardfeedsview.cpp @@ -6,7 +6,7 @@ #include "mainwindow.h" namespace The { -QMap* globalActions(); +QHash* globalActions(); } static const int cols = 5;