mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-25 20:25:54 +02:00
Define LinkApp::isOpk() also when OPK support is disabled
This reduces the number of required preprocessor directives, leading to more readable code and more code being examined by the compiler (useful to spot problems). Since the method is inlined, the compiler should be able to eliminate the same amount of code that the preprocessor would, only at a later stage of the compilation.
This commit is contained in:
parent
271ef00c18
commit
de30b3f98f
@ -49,18 +49,17 @@ ContextMenu::ContextMenu(GMenu2X &gmenu2x, Menu &menu)
|
|||||||
* This is not a good idea as it'll break things if
|
* This is not a good idea as it'll break things if
|
||||||
* a new config option is added to the contextual menu.
|
* a new config option is added to the contextual menu.
|
||||||
*/
|
*/
|
||||||
#if defined(HAVE_LIBOPK) && !defined(ENABLE_CPUFREQ)
|
if (!app->isOpk()
|
||||||
if (!app->isOpk() || !app->getSelectorDir().empty())
|
#if defined(ENABLE_CPUFREQ)
|
||||||
|
|| true
|
||||||
#endif
|
#endif
|
||||||
{
|
|| !app->getSelectorDir().empty()
|
||||||
|
) {
|
||||||
options.push_back(std::make_shared<MenuOption>(
|
options.push_back(std::make_shared<MenuOption>(
|
||||||
tr.translate("Edit $1", app->getTitle().c_str(), NULL),
|
tr.translate("Edit $1", app->getTitle().c_str(), NULL),
|
||||||
std::bind(&GMenu2X::editLink, &gmenu2x)));
|
std::bind(&GMenu2X::editLink, &gmenu2x)));
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LIBOPK
|
if (!app->isOpk()) {
|
||||||
if (!app->isOpk())
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
options.push_back(std::make_shared<MenuOption>(
|
options.push_back(std::make_shared<MenuOption>(
|
||||||
tr.translate("Delete $1 link", app->getTitle().c_str(), NULL),
|
tr.translate("Delete $1 link", app->getTitle().c_str(), NULL),
|
||||||
std::bind(&GMenu2X::deleteLink, &gmenu2x)));
|
std::bind(&GMenu2X::deleteLink, &gmenu2x)));
|
||||||
|
@ -880,9 +880,7 @@ void GMenu2X::editLink() {
|
|||||||
string diagIcon = linkApp->getIconPath();
|
string diagIcon = linkApp->getIconPath();
|
||||||
|
|
||||||
SettingsDialog sd(this, input, ts, diagTitle, diagIcon);
|
SettingsDialog sd(this, input, ts, diagTitle, diagIcon);
|
||||||
#ifdef HAVE_LIBOPK
|
|
||||||
if (!linkApp->isOpk()) {
|
if (!linkApp->isOpk()) {
|
||||||
#endif
|
|
||||||
sd.addSetting(new MenuSettingString(this, ts, tr["Title"], tr["Link title"], &linkTitle, diagTitle, diagIcon));
|
sd.addSetting(new MenuSettingString(this, ts, tr["Title"], tr["Link title"], &linkTitle, diagTitle, diagIcon));
|
||||||
sd.addSetting(new MenuSettingString(this, ts, tr["Description"], tr["Link description"], &linkDescription, diagTitle, diagIcon));
|
sd.addSetting(new MenuSettingString(this, ts, tr["Description"], tr["Link description"], &linkDescription, diagTitle, diagIcon));
|
||||||
sd.addSetting(new MenuSettingMultiString(this, ts, tr["Section"], tr["The section this link belongs to"], &newSection, &menu->getSections()));
|
sd.addSetting(new MenuSettingMultiString(this, ts, tr["Section"], tr["The section this link belongs to"], &newSection, &menu->getSections()));
|
||||||
@ -892,21 +890,15 @@ void GMenu2X::editLink() {
|
|||||||
sd.addSetting(new MenuSettingFile(this, ts, tr["Manual"],
|
sd.addSetting(new MenuSettingFile(this, ts, tr["Manual"],
|
||||||
tr["Select a graphic/textual manual or a readme"],
|
tr["Select a graphic/textual manual or a readme"],
|
||||||
&linkManual, "man.png,txt"));
|
&linkManual, "man.png,txt"));
|
||||||
#ifdef HAVE_LIBOPK
|
|
||||||
}
|
}
|
||||||
if (!linkApp->isOpk() || !linkApp->getSelectorDir().empty()) {
|
if (!linkApp->isOpk() || !linkApp->getSelectorDir().empty()) {
|
||||||
#endif
|
|
||||||
sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Directory"], tr["Directory to scan for the selector"], &linkSelDir));
|
sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Directory"], tr["Directory to scan for the selector"], &linkSelDir));
|
||||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Selector Browser"], tr["Allow the selector to change directory"], &linkSelBrowser));
|
sd.addSetting(new MenuSettingBool(this, ts, tr["Selector Browser"], tr["Allow the selector to change directory"], &linkSelBrowser));
|
||||||
#ifdef HAVE_LIBOPK
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_CPUFREQ
|
#ifdef ENABLE_CPUFREQ
|
||||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Clock frequency"], tr["Cpu clock frequency to set when launching this link"], &linkClock, cpuFreqMin, confInt["maxClock"], cpuFreqMultiple));
|
sd.addSetting(new MenuSettingInt(this, ts, tr["Clock frequency"], tr["Cpu clock frequency to set when launching this link"], &linkClock, cpuFreqMin, confInt["maxClock"], cpuFreqMultiple));
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIBOPK
|
|
||||||
if (!linkApp->isOpk()) {
|
if (!linkApp->isOpk()) {
|
||||||
#endif
|
|
||||||
sd.addSetting(new MenuSettingString(this, ts, tr["Selector Filter"], tr["Selector filter (Separate values with a comma)"], &linkSelFilter, diagTitle, diagIcon));
|
sd.addSetting(new MenuSettingString(this, ts, tr["Selector Filter"], tr["Selector filter (Separate values with a comma)"], &linkSelFilter, diagTitle, diagIcon));
|
||||||
sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Screenshots"], tr["Directory of the screenshots for the selector"], &linkSelScreens));
|
sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Screenshots"], tr["Directory of the screenshots for the selector"], &linkSelScreens));
|
||||||
sd.addSetting(new MenuSettingFile(this, ts, tr["Selector Aliases"], tr["File containing a list of aliases for the selector"], &linkSelAliases));
|
sd.addSetting(new MenuSettingFile(this, ts, tr["Selector Aliases"], tr["File containing a list of aliases for the selector"], &linkSelAliases));
|
||||||
@ -914,9 +906,7 @@ void GMenu2X::editLink() {
|
|||||||
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
|
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
|
||||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Display Console"], tr["Must be enabled for console-based applications"], &linkApp->consoleApp));
|
sd.addSetting(new MenuSettingBool(this, ts, tr["Display Console"], tr["Must be enabled for console-based applications"], &linkApp->consoleApp));
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIBOPK
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (sd.exec() && sd.edited()) {
|
if (sd.exec() && sd.edited()) {
|
||||||
linkApp->setTitle(linkTitle);
|
linkApp->setTitle(linkTitle);
|
||||||
|
@ -68,6 +68,7 @@ public:
|
|||||||
#else
|
#else
|
||||||
LinkApp(GMenu2X *gmenu2x, Touchscreen &ts, InputManager &inputMgr,
|
LinkApp(GMenu2X *gmenu2x, Touchscreen &ts, InputManager &inputMgr,
|
||||||
const char* linkfile);
|
const char* linkfile);
|
||||||
|
bool isOpk() { return false; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual void loadIcon();
|
virtual void loadIcon();
|
||||||
|
Loading…
Reference in New Issue
Block a user