Date:2011-10-23 16:43:56 (12 years 5 months ago)
Author:Maarten ter Huurne
Commit:a01d892eb6df439d463c405750d3cce4c4d4b9ad
Message:More header cleanups.

This time the focus was on removing namespace imports from headers.
Files: src/browsedialog.cpp (1 diff)
src/button.h (3 diffs)
src/filedialog.h (2 diffs)
src/filelister.cpp (3 diffs)
src/filelister.h (2 diffs)
src/gmenu2x.cpp (3 diffs)
src/gmenu2x.h (12 diffs)
src/imagedialog.h (1 diff)
src/link.h (3 diffs)
src/linkaction.cpp (2 diffs)
src/linkaction.h (3 diffs)
src/linkapp.h (2 diffs)
src/menu.cpp (5 diffs)
src/menu.h (5 diffs)
src/menusetting.cpp (2 diffs)
src/selector.cpp (1 diff)
src/selector.h (2 diffs)
src/surface.cpp (2 diffs)
src/surface.h (4 diffs)
src/translator.cpp (2 diffs)
src/translator.h (3 diffs)
src/utilities.h (1 diff)

Change Details

src/browsedialog.cpp
77#include <string>
88
99using namespace fastdelegate;
10using std::string;
1011
1112BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title,
1213        const string &subtitle)
src/button.h
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
2020
21#ifndef BUTTON_H_
22#define BUTTON_H_
21#ifndef BUTTON_H
22#define BUTTON_H
2323
24#include <string>
25#include <SDL.h>
2624#include "FastDelegate.h"
2725
28using std::string;
29using fastdelegate::FastDelegate0;
26#include <SDL.h>
3027
31typedef FastDelegate0<> ButtonAction;
28typedef fastdelegate::FastDelegate0<> ButtonAction;
3229class Touchscreen;
3330
3431class Button {
...... 
6158    void setAction(ButtonAction action);
6259};
6360
64#endif /*BUTTON_H_*/
61#endif // BUTTON_H
src/filedialog.h
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
2020
21#ifndef FILEDIALOG_H_
22#define FILEDIALOG_H_
23
24#include <string>
21#ifndef FILEDIALOG_H
22#define FILEDIALOG_H
2523
2624#include "browsedialog.h"
2725
26#include <string>
2827
2928class FileDialog : public BrowseDialog {
3029public:
31    FileDialog(GMenu2X *gmenu2x, const string &text, const string &filter="",
32        const string &file="", const string &title = "File Dialog");
30    FileDialog(GMenu2X *gmenu2x, const std::string &text,
31            const std::string &filter="", const std::string &file="",
32            const std::string &title = "File Dialog");
3333    virtual ~FileDialog();
3434    bool exec();
3535};
3636
37#endif /*INPUTDIALOG_H_*/
37#endif // FILEDIALOG_H
src/filelister.cpp
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
2020
21#include "filelister.h"
22
23#include "debug.h"
24#include "utilities.h"
25
2126//for browsing the filesystem
2227#include <sys/stat.h>
2328#include <sys/types.h>
...... 
2732#include <algorithm>
2833#include <cstring>
2934
30#include "filelister.h"
31#include "utilities.h"
32#include "debug.h"
33
3435using namespace std;
3536
3637FileLister::FileLister(const string &startPath, bool showDirectories,
src/filelister.h
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
2020
21#ifndef FILELISTER_H_
22#define FILELISTER_H_
21#ifndef FILELISTER_H
22#define FILELISTER_H
2323
2424#include <string>
2525#include <vector>
2626
27using std::string;
28using std::vector;
29
3027class FileLister {
3128private:
32    string path, filter;
29    std::string path, filter;
3330    bool showDirectories, showFiles;
3431
35    vector<string> directories, files, excludes;
32    std::vector<std::string> directories, files, excludes;
3633
3734public:
38    FileLister(const string &startPath = "/boot/local", bool showDirectories = true, bool showFiles = true);
35    FileLister(const std::string &startPath = "/boot/local", bool showDirectories = true, bool showFiles = true);
3936    void browse(bool clean = true);
4037
4138    unsigned int size();
4239    unsigned int dirCount();
4340    unsigned int fileCount();
44    string operator[](unsigned int);
45    string at(unsigned int);
41    std::string operator[](unsigned int);
42    std::string at(unsigned int);
4643    bool isFile(unsigned int);
4744    bool isDirectory(unsigned int);
4845
49    const string &getPath();
50    void setPath(const string &path, bool doBrowse=true);
51    const string &getFilter();
52    void setFilter(const string &filter);
46    const std::string &getPath();
47    void setPath(const std::string &path, bool doBrowse=true);
48    const std::string &getFilter();
49    void setFilter(const std::string &filter);
5350
54    const vector<string> &getDirectories() { return directories; }
55    const vector<string> &getFiles() { return files; }
56    void insertFile(const string &file);
57    void addExclude(const string &exclude);
51    const std::vector<std::string> &getDirectories() { return directories; }
52    const std::vector<std::string> &getFiles() { return files; }
53    void insertFile(const std::string &file);
54    void addExclude(const std::string &exclude);
5855};
5956
60#endif /*FILELISTER_H_*/
57#endif // FILELISTER_H
src/gmenu2x.cpp
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
8686//#include <pnd_discovery.h>
8787#endif
8888
89using namespace std;
90using namespace fastdelegate;
91
8992#ifdef _CARD_ROOT
9093const char *CARD_ROOT = _CARD_ROOT;
9194#elif defined(PLATFORM_DINGUX)
...... 
98101static GMenu2X *app;
99102static string gmenu2x_home;
100103
101using namespace std;
102using namespace fastdelegate;
103
104104// Note: Keep this in sync with the enum!
105105static const char *colorNames[NUM_COLORS] = {
106106    "topBarBg",
src/gmenu2x.h
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
7373    NUM_COLORS,
7474};
7575
76using std::string;
77using std::vector;
78using fastdelegate::FastDelegate0;
79
80typedef FastDelegate0<> MenuAction;
81typedef unordered_map<string, string, hash<string> > ConfStrHash;
82typedef unordered_map<string, int, hash<string> > ConfIntHash;
76typedef fastdelegate::FastDelegate0<> MenuAction;
77typedef std::tr1::unordered_map<std::string, std::string, std::tr1::hash<std::string> > ConfStrHash;
78typedef std::tr1::unordered_map<std::string, int, std::tr1::hash<std::string> > ConfIntHash;
8379
8480typedef struct {
8581    unsigned short batt;
...... 
8783} MMSP2ADC;
8884
8985struct MenuOption {
90    string text;
86    std::string text;
9187    MenuAction action;
9288};
9389
...... 
9591
9692class GMenu2X {
9793private:
98    string path; //!< Contains the working directory of GMenu2X
94    std::string path; //!< Contains the working directory of GMenu2X
9995    /*!
10096    Retrieves the free disk space on the sd
10197    @return String containing a human readable representation of the free disk space
10298    */
103    string getDiskFree(const char *path);
99    std::string getDiskFree(const char *path);
104100    unsigned short cpuX; //!< Offset for displaying cpu clock information
105101    unsigned short volumeX; //!< Offset for displaying volume level
106102    unsigned short manualX; //!< Offset for displaying the manual indicator in the taskbar
...... 
116112    */
117113    unsigned short getBatteryLevel();
118114    FILE* batteryHandle, *backlightHandle, *usbHandle, *acHandle;
119    void browsePath(const string &path, vector<string>* directories, vector<string>* files);
115    void browsePath(const std::string &path, std::vector<std::string>* directories, std::vector<std::string>* files);
120116    /*!
121117    Starts the scanning of the nand and sd filesystems, searching for dge and gpu files and creating the links in 2 dedicated sections.
122118    */
...... 
125121    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.
126122    @see scanner
127123    */
128    void scanPath(string path, vector<string> *files);
124    void scanPath(std::string path, std::vector<std::string> *files);
129125
130126    /*!
131127    Displays a selector and launches the specified executable file
...... 
137133        samba,
138134        web;
139135
140    string ip, defaultgw, lastSelectorDir;
136    std::string ip, defaultgw, lastSelectorDir;
141137    int lastSelectorElement;
142138    void readConfig();
143    void readConfig(string path);
139    void readConfig(std::string path);
144140    void readTmp();
145141
146142    void initServices();
...... 
174170
175171    /* Returns the home directory of gmenu2x, usually
176172     * ~/.gmenu2x */
177    static const string getHome(void);
173    static const std::string getHome(void);
178174
179175    /*
180176     * Variables needed for elements disposition
...... 
188184    @see path
189185    @return String containing the parent directory
190186    */
191    const string &getExePath();
187    const std::string &getExePath();
192188
193189    InputManager input;
194190    Touchscreen ts;
...... 
200196
201197    //Configuration settings
202198    bool useSelectionPng;
203    void setSkin(const string &skin, bool setWallpaper = true);
199    void setSkin(const std::string &skin, bool setWallpaper = true);
204200
205201#ifdef PLATFORM_GP2X
206202    //firmware type and version
207    string fwType, fwVersion;
203    std::string fwType, fwVersion;
208204
209205    bool isF200() { return ts.initialized(); }
210206
211207    // Open2x settings ---------------------------------------------------------
212208    bool o2x_usb_net_on_boot, o2x_ftp_on_boot, o2x_telnet_on_boot, o2x_gp2xjoy_on_boot, o2x_usb_host_on_boot, o2x_usb_hid_on_boot, o2x_usb_storage_on_boot;
213    string o2x_usb_net_ip;
209    std::string o2x_usb_net_ip;
214210    int volumeMode, savedVolumeMode; // just use the const int scale values at top of source
215211#endif
216212
...... 
262258    void writeConfigOpen2x();
263259#endif
264260    void writeSkinConfig();
265    void writeTmp(int selelem=-1, const string &selectordir="");
261    void writeTmp(int selelem=-1, const std::string &selectordir="");
266262
267263    void ledOn();
268264    void ledOff();
...... 
276272
277273    void initBG();
278274    int drawButton(Button *btn, int x=5, int y=-10);
279    int drawButton(Surface *s, const string &btn, const string &text, int x=5, int y=-10);
280    int drawButtonRight(Surface *s, const string &btn, const string &text, int x=5, int y=-10);
275    int drawButton(Surface *s, const std::string &btn, const std::string &text, int x=5, int y=-10);
276    int drawButtonRight(Surface *s, const std::string &btn, const std::string &text, int x=5, int y=-10);
281277    void drawScrollBar(uint pagesize, uint totalsize, uint pagepos, uint top, uint height);
282278
283279    void drawTopBar(Surface *s=NULL);
284280    void drawBottomBar(Surface *s=NULL);
285281
286    Menu* menu;
282    Menu *menu;
287283};
288284
289#endif
285#endif // GMENU2X_H
src/imagedialog.h
3131    SurfaceCollection previews;
3232public:
3333    ImageDialog(GMenu2X *gmenu2x, const std::string &text,
34            const std::string &filter="", const string &file="");
34            const std::string &filter="", const std::string &file="");
3535    virtual ~ImageDialog();
3636
3737    virtual void beforeFileList();
src/link.h
2424#include "button.h"
2525
2626#include <string>
27#include <iostream>
2827
2928class Surface;
3029
31using std::string;
32
3330class GMenu2X;
3431
3532/**
...... 
4441protected:
4542    GMenu2X *gmenu2x;
4643    bool edited;
47    string title, description, icon, iconPath;
44    std::string title, description, icon, iconPath;
4845
4946    Surface *iconSurface;
5047    Surface *icon_hover;
...... 
6259    void setSize(int w, int h);
6360    void setPosition(int x, int y);
6461
65    const string &getTitle();
66    void setTitle(const string &title);
67    const string &getDescription();
68    void setDescription(const string &description);
69    const string &getIcon();
70    void setIcon(const string &icon);
71    virtual const string &searchIcon();
72    const string &getIconPath();
73    void setIconPath(const string &icon);
62    const std::string &getTitle();
63    void setTitle(const std::string &title);
64    const std::string &getDescription();
65    void setDescription(const std::string &description);
66    const std::string &getIcon();
67    void setIcon(const std::string &icon);
68    virtual const std::string &searchIcon();
69    const std::string &getIconPath();
70    void setIconPath(const std::string &icon);
7471
7572    virtual void run();
7673};
src/linkaction.cpp
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1717 * Free Software Foundation, Inc., *
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
20#include <fstream>
21#include <sstream>
22#include "linkaction.h"
2320
24using namespace std;
21#include "linkaction.h"
2522
2623LinkAction::LinkAction(GMenu2X *gmenu2x, LinkRunAction act)
2724    : Link(gmenu2x) {
src/linkaction.h
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1717 * Free Software Foundation, Inc., *
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
20
2021#ifndef LINKACTION_H
2122#define LINKACTION_H
2223
23#include <string>
24#include <iostream>
25
2624#include "FastDelegate.h"
2725#include "link.h"
2826
29using std::string;
30using fastdelegate::FastDelegate0;
31
32typedef FastDelegate0<> LinkRunAction;
27typedef fastdelegate::FastDelegate0<> LinkRunAction;
3328
3429class GMenu2X;
3530
...... 
4742    virtual void run();
4843};
4944
50#endif
45#endif // LINKACTION_H
src/linkapp.h
2424#include "link.h"
2525
2626#include <string>
27#include <iostream>
28
29using std::string;
3027
3128class GMenu2X;
3229class InputManager;
...... 
3936class LinkApp : public Link {
4037private:
4138    InputManager &inputMgr;
42    string sclock, svolume;
39    std::string sclock, svolume;
4340    int iclock, ivolume;
4441    //G
45    string sgamma;
42    std::string sgamma;
4643    //G
4744    int igamma;
48    string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens;
45    std::string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens;
4946    bool selectorbrowser, useRamTimings;
5047    void drawRun();
5148
52    string aliasfile;
53    string file;
49    std::string aliasfile;
50    std::string file;
5451
5552    bool wrapper;
5653    bool dontleave;
5754
5855public:
5956    LinkApp(GMenu2X *gmenu2x, InputManager &inputMgr, const char* linkfile);
60    virtual const string &searchIcon();
61
62    const string &getExec();
63    void setExec(const string &exec);
64    const string &getParams();
65    void setParams(const string &params);
66    const string &getWorkdir();
67    void setWorkdir(const string &workdir);
68    const string &getManual();
69    void setManual(const string &manual);
70    const string &getSelectorDir();
71    void setSelectorDir(const string &selectordir);
57    virtual const std::string &searchIcon();
58
59    const std::string &getExec();
60    void setExec(const std::string &exec);
61    const std::string &getParams();
62    void setParams(const std::string &params);
63    const std::string &getWorkdir();
64    void setWorkdir(const std::string &workdir);
65    const std::string &getManual();
66    void setManual(const std::string &manual);
67    const std::string &getSelectorDir();
68    void setSelectorDir(const std::string &selectordir);
7269    bool getSelectorBrowser();
7370    void setSelectorBrowser(bool value);
7471    bool getUseRamTimings();
7572    void setUseRamTimings(bool value);
76    const string &getSelectorScreens();
77    void setSelectorScreens(const string &selectorscreens);
78    const string &getSelectorFilter();
79    void setSelectorFilter(const string &selectorfilter);
80    const string &getAliasFile();
81    void setAliasFile(const string &aliasfile);
73    const std::string &getSelectorScreens();
74    void setSelectorScreens(const std::string &selectorscreens);
75    const std::string &getSelectorFilter();
76    void setSelectorFilter(const std::string &selectorfilter);
77    const std::string &getAliasFile();
78    void setAliasFile(const std::string &aliasfile);
8279
8380    int clock();
84    const string &clockStr(int maxClock);
81    const std::string &clockStr(int maxClock);
8582    void setClock(int mhz);
8683
8784    int volume();
88    const string &volumeStr();
85    const std::string &volumeStr();
8986    void setVolume(int vol);
9087
9188//G
9289    int gamma();
93    const string &gammaStr();
90    const std::string &gammaStr();
9491    void setGamma(int gamma);
9592
9693    bool save();
9794    void run();
9895    void showManual();
99    void selector(int startSelection=0, const string &selectorDir="");
100    void launch(const string &selectedFile="", const string &selectedDir="");
96    void selector(int startSelection=0, const std::string &selectorDir="");
97    void launch(const std::string &selectedFile="",
98            const std::string &selectedDir="");
10199    bool targetExists();
102100
103    const string &getFile() { return file; }
104    void renameFile(const string &name);
101    const std::string &getFile() { return file; }
102    void renameFile(const std::string &name);
105103    bool &needsWrapperRef() { return wrapper; }
106104    bool &runsInBackgroundRef() { return dontleave; }
107105};
src/menu.cpp
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
7474        if (statret != -1) {
7575            if (find(sections.begin(), sections.end(), (string)dptr->d_name) == sections.end()) {
7676                sections.push_back((string)dptr->d_name);
77                linklist ll;
77                vector<Link*> ll;
7878                links.push_back(ll);
7979            }
8080        }
...... 
114114   SECTION MANAGEMENT
115115  ====================================*/
116116void Menu::freeLinks() {
117    for (vector<linklist>::iterator section = links.begin(); section<links.end(); section++)
118        for (linklist::iterator link = section->begin(); link<section->end(); link++)
117    for (vector< vector<Link*> >::iterator section = links.begin(); section<links.end(); section++)
118        for (vector<Link*>::iterator link = section->begin(); link<section->end(); link++)
119119            delete *link;
120120}
121121
122linklist *Menu::sectionLinks(int i) {
122vector<Link*> *Menu::sectionLinks(int i) {
123123    if (i<0 || i>(int)links.size())
124124        i = selSectionIndex();
125125
...... 
305305    sectiondir = sectiondir + "/" + sectionName;
306306    if (mkdir(sectiondir.c_str(), 0755) == 0) {
307307        sections.push_back(sectionName);
308        linklist ll;
308        vector<Link*> ll;
309309        links.push_back(ll);
310310        return true;
311311    }
...... 
324324    sectionLinks()->erase( sectionLinks()->begin() + selLinkIndex() );
325325    setLinkIndex(selLinkIndex());
326326
327    for (vector<linklist>::iterator section = links.begin();
327    for (vector< vector<Link*> >::iterator section = links.begin();
328328                !icon_used && section<links.end(); section++)
329        for (linklist::iterator link = section->begin();
329        for (vector<Link*>::iterator link = section->begin();
330330                    !icon_used && link<section->end(); link++)
331331            icon_used = !iconpath.compare((*link)->getIconPath());
332332
src/menu.h
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1717 * Free Software Foundation, Inc., *
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
20
2021#ifndef MENU_H
2122#define MENU_H
2223
23#include <string>
24#include <vector>
2524#include "linkaction.h"
2625
27using std::string;
28using std::vector;
26#include <string>
27#include <vector>
2928
3029class LinkApp;
3130class GMenu2X;
3231
33typedef vector<Link*> linklist;
34
3532/**
3633Handles the menu structure
3734
...... 
4239    GMenu2X *gmenu2x;
4340    int iSection, iLink;
4441    uint iFirstDispSection, iFirstDispRow;
45    vector<string> sections;
46    vector<linklist> links;
42    std::vector<std::string> sections;
43    std::vector< std::vector<Link*> > links;
4744
4845    void readLinks();
4946    void freeLinks();
...... 
5855    Menu(GMenu2X *gmenu2x);
5956    ~Menu();
6057
61    linklist *sectionLinks(int i = -1);
58    std::vector<Link*> *sectionLinks(int i = -1);
6259
6360    int selSectionIndex();
64    const string &selSection();
61    const std::string &selSection();
6562    void decSectionIndex();
6663    void incSectionIndex();
6764    void setSectionIndex(int i);
6865    uint firstDispSection();
6966    uint firstDispRow();
7067
71    bool addActionLink(uint section, const string &title, LinkRunAction action, const string &description="", const string &icon="");
72    bool addLink(string path, string file, string section="");
73    bool addSection(const string &sectionName);
68    bool addActionLink(uint section, const std::string &title,
69            LinkRunAction action, const std::string &description="",
70            const std::string &icon="");
71    bool addLink(std::string path, std::string file, std::string section="");
72    bool addSection(const std::string &sectionName);
7473    void deleteSelectedLink();
7574    void deleteSelectedSection();
7675
...... 
8685    void linkDown();
8786    void setLinkIndex(int i);
8887
89    const vector<string> &getSections() { return sections; }
90    void renameSection(int index, const string &name);
88    const std::vector<std::string> &getSections() { return sections; }
89    void renameSection(int index, const std::string &name);
9190};
9291
93#endif
92#endif // MENU_H
src/menusetting.cpp
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1717 * Free Software Foundation, Inc., *
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
20
2021#include "menusetting.h"
22
2123#include "asfont.h"
2224#include "gmenu2x.h"
2325
26using std::string;
27
2428MenuSetting::MenuSetting(GMenu2X *gmenu2x, const string &name,
2529        const string &description)
2630    : gmenu2x(gmenu2x)
src/selector.cpp
3535#include "debug.h"
3636
3737using namespace std;
38using std::tr1::unordered_map;
3839
3940#define SELECTOR_ELEMENTS 11
4041
src/selector.h
2929class LinkApp;
3030class FileLister;
3131
32using std::string;
33using std::vector;
34
3532class Selector : protected Dialog {
3633private:
3734    int selRow;
...... 
4037    std::tr1::unordered_map<std::string, std::string> aliases;
4138
4239    void loadAliases();
43    string getAlias(const std::string &key);
40    std::string getAlias(const std::string &key);
4441    void prepare(FileLister *fl, std::vector<std::string> *screens,
4542            std::vector<std::string> *titles);
4643    void freeScreenshots(std::vector<std::string> *screens);
src/surface.cpp
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1919 ***************************************************************************/
2020
2121#include "surface.h"
22#include "imageio.h"
23#include "utilities.h"
22
2423#include "debug.h"
24#include "imageio.h"
2525#include "surfacecollection.h"
26#include "utilities.h"
2627
2728#include <SDL_gfxPrimitives.h>
2829
2930#include <iostream>
31
3032using namespace std;
3133
3234RGBAColor strtorgba(const string &strColor) {
src/surface.h
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1717 * Free Software Foundation, Inc., *
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
20
2021#ifndef SURFACE_H
2122#define SURFACE_H
2223
23#include <SDL.h>
24#include <string>
25
2624#include "asfont.h"
2725
28using std::string;
26#include <SDL.h>
27#include <string>
2928
3029struct RGBAColor {
3130    unsigned short r,g,b,a;
3231};
3332
34RGBAColor strtorgba(const string &strColor);
33RGBAColor strtorgba(const std::string &strColor);
3534
3635/**
3736    Wrapper around SDL_Surface
...... 
4140public:
4241    static Surface *openOutputSurface(int width, int height, int bitsperpixel);
4342    static Surface *emptySurface(int width, int height);
44    static Surface *loadImage(const string &img, const string &skin="");
43    static Surface *loadImage(const std::string &img,
44            const std::string &skin="");
4545
4646    Surface(Surface *s);
4747    ~Surface();
...... 
6666    bool blitCenter(Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
6767    bool blitRight(Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
6868
69    void write(ASFont *font, const string &text, int x, int y, ASFont::HAlign halign = ASFont::HAlignLeft, ASFont::VAlign valign = ASFont::VAlignTop) {
69    void write(ASFont *font, const std::string &text, int x, int y,
70            ASFont::HAlign halign = ASFont::HAlignLeft,
71            ASFont::VAlign valign = ASFont::VAlignTop) {
7072        font->write(this, text, x, y, halign, valign);
7173    }
7274
src/translator.cpp
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
2020
21#include "translator.h"
22
23#include "debug.h"
24#include "gmenu2x.h"
25
2126#include <fstream>
2227#include <iostream>
2328#include <sstream>
2429#include <stdarg.h>
2530
26#include "translator.h"
27#include "debug.h"
28#include "gmenu2x.h"
29
3031using namespace std;
32using std::tr1::unordered_map;
3133
3234Translator::Translator(const string &lang) {
3335    _lang = "";
src/translator.h
11/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
44 * *
55 * This program is free software; you can redistribute it and/or modify *
66 * it under the terms of the GNU General Public License as published by *
...... 
1717 * Free Software Foundation, Inc., *
1818 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
1919 ***************************************************************************/
20
2021#ifndef TRANSLATOR_H
2122#define TRANSLATOR_H
2223
23#include "utilities.h"
24#include <string>
25#include <tr1/unordered_map>
2426
2527/**
2628Hash Map of translation strings.
...... 
2931*/
3032class Translator {
3133private:
32    string _lang;
33    unordered_map<string, string> translations;
34    std::string _lang;
35    std::tr1::unordered_map<std::string, std::string> translations;
3436
3537public:
36    Translator(const string &lang="");
38    Translator(const std::string &lang="");
3739    ~Translator();
3840
39    string lang();
40    void setLang(const string &lang);
41    bool exists(const string &term);
42    string translate(const string &term,const char *replacestr=NULL,...);
43    string operator[](const string &term);
41    std::string lang();
42    void setLang(const std::string &lang);
43    bool exists(const std::string &term);
44    std::string translate(const std::string &term,
45            const char *replacestr = NULL, ...);
46    std::string operator[](const std::string &term);
4447};
4548
46#endif
49#endif // TRANSLATOR_H
src/utilities.h
2323
2424#include <string>
2525#include <vector>
26#include <tr1/unordered_map>
27
28using std::tr1::unordered_map;
29using std::tr1::hash;
30using std::string;
31using std::vector;
3226
3327class case_less {
3428public:
35    bool operator()(const string &left, const string &right) const;
29    bool operator()(const std::string &left, const std::string &right) const;
3630};
3731
38string trim(const string& s);
39string strreplace (string orig, const string &search, const string &replace);
40string cmdclean (string cmdline);
32std::string trim(const std::string& s);
33std::string strreplace (std::string orig, const std::string &search, const std::string &replace);
34std::string cmdclean (std::string cmdline);
4135
42char *string_copy(const string &);
43void string_copy(const string &, char **);
36char *string_copy(const std::string &);
37void string_copy(const std::string &, char **);
4438
45bool fileExists(const string &file);
46bool rmtree(string path);
39bool fileExists(const std::string &file);
40bool rmtree(std::string path);
4741
48int max (int a, int b);
49int min (int a, int b);
50int constrain (int x, int imin, int imax);
42int max(int a, int b);
43int min(int a, int b);
44int constrain(int x, int imin, int imax);
5145
52int evalIntConf (int val, int def, int imin, int imax);
53int evalIntConf (int *val, int def, int imin, int imax);
54const string &evalStrConf (const string &val, const string &def);
55const string &evalStrConf (string *val, const string &def);
46int evalIntConf(int val, int def, int imin, int imax);
47int evalIntConf(int *val, int def, int imin, int imax);
48const std::string &evalStrConf(const std::string &val, const std::string &def);
49const std::string &evalStrConf(std::string *val, const std::string &def);
5650
57bool split (vector<string> &vec, const string &str, const string &delim, bool destructive=true);
51bool split(std::vector<std::string> &vec, const std::string &str,
52        const std::string &delim, bool destructive=true);
5853
59int intTransition(int from, int to, long int tickStart, long duration=500, long tickNow=-1);
54int intTransition(int from, int to, long int tickStart, long duration=500,
55        long tickNow=-1);
6056
61#endif
57#endif // UTILITIES_H

Archive Download the corresponding diff file



interactive