1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-29 14:31:38 +02:00

Minimize namespace pollution in MenuSetting class hierarchy.

This should be done for all source files, but it is too much to do all at once.
This commit is contained in:
Maarten ter Huurne 2010-07-28 02:36:46 +02:00
parent 961e030670
commit d082f7f280
20 changed files with 97 additions and 86 deletions

View File

@ -18,6 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "menusetting.h" #include "menusetting.h"
#include "asfont.h"
#include "gmenu2x.h"
MenuSetting::MenuSetting(GMenu2X *gmenu2x, const string &name, MenuSetting::MenuSetting(GMenu2X *gmenu2x, const string &name,
const string &description) const string &description)

View File

@ -20,14 +20,9 @@
#ifndef MENUSETTING_H #ifndef MENUSETTING_H
#define MENUSETTING_H #define MENUSETTING_H
#ifdef TARGET_GP2X
#include "inputmanager.h"
#endif
#include "gmenu2x.h"
#include "buttonbox.h" #include "buttonbox.h"
using std::string; #include <string>
/** /**
Base class for different kind of option Base class for different kind of option
@ -40,10 +35,12 @@ protected:
ButtonBox buttonBox; ButtonBox buttonBox;
string name, description; std::string name, description;
public: public:
MenuSetting(GMenu2X *gmenu2x, const string &name, const string &description); MenuSetting(
GMenu2X *gmenu2x, const std::string &name,
const std::string &description);
virtual ~MenuSetting(); virtual ~MenuSetting();
virtual void draw(int y); virtual void draw(int y);
@ -54,7 +51,7 @@ public:
virtual void drawSelected(int y); virtual void drawSelected(int y);
virtual bool edited() = 0; virtual bool edited() = 0;
const string &getDescription() { return description; } const std::string &getDescription() { return description; }
}; };
#endif #endif

View File

@ -18,13 +18,17 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "menusettingbool.h" #include "menusettingbool.h"
#include "gmenu2x.h"
#include "utilities.h" #include "utilities.h"
#include <sstream> #include <sstream>
using namespace std; using std::string;
using namespace fastdelegate; using fastdelegate::MakeDelegate;
MenuSettingBool::MenuSettingBool(GMenu2X *gmenu2x, const string &name, const string &description, int *value) MenuSettingBool::MenuSettingBool(
GMenu2X *gmenu2x, const string &name,
const string &description, int *value)
: MenuSetting(gmenu2x, name, description) : MenuSetting(gmenu2x, name, description)
{ {
_ivalue = value; _ivalue = value;
@ -34,7 +38,9 @@ MenuSettingBool::MenuSettingBool(GMenu2X *gmenu2x, const string &name, const str
initButton(); initButton();
} }
MenuSettingBool::MenuSettingBool(GMenu2X *gmenu2x, const string &name, const string &description, bool *value) MenuSettingBool::MenuSettingBool(
GMenu2X *gmenu2x, const string &name,
const string &description, bool *value)
: MenuSetting(gmenu2x, name, description) : MenuSetting(gmenu2x, name, description)
{ {
_value = value; _value = value;

View File

@ -20,10 +20,8 @@
#ifndef MENUSETTINGBOOL_H #ifndef MENUSETTINGBOOL_H
#define MENUSETTINGBOOL_H #define MENUSETTINGBOOL_H
#include "iconbutton.h"
#include "menusetting.h" #include "menusetting.h"
using std::string;
class GMenu2X; class GMenu2X;
class MenuSettingBool : public MenuSetting { class MenuSettingBool : public MenuSetting {
@ -34,12 +32,16 @@ private:
bool originalValue; bool originalValue;
bool *_value; bool *_value;
int *_ivalue; int *_ivalue;
string strvalue; std::string strvalue;
public: public:
MenuSettingBool(GMenu2X *gmenu2x, const string &name, const string &description, bool *value); MenuSettingBool(
MenuSettingBool(GMenu2X *gmenu2x, const string &name, const string &description, int *value); GMenu2X *gmenu2x, const std::string &name,
virtual ~MenuSettingBool() {}; const std::string &description, bool *value);
MenuSettingBool(
GMenu2X *gmenu2x, const std::string &name,
const std::string &description, int *value);
virtual ~MenuSettingBool() {}
virtual void draw(int y); virtual void draw(int y);
virtual void manageInput(); virtual void manageInput();

View File

@ -18,10 +18,11 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "menusettingdir.h" #include "menusettingdir.h"
#include "iconbutton.h"
#include "dirdialog.h" #include "dirdialog.h"
using namespace std; using std::string;
using namespace fastdelegate; using fastdelegate::MakeDelegate;
MenuSettingDir::MenuSettingDir( MenuSettingDir::MenuSettingDir(
GMenu2X *gmenu2x, const string &name, GMenu2X *gmenu2x, const string &name,

View File

@ -22,16 +22,14 @@
#include "menusettingstringbase.h" #include "menusettingstringbase.h"
using std::string;
class MenuSettingDir : public MenuSettingStringBase { class MenuSettingDir : public MenuSettingStringBase {
protected: protected:
virtual void edit(); virtual void edit();
public: public:
MenuSettingDir( MenuSettingDir(
GMenu2X *gmenu2x, const string &name, GMenu2X *gmenu2x, const std::string &name,
const string &description, string *value); const std::string &description, std::string *value);
virtual ~MenuSettingDir() {} virtual ~MenuSettingDir() {}
}; };

View File

@ -18,10 +18,11 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "menusettingfile.h" #include "menusettingfile.h"
#include "iconbutton.h"
#include "filedialog.h" #include "filedialog.h"
using namespace std; using std::string;
using namespace fastdelegate; using fastdelegate::MakeDelegate;
MenuSettingFile::MenuSettingFile( MenuSettingFile::MenuSettingFile(
GMenu2X *gmenu2x, const string &name, GMenu2X *gmenu2x, const string &name,

View File

@ -22,19 +22,17 @@
#include "menusettingstringbase.h" #include "menusettingstringbase.h"
using std::string;
class MenuSettingFile : public MenuSettingStringBase { class MenuSettingFile : public MenuSettingStringBase {
protected: protected:
virtual void edit(); virtual void edit();
string filter; std::string filter;
public: public:
MenuSettingFile( MenuSettingFile(
GMenu2X *gmenu2x, const string &name, GMenu2X *gmenu2x, const std::string &name,
const string &description, string *value, const std::string &description, std::string *value,
const string &filter = ""); const std::string &filter = "");
virtual ~MenuSettingFile() {} virtual ~MenuSettingFile() {}
}; };

View File

@ -21,7 +21,7 @@
#include "imagedialog.h" #include "imagedialog.h"
#include "utilities.h" #include "utilities.h"
using namespace std; using std::string;
MenuSettingImage::MenuSettingImage(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &filter) MenuSettingImage::MenuSettingImage(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &filter)
: MenuSettingFile(gmenu2x, name, description, value, filter) : MenuSettingFile(gmenu2x, name, description, value, filter)

View File

@ -22,19 +22,17 @@
#include "menusettingfile.h" #include "menusettingfile.h"
using std::string;
class MenuSettingImage : public MenuSettingFile { class MenuSettingImage : public MenuSettingFile {
protected: protected:
virtual void edit(); virtual void edit();
public: public:
MenuSettingImage(GMenu2X *gmenu2x, const string &name, MenuSettingImage(GMenu2X *gmenu2x, const std::string &name,
const string &description, string *value, const std::string &description, std::string *value,
const string &filter = ""); const std::string &filter = "");
virtual ~MenuSettingImage() {} virtual ~MenuSettingImage() {}
virtual void setValue(const string &value); virtual void setValue(const std::string &value);
}; };
#endif #endif

View File

@ -18,11 +18,14 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "menusettingint.h" #include "menusettingint.h"
#include "gmenu2x.h"
#include "utilities.h" #include "utilities.h"
#include <sstream> #include <sstream>
using namespace std; using std::string;
using namespace fastdelegate; using std::stringstream;
using fastdelegate::MakeDelegate;
MenuSettingInt::MenuSettingInt(GMenu2X *gmenu2x, const string &name, const string &description, int *value, int min, int max) MenuSettingInt::MenuSettingInt(GMenu2X *gmenu2x, const string &name, const string &description, int *value, int min, int max)
: MenuSetting(gmenu2x,name,description) : MenuSetting(gmenu2x,name,description)

View File

@ -20,26 +20,23 @@
#ifndef MENUSETTINGINT_H #ifndef MENUSETTINGINT_H
#define MENUSETTINGINT_H #define MENUSETTINGINT_H
#include "iconbutton.h"
#include "menusetting.h" #include "menusetting.h"
#include "FastDelegate.h"
using std::string;
class GMenu2X;
class MenuSettingInt : public MenuSetting { class MenuSettingInt : public MenuSetting {
private: private:
int originalValue; int originalValue;
int *_value; int *_value;
string strvalue; std::string strvalue;
int min, max; int min, max;
void inc(); void inc();
void dec(); void dec();
public: public:
MenuSettingInt(GMenu2X *gmenu2x, const string &name, const string &description, int *value, int min, int max); MenuSettingInt(
virtual ~MenuSettingInt() {}; GMenu2X *gmenu2x, const std::string &name,
const std::string &description, int *value, int min, int max);
virtual ~MenuSettingInt() {}
virtual void manageInput(); virtual void manageInput();
virtual void adjustInput(); virtual void adjustInput();

View File

@ -18,9 +18,13 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "menusettingmultistring.h" #include "menusettingmultistring.h"
#include "gmenu2x.h"
#include "iconbutton.h"
#include "FastDelegate.h"
using namespace std; using std::string;
using namespace fastdelegate; using std::vector;
using fastdelegate::MakeDelegate;
MenuSettingMultiString::MenuSettingMultiString( MenuSettingMultiString::MenuSettingMultiString(
GMenu2X *gmenu2x, const string &name, GMenu2X *gmenu2x, const string &name,

View File

@ -22,7 +22,7 @@
#include "menusettingstringbase.h" #include "menusettingstringbase.h"
using std::string; #include <vector>
class MenuSettingMultiString : public MenuSettingStringBase { class MenuSettingMultiString : public MenuSettingStringBase {
private: private:
@ -30,8 +30,8 @@ private:
/* never called because manageInput() is overridden */ /* never called because manageInput() is overridden */
} }
const vector<string> *choices; const std::vector<std::string> *choices;
uint selected; int selected;
void incSel(); void incSel();
void decSel(); void decSel();
@ -39,9 +39,9 @@ private:
public: public:
MenuSettingMultiString( MenuSettingMultiString(
GMenu2X *gmenu2x, const string &name, GMenu2X *gmenu2x, const std::string &name,
const string &description, string *value, const std::string &description, std::string *value,
const vector<string> *choices); const std::vector<std::string> *choices);
virtual ~MenuSettingMultiString() {}; virtual ~MenuSettingMultiString() {};
virtual void manageInput(); virtual void manageInput();

