mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 11:56:16 +02:00
More header cleanups.
This time the focus was on removing namespace imports from headers.
This commit is contained in:
parent
e0e7e87ebc
commit
a01d892eb6
@ -7,6 +7,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace fastdelegate;
|
using namespace fastdelegate;
|
||||||
|
using std::string;
|
||||||
|
|
||||||
BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title,
|
BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title,
|
||||||
const string &subtitle)
|
const string &subtitle)
|
||||||
|
17
src/button.h
17
src/button.h
@ -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,17 +18,14 @@
|
|||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef BUTTON_H_
|
#ifndef BUTTON_H
|
||||||
#define BUTTON_H_
|
#define BUTTON_H
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <SDL.h>
|
|
||||||
#include "FastDelegate.h"
|
#include "FastDelegate.h"
|
||||||
|
|
||||||
using std::string;
|
#include <SDL.h>
|
||||||
using fastdelegate::FastDelegate0;
|
|
||||||
|
|
||||||
typedef FastDelegate0<> ButtonAction;
|
typedef fastdelegate::FastDelegate0<> ButtonAction;
|
||||||
class Touchscreen;
|
class Touchscreen;
|
||||||
|
|
||||||
class Button {
|
class Button {
|
||||||
@ -61,4 +58,4 @@ public:
|
|||||||
void setAction(ButtonAction action);
|
void setAction(ButtonAction action);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*BUTTON_H_*/
|
#endif // BUTTON_H
|
||||||
|
@ -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,20 +18,20 @@
|
|||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef FILEDIALOG_H_
|
#ifndef FILEDIALOG_H
|
||||||
#define FILEDIALOG_H_
|
#define FILEDIALOG_H
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "browsedialog.h"
|
#include "browsedialog.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class FileDialog : public BrowseDialog {
|
class FileDialog : public BrowseDialog {
|
||||||
public:
|
public:
|
||||||
FileDialog(GMenu2X *gmenu2x, const string &text, const string &filter="",
|
FileDialog(GMenu2X *gmenu2x, const std::string &text,
|
||||||
const string &file="", const string &title = "File Dialog");
|
const std::string &filter="", const std::string &file="",
|
||||||
|
const std::string &title = "File Dialog");
|
||||||
virtual ~FileDialog();
|
virtual ~FileDialog();
|
||||||
bool exec();
|
bool exec();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*INPUTDIALOG_H_*/
|
#endif // FILEDIALOG_H
|
||||||
|
@ -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 "filelister.h"
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
//for browsing the filesystem
|
//for browsing the filesystem
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -27,10 +32,6 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "filelister.h"
|
|
||||||
#include "utilities.h"
|
|
||||||
#include "debug.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
FileLister::FileLister(const string &startPath, bool showDirectories,
|
FileLister::FileLister(const string &startPath, bool showDirectories,
|
||||||
|
@ -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,43 +18,40 @@
|
|||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef FILELISTER_H_
|
#ifndef FILELISTER_H
|
||||||
#define FILELISTER_H_
|
#define FILELISTER_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
class FileLister {
|
class FileLister {
|
||||||
private:
|
private:
|
||||||
string path, filter;
|
std::string path, filter;
|
||||||
bool showDirectories, showFiles;
|
bool showDirectories, showFiles;
|
||||||
|
|
||||||
vector<string> directories, files, excludes;
|
std::vector<std::string> directories, files, excludes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FileLister(const string &startPath = "/boot/local", bool showDirectories = true, bool showFiles = true);
|
FileLister(const std::string &startPath = "/boot/local", bool showDirectories = true, bool showFiles = true);
|
||||||
void browse(bool clean = true);
|
void browse(bool clean = true);
|
||||||
|
|
||||||
unsigned int size();
|
unsigned int size();
|
||||||
unsigned int dirCount();
|
unsigned int dirCount();
|
||||||
unsigned int fileCount();
|
unsigned int fileCount();
|
||||||
string operator[](unsigned int);
|
std::string operator[](unsigned int);
|
||||||
string at(unsigned int);
|
std::string at(unsigned int);
|
||||||
bool isFile(unsigned int);
|
bool isFile(unsigned int);
|
||||||
bool isDirectory(unsigned int);
|
bool isDirectory(unsigned int);
|
||||||
|
|
||||||
const string &getPath();
|
const std::string &getPath();
|
||||||
void setPath(const string &path, bool doBrowse=true);
|
void setPath(const std::string &path, bool doBrowse=true);
|
||||||
const string &getFilter();
|
const std::string &getFilter();
|
||||||
void setFilter(const string &filter);
|
void setFilter(const std::string &filter);
|
||||||
|
|
||||||
const vector<string> &getDirectories() { return directories; }
|
const std::vector<std::string> &getDirectories() { return directories; }
|
||||||
const vector<string> &getFiles() { return files; }
|
const std::vector<std::string> &getFiles() { return files; }
|
||||||
void insertFile(const string &file);
|
void insertFile(const std::string &file);
|
||||||
void addExclude(const string &exclude);
|
void addExclude(const std::string &exclude);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*FILELISTER_H_*/
|
#endif // FILELISTER_H
|
||||||
|
@ -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 *
|
||||||
@ -86,6 +86,9 @@
|
|||||||
//#include <pnd_discovery.h>
|
//#include <pnd_discovery.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace fastdelegate;
|
||||||
|
|
||||||
#ifdef _CARD_ROOT
|
#ifdef _CARD_ROOT
|
||||||
const char *CARD_ROOT = _CARD_ROOT;
|
const char *CARD_ROOT = _CARD_ROOT;
|
||||||
#elif defined(PLATFORM_DINGUX)
|
#elif defined(PLATFORM_DINGUX)
|
||||||
@ -98,9 +101,6 @@ const int CARD_ROOT_LEN = strlen(CARD_ROOT)-1;
|
|||||||
static GMenu2X *app;
|
static GMenu2X *app;
|
||||||
static string gmenu2x_home;
|
static string gmenu2x_home;
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace fastdelegate;
|
|
||||||
|
|
||||||
// Note: Keep this in sync with the enum!
|
// Note: Keep this in sync with the enum!
|
||||||
static const char *colorNames[NUM_COLORS] = {
|
static const char *colorNames[NUM_COLORS] = {
|
||||||
"topBarBg",
|
"topBarBg",
|
||||||
|
@ -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 *
|
||||||
@ -73,13 +73,9 @@ enum color {
|
|||||||
NUM_COLORS,
|
NUM_COLORS,
|
||||||
};
|
};
|
||||||
|
|
||||||
using std::string;
|
typedef fastdelegate::FastDelegate0<> MenuAction;
|
||||||
using std::vector;
|
typedef std::tr1::unordered_map<std::string, std::string, std::tr1::hash<std::string> > ConfStrHash;
|
||||||
using fastdelegate::FastDelegate0;
|
typedef std::tr1::unordered_map<std::string, int, std::tr1::hash<std::string> > ConfIntHash;
|
||||||
|
|
||||||
typedef FastDelegate0<> MenuAction;
|
|
||||||
typedef unordered_map<string, string, hash<string> > ConfStrHash;
|
|
||||||
typedef unordered_map<string, int, hash<string> > ConfIntHash;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned short batt;
|
unsigned short batt;
|
||||||
@ -87,7 +83,7 @@ typedef struct {
|
|||||||
} MMSP2ADC;
|
} MMSP2ADC;
|
||||||
|
|
||||||
struct MenuOption {
|
struct MenuOption {
|
||||||
string text;
|
std::string text;
|
||||||
MenuAction action;
|
MenuAction action;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,12 +91,12 @@ class Menu;
|
|||||||
|
|
||||||
class GMenu2X {
|
class GMenu2X {
|
||||||
private:
|
private:
|
||||||
string path; //!< Contains the working directory of GMenu2X
|
std::string path; //!< Contains the working directory of GMenu2X
|
||||||
/*!
|
/*!
|
||||||
Retrieves the free disk space on the sd
|
Retrieves the free disk space on the sd
|
||||||
@return String containing a human readable representation of the free disk space
|
@return String containing a human readable representation of the free disk space
|
||||||
*/
|
*/
|
||||||
string getDiskFree(const char *path);
|
std::string getDiskFree(const char *path);
|
||||||
unsigned short cpuX; //!< Offset for displaying cpu clock information
|
unsigned short cpuX; //!< Offset for displaying cpu clock information
|
||||||
unsigned short volumeX; //!< Offset for displaying volume level
|
unsigned short volumeX; //!< Offset for displaying volume level
|
||||||
unsigned short manualX; //!< Offset for displaying the manual indicator in the taskbar
|
unsigned short manualX; //!< Offset for displaying the manual indicator in the taskbar
|
||||||
@ -116,7 +112,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
unsigned short getBatteryLevel();
|
unsigned short getBatteryLevel();
|
||||||
FILE* batteryHandle, *backlightHandle, *usbHandle, *acHandle;
|
FILE* batteryHandle, *backlightHandle, *usbHandle, *acHandle;
|
||||||
void browsePath(const string &path, vector<string>* directories, vector<string>* files);
|
void browsePath(const std::string &path, std::vector<std::string>* directories, std::vector<std::string>* files);
|
||||||
/*!
|
/*!
|
||||||
Starts the scanning of the nand and sd filesystems, searching for dge and gpu files and creating the links in 2 dedicated sections.
|
Starts the scanning of the nand and sd filesystems, searching for dge and gpu files and creating the links in 2 dedicated sections.
|
||||||
*/
|
*/
|
||||||
@ -125,7 +121,7 @@ private:
|
|||||||
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.
|
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.
|
||||||
@see scanner
|
@see scanner
|
||||||
*/
|
*/
|
||||||
void scanPath(string path, vector<string> *files);
|
void scanPath(std::string path, std::vector<std::string> *files);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Displays a selector and launches the specified executable file
|
Displays a selector and launches the specified executable file
|
||||||
@ -137,10 +133,10 @@ private:
|
|||||||
samba,
|
samba,
|
||||||
web;
|
web;
|
||||||
|
|
||||||
string ip, defaultgw, lastSelectorDir;
|
std::string ip, defaultgw, lastSelectorDir;
|
||||||
int lastSelectorElement;
|
int lastSelectorElement;
|
||||||
void readConfig();
|
void readConfig();
|
||||||
void readConfig(string path);
|
void readConfig(std::string path);
|
||||||
void readTmp();
|
void readTmp();
|
||||||
|
|
||||||
void initServices();
|
void initServices();
|
||||||
@ -174,7 +170,7 @@ public:
|
|||||||
|
|
||||||
/* Returns the home directory of gmenu2x, usually
|
/* Returns the home directory of gmenu2x, usually
|
||||||
* ~/.gmenu2x */
|
* ~/.gmenu2x */
|
||||||
static const string getHome(void);
|
static const std::string getHome(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables needed for elements disposition
|
* Variables needed for elements disposition
|
||||||
@ -188,7 +184,7 @@ public:
|
|||||||
@see path
|
@see path
|
||||||
@return String containing the parent directory
|
@return String containing the parent directory
|
||||||
*/
|
*/
|
||||||
const string &getExePath();
|
const std::string &getExePath();
|
||||||
|
|
||||||
InputManager input;
|
InputManager input;
|
||||||
Touchscreen ts;
|
Touchscreen ts;
|
||||||
@ -200,17 +196,17 @@ public:
|
|||||||
|
|
||||||
//Configuration settings
|
//Configuration settings
|
||||||
bool useSelectionPng;
|
bool useSelectionPng;
|
||||||
void setSkin(const string &skin, bool setWallpaper = true);
|
void setSkin(const std::string &skin, bool setWallpaper = true);
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
#ifdef PLATFORM_GP2X
|
||||||
//firmware type and version
|
//firmware type and version
|
||||||
string fwType, fwVersion;
|
std::string fwType, fwVersion;
|
||||||
|
|
||||||
bool isF200() { return ts.initialized(); }
|
bool isF200() { return ts.initialized(); }
|
||||||
|
|
||||||
// Open2x settings ---------------------------------------------------------
|
// Open2x settings ---------------------------------------------------------
|
||||||
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;
|
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;
|
||||||
string o2x_usb_net_ip;
|
std::string o2x_usb_net_ip;
|
||||||
int volumeMode, savedVolumeMode; // just use the const int scale values at top of source
|
int volumeMode, savedVolumeMode; // just use the const int scale values at top of source
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -262,7 +258,7 @@ public:
|
|||||||
void writeConfigOpen2x();
|
void writeConfigOpen2x();
|
||||||
#endif
|
#endif
|
||||||
void writeSkinConfig();
|
void writeSkinConfig();
|
||||||
void writeTmp(int selelem=-1, const string &selectordir="");
|
void writeTmp(int selelem=-1, const std::string &selectordir="");
|
||||||
|
|
||||||
void ledOn();
|
void ledOn();
|
||||||
void ledOff();
|
void ledOff();
|
||||||
@ -276,14 +272,14 @@ public:
|
|||||||
|
|
||||||
void initBG();
|
void initBG();
|
||||||
int drawButton(Button *btn, int x=5, int y=-10);
|
int drawButton(Button *btn, int x=5, int y=-10);
|
||||||
int drawButton(Surface *s, const string &btn, const string &text, int x=5, int y=-10);
|
int drawButton(Surface *s, const std::string &btn, const std::string &text, int x=5, int y=-10);
|
||||||
int drawButtonRight(Surface *s, const string &btn, const string &text, int x=5, int y=-10);
|
int drawButtonRight(Surface *s, const std::string &btn, const std::string &text, int x=5, int y=-10);
|
||||||
void drawScrollBar(uint pagesize, uint totalsize, uint pagepos, uint top, uint height);
|
void drawScrollBar(uint pagesize, uint totalsize, uint pagepos, uint top, uint height);
|
||||||
|
|
||||||
void drawTopBar(Surface *s=NULL);
|
void drawTopBar(Surface *s=NULL);
|
||||||
void drawBottomBar(Surface *s=NULL);
|
void drawBottomBar(Surface *s=NULL);
|
||||||
|
|
||||||
Menu* menu;
|
Menu *menu;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // GMENU2X_H
|
||||||
|
@ -31,7 +31,7 @@ protected:
|
|||||||
SurfaceCollection previews;
|
SurfaceCollection previews;
|
||||||
public:
|
public:
|
||||||
ImageDialog(GMenu2X *gmenu2x, const std::string &text,
|
ImageDialog(GMenu2X *gmenu2x, const std::string &text,
|
||||||
const std::string &filter="", const string &file="");
|
const std::string &filter="", const std::string &file="");
|
||||||
virtual ~ImageDialog();
|
virtual ~ImageDialog();
|
||||||
|
|
||||||
virtual void beforeFileList();
|
virtual void beforeFileList();
|
||||||
|
23
src/link.h
23
src/link.h
@ -24,12 +24,9 @@
|
|||||||
#include "button.h"
|
#include "button.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
class Surface;
|
class Surface;
|
||||||
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
class GMenu2X;
|
class GMenu2X;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,7 +41,7 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
GMenu2X *gmenu2x;
|
GMenu2X *gmenu2x;
|
||||||
bool edited;
|
bool edited;
|
||||||
string title, description, icon, iconPath;
|
std::string title, description, icon, iconPath;
|
||||||
|
|
||||||
Surface *iconSurface;
|
Surface *iconSurface;
|
||||||
Surface *icon_hover;
|
Surface *icon_hover;
|
||||||
@ -62,15 +59,15 @@ public:
|
|||||||
void setSize(int w, int h);
|
void setSize(int w, int h);
|
||||||
void setPosition(int x, int y);
|
void setPosition(int x, int y);
|
||||||
|
|
||||||
const string &getTitle();
|
const std::string &getTitle();
|
||||||
void setTitle(const string &title);
|
void setTitle(const std::string &title);
|
||||||
const string &getDescription();
|
const std::string &getDescription();
|
||||||
void setDescription(const string &description);
|
void setDescription(const std::string &description);
|
||||||
const string &getIcon();
|
const std::string &getIcon();
|
||||||
void setIcon(const string &icon);
|
void setIcon(const std::string &icon);
|
||||||
virtual const string &searchIcon();
|
virtual const std::string &searchIcon();
|
||||||
const string &getIconPath();
|
const std::string &getIconPath();
|
||||||
void setIconPath(const string &icon);
|
void setIconPath(const std::string &icon);
|
||||||
|
|
||||||
virtual void run();
|
virtual void run();
|
||||||
};
|
};
|
||||||
|
@ -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,11 +17,8 @@
|
|||||||
* 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 "linkaction.h"
|
|
||||||
|
|
||||||
using namespace std;
|
#include "linkaction.h"
|
||||||
|
|
||||||
LinkAction::LinkAction(GMenu2X *gmenu2x, LinkRunAction act)
|
LinkAction::LinkAction(GMenu2X *gmenu2x, LinkRunAction act)
|
||||||
: Link(gmenu2x) {
|
: Link(gmenu2x) {
|
||||||
|
@ -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,19 +17,14 @@
|
|||||||
* 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 LINKACTION_H
|
#ifndef LINKACTION_H
|
||||||
#define LINKACTION_H
|
#define LINKACTION_H
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "FastDelegate.h"
|
#include "FastDelegate.h"
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
|
|
||||||
using std::string;
|
typedef fastdelegate::FastDelegate0<> LinkRunAction;
|
||||||
using fastdelegate::FastDelegate0;
|
|
||||||
|
|
||||||
typedef FastDelegate0<> LinkRunAction;
|
|
||||||
|
|
||||||
class GMenu2X;
|
class GMenu2X;
|
||||||
|
|
||||||
@ -47,4 +42,4 @@ public:
|
|||||||
virtual void run();
|
virtual void run();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // LINKACTION_H
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
#include "link.h"
|
#include "link.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
class GMenu2X;
|
class GMenu2X;
|
||||||
class InputManager;
|
class InputManager;
|
||||||
@ -39,69 +36,70 @@ Parses links files.
|
|||||||
class LinkApp : public Link {
|
class LinkApp : public Link {
|
||||||
private:
|
private:
|
||||||
InputManager &inputMgr;
|
InputManager &inputMgr;
|
||||||
string sclock, svolume;
|
std::string sclock, svolume;
|
||||||
int iclock, ivolume;
|
int iclock, ivolume;
|
||||||
//G
|
//G
|
||||||
string sgamma;
|
std::string sgamma;
|
||||||
//G
|
//G
|
||||||
int igamma;
|
int igamma;
|
||||||
string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens;
|
std::string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens;
|
||||||
bool selectorbrowser, useRamTimings;
|
bool selectorbrowser, useRamTimings;
|
||||||
void drawRun();
|
void drawRun();
|
||||||
|
|
||||||
string aliasfile;
|
std::string aliasfile;
|
||||||
string file;
|
std::string file;
|
||||||
|
|
||||||
bool wrapper;
|
bool wrapper;
|
||||||
bool dontleave;
|
bool dontleave;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LinkApp(GMenu2X *gmenu2x, InputManager &inputMgr, const char* linkfile);
|
LinkApp(GMenu2X *gmenu2x, InputManager &inputMgr, const char* linkfile);
|
||||||
virtual const string &searchIcon();
|
virtual const std::string &searchIcon();
|
||||||
|
|
||||||
const string &getExec();
|
const std::string &getExec();
|
||||||
void setExec(const string &exec);
|
void setExec(const std::string &exec);
|
||||||
const string &getParams();
|
const std::string &getParams();
|
||||||
void setParams(const string ¶ms);
|
void setParams(const std::string ¶ms);
|
||||||
const string &getWorkdir();
|
const std::string &getWorkdir();
|
||||||
void setWorkdir(const string &workdir);
|
void setWorkdir(const std::string &workdir);
|
||||||
const string &getManual();
|
const std::string &getManual();
|
||||||
void setManual(const string &manual);
|
void setManual(const std::string &manual);
|
||||||
const string &getSelectorDir();
|
const std::string &getSelectorDir();
|
||||||
void setSelectorDir(const string &selectordir);
|
void setSelectorDir(const std::string &selectordir);
|
||||||
bool getSelectorBrowser();
|
bool getSelectorBrowser();
|
||||||
void setSelectorBrowser(bool value);
|
void setSelectorBrowser(bool value);
|
||||||
bool getUseRamTimings();
|
bool getUseRamTimings();
|
||||||
void setUseRamTimings(bool value);
|
void setUseRamTimings(bool value);
|
||||||
const string &getSelectorScreens();
|
const std::string &getSelectorScreens();
|
||||||
void setSelectorScreens(const string &selectorscreens);
|
void setSelectorScreens(const std::string &selectorscreens);
|
||||||
const string &getSelectorFilter();
|
const std::string &getSelectorFilter();
|
||||||
void setSelectorFilter(const string &selectorfilter);
|
void setSelectorFilter(const std::string &selectorfilter);
|
||||||
const string &getAliasFile();
|
const std::string &getAliasFile();
|
||||||
void setAliasFile(const string &aliasfile);
|
void setAliasFile(const std::string &aliasfile);
|
||||||
|
|
||||||
int clock();
|
int clock();
|
||||||
const string &clockStr(int maxClock);
|
const std::string &clockStr(int maxClock);
|
||||||
void setClock(int mhz);
|
void setClock(int mhz);
|
||||||
|
|
||||||
int volume();
|
int volume();
|
||||||
const string &volumeStr();
|
const std::string &volumeStr();
|
||||||
void setVolume(int vol);
|
void setVolume(int vol);
|
||||||
|
|
||||||
//G
|
//G
|
||||||
int gamma();
|
int gamma();
|
||||||
const string &gammaStr();
|
const std::string &gammaStr();
|
||||||
void setGamma(int gamma);
|
void setGamma(int gamma);
|
||||||
|
|
||||||
bool save();
|
bool save();
|
||||||
void run();
|
void run();
|
||||||
void showManual();
|
void showManual();
|
||||||
void selector(int startSelection=0, const string &selectorDir="");
|
void selector(int startSelection=0, const std::string &selectorDir="");
|
||||||
void launch(const string &selectedFile="", const string &selectedDir="");
|
void launch(const std::string &selectedFile="",
|
||||||
|
const std::string &selectedDir="");
|
||||||
bool targetExists();
|
bool targetExists();
|
||||||
|
|
||||||
const string &getFile() { return file; }
|
const std::string &getFile() { return file; }
|
||||||
void renameFile(const string &name);
|
void renameFile(const std::string &name);
|
||||||
bool &needsWrapperRef() { return wrapper; }
|
bool &needsWrapperRef() { return wrapper; }
|
||||||
bool &runsInBackgroundRef() { return dontleave; }
|
bool &runsInBackgroundRef() { return dontleave; }
|
||||||
};
|
};
|
||||||
|
18
src/menu.cpp
18
src/menu.cpp
@ -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 *
|
||||||
@ -74,7 +74,7 @@ void Menu::readSections(std::string parentDir)
|
|||||||
if (statret != -1) {
|
if (statret != -1) {
|
||||||
if (find(sections.begin(), sections.end(), (string)dptr->d_name) == sections.end()) {
|
if (find(sections.begin(), sections.end(), (string)dptr->d_name) == sections.end()) {
|
||||||
sections.push_back((string)dptr->d_name);
|
sections.push_back((string)dptr->d_name);
|
||||||
linklist ll;
|
vector<Link*> ll;
|
||||||
links.push_back(ll);
|
links.push_back(ll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,12 +114,12 @@ void Menu::loadIcons() {
|
|||||||
SECTION MANAGEMENT
|
SECTION MANAGEMENT
|
||||||
====================================*/
|
====================================*/
|
||||||
void Menu::freeLinks() {
|
void Menu::freeLinks() {
|
||||||
for (vector<linklist>::iterator section = links.begin(); section<links.end(); section++)
|
for (vector< vector<Link*> >::iterator section = links.begin(); section<links.end(); section++)
|
||||||
for (linklist::iterator link = section->begin(); link<section->end(); link++)
|
for (vector<Link*>::iterator link = section->begin(); link<section->end(); link++)
|
||||||
delete *link;
|
delete *link;
|
||||||
}
|
}
|
||||||
|
|
||||||
linklist *Menu::sectionLinks(int i) {
|
vector<Link*> *Menu::sectionLinks(int i) {
|
||||||
if (i<0 || i>(int)links.size())
|
if (i<0 || i>(int)links.size())
|
||||||
i = selSectionIndex();
|
i = selSectionIndex();
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ bool Menu::addSection(const string §ionName) {
|
|||||||
sectiondir = sectiondir + "/" + sectionName;
|
sectiondir = sectiondir + "/" + sectionName;
|
||||||
if (mkdir(sectiondir.c_str(), 0755) == 0) {
|
if (mkdir(sectiondir.c_str(), 0755) == 0) {
|
||||||
sections.push_back(sectionName);
|
sections.push_back(sectionName);
|
||||||
linklist ll;
|
vector<Link*> ll;
|
||||||
links.push_back(ll);
|
links.push_back(ll);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -324,9 +324,9 @@ void Menu::deleteSelectedLink()
|
|||||||
sectionLinks()->erase( sectionLinks()->begin() + selLinkIndex() );
|
sectionLinks()->erase( sectionLinks()->begin() + selLinkIndex() );
|
||||||
setLinkIndex(selLinkIndex());
|
setLinkIndex(selLinkIndex());
|
||||||
|
|
||||||
for (vector<linklist>::iterator section = links.begin();
|
for (vector< vector<Link*> >::iterator section = links.begin();
|
||||||
!icon_used && section<links.end(); section++)
|
!icon_used && section<links.end(); section++)
|
||||||
for (linklist::iterator link = section->begin();
|
for (vector<Link*>::iterator link = section->begin();
|
||||||
!icon_used && link<section->end(); link++)
|
!icon_used && link<section->end(); link++)
|
||||||
icon_used = !iconpath.compare((*link)->getIconPath());
|
icon_used = !iconpath.compare((*link)->getIconPath());
|
||||||
|
|
||||||
|
35
src/menu.h
35
src/menu.h
@ -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,21 +17,18 @@
|
|||||||
* 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 MENU_H
|
#ifndef MENU_H
|
||||||
#define MENU_H
|
#define MENU_H
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include "linkaction.h"
|
#include "linkaction.h"
|
||||||
|
|
||||||
using std::string;
|
#include <string>
|
||||||
using std::vector;
|
#include <vector>
|
||||||
|
|
||||||
class LinkApp;
|
class LinkApp;
|
||||||
class GMenu2X;
|
class GMenu2X;
|
||||||
|
|
||||||
typedef vector<Link*> linklist;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handles the menu structure
|
Handles the menu structure
|
||||||
|
|
||||||
@ -42,8 +39,8 @@ private:
|
|||||||
GMenu2X *gmenu2x;
|
GMenu2X *gmenu2x;
|
||||||
int iSection, iLink;
|
int iSection, iLink;
|
||||||
uint iFirstDispSection, iFirstDispRow;
|
uint iFirstDispSection, iFirstDispRow;
|
||||||
vector<string> sections;
|
std::vector<std::string> sections;
|
||||||
vector<linklist> links;
|
std::vector< std::vector<Link*> > links;
|
||||||
|
|
||||||
void readLinks();
|
void readLinks();
|
||||||
void freeLinks();
|
void freeLinks();
|
||||||
@ -58,19 +55,21 @@ public:
|
|||||||
Menu(GMenu2X *gmenu2x);
|
Menu(GMenu2X *gmenu2x);
|
||||||
~Menu();
|
~Menu();
|
||||||
|
|
||||||
linklist *sectionLinks(int i = -1);
|
std::vector<Link*> *sectionLinks(int i = -1);
|
||||||
|
|
||||||
int selSectionIndex();
|
int selSectionIndex();
|
||||||
const string &selSection();
|
const std::string &selSection();
|
||||||
void decSectionIndex();
|
void decSectionIndex();
|
||||||
void incSectionIndex();
|
void incSectionIndex();
|
||||||
void setSectionIndex(int i);
|
void setSectionIndex(int i);
|
||||||
uint firstDispSection();
|
uint firstDispSection();
|
||||||
uint firstDispRow();
|
uint firstDispRow();
|
||||||
|
|
||||||
bool addActionLink(uint section, const string &title, LinkRunAction action, const string &description="", const string &icon="");
|
bool addActionLink(uint section, const std::string &title,
|
||||||
bool addLink(string path, string file, string section="");
|
LinkRunAction action, const std::string &description="",
|
||||||
bool addSection(const string §ionName);
|
const std::string &icon="");
|
||||||
|
bool addLink(std::string path, std::string file, std::string section="");
|
||||||
|
bool addSection(const std::string §ionName);
|
||||||
void deleteSelectedLink();
|
void deleteSelectedLink();
|
||||||
void deleteSelectedSection();
|
void deleteSelectedSection();
|
||||||
|
|
||||||
@ -86,8 +85,8 @@ public:
|
|||||||
void linkDown();
|
void linkDown();
|
||||||
void setLinkIndex(int i);
|
void setLinkIndex(int i);
|
||||||
|
|
||||||
const vector<string> &getSections() { return sections; }
|
const std::vector<std::string> &getSections() { return sections; }
|
||||||
void renameSection(int index, const string &name);
|
void renameSection(int index, const std::string &name);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // MENU_H
|
||||||
|
@ -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,10 +17,14 @@
|
|||||||
* 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 "menusetting.h"
|
#include "menusetting.h"
|
||||||
|
|
||||||
#include "asfont.h"
|
#include "asfont.h"
|
||||||
#include "gmenu2x.h"
|
#include "gmenu2x.h"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
MenuSetting::MenuSetting(GMenu2X *gmenu2x, const string &name,
|
MenuSetting::MenuSetting(GMenu2X *gmenu2x, const string &name,
|
||||||
const string &description)
|
const string &description)
|
||||||
: gmenu2x(gmenu2x)
|
: gmenu2x(gmenu2x)
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using std::tr1::unordered_map;
|
||||||
|
|
||||||
#define SELECTOR_ELEMENTS 11
|
#define SELECTOR_ELEMENTS 11
|
||||||
|
|
||||||
|
@ -29,9 +29,6 @@
|
|||||||
class LinkApp;
|
class LinkApp;
|
||||||
class FileLister;
|
class FileLister;
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
class Selector : protected Dialog {
|
class Selector : protected Dialog {
|
||||||
private:
|
private:
|
||||||
int selRow;
|
int selRow;
|
||||||
@ -40,7 +37,7 @@ private:
|
|||||||
std::tr1::unordered_map<std::string, std::string> aliases;
|
std::tr1::unordered_map<std::string, std::string> aliases;
|
||||||
|
|
||||||
void loadAliases();
|
void loadAliases();
|
||||||
string getAlias(const std::string &key);
|
std::string getAlias(const std::string &key);
|
||||||
void prepare(FileLister *fl, std::vector<std::string> *screens,
|
void prepare(FileLister *fl, std::vector<std::string> *screens,
|
||||||
std::vector<std::string> *titles);
|
std::vector<std::string> *titles);
|
||||||
void freeScreenshots(std::vector<std::string> *screens);
|
void freeScreenshots(std::vector<std::string> *screens);
|
||||||
|
@ -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,14 +19,16 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
#include "imageio.h"
|
|
||||||
#include "utilities.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "imageio.h"
|
||||||
#include "surfacecollection.h"
|
#include "surfacecollection.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
#include <SDL_gfxPrimitives.h>
|
#include <SDL_gfxPrimitives.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
RGBAColor strtorgba(const string &strColor) {
|
RGBAColor strtorgba(const string &strColor) {
|
||||||
|
@ -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,21 +17,20 @@
|
|||||||
* 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 SURFACE_H
|
#ifndef SURFACE_H
|
||||||
#define SURFACE_H
|
#define SURFACE_H
|
||||||
|
|
||||||
#include <SDL.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "asfont.h"
|
#include "asfont.h"
|
||||||
|
|
||||||
using std::string;
|
#include <SDL.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
struct RGBAColor {
|
struct RGBAColor {
|
||||||
unsigned short r,g,b,a;
|
unsigned short r,g,b,a;
|
||||||
};
|
};
|
||||||
|
|
||||||
RGBAColor strtorgba(const string &strColor);
|
RGBAColor strtorgba(const std::string &strColor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wrapper around SDL_Surface
|
Wrapper around SDL_Surface
|
||||||
@ -41,7 +40,8 @@ class Surface {
|
|||||||
public:
|
public:
|
||||||
static Surface *openOutputSurface(int width, int height, int bitsperpixel);
|
static Surface *openOutputSurface(int width, int height, int bitsperpixel);
|
||||||
static Surface *emptySurface(int width, int height);
|
static Surface *emptySurface(int width, int height);
|
||||||
static Surface *loadImage(const string &img, const string &skin="");
|
static Surface *loadImage(const std::string &img,
|
||||||
|
const std::string &skin="");
|
||||||
|
|
||||||
Surface(Surface *s);
|
Surface(Surface *s);
|
||||||
~Surface();
|
~Surface();
|
||||||
@ -66,7 +66,9 @@ public:
|
|||||||
bool blitCenter(Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
|
bool blitCenter(Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
|
||||||
bool blitRight(Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
|
bool blitRight(Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
|
||||||
|
|
||||||
void write(ASFont *font, const string &text, int x, int y, ASFont::HAlign halign = ASFont::HAlignLeft, ASFont::VAlign valign = ASFont::VAlignTop) {
|
void write(ASFont *font, const std::string &text, int x, int y,
|
||||||
|
ASFont::HAlign halign = ASFont::HAlignLeft,
|
||||||
|
ASFont::VAlign valign = ASFont::VAlignTop) {
|
||||||
font->write(this, text, x, y, halign, valign);
|
font->write(this, text, x, y, halign, valign);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,16 +18,18 @@
|
|||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "translator.h"
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
#include "gmenu2x.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "translator.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "gmenu2x.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using std::tr1::unordered_map;
|
||||||
|
|
||||||
Translator::Translator(const string &lang) {
|
Translator::Translator(const string &lang) {
|
||||||
_lang = "";
|
_lang = "";
|
||||||
|
@ -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,10 +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. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef TRANSLATOR_H
|
#ifndef TRANSLATOR_H
|
||||||
#define TRANSLATOR_H
|
#define TRANSLATOR_H
|
||||||
|
|
||||||
#include "utilities.h"
|
#include <string>
|
||||||
|
#include <tr1/unordered_map>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Hash Map of translation strings.
|
Hash Map of translation strings.
|
||||||
@ -29,18 +31,19 @@ Hash Map of translation strings.
|
|||||||
*/
|
*/
|
||||||
class Translator {
|
class Translator {
|
||||||
private:
|
private:
|
||||||
string _lang;
|
std::string _lang;
|
||||||
unordered_map<string, string> translations;
|
std::tr1::unordered_map<std::string, std::string> translations;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Translator(const string &lang="");
|
Translator(const std::string &lang="");
|
||||||
~Translator();
|
~Translator();
|
||||||
|
|
||||||
string lang();
|
std::string lang();
|
||||||
void setLang(const string &lang);
|
void setLang(const std::string &lang);
|
||||||
bool exists(const string &term);
|
bool exists(const std::string &term);
|
||||||
string translate(const string &term,const char *replacestr=NULL,...);
|
std::string translate(const std::string &term,
|
||||||
string operator[](const string &term);
|
const char *replacestr = NULL, ...);
|
||||||
|
std::string operator[](const std::string &term);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // TRANSLATOR_H
|
||||||
|
@ -23,39 +23,35 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <tr1/unordered_map>
|
|
||||||
|
|
||||||
using std::tr1::unordered_map;
|
|
||||||
using std::tr1::hash;
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
class case_less {
|
class case_less {
|
||||||
public:
|
public:
|
||||||
bool operator()(const string &left, const string &right) const;
|
bool operator()(const std::string &left, const std::string &right) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
string trim(const string& s);
|
std::string trim(const std::string& s);
|
||||||
string strreplace (string orig, const string &search, const string &replace);
|
std::string strreplace (std::string orig, const std::string &search, const std::string &replace);
|
||||||
string cmdclean (string cmdline);
|
std::string cmdclean (std::string cmdline);
|
||||||
|
|
||||||
char *string_copy(const string &);
|
char *string_copy(const std::string &);
|
||||||
void string_copy(const string &, char **);
|
void string_copy(const std::string &, char **);
|
||||||
|
|
||||||
bool fileExists(const string &file);
|
bool fileExists(const std::string &file);
|
||||||
bool rmtree(string path);
|
bool rmtree(std::string path);
|
||||||
|
|
||||||
int max (int a, int b);
|
int max(int a, int b);
|
||||||
int min (int a, int b);
|
int min(int a, int b);
|
||||||
int constrain (int x, int imin, int imax);
|
int constrain(int x, int imin, int imax);
|
||||||
|
|
||||||
int evalIntConf (int val, int def, int imin, int imax);
|
int evalIntConf(int val, int def, int imin, int imax);
|
||||||
int evalIntConf (int *val, int def, int imin, int imax);
|
int evalIntConf(int *val, int def, int imin, int imax);
|
||||||
const string &evalStrConf (const string &val, const string &def);
|
const std::string &evalStrConf(const std::string &val, const std::string &def);
|
||||||
const string &evalStrConf (string *val, const string &def);
|
const std::string &evalStrConf(std::string *val, const std::string &def);
|
||||||
|
|
||||||
bool split (vector<string> &vec, const string &str, const string &delim, bool destructive=true);
|
bool split(std::vector<std::string> &vec, const std::string &str,
|
||||||
|
const std::string &delim, bool destructive=true);
|
||||||
|
|
||||||
int intTransition(int from, int to, long int tickStart, long duration=500, long tickNow=-1);
|
int intTransition(int from, int to, long int tickStart, long duration=500,
|
||||||
|
long tickNow=-1);
|
||||||
|
|
||||||
#endif
|
#endif // UTILITIES_H
|
||||||
|
Loading…
Reference in New Issue
Block a user