mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
Use nested namespaces (C++17 feature)
This commit is contained in:
@@ -19,77 +19,74 @@
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
namespace BlackCore
|
||||
namespace BlackCore::Application
|
||||
{
|
||||
namespace Application
|
||||
//! User configured hotkeys
|
||||
struct TActionHotkeys : public BlackMisc::TSettingTrait<BlackMisc::Input::CActionHotkeyList>
|
||||
{
|
||||
//! User configured hotkeys
|
||||
struct TActionHotkeys : public BlackMisc::TSettingTrait<BlackMisc::Input::CActionHotkeyList>
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "application/actionhotkeys"; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable() { static const QString name("Hotkeys"); return name; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::isValid
|
||||
static bool isValid(const BlackMisc::Input::CActionHotkeyList &value, QString &)
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "application/actionhotkeys"; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable() { static const QString name("Hotkeys"); return name; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::isValid
|
||||
static bool isValid(const BlackMisc::Input::CActionHotkeyList &value, QString &)
|
||||
for (const auto &actionHotkey : value)
|
||||
{
|
||||
for (const auto &actionHotkey : value)
|
||||
if (actionHotkey.getApplicableMachine().getMachineName().isEmpty() ||
|
||||
actionHotkey.getAction().isEmpty() ||
|
||||
actionHotkey.getCombination().isEmpty()) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//! Selected simulator plugins
|
||||
struct TEnabledSimulators : public BlackMisc::TSettingTrait<QStringList>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "application/enabledsimulators"; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable() { static const QString name("Enabled simulators"); return name; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||
static const QStringList &defaultValue()
|
||||
{
|
||||
// All default simulators
|
||||
static const QStringList enabledSimulators(BlackMisc::Simulation::CSimulatorPluginInfo::guessDefaultPlugins());
|
||||
return enabledSimulators;
|
||||
}
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::isValid
|
||||
static bool isValid(const QStringList &pluginIdentifiers, QString &)
|
||||
{
|
||||
for (const QString &pluginIdentifier : pluginIdentifiers)
|
||||
{
|
||||
if (!BlackMisc::Simulation::CSimulatorPluginInfo::allIdentifiers().contains(pluginIdentifier))
|
||||
{
|
||||
if (actionHotkey.getApplicableMachine().getMachineName().isEmpty() ||
|
||||
actionHotkey.getAction().isEmpty() ||
|
||||
actionHotkey.getCombination().isEmpty()) { return false; }
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//! Selected simulator plugins
|
||||
struct TEnabledSimulators : public BlackMisc::TSettingTrait<QStringList>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "application/enabledsimulators"; }
|
||||
//! Uploading of crash dumps is enabled or disabled
|
||||
//! \deprecated remove after changing to
|
||||
struct TCrashDumpSettings : public BlackMisc::TSettingTrait<BlackMisc::Settings::CCrashSettings>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "application/crashdump"; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable() { static const QString name("Enabled simulators"); return name; }
|
||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable() { static const QString name("Crash dumps"); return name; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||
static const QStringList &defaultValue()
|
||||
{
|
||||
// All default simulators
|
||||
static const QStringList enabledSimulators(BlackMisc::Simulation::CSimulatorPluginInfo::guessDefaultPlugins());
|
||||
return enabledSimulators;
|
||||
}
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::isValid
|
||||
static bool isValid(const QStringList &pluginIdentifiers, QString &)
|
||||
{
|
||||
for (const QString &pluginIdentifier : pluginIdentifiers)
|
||||
{
|
||||
if (!BlackMisc::Simulation::CSimulatorPluginInfo::allIdentifiers().contains(pluginIdentifier))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//! Uploading of crash dumps is enabled or disabled
|
||||
//! \deprecated remove after changing to
|
||||
struct TCrashDumpSettings : public BlackMisc::TSettingTrait<BlackMisc::Settings::CCrashSettings>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "application/crashdump"; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable() { static const QString name("Crash dumps"); return name; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||
// static bool defaultValue() { return BlackMisc::Settings::CCrashSettings(); }
|
||||
};
|
||||
} // ns
|
||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||
// static bool defaultValue() { return BlackMisc::Settings::CCrashSettings(); }
|
||||
};
|
||||
} // ns
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,34 +17,31 @@
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include <QStringList>
|
||||
|
||||
namespace BlackCore
|
||||
namespace BlackCore::Application
|
||||
{
|
||||
namespace Application
|
||||
//! Update info settings, QStringList with 2 values: channel/platform
|
||||
struct TUpdatePreferences : public BlackMisc::TSettingTrait<QStringList>
|
||||
{
|
||||
//! Update info settings, QStringList with 2 values: channel/platform
|
||||
struct TUpdatePreferences : public BlackMisc::TSettingTrait<QStringList>
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "updatepreferences"; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||
static const QStringList &defaultValue()
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "updatepreferences"; }
|
||||
// guessing / preset-ing some default values
|
||||
static const QStringList d = (sApp && !sApp->getUpdateInfo().isEmpty()) ?
|
||||
sApp->getUpdateInfo().anticipateMyDefaultChannelAndPlatform() : // from cached or loaded update info
|
||||
QStringList({ "STABLE", BlackMisc::CPlatform::currentPlatform().getPlatformName()});
|
||||
return d;
|
||||
}
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||
static const QStringList &defaultValue()
|
||||
{
|
||||
// guessing / preset-ing some default values
|
||||
static const QStringList d = (sApp && !sApp->getUpdateInfo().isEmpty()) ?
|
||||
sApp->getUpdateInfo().anticipateMyDefaultChannelAndPlatform() : // from cached or loaded update info
|
||||
QStringList({ "STABLE", BlackMisc::CPlatform::currentPlatform().getPlatformName()});
|
||||
return d;
|
||||
}
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable()
|
||||
{
|
||||
static const QString name("Updates channel/platform");
|
||||
return name;
|
||||
}
|
||||
};
|
||||
} // ns
|
||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable()
|
||||
{
|
||||
static const QString name("Updates channel/platform");
|
||||
return name;
|
||||
}
|
||||
};
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user