Date:2014-01-16 16:07:06 (6 months 8 days ago)
Author:Paul Cercueil
Commit:ad30fae321339f908e9074be2f021469730ffc4c
Message:Remove "scan for applications and games" feature

It's been broken for a long time now.
Files: src/contextmenu.cpp (1 diff)
src/gmenu2x.cpp (1 diff)
src/gmenu2x.h (2 diffs)

Change Details

src/contextmenu.cpp
7474    options.push_back(std::make_shared<MenuOption>(
7575            tr["Delete section"],
7676            std::bind(&GMenu2X::deleteSection, &gmenu2x)));
77    options.push_back(std::make_shared<MenuOption>(
78            tr["Scan for applications and games"],
79            std::bind(&GMenu2X::scanner, &gmenu2x)));
8077
8178    // Compute bounding box.
8279    int w = 0;
src/gmenu2x.cpp
10361036    }
10371037}
10381038
1039void GMenu2X::scanner() {
1040    Surface scanbg(bg);
1041    drawButton(&scanbg, "cancel", tr["Exit"],
1042    drawButton(&scanbg, "accept", "", 5)-10);
1043    scanbg.write(font,tr["Link Scanner"],halfX,7,Font::HAlignCenter,Font::VAlignMiddle);
1044    scanbg.convertToDisplayFormat();
1045
1046    uint lineY = 42;
1047
1048#ifdef PLATFORM_PANDORA
1049    //char *configpath = pnd_conf_query_searchpath();
1050#else
1051#ifdef ENABLE_CPUFREQ
1052    setSafeMaxClock();
1053#endif
1054
1055    scanbg.write(font,tr["Scanning filesystem..."],5,lineY);
1056    scanbg.blit(s,0,0);
1057    s->flip();
1058    lineY += 26;
1059
1060    vector<string> files;
1061    scanPath(CARD_ROOT, &files);
1062
1063    stringstream ss;
1064    ss << files.size();
1065    string str = "";
1066    ss >> str;
1067    scanbg.write(font,tr.translate("$1 files found.",str.c_str(),NULL),5,lineY);
1068    lineY += 26;
1069    scanbg.write(font,tr["Creating links..."],5,lineY);
1070    scanbg.blit(s,0,0);
1071    s->flip();
1072    lineY += 26;
1073
1074    string path, file;
1075    string::size_type pos;
1076    uint linkCount = 0;
1077
1078    for (uint i = 0; i<files.size(); i++) {
1079        pos = files[i].rfind("/");
1080        if (pos!=string::npos && pos>0) {
1081            path = files[i].substr(0, pos+1);
1082            file = files[i].substr(pos+1, files[i].length());
1083            if (menu->addLink(path,file,"found "+file.substr(file.length()-3,3)))
1084                linkCount++;
1085        }
1086    }
1087
1088    ss.clear();
1089    ss << linkCount;
1090    ss >> str;
1091    scanbg.write(font,tr.translate("$1 links created.",str.c_str(),NULL),5,lineY);
1092    scanbg.blit(s,0,0);
1093    s->flip();
1094    lineY += 26;
1095
1096#ifdef ENABLE_CPUFREQ
1097    setMenuClock();
1098#endif
1099#endif
1100
1101    InputManager::Button button;
1102    do {
1103        button = input.waitForPressedButton();
1104    } while ((button != InputManager::SETTINGS)
1105                && (button != InputManager::ACCEPT)
1106                && (button != InputManager::CANCEL));
1107}
1108
1109void GMenu2X::scanPath(string path, vector<string> *files) {
1110    DIR *dirp;
1111    struct stat st;
1112    struct dirent *dptr;
1113    string filepath, ext;
1114
1115    if (path[path.length()-1]!='/') path += "/";
1116    if ((dirp = opendir(path.c_str())) == NULL) return;
1117
1118    while ((dptr = readdir(dirp))) {
1119        if (dptr->d_name[0]=='.')
1120            continue;
1121        filepath = path+dptr->d_name;
1122        int statRet = stat(filepath.c_str(), &st);
1123        if (S_ISDIR(st.st_mode))
1124            scanPath(filepath, files);
1125        if (statRet != -1) {
1126            ext = filepath.substr(filepath.length()-4,4);
1127#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0) || defined(PLATFORM_NANONOTE)
1128            if (ext==".dge")
1129#else
1130            if (ext==".pxml")
1131#endif
1132                files->push_back(filepath);
1133        }
1134    }
1135
1136    closedir(dirp);
1137}
1138
11391039typedef struct {
11401040    unsigned short batt;
11411041    unsigned short remocon;
src/gmenu2x.h
100100    void initCPULimits();
101101#endif
102102    void browsePath(const std::string &path, std::vector<std::string>* directories, std::vector<std::string>* files);
103    /*!
104    Performs the actual scan in the given path and populates the files vector with the results. The creation of the links is not performed here.
105    @see scanner
106    */
107    void scanPath(std::string path, std::vector<std::string> *files);
108103
109104    /*!
110105    Displays a selector and launches the specified executable file
...... 
171166
172167    //Status functions
173168    void main();
174    /**
175     * Starts the scanning of the nand and sd filesystems, searching for dge
176     * and gpu files and creating the links in 2 dedicated sections.
177     */
178    void scanner();
179169    void showContextMenu();
180170    void showHelpPopup();
181171    void showManual();

Archive Download the corresponding diff file



interactive