mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 23:00:37 +02:00
Call Menu::selLinkApp() only once in GMenu2X::editLink()
This commit is contained in:
parent
84fe36b5e8
commit
271ef00c18
@ -855,32 +855,33 @@ void GMenu2X::addLink() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GMenu2X::editLink() {
|
void GMenu2X::editLink() {
|
||||||
if (menu->selLinkApp()==NULL) return;
|
LinkApp *linkApp = menu->selLinkApp();
|
||||||
|
if (!linkApp) return;
|
||||||
|
|
||||||
vector<string> pathV;
|
vector<string> pathV;
|
||||||
split(pathV,menu->selLinkApp()->getFile(),"/");
|
split(pathV,linkApp->getFile(),"/");
|
||||||
string oldSection = "";
|
string oldSection = "";
|
||||||
if (pathV.size()>1)
|
if (pathV.size()>1)
|
||||||
oldSection = pathV[pathV.size()-2];
|
oldSection = pathV[pathV.size()-2];
|
||||||
string newSection = oldSection;
|
string newSection = oldSection;
|
||||||
|
|
||||||
string linkTitle = menu->selLinkApp()->getTitle();
|
string linkTitle = linkApp->getTitle();
|
||||||
string linkDescription = menu->selLinkApp()->getDescription();
|
string linkDescription = linkApp->getDescription();
|
||||||
string linkIcon = menu->selLinkApp()->getIcon();
|
string linkIcon = linkApp->getIcon();
|
||||||
string linkManual = menu->selLinkApp()->getManual();
|
string linkManual = linkApp->getManual();
|
||||||
string linkSelFilter = menu->selLinkApp()->getSelectorFilter();
|
string linkSelFilter = linkApp->getSelectorFilter();
|
||||||
string linkSelDir = menu->selLinkApp()->getSelectorDir();
|
string linkSelDir = linkApp->getSelectorDir();
|
||||||
bool linkSelBrowser = menu->selLinkApp()->getSelectorBrowser();
|
bool linkSelBrowser = linkApp->getSelectorBrowser();
|
||||||
string linkSelScreens = menu->selLinkApp()->getSelectorScreens();
|
string linkSelScreens = linkApp->getSelectorScreens();
|
||||||
string linkSelAliases = menu->selLinkApp()->getAliasFile();
|
string linkSelAliases = linkApp->getAliasFile();
|
||||||
int linkClock = menu->selLinkApp()->clock();
|
int linkClock = linkApp->clock();
|
||||||
|
|
||||||
string diagTitle = tr.translate("Edit link: $1",linkTitle.c_str(),NULL);
|
string diagTitle = tr.translate("Edit link: $1",linkTitle.c_str(),NULL);
|
||||||
string diagIcon = menu->selLinkApp()->getIconPath();
|
string diagIcon = linkApp->getIconPath();
|
||||||
|
|
||||||
SettingsDialog sd(this, input, ts, diagTitle, diagIcon);
|
SettingsDialog sd(this, input, ts, diagTitle, diagIcon);
|
||||||
#ifdef HAVE_LIBOPK
|
#ifdef HAVE_LIBOPK
|
||||||
if (!menu->selLinkApp()->isOpk()) {
|
if (!linkApp->isOpk()) {
|
||||||
#endif
|
#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));
|
||||||
@ -893,8 +894,7 @@ void GMenu2X::editLink() {
|
|||||||
&linkManual, "man.png,txt"));
|
&linkManual, "man.png,txt"));
|
||||||
#ifdef HAVE_LIBOPK
|
#ifdef HAVE_LIBOPK
|
||||||
}
|
}
|
||||||
if (!menu->selLinkApp()->isOpk() ||
|
if (!linkApp->isOpk() || !linkApp->getSelectorDir().empty()) {
|
||||||
!menu->selLinkApp()->getSelectorDir().empty()) {
|
|
||||||
#endif
|
#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));
|
||||||
@ -905,30 +905,30 @@ void GMenu2X::editLink() {
|
|||||||
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
|
#ifdef HAVE_LIBOPK
|
||||||
if (!menu->selLinkApp()->isOpk()) {
|
if (!linkApp->isOpk()) {
|
||||||
#endif
|
#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));
|
||||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Don't Leave"], tr["Don't quit GMenu2X when launching this link"], &menu->selLinkApp()->runsInBackgroundRef()));
|
sd.addSetting(new MenuSettingBool(this, ts, tr["Don't Leave"], tr["Don't quit GMenu2X when launching this link"], &linkApp->runsInBackgroundRef()));
|
||||||
#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"], &menu->selLinkApp()->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
|
#ifdef HAVE_LIBOPK
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sd.exec() && sd.edited()) {
|
if (sd.exec() && sd.edited()) {
|
||||||
menu->selLinkApp()->setTitle(linkTitle);
|
linkApp->setTitle(linkTitle);
|
||||||
menu->selLinkApp()->setDescription(linkDescription);
|
linkApp->setDescription(linkDescription);
|
||||||
menu->selLinkApp()->setIcon(linkIcon);
|
linkApp->setIcon(linkIcon);
|
||||||
menu->selLinkApp()->setManual(linkManual);
|
linkApp->setManual(linkManual);
|
||||||
menu->selLinkApp()->setSelectorFilter(linkSelFilter);
|
linkApp->setSelectorFilter(linkSelFilter);
|
||||||
menu->selLinkApp()->setSelectorDir(linkSelDir);
|
linkApp->setSelectorDir(linkSelDir);
|
||||||
menu->selLinkApp()->setSelectorBrowser(linkSelBrowser);
|
linkApp->setSelectorBrowser(linkSelBrowser);
|
||||||
menu->selLinkApp()->setSelectorScreens(linkSelScreens);
|
linkApp->setSelectorScreens(linkSelScreens);
|
||||||
menu->selLinkApp()->setAliasFile(linkSelAliases);
|
linkApp->setAliasFile(linkSelAliases);
|
||||||
menu->selLinkApp()->setClock(linkClock);
|
linkApp->setClock(linkClock);
|
||||||
|
|
||||||
INFO("New Section: '%s'\n", newSection.c_str());
|
INFO("New Section: '%s'\n", newSection.c_str());
|
||||||
|
|
||||||
@ -944,14 +944,14 @@ void GMenu2X::editLink() {
|
|||||||
newFileName = "sections/"+newSection+"/"+linkTitle+id;
|
newFileName = "sections/"+newSection+"/"+linkTitle+id;
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
rename(menu->selLinkApp()->getFile().c_str(),newFileName.c_str());
|
rename(linkApp->getFile().c_str(),newFileName.c_str());
|
||||||
menu->selLinkApp()->renameFile(newFileName);
|
linkApp->renameFile(newFileName);
|
||||||
|
|
||||||
INFO("New section index: %i.\n", newSectionIndex - menu->getSections().begin());
|
INFO("New section index: %i.\n", newSectionIndex - menu->getSections().begin());
|
||||||
|
|
||||||
menu->linkChangeSection(menu->selLinkIndex(), menu->selSectionIndex(), newSectionIndex - menu->getSections().begin());
|
menu->linkChangeSection(menu->selLinkIndex(), menu->selSectionIndex(), newSectionIndex - menu->getSections().begin());
|
||||||
}
|
}
|
||||||
menu->selLinkApp()->save();
|
linkApp->save();
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user