mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 19:03:44 +02:00
The FileLister won't list a file if a previous one has the same file name (without path).
This is useful when the files/directories lists are not cleared; then it is possible to define priorities between the files. For instance, the skin "Default" will be shown only once, even if the directory "Default" exists both in the system and the user directories. As the skin and translation loading functions does check both directories, there is no problem in doing that.
This commit is contained in:
parent
f10bb60717
commit
6c97139113
@ -88,8 +88,8 @@ void FileLister::browse(bool clean)
|
|||||||
|
|
||||||
while ((dptr = readdir(dirp))) {
|
while ((dptr = readdir(dirp))) {
|
||||||
file = dptr->d_name;
|
file = dptr->d_name;
|
||||||
file_lowercase = file;
|
file_lowercase = file;
|
||||||
std::transform(file_lowercase.begin(), file_lowercase.end(), file_lowercase.begin(), ::tolower);
|
std::transform(file_lowercase.begin(), file_lowercase.end(), file_lowercase.begin(), ::tolower);
|
||||||
|
|
||||||
if (file[0] == '.' && file != "..")
|
if (file[0] == '.' && file != "..")
|
||||||
continue;
|
continue;
|
||||||
@ -106,10 +106,18 @@ void FileLister::browse(bool clean)
|
|||||||
if (S_ISDIR(st.st_mode)) {
|
if (S_ISDIR(st.st_mode)) {
|
||||||
if (!showDirectories)
|
if (!showDirectories)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (std::find(directories.begin(), directories.end(), file) != directories.end())
|
||||||
|
continue;
|
||||||
|
|
||||||
directories.push_back(file);
|
directories.push_back(file);
|
||||||
} else {
|
} else {
|
||||||
if (!showFiles)
|
if (!showFiles)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (std::find(files.begin(), files.end(), file) != files.end())
|
||||||
|
continue;
|
||||||
|
|
||||||
for (vector<string>::iterator it = vfilter.begin(); it != vfilter.end(); ++it) {
|
for (vector<string>::iterator it = vfilter.begin(); it != vfilter.end(); ++it) {
|
||||||
if (it->length() <= file.length()) {
|
if (it->length() <= file.length()) {
|
||||||
if (file_lowercase.compare(file.length() - it->length(), it->length(), *it) == 0) {
|
if (file_lowercase.compare(file.length() - it->length(), it->length(), *it) == 0) {
|
||||||
|
@ -1128,9 +1128,9 @@ void GMenu2X::options() {
|
|||||||
int prevbacklight = confInt["backlight"];
|
int prevbacklight = confInt["backlight"];
|
||||||
bool showRootFolder = fileExists(CARD_ROOT);
|
bool showRootFolder = fileExists(CARD_ROOT);
|
||||||
|
|
||||||
FileLister fl_tr(GMENU2X_SYSTEM_DIR "/translations");
|
FileLister fl_tr(getHome() + "/translations");
|
||||||
fl_tr.browse();
|
fl_tr.browse();
|
||||||
fl_tr.setPath(getHome() + "/translations", false);
|
fl_tr.setPath(GMENU2X_SYSTEM_DIR "/translations", false);
|
||||||
fl_tr.browse(false);
|
fl_tr.browse(false);
|
||||||
|
|
||||||
fl_tr.insertFile("English");
|
fl_tr.insertFile("English");
|
||||||
@ -1197,10 +1197,10 @@ void GMenu2X::settingsOpen2x() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GMenu2X::skinMenu() {
|
void GMenu2X::skinMenu() {
|
||||||
FileLister fl_sk(GMENU2X_SYSTEM_DIR "/skins", true, false);
|
FileLister fl_sk(getHome() + "/skins", true, false);
|
||||||
fl_sk.addExclude("..");
|
fl_sk.addExclude("..");
|
||||||
fl_sk.browse();
|
fl_sk.browse();
|
||||||
fl_sk.setPath(getHome() + "/skins", false);
|
fl_sk.setPath(GMENU2X_SYSTEM_DIR "/skins", false);
|
||||||
fl_sk.browse(false);
|
fl_sk.browse(false);
|
||||||
|
|
||||||
string curSkin = confStr["skin"];
|
string curSkin = confStr["skin"];
|
||||||
|
@ -38,12 +38,12 @@ bool WallpaperDialog::exec()
|
|||||||
FileLister fl;
|
FileLister fl;
|
||||||
fl.setFilter(".png,.jpg,.jpeg,.bmp");
|
fl.setFilter(".png,.jpg,.jpeg,.bmp");
|
||||||
|
|
||||||
string filepath = GMENU2X_SYSTEM_DIR "/skins/"
|
string filepath = GMenu2X::getHome() + "/skins/"
|
||||||
+ gmenu2x->confStr["skin"] + "/wallpapers";
|
+ gmenu2x->confStr["skin"] + "/wallpapers";
|
||||||
if (fileExists(filepath))
|
if (fileExists(filepath))
|
||||||
fl.setPath(filepath, true);
|
fl.setPath(filepath, true);
|
||||||
|
|
||||||
filepath = GMenu2X::getHome() + "/skins/"
|
filepath = GMENU2X_SYSTEM_DIR "/skins/"
|
||||||
+ gmenu2x->confStr["skin"] + "/wallpapers";
|
+ gmenu2x->confStr["skin"] + "/wallpapers";
|
||||||
if (fileExists(filepath)) {
|
if (fileExists(filepath)) {
|
||||||
fl.setPath(filepath, false);
|
fl.setPath(filepath, false);
|
||||||
@ -51,13 +51,13 @@ bool WallpaperDialog::exec()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gmenu2x->confStr["skin"] != "Default") {
|
if (gmenu2x->confStr["skin"] != "Default") {
|
||||||
filepath = GMENU2X_SYSTEM_DIR "/skins/Default/wallpapers";
|
filepath = GMenu2X::getHome() + "/skins/Default/wallpapers";
|
||||||
if (fileExists(filepath)) {
|
if (fileExists(filepath)) {
|
||||||
fl.setPath(filepath, false);
|
fl.setPath(filepath, false);
|
||||||
fl.browse(false);
|
fl.browse(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
filepath = GMenu2X::getHome() + "/skins/Default/wallpapers";
|
filepath = GMENU2X_SYSTEM_DIR "/skins/Default/wallpapers";
|
||||||
if (fileExists(filepath)) {
|
if (fileExists(filepath)) {
|
||||||
fl.setPath(filepath, false);
|
fl.setPath(filepath, false);
|
||||||
fl.browse(false);
|
fl.browse(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user