mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 02:15:19 +02:00
Converted public fields of FileLister to private.
This commit is contained in:
parent
0c6e23e869
commit
8032d96a17
@ -95,7 +95,7 @@ void FileLister::browse()
|
||||
cout << "\033[0;34mGMENU2X:\033[0;31m stat failed on '" << filepath << "' with error '" << strerror(errno) << "'\033[0m" << endl;
|
||||
continue;
|
||||
}
|
||||
if (find(exclude.begin(), exclude.end(), file) != exclude.end())
|
||||
if (find(excludes.begin(), excludes.end(), file) != excludes.end())
|
||||
continue;
|
||||
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
@ -159,3 +159,11 @@ bool FileLister::isDirectory(unsigned int x)
|
||||
{
|
||||
return x < directories.size();
|
||||
}
|
||||
|
||||
void FileLister::insertFile(const string &file) {
|
||||
files.insert(files.begin(), file);
|
||||
}
|
||||
|
||||
void FileLister::addExclude(const string &exclude) {
|
||||
excludes.push_back(exclude);
|
||||
}
|
||||
|
@ -32,11 +32,12 @@ private:
|
||||
string path, filter;
|
||||
bool showDirectories, showFiles;
|
||||
|
||||
vector<string> directories, files, excludes;
|
||||
|
||||
public:
|
||||
FileLister(const string &startPath = "/boot/local", bool showDirectories = true, bool showFiles = true);
|
||||
void browse();
|
||||
|
||||
vector<string> directories, files, exclude;
|
||||
unsigned int size();
|
||||
unsigned int dirCount();
|
||||
unsigned int fileCount();
|
||||
@ -49,6 +50,11 @@ public:
|
||||
void setPath(const string &path, bool doBrowse=true);
|
||||
const string &getFilter();
|
||||
void setFilter(const string &filter);
|
||||
|
||||
const vector<string> &getDirectories() { return directories; }
|
||||
const vector<string> &getFiles() { return files; }
|
||||
void insertFile(const string &file);
|
||||
void addExclude(const string &exclude);
|
||||
};
|
||||
|
||||
#endif /*FILELISTER_H_*/
|
||||
|
@ -272,10 +272,10 @@ GMenu2X::GMenu2X() {
|
||||
FileLister fl("skins/"+confStr["skin"]+"/wallpapers",false,true);
|
||||
fl.setFilter(".png,.jpg,.jpeg,.bmp");
|
||||
fl.browse();
|
||||
if (fl.files.size()<=0 && confStr["skin"] != "Default")
|
||||
if (fl.getFiles().size()<=0 && confStr["skin"] != "Default")
|
||||
fl.setPath("skins/Default/wallpapers",true);
|
||||
if (fl.files.size()>0)
|
||||
confStr["wallpaper"] = fl.getPath()+fl.files[0];
|
||||
if (fl.getFiles().size()>0)
|
||||
confStr["wallpaper"] = fl.getPath()+fl.getFiles()[0];
|
||||
}
|
||||
|
||||
initBG();
|
||||
@ -1020,7 +1020,7 @@ void GMenu2X::options() {
|
||||
|
||||
FileLister fl_tr("translations");
|
||||
fl_tr.browse();
|
||||
fl_tr.files.insert(fl_tr.files.begin(),"English");
|
||||
fl_tr.insertFile("English");
|
||||
string lang = tr.lang();
|
||||
|
||||
vector<string> encodings;
|
||||
@ -1028,7 +1028,7 @@ void GMenu2X::options() {
|
||||
encodings.push_back("PAL");
|
||||
|
||||
SettingsDialog sd(this,tr["Settings"]);
|
||||
sd.addSetting(new MenuSettingMultiString(this,tr["Language"],tr["Set the language used by GMenu2X"],&lang,&fl_tr.files));
|
||||
sd.addSetting(new MenuSettingMultiString(this,tr["Language"],tr["Set the language used by GMenu2X"],&lang,&fl_tr.getFiles()));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["Save last selection"],tr["Save the last selected link and section on exit"],&confInt["saveSelection"]));
|
||||
sd.addSetting(new MenuSettingInt(this,tr["Clock for GMenu2X"],tr["Set the cpu working frequency when running GMenu2X"],&confInt["menuClock"],200,430));
|
||||
sd.addSetting(new MenuSettingInt(this,tr["Maximum overclock"],tr["Set the maximum overclock for launching links"],&confInt["maxClock"],200,430));
|
||||
@ -1081,12 +1081,12 @@ void GMenu2X::settingsOpen2x() {
|
||||
|
||||
void GMenu2X::skinMenu() {
|
||||
FileLister fl_sk("skins",true,false);
|
||||
fl_sk.exclude.push_back("..");
|
||||
fl_sk.addExclude("..");
|
||||
fl_sk.browse();
|
||||
string curSkin = confStr["skin"];
|
||||
|
||||
SettingsDialog sd(this,tr["Skin"]);
|
||||
sd.addSetting(new MenuSettingMultiString(this,tr["Skin"],tr["Set the skin used by GMenu2X"],&confStr["skin"],&fl_sk.directories));
|
||||
sd.addSetting(new MenuSettingMultiString(this,tr["Skin"],tr["Set the skin used by GMenu2X"],&confStr["skin"],&fl_sk.getDirectories()));
|
||||
sd.addSetting(new MenuSettingRGBA(this,tr["Top Bar Color"],tr["Color of the top bar"],&skinConfColors[COLOR_TOP_BAR_BG]));
|
||||
sd.addSetting(new MenuSettingRGBA(this,tr["Bottom Bar Color"],tr["Color of the bottom bar"],&skinConfColors[COLOR_BOTTOM_BAR_BG]));
|
||||
sd.addSetting(new MenuSettingRGBA(this,tr["Selection Color"],tr["Color of the selection and other interface details"],&skinConfColors[COLOR_SELECTION_BG]));
|
||||
|
@ -237,7 +237,7 @@ bool Menu::addLink(string path, string file, string section) {
|
||||
|
||||
if (lcfilename.find("readme") != string::npos) {
|
||||
found = true;
|
||||
manual = path+fl.files[x];
|
||||
manual = path+fl.getFiles()[x];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,16 +188,16 @@ int Selector::exec(int startSelection) {
|
||||
void Selector::prepare(FileLister *fl, vector<string> *screens, vector<string> *titles) {
|
||||
fl->setPath(dir);
|
||||
freeScreenshots(screens);
|
||||
screens->resize(fl->files.size());
|
||||
titles->resize(fl->files.size());
|
||||
screens->resize(fl->getFiles().size());
|
||||
titles->resize(fl->getFiles().size());
|
||||
|
||||
string screendir = link->getSelectorScreens();
|
||||
if (screendir != "" && screendir[screendir.length()-1]!='/') screendir += "/";
|
||||
|
||||
string noext;
|
||||
string::size_type pos;
|
||||
for (uint i=0; i<fl->files.size(); i++) {
|
||||
noext = fl->files[i];
|
||||
for (uint i=0; i<fl->getFiles().size(); i++) {
|
||||
noext = fl->getFiles()[i];
|
||||
pos = noext.rfind(".");
|
||||
if (pos!=string::npos && pos>0)
|
||||
noext = noext.substr(0, pos);
|
||||
|
@ -37,12 +37,12 @@ bool WallpaperDialog::exec()
|
||||
vector<string> wallpapers;
|
||||
if (fileExists("skins/"+gmenu2x->confStr["skin"]+"/wallpapers")) {
|
||||
fl.browse();
|
||||
wallpapers = fl.files;
|
||||
wallpapers = fl.getFiles();
|
||||
}
|
||||
if (gmenu2x->confStr["skin"] != "Default") {
|
||||
fl.setPath("skins/Default/wallpapers",true);
|
||||
for (uint i=0; i<fl.files.size(); i++)
|
||||
wallpapers.push_back(fl.files[i]);
|
||||
for (uint i=0; i<fl.getFiles().size(); i++)
|
||||
wallpapers.push_back(fl.getFiles()[i]);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
cout << "Wallpapers: " << wallpapers.size() << endl;
|
||||
@ -54,7 +54,7 @@ bool WallpaperDialog::exec()
|
||||
if (selected<firstElement) firstElement=selected;
|
||||
|
||||
//Wallpaper
|
||||
if (selected<wallpapers.size()-fl.files.size())
|
||||
if (selected<wallpapers.size()-fl.getFiles().size())
|
||||
gmenu2x->sc["skins/"+gmenu2x->confStr["skin"]+"/wallpapers/"+wallpapers[selected]]->blit(gmenu2x->s,0,0);
|
||||
else
|
||||
gmenu2x->sc["skins/Default/wallpapers/"+wallpapers[selected]]->blit(gmenu2x->s,0,0);
|
||||
@ -120,7 +120,7 @@ bool WallpaperDialog::exec()
|
||||
if ( gmenu2x->input[ACTION_B] ) {
|
||||
close = true;
|
||||
if (wallpapers.size()>0) {
|
||||
if (selected<wallpapers.size()-fl.files.size())
|
||||
if (selected<wallpapers.size()-fl.getFiles().size())
|
||||
wallpaper = "skins/"+gmenu2x->confStr["skin"]+"/wallpapers/"+wallpapers[selected];
|
||||
else
|
||||
wallpaper = "skins/Default/wallpapers/"+wallpapers[selected];
|
||||
@ -129,7 +129,7 @@ bool WallpaperDialog::exec()
|
||||
}
|
||||
|
||||
for (uint i=0; i<wallpapers.size(); i++)
|
||||
if (i<wallpapers.size()-fl.files.size())
|
||||
if (i<wallpapers.size()-fl.getFiles().size())
|
||||
gmenu2x->sc.del("skins/"+gmenu2x->confStr["skin"]+"/wallpapers/"+wallpapers[i]);
|
||||
else
|
||||
gmenu2x->sc.del("skins/Default/wallpapers/"+wallpapers[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user