View File

@ -18,13 +18,19 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "menusettingrgba.h" #include "menusettingrgba.h"
#include "gmenu2x.h"
#include <sstream> #include <sstream>
using namespace std; using std::string;
using namespace fastdelegate; using std::stringstream;
using fastdelegate::MakeDelegate;
MenuSettingRGBA::MenuSettingRGBA(GMenu2X *gmenu2x, const string &name, const string &description, RGBAColor *value) MenuSettingRGBA::MenuSettingRGBA(
: MenuSetting(gmenu2x,name,description) { GMenu2X *gmenu2x, const string &name,
const string &description, RGBAColor *value)
: MenuSetting(gmenu2x,name,description)
{
IconButton *btn; IconButton *btn;
selPart = 0; selPart = 0;

View File

@ -20,17 +20,16 @@
#ifndef MENUSETTINGRGBA_H #ifndef MENUSETTINGRGBA_H
#define MENUSETTINGRGBA_H #define MENUSETTINGRGBA_H
#include "gmenu2x.h"
#include "menusetting.h" #include "menusetting.h"
#include "utilities.h" #include "surface.h"
using std::string; class GMenu2X;
class MenuSettingRGBA : public MenuSetting { class MenuSettingRGBA : public MenuSetting {
private: private:
unsigned short selPart; unsigned short selPart;
int y; int y;
string strR, strG, strB, strA; std::string strR, strG, strB, strA;
RGBAColor originalValue; RGBAColor originalValue;
RGBAColor *_value; RGBAColor *_value;
@ -40,7 +39,9 @@ private:
void rightComponent(); void rightComponent();
public: public:
MenuSettingRGBA(GMenu2X *gmenu2x, const string &name, const string &description, RGBAColor *value); MenuSettingRGBA(
GMenu2X *gmenu2x, const std::string &name,
const std::string &description, RGBAColor *value);
virtual ~MenuSettingRGBA() {}; virtual ~MenuSettingRGBA() {};
virtual void draw(int y); virtual void draw(int y);

View File

@ -18,10 +18,11 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "menusettingstring.h" #include "menusettingstring.h"
#include "iconbutton.h"
#include "inputdialog.h" #include "inputdialog.h"
using namespace std; using std::string;
using namespace fastdelegate; using fastdelegate::MakeDelegate;
MenuSettingString::MenuSettingString( MenuSettingString::MenuSettingString(
GMenu2X *gmenu2x, const string &name, GMenu2X *gmenu2x, const string &name,

View File

@ -22,19 +22,17 @@
#include "menusettingstringbase.h" #include "menusettingstringbase.h"
using std::string;
class MenuSettingString : public MenuSettingStringBase { class MenuSettingString : public MenuSettingStringBase {
protected: protected:
virtual void edit(); virtual void edit();
string diagTitle, diagIcon; std::string diagTitle, diagIcon;
public: public:
MenuSettingString(GMenu2X *gmenu2x, const string &name, MenuSettingString(GMenu2X *gmenu2x, const std::string &name,
const string &description, string *value, const std::string &description, std::string *value,
const string &diagTitle = "", const std::string &diagTitle = "",
const string &diagIcon = ""); const std::string &diagIcon = "");
virtual ~MenuSettingString() {} virtual ~MenuSettingString() {}
}; };

View File

@ -18,9 +18,9 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "menusettingstringbase.h" #include "menusettingstringbase.h"
#include "gmenu2x.h"
using namespace std; using std::string;
using namespace fastdelegate;
MenuSettingStringBase::MenuSettingStringBase( MenuSettingStringBase::MenuSettingStringBase(
GMenu2X *gmenu2x, const string &name, GMenu2X *gmenu2x, const string &name,

View File

@ -22,28 +22,26 @@
#include "menusetting.h" #include "menusetting.h"
using std::string;
class MenuSettingStringBase : public MenuSetting { class MenuSettingStringBase : public MenuSetting {
protected: protected:
string originalValue; std::string originalValue;
string *_value; std::string *_value;
virtual void edit() = 0; virtual void edit() = 0;
void clear(); void clear();
public: public:
MenuSettingStringBase( MenuSettingStringBase(
GMenu2X *gmenu2x, const string &name, GMenu2X *gmenu2x, const std::string &name,
const string &description, string *value); const std::string &description, std::string *value);
virtual ~MenuSettingStringBase(); virtual ~MenuSettingStringBase();
virtual void draw(int y); virtual void draw(int y);
virtual void manageInput(); virtual void manageInput();
virtual bool edited(); virtual bool edited();
void setValue(const string &value) { *_value = value; } void setValue(const std::string &value) { *_value = value; }
const string &value() { return *_value; } const std::string &value() { return *_value; }
}; };
#endif #endif