1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-25 18:58:25 +02:00

Remove the 'Selector alias file' feature

Who seriously used that?
This commit is contained in:
Paul Cercueil 2014-06-12 21:31:12 +02:00
parent 9e113d88c7
commit c72266d771
5 changed files with 1 additions and 50 deletions

View File

@ -909,7 +909,6 @@ void GMenu2X::editLink() {
string linkSelDir = linkApp->getSelectorDir(); string linkSelDir = linkApp->getSelectorDir();
bool linkSelBrowser = linkApp->getSelectorBrowser(); bool linkSelBrowser = linkApp->getSelectorBrowser();
string linkSelScreens = linkApp->getSelectorScreens(); string linkSelScreens = linkApp->getSelectorScreens();
string linkSelAliases = linkApp->getAliasFile();
int linkClock = linkApp->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);
@ -937,7 +936,6 @@ void GMenu2X::editLink() {
if (!linkApp->isOpk()) { if (!linkApp->isOpk()) {
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));
#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
@ -952,7 +950,6 @@ void GMenu2X::editLink() {
linkApp->setSelectorDir(linkSelDir); linkApp->setSelectorDir(linkSelDir);
linkApp->setSelectorBrowser(linkSelBrowser); linkApp->setSelectorBrowser(linkSelBrowser);
linkApp->setSelectorScreens(linkSelScreens); linkApp->setSelectorScreens(linkSelScreens);
linkApp->setAliasFile(linkSelAliases);
linkApp->setClock(linkClock); linkApp->setClock(linkClock);
INFO("New Section: '%s'\n", newSection.c_str()); INFO("New Section: '%s'\n", newSection.c_str());

View File

@ -212,8 +212,6 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
if (value=="false") selectorbrowser = false; if (value=="false") selectorbrowser = false;
} else if (name == "selectorscreens") { } else if (name == "selectorscreens") {
setSelectorScreens( value ); setSelectorScreens( value );
} else if (name == "selectoraliases") {
setAliasFile( value );
} else if (!isOpk()) { } else if (!isOpk()) {
if (name == "title") { if (name == "title") {
title = value; title = value;
@ -330,7 +328,6 @@ bool LinkApp::save() {
if (!selectordir.empty() ) f << "selectordir=" << selectordir << endl; if (!selectordir.empty() ) f << "selectordir=" << selectordir << endl;
if (!selectorbrowser ) f << "selectorbrowser=false" << endl; if (!selectorbrowser ) f << "selectorbrowser=false" << endl;
if (!selectorscreens.empty() ) f << "selectorscreens=" << selectorscreens << endl; if (!selectorscreens.empty() ) f << "selectorscreens=" << selectorscreens << endl;
if (!aliasfile.empty() ) f << "selectoraliases=" << aliasfile << endl;
f.close(); f.close();
sync(); sync();
return true; return true;
@ -710,17 +707,6 @@ void LinkApp::setSelectorScreens(const string &selectorscreens) {
edited = true; edited = true;
} }
const string &LinkApp::getAliasFile() {
return aliasfile;
}
void LinkApp::setAliasFile(const string &aliasfile) {
if (fileExists(aliasfile)) {
this->aliasfile = aliasfile;
edited = true;
}
}
void LinkApp::renameFile(const string &name) { void LinkApp::renameFile(const string &name) {
file = name; file = name;
} }

View File

@ -39,7 +39,6 @@ private:
std::string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens; std::string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens;
bool selectorbrowser, editable; bool selectorbrowser, editable;
std::string aliasfile;
std::string file; std::string file;
bool dontleave; bool dontleave;
@ -86,8 +85,6 @@ public:
void setSelectorScreens(const std::string &selectorscreens); void setSelectorScreens(const std::string &selectorscreens);
const std::string &getSelectorFilter(); const std::string &getSelectorFilter();
void setSelectorFilter(const std::string &selectorfilter); void setSelectorFilter(const std::string &selectorfilter);
const std::string &getAliasFile();
void setAliasFile(const std::string &aliasfile);
int clock(); int clock();
const std::string &clockStr(int maxClock); const std::string &clockStr(int maxClock);

View File

@ -44,7 +44,6 @@ Selector::Selector(GMenu2X *gmenu2x, LinkApp *link, const string &selectorDir) :
Dialog(gmenu2x) Dialog(gmenu2x)
{ {
this->link = link; this->link = link;
loadAliases();
selRow = 0; selRow = 0;
if (selectorDir.empty()) if (selectorDir.empty())
dir = link->getSelectorDir(); dir = link->getSelectorDir();
@ -242,9 +241,7 @@ void Selector::prepare(FileLister *fl, vector<string> *screens, vector<string> *
pos = noext.rfind("."); pos = noext.rfind(".");
if (pos!=string::npos && pos>0) if (pos!=string::npos && pos>0)
noext = noext.substr(0, pos); noext = noext.substr(0, pos);
titles->at(i) = getAlias(noext); titles->at(i) = noext;
if (titles->at(i).empty())
titles->at(i) = noext;
DEBUG("Searching for screen '%s%s.png'\n", screendir.c_str(), noext.c_str()); DEBUG("Searching for screen '%s%s.png'\n", screendir.c_str(), noext.c_str());
@ -261,26 +258,3 @@ void Selector::freeScreenshots(vector<string> *screens) {
gmenu2x->sc.del(screens->at(i)); gmenu2x->sc.del(screens->at(i));
} }
} }
void Selector::loadAliases() {
aliases.clear();
if (fileExists(link->getAliasFile())) {
string line;
ifstream infile (link->getAliasFile().c_str(), ios_base::in);
while (getline(infile, line, '\n')) {
string::size_type position = line.find("=");
string name = trim(line.substr(0,position));
string value = trim(line.substr(position+1));
aliases[name] = value;
}
infile.close();
}
}
string Selector::getAlias(const string &key) {
unordered_map<string, string>::iterator i = aliases.find(key);
if (i == aliases.end())
return "";
else
return i->second;
}

View File

@ -35,10 +35,7 @@ private:
int selRow; int selRow;
LinkApp *link; LinkApp *link;
std::string file, dir; std::string file, dir;
std::unordered_map<std::string, std::string> aliases;
void loadAliases();
std::string getAlias(const std::string &key);
void prepare(FileLister *fl, std::vector<std::string> *screens, void prepare(FileLister *fl, std::vector<std::string> *screens,
std::vector<std::string> *titles); std::vector<std::string> *titles);
void freeScreenshots(std::vector<std::string> *screens); void freeScreenshots(std::vector<std::string> *screens);