1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-25 20:51: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. *
***************************************************************************/
#include "menusetting.h"
#include "asfont.h"
#include "gmenu2x.h"
MenuSetting::MenuSetting(GMenu2X *gmenu2x, const string &name,
const string &description)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
#include "imagedialog.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)
: MenuSettingFile(gmenu2x, name, description, value, filter)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,17 +20,16 @@
#ifndef MENUSETTINGRGBA_H
#define MENUSETTINGRGBA_H
#include "gmenu2x.h"
#include "menusetting.h"
#include "utilities.h"
#include "surface.h"
using std::string;
class GMenu2X;
class MenuSettingRGBA : public MenuSetting {
private:
unsigned short selPart;
int y;
string strR, strG, strB, strA;
std::string strR, strG, strB, strA;
RGBAColor originalValue;
RGBAColor *_value;
@ -40,7 +39,9 @@ private:
void rightComponent();
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 void draw(int y);

View File

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

View File

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

View File

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

View File

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