1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-04 21:05:27 +03:00

Massive header cleanup.

The main goal is to avoid including "gmenu2x.h" from headers.
But I did various other cleanups as well while I was at it.
This commit is contained in:
Maarten ter Huurne 2011-10-23 16:13:02 +02:00
parent 33e7f1ef56
commit e0e7e87ebc
24 changed files with 203 additions and 171 deletions

View File

@ -1,11 +1,11 @@
#include <string>
#include "browsedialog.h" #include "browsedialog.h"
#include "FastDelegate.h" #include "FastDelegate.h"
#include "filelister.h" #include "filelister.h"
#include "gmenu2x.h" #include "gmenu2x.h"
#include <string>
using namespace fastdelegate; using namespace fastdelegate;
BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title, BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title,

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,26 +18,24 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef BROWSEDIALOG_H_ #ifndef BROWSEDIALOG_H
#define BROWSEDIALOG_H_ #define BROWSEDIALOG_H
#include <string>
#include "filelister.h"
#include "gmenu2x.h"
#include "buttonbox.h" #include "buttonbox.h"
#include "dialog.h" #include "dialog.h"
#include "filelister.h"
#include "inputmanager.h" #include "inputmanager.h"
class FileLister; #include <SDL.h>
#include <string>
using std::string;
class BrowseDialog : protected Dialog { class BrowseDialog : protected Dialog {
protected: protected:
BrowseDialog(GMenu2X *gmenu2x, const string &title, const string &subtitle); BrowseDialog(GMenu2X *gmenu2x, const std::string &title,
const std::string &subtitle);
virtual ~BrowseDialog(); virtual ~BrowseDialog();
void setPath(const string &path) { void setPath(const std::string &path) {
fl->setPath(path); fl->setPath(path);
} }
@ -59,8 +57,8 @@ private:
bool close, result; bool close, result;
string title; std::string title;
string subtitle; std::string subtitle;
SDL_Rect clipRect; SDL_Rect clipRect;
SDL_Rect touchRect; SDL_Rect touchRect;
@ -89,14 +87,12 @@ private:
public: public:
bool exec(); bool exec();
const std::string &getPath() const std::string &getPath() {
{
return fl->getPath(); return fl->getPath();
} }
std::string getFile() std::string getFile() {
{
return (*fl)[selected]; return (*fl)[selected];
} }
}; };
#endif /*INPUTDIALOG_H_*/ #endif // INPUTDIALOG_H

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -20,10 +20,12 @@
#include "dirdialog.h" #include "dirdialog.h"
#include "filelister.h"
using namespace std; using namespace std;
DirDialog::DirDialog(GMenu2X *gmenu2x, const string &text, const string &dir) : DirDialog::DirDialog(GMenu2X *gmenu2x, const string &text, const string &dir)
BrowseDialog(gmenu2x, "Directory Browser", text) : BrowseDialog(gmenu2x, "Directory Browser", text)
{ {
fl = new FileLister(dir, true, false); fl = new FileLister(dir, true, false);
} }

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,19 +18,18 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef DIRDIALOG_H_ #ifndef DIRDIALOG_H
#define DIRDIALOG_H_ #define DIRDIALOG_H
#include <string>
#include "gmenu2x.h"
#include "browsedialog.h" #include "browsedialog.h"
#include <string>
class DirDialog : public BrowseDialog { class DirDialog : public BrowseDialog {
public: public:
DirDialog(GMenu2X *gmenu2x, const string &text, const string &dir=""); DirDialog(GMenu2X *gmenu2x, const std::string &text,
const std::string &dir="");
~DirDialog(); ~DirDialog();
}; };
#endif /*INPUTDIALOG_H_*/ #endif // DIRDIALOG_H

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -19,6 +19,8 @@
***************************************************************************/ ***************************************************************************/
#include "filedialog.h" #include "filedialog.h"
#include "filelister.h"
#include "gmenu2x.h" #include "gmenu2x.h"
using namespace std; using namespace std;

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,6 +18,11 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "imagedialog.h"
#include "filelister.h"
#include "gmenu2x.h"
#include <SDL.h> #include <SDL.h>
#include <SDL_gfxPrimitives.h> #include <SDL_gfxPrimitives.h>
@ -26,9 +31,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include "imagedialog.h"
#include "filelister.h"
using namespace std; using namespace std;
ImageDialog::ImageDialog(GMenu2X *gmenu2x, const string &text, ImageDialog::ImageDialog(GMenu2X *gmenu2x, const string &text,

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,24 +18,24 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef IMAGEDIALOG_H_ #ifndef IMAGEDIALOG_H
#define IMAGEDIALOG_H_ #define IMAGEDIALOG_H
#include "filedialog.h"
#include "surfacecollection.h"
#include <string> #include <string>
#include "filedialog.h"
using std::string;
using std::vector;
class ImageDialog : public FileDialog { class ImageDialog : public FileDialog {
protected: protected:
SurfaceCollection previews; SurfaceCollection previews;
public: public:
ImageDialog(GMenu2X *gmenu2x, const string &text, const string &filter="", const string &file=""); ImageDialog(GMenu2X *gmenu2x, const std::string &text,
const std::string &filter="", const string &file="");
virtual ~ImageDialog(); virtual ~ImageDialog();
virtual void beforeFileList(); virtual void beforeFileList();
virtual void onChangeDir(); virtual void onChangeDir();
}; };
#endif /*IMAGEDIALOG_H_*/ #endif // IMAGEDIALOG_H

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -17,12 +17,16 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include <fstream>
#include <sstream>
#include "link.h" #include "link.h"
#include "gmenu2x.h"
#include "menu.h" #include "menu.h"
#include "selector.h" #include "selector.h"
#include <fstream>
#include <sstream>
using namespace std; using namespace std;
using namespace fastdelegate; using namespace fastdelegate;

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -17,14 +17,16 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef LINK_H #ifndef LINK_H
#define LINK_H #define LINK_H
#include "button.h"
#include <string> #include <string>
#include <iostream> #include <iostream>
#include "button.h" class Surface;
#include "surface.h"
using std::string; using std::string;

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -17,6 +17,15 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "linkapp.h"
#include "debug.h"
#include "gmenu2x.h"
#include "menu.h"
#include "selector.h"
#include "textmanualdialog.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -26,12 +35,6 @@
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include "linkapp.h"
#include "menu.h"
#include "selector.h"
#include "textmanualdialog.h"
#include "debug.h"
using namespace std; using namespace std;
LinkApp::LinkApp(GMenu2X *gmenu2x_, InputManager &inputMgr_, LinkApp::LinkApp(GMenu2X *gmenu2x_, InputManager &inputMgr_,

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -17,14 +17,15 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef LINKAPP_H #ifndef LINKAPP_H
#define LINKAPP_H #define LINKAPP_H
#include "link.h"
#include <string> #include <string>
#include <iostream> #include <iostream>
#include "link.h"
using std::string; using std::string;
class GMenu2X; class GMenu2X;

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -17,9 +17,12 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 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"
#include "gmenu2x.h"
#include "iconbutton.h"
using std::string; using std::string;
using fastdelegate::MakeDelegate; using fastdelegate::MakeDelegate;
@ -31,11 +34,13 @@ MenuSettingDir::MenuSettingDir(
{ {
IconButton *btn; IconButton *btn;
btn = new IconButton(gmenu2x, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Clear"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/cancel.png",
gmenu2x->tr["Clear"]);
btn->setAction(MakeDelegate(this, &MenuSettingDir::clear)); btn->setAction(MakeDelegate(this, &MenuSettingDir::clear));
buttonBox.add(btn); buttonBox.add(btn);
btn = new IconButton(gmenu2x, "skin:imgs/buttons/accept.png", gmenu2x->tr["Select a directory"]); btn = new IconButton(gmenu2x, "skin:imgs/buttons/accept.png",
gmenu2x->tr["Select a directory"]);
btn->setAction(MakeDelegate(this, &MenuSettingDir::edit)); btn->setAction(MakeDelegate(this, &MenuSettingDir::edit));
buttonBox.add(btn); buttonBox.add(btn);
} }
@ -43,5 +48,5 @@ MenuSettingDir::MenuSettingDir(
void MenuSettingDir::edit() void MenuSettingDir::edit()
{ {
DirDialog dd(gmenu2x, description, value()); DirDialog dd(gmenu2x, description, value());
if (dd.exec()) setValue( dd.getPath() ); if (dd.exec()) setValue(dd.getPath());
} }

View File

@ -17,9 +17,12 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 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"
#include "gmenu2x.h"
#include "iconbutton.h"
using std::string; using std::string;
using fastdelegate::MakeDelegate; using fastdelegate::MakeDelegate;

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -17,7 +17,10 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include "menusettingimage.h" #include "menusettingimage.h"
#include "gmenu2x.h"
#include "imagedialog.h" #include "imagedialog.h"
#include "utilities.h" #include "utilities.h"

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -36,6 +36,8 @@
using namespace std; using namespace std;
#define SELECTOR_ELEMENTS 11
Selector::Selector(GMenu2X *gmenu2x, LinkApp *link, const string &selectorDir) : Selector::Selector(GMenu2X *gmenu2x, LinkApp *link, const string &selectorDir) :
Dialog(gmenu2x) Dialog(gmenu2x)
{ {

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,15 +18,13 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef SELECTOR_H_ #ifndef SELECTOR_H
#define SELECTOR_H_ #define SELECTOR_H
#include <string>
#include "gmenu2x.h"
#include "utilities.h"
#include "dialog.h" #include "dialog.h"
#define SELECTOR_ELEMENTS 11 #include <string>
#include <tr1/unordered_map>
class LinkApp; class LinkApp;
class FileLister; class FileLister;
@ -38,21 +36,23 @@ class Selector : protected Dialog {
private: private:
int selRow; int selRow;
LinkApp *link; LinkApp *link;
string file, dir; std::string file, dir;
unordered_map<string, string> aliases; std::tr1::unordered_map<std::string, std::string> aliases;
void loadAliases(); void loadAliases();
string getAlias(const string &key); string getAlias(const std::string &key);
void prepare(FileLister *fl, vector<string> *screens, vector<string> *titles); void prepare(FileLister *fl, std::vector<std::string> *screens,
void freeScreenshots(vector<string> *screens); std::vector<std::string> *titles);
void freeScreenshots(std::vector<std::string> *screens);
public: public:
Selector(GMenu2X *gmenu2x, LinkApp *link, const string &selectorDir=""); Selector(GMenu2X *gmenu2x, LinkApp *link,
const std::string &selectorDir = "");
int exec(int startSelection=0); int exec(int startSelection = 0);
const string &getFile() { return file; } const std::string &getFile() { return file; }
const string &getDir() { return dir; } const std::string &getDir() { return dir; }
}; };
#endif /*SELECTOR_H_*/ #endif // SELECTOR_H

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -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 "settingsdialog.h"
#include "gmenu2x.h"
#include "menusetting.h"
#include <SDL.h> #include <SDL.h>
#include <SDL_gfxPrimitives.h> #include <SDL_gfxPrimitives.h>
#include "settingsdialog.h"
using namespace std; using namespace std;
SettingsDialog::SettingsDialog( SettingsDialog::SettingsDialog(

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,29 +18,29 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef SETTINGSDIALOG_H_ #ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H_ #define SETTINGSDIALOG_H
#include <string>
#include "gmenu2x.h"
#include "menusetting.h"
#include "dialog.h" #include "dialog.h"
using std::string; #include <string>
using std::vector; #include <vector>
class InputManager; class InputManager;
class MenuSetting;
class Touchscreen; class Touchscreen;
class SettingsDialog : protected Dialog { class SettingsDialog : protected Dialog {
private: private:
InputManager &inputMgr; InputManager &inputMgr;
Touchscreen &ts; Touchscreen &ts;
vector<MenuSetting *> voices; std::vector<MenuSetting *> voices;
string text, icon; std::string text, icon;
public: public:
SettingsDialog(GMenu2X *gmenu2x, InputManager &inputMgr, Touchscreen &ts, const string &text, const string &icon="skin:sections/settings.png"); SettingsDialog(GMenu2X *gmenu2x, InputManager &inputMgr, Touchscreen &ts,
const std::string &text,
const std::string &icon = "skin:sections/settings.png");
~SettingsDialog(); ~SettingsDialog();
bool edited(); bool edited();
@ -48,4 +48,4 @@ public:
void addSetting(MenuSetting* set); void addSetting(MenuSetting* set);
}; };
#endif /*INPUTDIALOG_H_*/ #endif // SETTINGSDIALOG_H

View File

@ -20,6 +20,8 @@
#include "textdialog.h" #include "textdialog.h"
#include "gmenu2x.h"
using namespace std; using namespace std;
TextDialog::TextDialog(GMenu2X *gmenu2x, const string &title, const string &description, const string &icon, vector<string> *text) TextDialog::TextDialog(GMenu2X *gmenu2x, const string &title, const string &description, const string &icon, vector<string> *text)
@ -33,7 +35,7 @@ TextDialog::TextDialog(GMenu2X *gmenu2x, const string &title, const string &desc
} }
void TextDialog::preProcess() { void TextDialog::preProcess() {
uint i=0; unsigned i = 0;
string row; string row;
while (i<text->size()) { while (i<text->size()) {
@ -45,12 +47,12 @@ void TextDialog::preProcess() {
vector<string> words; vector<string> words;
split(words, row, " "); split(words, row, " ");
uint numWords = words.size(); unsigned numWords = words.size();
//find the maximum number of rows that can be printed on screen //find the maximum number of rows that can be printed on screen
while (gmenu2x->font->getTextWidth(row)>(int)gmenu2x->resX-15 && numWords>0) { while (gmenu2x->font->getTextWidth(row)>(int)gmenu2x->resX-15 && numWords>0) {
numWords--; numWords--;
row = ""; row = "";
for (uint x=0; x<numWords; x++) for (unsigned x=0; x<numWords; x++)
row += words[x] + " "; row += words[x] + " ";
row = trim(row); row = trim(row);
} }
@ -62,7 +64,7 @@ void TextDialog::preProcess() {
//build the remaining text in another row //build the remaining text in another row
row = ""; row = "";
for (uint x=numWords; x<words.size(); x++) for (unsigned x=numWords; x<words.size(); x++)
row += words[x] + " "; row += words[x] + " ";
row = trim(row); row = trim(row);
@ -74,10 +76,11 @@ void TextDialog::preProcess() {
} }
} }
void TextDialog::drawText(vector<string> *text, uint firstRow, uint rowsPerPage) { void TextDialog::drawText(vector<string> *text, unsigned firstRow,
unsigned rowsPerPage) {
gmenu2x->s->setClipRect(0,41,gmenu2x->resX-10,gmenu2x->resY-60); gmenu2x->s->setClipRect(0,41,gmenu2x->resX-10,gmenu2x->resY-60);
for (uint i=firstRow; i<firstRow+rowsPerPage && i<text->size(); i++) { for (unsigned i=firstRow; i<firstRow+rowsPerPage && i<text->size(); i++) {
int rowY; int rowY;
if (text->at(i)=="----") { //draw a line if (text->at(i)=="----") { //draw a line
rowY = 42+(int)((i-firstRow+0.5)*gmenu2x->font->getHeight()); rowY = 42+(int)((i-firstRow+0.5)*gmenu2x->font->getHeight());
@ -113,8 +116,8 @@ void TextDialog::exec() {
bg.convertToDisplayFormat(); bg.convertToDisplayFormat();
uint firstRow = 0; unsigned firstRow = 0;
uint rowsPerPage = (gmenu2x->resY - 60) / gmenu2x->font->getHeight(); unsigned rowsPerPage = (gmenu2x->resY - 60) / gmenu2x->font->getHeight();
while (!close) { while (!close) {
bg.blit(gmenu2x->s, 0, 0); bg.blit(gmenu2x->s, 0, 0);
drawText(text, firstRow, rowsPerPage); drawText(text, firstRow, rowsPerPage);

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,27 +18,28 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef TEXTDIALOG_H_ #ifndef TEXTDIALOG_H
#define TEXTDIALOG_H_ #define TEXTDIALOG_H
#include <string>
#include "gmenu2x.h"
#include "dialog.h" #include "dialog.h"
using std::string; #include <string>
using std::vector; #include <vector>
class TextDialog : protected Dialog { class TextDialog : protected Dialog {
protected: protected:
vector<string> *text; std::vector<std::string> *text;
string title, description, icon; std::string title, description, icon;
void preProcess(); void preProcess();
void drawText(vector<string> *text, uint firstRow, uint rowsPerPage); void drawText(std::vector<std::string> *text, unsigned firstRow,
unsigned rowsPerPage);
public: public:
TextDialog(GMenu2X *gmenu2x, const string &title, const string &description, const string &icon, vector<string> *text); TextDialog(GMenu2X *gmenu2x, const std::string &title,
const std::string &description, const std::string &icon,
std::vector<std::string> *text);
void exec(); void exec();
}; };
#endif /*TEXTDIALOG_H_*/ #endif // TEXTDIALOG_H

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,9 +18,12 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include <sstream>
#include "textmanualdialog.h" #include "textmanualdialog.h"
#include "gmenu2x.h"
#include <sstream>
using namespace std; using namespace std;
TextManualDialog::TextManualDialog(GMenu2X *gmenu2x, const string &title, const string &icon, vector<string> *text) TextManualDialog::TextManualDialog(GMenu2X *gmenu2x, const string &title, const string &icon, vector<string> *text)

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,28 +18,27 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef TEXTMANUALDIALOG_H_ #ifndef TEXTMANUALDIALOG_H
#define TEXTMANUALDIALOG_H_ #define TEXTMANUALDIALOG_H
#include "textdialog.h"
#include <string> #include <string>
#include "textdialog.h" #include <vector>
#include "gmenu2x.h"
using std::string;
using std::vector;
struct ManualPage { struct ManualPage {
string title; std::string title;
vector<string> text; std::vector<std::string> text;
}; };
class TextManualDialog : public TextDialog { class TextManualDialog : public TextDialog {
private: private:
vector<ManualPage> pages; std::vector<ManualPage> pages;
public: public:
TextManualDialog(GMenu2X *gmenu2x, const string &title, const string &icon, vector<string> *text); TextManualDialog(GMenu2X *gmenu2x, const std::string &title,
const std::string &icon, std::vector<std::string> *text);
void exec(); void exec();
}; };
#endif /*TEXTMANUALDIALOG_H_*/ #endif // TEXTMANUALDIALOG_H

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,12 +18,14 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include <iostream>
#include "wallpaperdialog.h" #include "wallpaperdialog.h"
#include "filelister.h"
#include "buttonbox.h"
#include "debug.h" #include "debug.h"
#include "buttonbox.h"
#include "filelister.h"
#include "gmenu2x.h"
#include <iostream>
using namespace std; using namespace std;

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Massimiliano Torromeo * * Copyright (C) 2006 by Massimiliano Torromeo *
* massimiliano.torromeo@gmail.com * * massimiliano.torromeo@gmail.com *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
@ -18,22 +18,19 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifndef WALLPAPERDIALOG_H_ #ifndef WALLPAPERDIALOG_H
#define WALLPAPERDIALOG_H_ #define WALLPAPERDIALOG_H
#include <string>
#include "gmenu2x.h"
#include "dialog.h" #include "dialog.h"
using std::string; #include <string>
using std::vector;
class WallpaperDialog : protected Dialog { class WallpaperDialog : protected Dialog {
public: public:
WallpaperDialog(GMenu2X *gmenu2x); WallpaperDialog(GMenu2X *gmenu2x);
string wallpaper; std::string wallpaper;
bool exec(); bool exec();
}; };
#endif /*WALLPAPERDIALOG_H_*/ #endif // WALLPAPERDIALOG_H