mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
refs #661, info in context menu when force reload is unavailable
(KB/RW slack discussion)
This commit is contained in:
@@ -233,6 +233,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
|
|
||||||
// with models loaded I allow a refresh reload
|
// with models loaded I allow a refresh reload
|
||||||
|
// I need those models because I want to merge with DM data in the loader
|
||||||
if (sGui->getWebDataServices() && sGui->getWebDataServices()->getModelsCount() > 0)
|
if (sGui->getWebDataServices() && sGui->getWebDataServices()->getModelsCount() > 0)
|
||||||
{
|
{
|
||||||
if (this->m_reloadActions.isEmpty()) { this->m_reloadActions = QList<QAction *>({nullptr, nullptr, nullptr, nullptr}); }
|
if (this->m_reloadActions.isEmpty()) { this->m_reloadActions = QList<QAction *>({nullptr, nullptr, nullptr, nullptr}); }
|
||||||
@@ -290,6 +291,12 @@ namespace BlackGui
|
|||||||
menuActions.addAction(this->m_reloadActions[3], CMenuAction::pathSimulatorModelsReload());
|
menuActions.addAction(this->m_reloadActions[3], CMenuAction::pathSimulatorModelsReload());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// dummy action grayed out
|
||||||
|
CMenuAction a = menuActions.addAction(CIcons::refresh16(), "Force model reload impossible, no DB data", CMenuAction::pathSimulator());
|
||||||
|
a.setActionEnabled(false); // gray out
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this->nestedCustomMenu(menuActions);
|
this->nestedCustomMenu(menuActions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,17 @@ namespace BlackGui
|
|||||||
if (this->m_action) { m_action->setChecked(checked); }
|
if (this->m_action) { m_action->setChecked(checked); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CMenuAction::isActionEnabled() const
|
||||||
|
{
|
||||||
|
if (!this->m_action) { return false; }
|
||||||
|
return this->m_action->isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMenuAction::setActionEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
if (this->m_action) { m_action->setEnabled(enabled); }
|
||||||
|
}
|
||||||
|
|
||||||
bool CMenuAction::hasNoPathWithSeparator() const
|
bool CMenuAction::hasNoPathWithSeparator() const
|
||||||
{
|
{
|
||||||
return this->m_separator && this->hasNoPath();
|
return this->m_separator && this->hasNoPath();
|
||||||
@@ -244,6 +255,11 @@ namespace BlackGui
|
|||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CMenuAction CMenuActions::addAction(const QIcon &actionIcon, const QString &text, const QString &path)
|
||||||
|
{
|
||||||
|
return this->addAction(actionIcon, text, path, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
CMenuAction CMenuActions::addAction(const QIcon &actionIcon, const QString &text, const QString &path, const BlackMisc::CSlot<void ()> &slot, const QKeySequence &shortcut)
|
CMenuAction CMenuActions::addAction(const QIcon &actionIcon, const QString &text, const QString &path, const BlackMisc::CSlot<void ()> &slot, const QKeySequence &shortcut)
|
||||||
{
|
{
|
||||||
return this->addAction(actionIcon, text, path, slot.object(), slot, shortcut);
|
return this->addAction(actionIcon, text, path, slot.object(), slot, shortcut);
|
||||||
|
|||||||
@@ -60,6 +60,12 @@ namespace BlackGui
|
|||||||
//! Set a checkable action, QAction::setChecked
|
//! Set a checkable action, QAction::setChecked
|
||||||
void setActionChecked(bool checked);
|
void setActionChecked(bool checked);
|
||||||
|
|
||||||
|
//! Enabled action?
|
||||||
|
bool isActionEnabled() const;
|
||||||
|
|
||||||
|
//! Enable action (allow gray out)
|
||||||
|
void setActionEnabled(bool enabled);
|
||||||
|
|
||||||
//! Path
|
//! Path
|
||||||
const QString &getPath() const { return m_path; }
|
const QString &getPath() const { return m_path; }
|
||||||
|
|
||||||
@@ -241,6 +247,9 @@ namespace BlackGui
|
|||||||
//! Add action
|
//! Add action
|
||||||
CMenuAction addAction(const QIcon &actionIcon, const QString &text, const QString &path, QObject *actionOwner, const BlackMisc::CSlot<void()> &slot, const QKeySequence &shortcut = 0);
|
CMenuAction addAction(const QIcon &actionIcon, const QString &text, const QString &path, QObject *actionOwner, const BlackMisc::CSlot<void()> &slot, const QKeySequence &shortcut = 0);
|
||||||
|
|
||||||
|
//! Add action without slot
|
||||||
|
CMenuAction addAction(const QIcon &actionIcon, const QString &text, const QString &path);
|
||||||
|
|
||||||
//! Add action
|
//! Add action
|
||||||
CMenuAction addAction(const QIcon &actionIcon, const QString &text, const QString &path, const BlackMisc::CSlot<void()> &slot, const QKeySequence &shortcut = 0);
|
CMenuAction addAction(const QIcon &actionIcon, const QString &text, const QString &path, const BlackMisc::CSlot<void()> &slot, const QKeySequence &shortcut = 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user