refs #855, use Qt5 isSignalConnected feature to hide menus not used

This commit is contained in:
Klaus Basan
2017-01-07 17:40:33 +01:00
committed by Mathew Sutcliffe
parent 5f7c3f0e9c
commit 0a611890e8

View File

@@ -83,6 +83,7 @@
#include <QShortcut>
#include <QVariant>
#include <QWidget>
#include <QMetaMethod>
#include <limits>
using namespace BlackConfig;
@@ -238,8 +239,18 @@ namespace BlackGui
CMenuActions ma;
switch (menu)
{
case MenuRefresh: { ma.addAction(BlackMisc::CIcons::refresh16(), "Update", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReload }); break; }
case MenuBackend: { ma.addAction(BlackMisc::CIcons::refresh16(), "Reload from backend", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReloadFromBackend }); break; }
case MenuRefresh:
{
static const QMetaMethod requestSignal = QMetaMethod::fromSignal(&CViewBaseNonTemplate::requestUpdate);
if (!this->isSignalConnected(requestSignal)) break;
ma.addAction(BlackMisc::CIcons::refresh16(), "Update", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReload }); break;
}
case MenuBackend:
{
static const QMetaMethod requestSignal = QMetaMethod::fromSignal(&CViewBaseNonTemplate::requestNewBackendData);
if (!this->isSignalConnected(requestSignal)) break;
ma.addAction(BlackMisc::CIcons::refresh16(), "Reload from backend", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReloadFromBackend }); break;
}
case MenuDisplayAutomatically:
{
QAction *a = ma.addAction(CIcons::appMappings16(), "Automatically display (when loaded)", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_toggleAutoDisplay });