mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 02:00:37 +02:00
Made GMenu2X::ts private.
Pass Touchscreen reference to constructors instead of pulling it from the GMenu2X class.
This commit is contained in:
parent
944ab86f9c
commit
1ad6b2f25a
@ -9,9 +9,11 @@
|
||||
using namespace fastdelegate;
|
||||
using std::string;
|
||||
|
||||
BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title,
|
||||
const string &subtitle)
|
||||
BrowseDialog::BrowseDialog(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts_,
|
||||
const string &title, const string &subtitle)
|
||||
: Dialog(gmenu2x)
|
||||
, ts(ts_)
|
||||
, title(title)
|
||||
, subtitle(subtitle)
|
||||
, ts_pressed(false)
|
||||
@ -19,20 +21,20 @@ BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title,
|
||||
{
|
||||
IconButton *btn;
|
||||
|
||||
buttonBox.add(new IconButton(gmenu2x, "skin:imgs/buttons/left.png"));
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Up one folder"]);
|
||||
buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png"));
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Up one folder"]);
|
||||
btn->setAction(MakeDelegate(this, &BrowseDialog::directoryUp));
|
||||
buttonBox.add(btn);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/accept.png", gmenu2x->tr["Enter folder"]);
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Enter folder"]);
|
||||
btn->setAction(MakeDelegate(this, &BrowseDialog::directoryEnter));
|
||||
buttonBox.add(btn);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/start.png", gmenu2x->tr["Confirm"]);
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/start.png", gmenu2x->tr["Confirm"]);
|
||||
btn->setAction(MakeDelegate(this, &BrowseDialog::confirm));
|
||||
buttonBox.add(btn);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/select.png", gmenu2x->tr["Exit"]);
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/select.png", gmenu2x->tr["Exit"]);
|
||||
btn->setAction(MakeDelegate(this, &BrowseDialog::quit));
|
||||
buttonBox.add(btn);
|
||||
|
||||
@ -64,7 +66,7 @@ bool BrowseDialog::exec()
|
||||
selected = 0;
|
||||
close = false;
|
||||
while (!close) {
|
||||
if (gmenu2x->ts.available()) gmenu2x->ts.poll();
|
||||
if (ts.available()) ts.poll();
|
||||
|
||||
paint();
|
||||
|
||||
@ -104,14 +106,14 @@ void BrowseDialog::handleInput()
|
||||
InputManager::Button button = gmenu2x->input.waitForPressedButton();
|
||||
|
||||
BrowseDialog::Action action;
|
||||
if (ts_pressed && !gmenu2x->ts.pressed()) {
|
||||
if (ts_pressed && !ts.pressed()) {
|
||||
action = BrowseDialog::ACT_SELECT;
|
||||
ts_pressed = false;
|
||||
} else {
|
||||
action = getAction(button);
|
||||
}
|
||||
|
||||
if (gmenu2x->ts.available() && gmenu2x->ts.pressed() && !gmenu2x->ts.inRect(touchRect)) ts_pressed = false;
|
||||
if (ts.available() && ts.pressed() && !ts.inRect(touchRect)) ts_pressed = false;
|
||||
|
||||
if (action == BrowseDialog::ACT_SELECT && (*fl)[selected] == "..")
|
||||
action = BrowseDialog::ACT_GOUP;
|
||||
@ -250,7 +252,7 @@ void BrowseDialog::paint()
|
||||
icon->blit(gmenu2x->s, 5, offsetY);
|
||||
gmenu2x->s->write(gmenu2x->font, (*fl)[i], 24, offsetY + 8, ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
|
||||
if (gmenu2x->ts.available() && gmenu2x->ts.pressed() && gmenu2x->ts.inRect(touchRect.x, offsetY + 3, touchRect.w, rowHeight)) {
|
||||
if (ts.available() && ts.pressed() && ts.inRect(touchRect.x, offsetY + 3, touchRect.w, rowHeight)) {
|
||||
ts_pressed = true;
|
||||
selected = i;
|
||||
}
|
||||
|
@ -29,10 +29,13 @@
|
||||
#include <SDL.h>
|
||||
#include <string>
|
||||
|
||||
class Touchscreen;
|
||||
|
||||
class BrowseDialog : protected Dialog {
|
||||
protected:
|
||||
BrowseDialog(GMenu2X *gmenu2x, const std::string &title,
|
||||
const std::string &subtitle);
|
||||
BrowseDialog(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &title, const std::string &subtitle);
|
||||
virtual ~BrowseDialog();
|
||||
|
||||
void setPath(const std::string &path) {
|
||||
@ -55,6 +58,7 @@ private:
|
||||
ACT_CONFIRM,
|
||||
};
|
||||
|
||||
Touchscreen &ts;
|
||||
bool close, result;
|
||||
|
||||
std::string title;
|
||||
|
@ -29,10 +29,8 @@ typedef fastdelegate::FastDelegate0<> ButtonAction;
|
||||
class Touchscreen;
|
||||
|
||||
class Button {
|
||||
private:
|
||||
Touchscreen &ts;
|
||||
|
||||
protected:
|
||||
Touchscreen &ts;
|
||||
ButtonAction action;
|
||||
SDL_Rect rect;
|
||||
bool doubleClick;
|
||||
|
@ -24,8 +24,10 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
DirDialog::DirDialog(GMenu2X *gmenu2x, const string &text, const string &dir)
|
||||
: BrowseDialog(gmenu2x, "Directory Browser", text)
|
||||
DirDialog::DirDialog(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const string &text, const string &dir)
|
||||
: BrowseDialog(gmenu2x, ts, "Directory Browser", text)
|
||||
{
|
||||
fl = new FileLister(dir, true, false);
|
||||
}
|
||||
|
@ -23,12 +23,11 @@
|
||||
|
||||
#include "browsedialog.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class DirDialog : public BrowseDialog {
|
||||
public:
|
||||
DirDialog(GMenu2X *gmenu2x, const std::string &text,
|
||||
const std::string &dir="");
|
||||
DirDialog(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &text, const std::string &dir = "");
|
||||
~DirDialog();
|
||||
};
|
||||
|
||||
|
@ -25,9 +25,10 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
FileDialog::FileDialog(GMenu2X *gmenu2x, const string &text,
|
||||
const string &filter, const string &file, const string &title) :
|
||||
BrowseDialog(gmenu2x, title, text)
|
||||
FileDialog::FileDialog(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts, const string &text,
|
||||
const string &filter, const string &file, const string &title)
|
||||
: BrowseDialog(gmenu2x, ts, title, text)
|
||||
{
|
||||
string path(CARD_ROOT);
|
||||
if (!file.empty()) {
|
||||
|
@ -23,11 +23,10 @@
|
||||
|
||||
#include "browsedialog.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class FileDialog : public BrowseDialog {
|
||||
public:
|
||||
FileDialog(GMenu2X *gmenu2x, const std::string &text,
|
||||
FileDialog(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts, const std::string &text,
|
||||
const std::string &filter="", const std::string &file="",
|
||||
const std::string &title = "File Dialog");
|
||||
virtual ~FileDialog();
|
||||
|
@ -558,7 +558,7 @@ void GMenu2X::initFont() {
|
||||
|
||||
void GMenu2X::initMenu() {
|
||||
//Menu structure handler
|
||||
menu = new Menu(this);
|
||||
menu = new Menu(this, ts);
|
||||
for (uint i=0; i<menu->getSections().size(); i++) {
|
||||
//Add virtual links in the applications section
|
||||
if (menu->getSections()[i]=="applications") {
|
||||
@ -983,7 +983,7 @@ void GMenu2X::main() {
|
||||
string fps = "";
|
||||
#endif
|
||||
|
||||
IconButton btnContextMenu(this,"skin:imgs/menu.png");
|
||||
IconButton btnContextMenu(this, ts, "skin:imgs/menu.png");
|
||||
btnContextMenu.setPosition(resX-38, bottomBarIconY);
|
||||
btnContextMenu.setAction(MakeDelegate(this, &GMenu2X::contextMenu));
|
||||
|
||||
@ -1243,7 +1243,7 @@ void GMenu2X::main() {
|
||||
}
|
||||
|
||||
void GMenu2X::explorer() {
|
||||
FileDialog fd(this,tr["Select an application"],".gpu,.dge,.sh,");
|
||||
FileDialog fd(this, ts, tr["Select an application"], ".gpu,.dge,.sh,");
|
||||
if (fd.exec()) {
|
||||
if (confInt["saveSelection"] && (confInt["section"]!=menu->selSectionIndex() || confInt["link"]!=menu->selLinkIndex()))
|
||||
writeConfig();
|
||||
@ -1287,21 +1287,21 @@ void GMenu2X::options() {
|
||||
encodings.push_back("PAL");
|
||||
|
||||
SettingsDialog sd(this, input, ts, tr["Settings"]);
|
||||
sd.addSetting(new MenuSettingMultiString(this,tr["Language"],tr["Set the language used by GMenu2X"],&lang,&fl_tr.getFiles()));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["Save last selection"],tr["Save the last selected link and section on exit"],&confInt["saveSelection"]));
|
||||
sd.addSetting(new MenuSettingInt(this,tr["Clock for GMenu2X"],tr["Set the cpu working frequency when running GMenu2X"],&confInt["menuClock"],cpuFreqMin,cpuFreqSafeMax,cpuFreqMultiple));
|
||||
sd.addSetting(new MenuSettingInt(this,tr["Maximum overclock"],tr["Set the maximum overclock for launching links"],&confInt["maxClock"],cpuFreqMin,cpuFreqMax,cpuFreqMultiple));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["Output logs"],tr["Logs the output of the links. Use the Log Viewer to read them."],&confInt["outputLogs"]));
|
||||
sd.addSetting(new MenuSettingMultiString(this, ts, tr["Language"], tr["Set the language used by GMenu2X"], &lang, &fl_tr.getFiles()));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Save last selection"], tr["Save the last selected link and section on exit"], &confInt["saveSelection"]));
|
||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Clock for GMenu2X"], tr["Set the cpu working frequency when running GMenu2X"], &confInt["menuClock"], cpuFreqMin, cpuFreqSafeMax, cpuFreqMultiple));
|
||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Maximum overclock"], tr["Set the maximum overclock for launching links"], &confInt["maxClock"], cpuFreqMin, cpuFreqMax, cpuFreqMultiple));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Output logs"], tr["Logs the output of the links. Use the Log Viewer to read them."], &confInt["outputLogs"]));
|
||||
//G
|
||||
sd.addSetting(new MenuSettingInt(this,tr["Lcd Backlight"],tr["Set Lcd Backlight value (default: 100)"],&newBacklight,5,100));
|
||||
sd.addSetting(new MenuSettingInt(this,tr["Screen Timeout"],tr["Set screen's backlight timeout in seconds"],&confInt["backlightTimeout"],0,120));
|
||||
// sd.addSetting(new MenuSettingMultiString(this,tr["Tv-Out encoding"],tr["Encoding of the tv-out signal"],&confStr["tvoutEncoding"],&encodings));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["Show root"],tr["Show root folder in the file selection dialogs"],&showRootFolder));
|
||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Lcd Backlight"], tr["Set Lcd Backlight value (default: 100)"], &newBacklight, 5, 100));
|
||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Screen Timeout"], tr["Set screen's backlight timeout in seconds"], &confInt["backlightTimeout"], 0, 120));
|
||||
// sd.addSetting(new MenuSettingMultiString(this, ts, tr["Tv-Out encoding"], tr["Encoding of the tv-out signal"], &confStr["tvoutEncoding"], &encodings));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Show root"], tr["Show root folder in the file selection dialogs"], &showRootFolder));
|
||||
|
||||
if (sd.exec() && sd.edited()) {
|
||||
//G
|
||||
if (newBacklight != oldBacklight) setBacklight(newBacklight);
|
||||
if (curMenuClock!=confInt["menuClock"]) setClock(confInt["menuClock"]);
|
||||
if (curMenuClock != confInt["menuClock"]) setClock(confInt["menuClock"]);
|
||||
|
||||
if (confInt["backlightTimeout"] == 0) {
|
||||
if (PowerSaver::isRunning())
|
||||
@ -1327,17 +1327,17 @@ void GMenu2X::options() {
|
||||
#ifdef PLATFORM_GP2X
|
||||
void GMenu2X::settingsOpen2x() {
|
||||
SettingsDialog sd(this, input, ts, tr["Open2x Settings"]);
|
||||
sd.addSetting(new MenuSettingBool(this,tr["USB net on boot"],tr["Allow USB networking to be started at boot time"],&o2x_usb_net_on_boot));
|
||||
sd.addSetting(new MenuSettingString(this,tr["USB net IP"],tr["IP address to be used for USB networking"],&o2x_usb_net_ip));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["Telnet on boot"],tr["Allow telnet to be started at boot time"],&o2x_telnet_on_boot));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["FTP on boot"],tr["Allow FTP to be started at boot time"],&o2x_ftp_on_boot));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["GP2XJOY on boot"],tr["Create a js0 device for GP2X controls"],&o2x_gp2xjoy_on_boot));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["USB host on boot"],tr["Allow USB host to be started at boot time"],&o2x_usb_host_on_boot));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["USB HID on boot"],tr["Allow USB HID to be started at boot time"],&o2x_usb_hid_on_boot));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["USB storage on boot"],tr["Allow USB storage to be started at boot time"],&o2x_usb_storage_on_boot));
|
||||
//sd.addSetting(new MenuSettingInt(this,tr["Speaker Mode on boot"],tr["Set Speaker mode. 0 = Mute, 1 = Phones, 2 = Speaker"],&volumeMode,0,2));
|
||||
sd.addSetting(new MenuSettingInt(this,tr["Speaker Scaler"],tr["Set the Speaker Mode scaling 0-150\% (default is 100\%)"],&volumeScalerNormal,0,150));
|
||||
sd.addSetting(new MenuSettingInt(this,tr["Headphones Scaler"],tr["Set the Headphones Mode scaling 0-100\% (default is 65\%)"],&volumeScalerPhones,0,100));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["USB net on boot"], tr["Allow USB networking to be started at boot time"], &o2x_usb_net_on_boot));
|
||||
sd.addSetting(new MenuSettingString(this, ts, tr["USB net IP"], tr["IP address to be used for USB networking"], &o2x_usb_net_ip));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Telnet on boot"], tr["Allow telnet to be started at boot time"], &o2x_telnet_on_boot));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["FTP on boot"], tr["Allow FTP to be started at boot time"], &o2x_ftp_on_boot));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["GP2XJOY on boot"], tr["Create a js0 device for GP2X controls"], &o2x_gp2xjoy_on_boot));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["USB host on boot"], tr["Allow USB host to be started at boot time"], &o2x_usb_host_on_boot));
|
||||
sd.addSetting(new MenuSettingBool(this,ts, tr["USB HID on boot"], tr["Allow USB HID to be started at boot time"], &o2x_usb_hid_on_boot));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["USB storage on boot"], tr["Allow USB storage to be started at boot time"], &o2x_usb_storage_on_boot));
|
||||
//sd.addSetting(new MenuSettingInt(this, ts, tr["Speaker Mode on boot"], tr["Set Speaker mode. 0 = Mute, 1 = Phones, 2 = Speaker"], &volumeMode, 0, 2));
|
||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Speaker Scaler"], tr["Set the Speaker Mode scaling 0-150\% (default is 100\%)"], &volumeScalerNormal, 0, 150));
|
||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Headphones Scaler"], tr["Set the Headphones Mode scaling 0-100\% (default is 65\%)"], &volumeScalerPhones, 0, 100));
|
||||
|
||||
if (sd.exec() && sd.edited()) {
|
||||
writeConfigOpen2x();
|
||||
@ -1360,13 +1360,13 @@ void GMenu2X::skinMenu() {
|
||||
string curSkin = confStr["skin"];
|
||||
|
||||
SettingsDialog sd(this, input, ts, tr["Skin"]);
|
||||
sd.addSetting(new MenuSettingMultiString(this,tr["Skin"],tr["Set the skin used by GMenu2X"],&confStr["skin"],&fl_sk.getDirectories()));
|
||||
sd.addSetting(new MenuSettingRGBA(this,tr["Top Bar Color"],tr["Color of the top bar"],&skinConfColors[COLOR_TOP_BAR_BG]));
|
||||
sd.addSetting(new MenuSettingRGBA(this,tr["Bottom Bar Color"],tr["Color of the bottom bar"],&skinConfColors[COLOR_BOTTOM_BAR_BG]));
|
||||
sd.addSetting(new MenuSettingRGBA(this,tr["Selection Color"],tr["Color of the selection and other interface details"],&skinConfColors[COLOR_SELECTION_BG]));
|
||||
sd.addSetting(new MenuSettingRGBA(this,tr["Message Box Color"],tr["Background color of the message box"],&skinConfColors[COLOR_MESSAGE_BOX_BG]));
|
||||
sd.addSetting(new MenuSettingRGBA(this,tr["Message Box Border Color"],tr["Border color of the message box"],&skinConfColors[COLOR_MESSAGE_BOX_BORDER]));
|
||||
sd.addSetting(new MenuSettingRGBA(this,tr["Message Box Selection Color"],tr["Color of the selection of the message box"],&skinConfColors[COLOR_MESSAGE_BOX_SELECTION]));
|
||||
sd.addSetting(new MenuSettingMultiString(this, ts, tr["Skin"], tr["Set the skin used by GMenu2X"], &confStr["skin"], &fl_sk.getDirectories()));
|
||||
sd.addSetting(new MenuSettingRGBA(this, ts, tr["Top Bar Color"], tr["Color of the top bar"], &skinConfColors[COLOR_TOP_BAR_BG]));
|
||||
sd.addSetting(new MenuSettingRGBA(this, ts, tr["Bottom Bar Color"], tr["Color of the bottom bar"], &skinConfColors[COLOR_BOTTOM_BAR_BG]));
|
||||
sd.addSetting(new MenuSettingRGBA(this, ts, tr["Selection Color"], tr["Color of the selection and other interface details"], &skinConfColors[COLOR_SELECTION_BG]));
|
||||
sd.addSetting(new MenuSettingRGBA(this, ts, tr["Message Box Color"], tr["Background color of the message box"], &skinConfColors[COLOR_MESSAGE_BOX_BG]));
|
||||
sd.addSetting(new MenuSettingRGBA(this, ts, tr["Message Box Border Color"], tr["Border color of the message box"], &skinConfColors[COLOR_MESSAGE_BOX_BORDER]));
|
||||
sd.addSetting(new MenuSettingRGBA(this, ts, tr["Message Box Selection Color"], tr["Color of the selection of the message box"], &skinConfColors[COLOR_MESSAGE_BOX_SELECTION]));
|
||||
|
||||
if (sd.exec() && sd.edited()) {
|
||||
if (curSkin != confStr["skin"]) {
|
||||
@ -1645,7 +1645,7 @@ void GMenu2X::contextMenu() {
|
||||
}
|
||||
|
||||
void GMenu2X::changeWallpaper() {
|
||||
WallpaperDialog wp(this);
|
||||
WallpaperDialog wp(this, ts);
|
||||
if (wp.exec() && confStr["wallpaper"] != wp.wallpaper) {
|
||||
confStr["wallpaper"] = wp.wallpaper;
|
||||
initBG();
|
||||
@ -1654,7 +1654,7 @@ void GMenu2X::changeWallpaper() {
|
||||
}
|
||||
|
||||
void GMenu2X::addLink() {
|
||||
FileDialog fd(this,tr["Select an application"]);
|
||||
FileDialog fd(this, ts, tr["Select an application"]);
|
||||
if (fd.exec()) {
|
||||
ledOn();
|
||||
menu->addLink(fd.getPath(), fd.getFile());
|
||||
@ -1692,22 +1692,22 @@ void GMenu2X::editLink() {
|
||||
string diagIcon = menu->selLinkApp()->getIconPath();
|
||||
|
||||
SettingsDialog sd(this, input, ts, diagTitle, diagIcon);
|
||||
sd.addSetting(new MenuSettingString(this,tr["Title"],tr["Link title"],&linkTitle, diagTitle,diagIcon));
|
||||
sd.addSetting(new MenuSettingString(this,tr["Description"],tr["Link description"],&linkDescription, diagTitle,diagIcon));
|
||||
sd.addSetting(new MenuSettingMultiString(this,tr["Section"],tr["The section this link belongs to"],&newSection,&menu->getSections()));
|
||||
sd.addSetting(new MenuSettingImage(this,tr["Icon"],tr.translate("Select an icon for the link: $1",linkTitle.c_str(),NULL),&linkIcon,".png,.bmp,.jpg,.jpeg"));
|
||||
sd.addSetting(new MenuSettingFile(this,tr["Manual"],tr["Select a graphic/textual manual or a readme"],&linkManual,".man.png,.txt"));
|
||||
sd.addSetting(new MenuSettingInt(this,tr["Clock (default: 336)"],tr["Cpu clock frequency to set when launching this link"],&linkClock,cpuFreqMin,confInt["maxClock"],cpuFreqMultiple));
|
||||
// sd.addSetting(new MenuSettingBool(this,tr["Tweak RAM Timings"],tr["This usually speeds up the application at the cost of stability"],&linkUseRamTimings));
|
||||
sd.addSetting(new MenuSettingString(this,tr["Parameters"],tr["Parameters to pass to the application"],&linkParams, diagTitle,diagIcon));
|
||||
sd.addSetting(new MenuSettingDir(this,tr["Selector Directory"],tr["Directory to scan for the selector"],&linkSelDir));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["Selector Browser"],tr["Allow the selector to change directory"],&linkSelBrowser));
|
||||
sd.addSetting(new MenuSettingString(this,tr["Selector Filter"],tr["Selector filter (Separate values with a comma)"],&linkSelFilter, diagTitle,diagIcon));
|
||||
sd.addSetting(new MenuSettingDir(this,tr["Selector Screenshots"],tr["Directory of the screenshots for the selector"],&linkSelScreens));
|
||||
sd.addSetting(new MenuSettingFile(this,tr["Selector Aliases"],tr["File containing a list of aliases for the selector"],&linkSelAliases));
|
||||
sd.addSetting(new MenuSettingString(this, ts, tr["Title"], tr["Link title"], &linkTitle, diagTitle, diagIcon));
|
||||
sd.addSetting(new MenuSettingString(this, ts, tr["Description"], tr["Link description"], &linkDescription, diagTitle, diagIcon));
|
||||
sd.addSetting(new MenuSettingMultiString(this, ts, tr["Section"], tr["The section this link belongs to"], &newSection, &menu->getSections()));
|
||||
sd.addSetting(new MenuSettingImage(this, ts, tr["Icon"], tr.translate("Select an icon for the link: $1", linkTitle.c_str(), NULL), &linkIcon, ".png,.bmp,.jpg,.jpeg"));
|
||||
sd.addSetting(new MenuSettingFile(this, ts, tr["Manual"], tr["Select a graphic/textual manual or a readme"], &linkManual, ".man.png,.txt"));
|
||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Clock (default: 336)"], tr["Cpu clock frequency to set when launching this link"], &linkClock, cpuFreqMin, confInt["maxClock"], cpuFreqMultiple));
|
||||
// sd.addSetting(new MenuSettingBool(this, ts, tr["Tweak RAM Timings"], tr["This usually speeds up the application at the cost of stability"], &linkUseRamTimings));
|
||||
sd.addSetting(new MenuSettingString(this, ts, tr["Parameters"], tr["Parameters to pass to the application"], &linkParams, diagTitle, diagIcon));
|
||||
sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Directory"], tr["Directory to scan for the selector"], &linkSelDir));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Selector Browser"], tr["Allow the selector to change directory"], &linkSelBrowser));
|
||||
sd.addSetting(new MenuSettingString(this, ts, tr["Selector Filter"], tr["Selector filter (Separate values with a comma)"], &linkSelFilter, diagTitle, diagIcon));
|
||||
sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Screenshots"], tr["Directory of the screenshots for the selector"], &linkSelScreens));
|
||||
sd.addSetting(new MenuSettingFile(this, ts, tr["Selector Aliases"], tr["File containing a list of aliases for the selector"], &linkSelAliases));
|
||||
//G
|
||||
sd.addSetting(new MenuSettingBool(this,tr["Wrapper"],tr["Explicitly relaunch GMenu2X after execution"],&menu->selLinkApp()->needsWrapperRef()));
|
||||
sd.addSetting(new MenuSettingBool(this,tr["Don't Leave"],tr["Don't quit GMenu2X when launching this link"],&menu->selLinkApp()->runsInBackgroundRef()));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Wrapper"], tr["Explicitly relaunch GMenu2X after execution"], &menu->selLinkApp()->needsWrapperRef()));
|
||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Don't Leave"], tr["Don't quit GMenu2X when launching this link"], &menu->selLinkApp()->runsInBackgroundRef()));
|
||||
|
||||
if (sd.exec() && sd.edited()) {
|
||||
ledOn();
|
||||
|
@ -64,7 +64,9 @@ typedef std::tr1::unordered_map<std::string, int, std::tr1::hash<std::string> >
|
||||
|
||||
class GMenu2X {
|
||||
private:
|
||||
Touchscreen ts;
|
||||
std::string path; //!< Contains the working directory of GMenu2X
|
||||
|
||||
/*!
|
||||
Retrieves the free disk space on the sd
|
||||
@return String containing a human readable representation of the free disk space
|
||||
@ -159,7 +161,6 @@ public:
|
||||
const std::string &getExePath();
|
||||
|
||||
InputManager input;
|
||||
Touchscreen ts;
|
||||
|
||||
//Configuration hashes
|
||||
ConfStrHash confStr, skinConfStr;
|
||||
|
@ -7,9 +7,10 @@
|
||||
using namespace std;
|
||||
using namespace fastdelegate;
|
||||
|
||||
IconButton::IconButton(GMenu2X *gmenu2x_, const string &icon,
|
||||
const string &label)
|
||||
: Button(gmenu2x_->ts)
|
||||
IconButton::IconButton(
|
||||
GMenu2X *gmenu2x_, Touchscreen &ts_,
|
||||
const string &icon, const string &label)
|
||||
: Button(ts_)
|
||||
, gmenu2x(gmenu2x_)
|
||||
{
|
||||
this->icon = icon;
|
||||
|
@ -10,8 +10,8 @@ class Surface;
|
||||
|
||||
class IconButton : public Button {
|
||||
public:
|
||||
IconButton(GMenu2X *gmenu2x, const std::string &icon,
|
||||
const std::string &label="");
|
||||
IconButton(GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &icon, const std::string &label = "");
|
||||
virtual ~IconButton() {};
|
||||
|
||||
virtual void paint();
|
||||
|
@ -34,9 +34,11 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
ImageDialog::ImageDialog(GMenu2X *gmenu2x, const string &text,
|
||||
const string &filter, const string &file) :
|
||||
FileDialog(gmenu2x, text, filter, file, "Image Browser") {
|
||||
ImageDialog::ImageDialog(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts, const string &text,
|
||||
const string &filter, const string &file)
|
||||
: FileDialog(gmenu2x, ts, text, filter, file, "Image Browser")
|
||||
{
|
||||
|
||||
string path;
|
||||
|
||||
|
@ -30,8 +30,9 @@ class ImageDialog : public FileDialog {
|
||||
protected:
|
||||
SurfaceCollection previews;
|
||||
public:
|
||||
ImageDialog(GMenu2X *gmenu2x, const std::string &text,
|
||||
const std::string &filter="", const std::string &file="");
|
||||
ImageDialog(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts, const std::string &text,
|
||||
const std::string &filter = "", const std::string &file = "");
|
||||
virtual ~ImageDialog();
|
||||
|
||||
virtual void beforeFileList();
|
||||
|
@ -94,22 +94,22 @@ InputDialog::InputDialog(GMenu2X *gmenu2x, InputManager &inputMgr_,
|
||||
setKeyboard(0);
|
||||
|
||||
buttonbox = new ButtonBox(gmenu2x);
|
||||
IconButton *btnBackspace = new IconButton(gmenu2x,
|
||||
IconButton *btnBackspace = new IconButton(gmenu2x, ts,
|
||||
"skin:imgs/buttons/l.png", gmenu2x->tr["Backspace"]);
|
||||
btnBackspace->setAction(MakeDelegate(this, &InputDialog::backspace));
|
||||
buttonbox->add(btnBackspace);
|
||||
|
||||
IconButton *btnSpace = new IconButton(gmenu2x,
|
||||
IconButton *btnSpace = new IconButton(gmenu2x, ts,
|
||||
"skin:imgs/buttons/r.png", gmenu2x->tr["Space"]);
|
||||
btnSpace->setAction(MakeDelegate(this, &InputDialog::space));
|
||||
buttonbox->add(btnSpace);
|
||||
|
||||
IconButton *btnConfirm = new IconButton(gmenu2x,
|
||||
IconButton *btnConfirm = new IconButton(gmenu2x, ts,
|
||||
"skin:imgs/buttons/accept.png", gmenu2x->tr["Confirm"]);
|
||||
btnConfirm->setAction(MakeDelegate(this, &InputDialog::confirm));
|
||||
buttonbox->add(btnConfirm);
|
||||
|
||||
IconButton *btnChangeKeys = new IconButton(gmenu2x,
|
||||
IconButton *btnChangeKeys = new IconButton(gmenu2x, ts,
|
||||
"skin:imgs/buttons/cancel.png", gmenu2x->tr["Change keys"]);
|
||||
btnChangeKeys->setAction(MakeDelegate(this, &InputDialog::changeKeys));
|
||||
buttonbox->add(btnChangeKeys);
|
||||
|
@ -31,8 +31,8 @@
|
||||
using namespace std;
|
||||
using namespace fastdelegate;
|
||||
|
||||
Link::Link(GMenu2X *gmenu2x_)
|
||||
: Button(gmenu2x_->ts, true)
|
||||
Link::Link(GMenu2X *gmenu2x_, Touchscreen &ts)
|
||||
: Button(ts, true)
|
||||
, gmenu2x(gmenu2x_)
|
||||
{
|
||||
action = MakeDelegate(this, &Link::run);
|
||||
|
@ -50,7 +50,7 @@ protected:
|
||||
void updateSurfaces();
|
||||
|
||||
public:
|
||||
Link(GMenu2X *gmenu2x);
|
||||
Link(GMenu2X *gmenu2x, Touchscreen &ts);
|
||||
virtual ~Link() {};
|
||||
|
||||
virtual void paint();
|
||||
|
@ -20,8 +20,8 @@
|
||||
|
||||
#include "linkaction.h"
|
||||
|
||||
LinkAction::LinkAction(GMenu2X *gmenu2x, LinkRunAction act)
|
||||
: Link(gmenu2x) {
|
||||
LinkAction::LinkAction(GMenu2X *gmenu2x, Touchscreen &ts, LinkRunAction act)
|
||||
: Link(gmenu2x, ts) {
|
||||
this->action = act;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class LinkAction : public Link {
|
||||
private:
|
||||
LinkRunAction action;
|
||||
public:
|
||||
LinkAction(GMenu2X *gmenu2x, LinkRunAction act);
|
||||
LinkAction(GMenu2X *gmenu2x, Touchscreen &ts, LinkRunAction act);
|
||||
virtual ~LinkAction() {};
|
||||
virtual void run();
|
||||
};
|
||||
|
@ -38,9 +38,9 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
LinkApp::LinkApp(GMenu2X *gmenu2x_, InputManager &inputMgr_,
|
||||
LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
||||
const char* linkfile)
|
||||
: Link(gmenu2x_)
|
||||
: Link(gmenu2x_, ts)
|
||||
, inputMgr(inputMgr_)
|
||||
{
|
||||
manual = "";
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
class GMenu2X;
|
||||
class InputManager;
|
||||
class Touchscreen;
|
||||
|
||||
/**
|
||||
Parses links files.
|
||||
@ -53,7 +54,8 @@ private:
|
||||
bool dontleave;
|
||||
|
||||
public:
|
||||
LinkApp(GMenu2X *gmenu2x, InputManager &inputMgr, const char* linkfile);
|
||||
LinkApp(GMenu2X *gmenu2x, Touchscreen &ts, InputManager &inputMgr,
|
||||
const char* linkfile);
|
||||
virtual const std::string &searchIcon();
|
||||
|
||||
const std::string &getExec();
|
||||
|
16
src/menu.cpp
16
src/menu.cpp
@ -35,8 +35,10 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
Menu::Menu(GMenu2X *gmenu2x) {
|
||||
this->gmenu2x = gmenu2x;
|
||||
Menu::Menu(GMenu2X *gmenu2x, Touchscreen &ts)
|
||||
: gmenu2x(gmenu2x)
|
||||
, ts(ts)
|
||||
{
|
||||
iFirstDispSection = 0;
|
||||
|
||||
readSections(GMENU2X_SYSTEM_DIR "/sections");
|
||||
@ -171,7 +173,7 @@ void Menu::setSectionIndex(int i) {
|
||||
bool Menu::addActionLink(uint section, const string &title, LinkRunAction action, const string &description, const string &icon) {
|
||||
if (section>=sections.size()) return false;
|
||||
|
||||
LinkAction *linkact = new LinkAction(gmenu2x,action);
|
||||
LinkAction *linkact = new LinkAction(gmenu2x, ts, action);
|
||||
linkact->setSize(gmenu2x->skinConfInt["linkWidth"],gmenu2x->skinConfInt["linkHeight"]);
|
||||
linkact->setTitle(title);
|
||||
linkact->setDescription(description);
|
||||
@ -283,7 +285,7 @@ bool Menu::addLink(string path, string file, string section) {
|
||||
|
||||
INFO("Section: '%s(%i)'\n", sections[isection].c_str(), isection);
|
||||
|
||||
LinkApp* link = new LinkApp(gmenu2x, gmenu2x->input, linkpath.c_str());
|
||||
LinkApp* link = new LinkApp(gmenu2x, ts, gmenu2x->input, linkpath.c_str());
|
||||
link->setSize(gmenu2x->skinConfInt["linkWidth"],gmenu2x->skinConfInt["linkHeight"]);
|
||||
links[isection].push_back( link );
|
||||
}
|
||||
@ -465,10 +467,10 @@ void Menu::readLinks() {
|
||||
|
||||
sort(linkfiles.begin(), linkfiles.end(),case_less());
|
||||
for (uint x=0; x<linkfiles.size(); x++) {
|
||||
LinkApp *link = new LinkApp(gmenu2x, gmenu2x->input, linkfiles[x].c_str());
|
||||
link->setSize(gmenu2x->skinConfInt["linkWidth"],gmenu2x->skinConfInt["linkHeight"]);
|
||||
LinkApp *link = new LinkApp(gmenu2x, ts, gmenu2x->input, linkfiles[x].c_str());
|
||||
link->setSize(gmenu2x->skinConfInt["linkWidth"], gmenu2x->skinConfInt["linkHeight"]);
|
||||
if (link->targetExists())
|
||||
links[i].push_back( link );
|
||||
links[i].push_back(link);
|
||||
else
|
||||
delete link;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ Handles the menu structure
|
||||
class Menu {
|
||||
private:
|
||||
GMenu2X *gmenu2x;
|
||||
Touchscreen &ts;
|
||||
int iSection, iLink;
|
||||
uint iFirstDispSection, iFirstDispRow;
|
||||
std::vector<std::string> sections;
|
||||
@ -52,7 +53,7 @@ private:
|
||||
void readLinksOfSection(std::string path, std::vector<std::string> &linkfiles);
|
||||
|
||||
public:
|
||||
Menu(GMenu2X *gmenu2x);
|
||||
Menu(GMenu2X *gmenu2x, Touchscreen &ts);
|
||||
~Menu();
|
||||
|
||||
std::vector<Link*> *sectionLinks(int i = -1);
|
||||
|
@ -30,9 +30,10 @@ using std::string;
|
||||
using fastdelegate::MakeDelegate;
|
||||
|
||||
MenuSettingBool::MenuSettingBool(
|
||||
GMenu2X *gmenu2x, const string &name,
|
||||
const string &description, int *value)
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const string &name, const string &description, int *value)
|
||||
: MenuSetting(gmenu2x, name, description)
|
||||
, ts(ts)
|
||||
{
|
||||
_ivalue = value;
|
||||
_value = NULL;
|
||||
@ -42,9 +43,10 @@ MenuSettingBool::MenuSettingBool(
|
||||
}
|
||||
|
||||
MenuSettingBool::MenuSettingBool(
|
||||
GMenu2X *gmenu2x, const string &name,
|
||||
const string &description, bool *value)
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const string &name, const string &description, bool *value)
|
||||
: MenuSetting(gmenu2x, name, description)
|
||||
, ts(ts)
|
||||
{
|
||||
_value = value;
|
||||
_ivalue = NULL;
|
||||
@ -55,7 +57,8 @@ MenuSettingBool::MenuSettingBool(
|
||||
|
||||
void MenuSettingBool::initButton()
|
||||
{
|
||||
IconButton *btn = new IconButton(gmenu2x, "skin:imgs/buttons/accept.png",
|
||||
IconButton *btn = new IconButton(gmenu2x, ts,
|
||||
"skin:imgs/buttons/accept.png",
|
||||
gmenu2x->tr["Switch"]);
|
||||
btn->setAction(MakeDelegate(this, &MenuSettingBool::toggle));
|
||||
buttonBox.add(btn);
|
||||
|
@ -24,12 +24,14 @@
|
||||
#include "inputmanager.h"
|
||||
|
||||
class GMenu2X;
|
||||
class Touchscreen;
|
||||
|
||||
class MenuSettingBool : public MenuSetting {
|
||||
private:
|
||||
void initButton();
|
||||
void toggle();
|
||||
|
||||
Touchscreen &ts;
|
||||
bool originalValue;
|
||||
bool *_value;
|
||||
int *_ivalue;
|
||||
@ -37,11 +39,13 @@ private:
|
||||
|
||||
public:
|
||||
MenuSettingBool(
|
||||
GMenu2X *gmenu2x, const std::string &name,
|
||||
const std::string &description, bool *value);
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &name, const std::string &description,
|
||||
bool *value);
|
||||
MenuSettingBool(
|
||||
GMenu2X *gmenu2x, const std::string &name,
|
||||
const std::string &description, int *value);
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &name, const std::string &description,
|
||||
int *value);
|
||||
virtual ~MenuSettingBool() {}
|
||||
|
||||
virtual void draw(int y);
|
||||
|
@ -28,18 +28,19 @@ using std::string;
|
||||
using fastdelegate::MakeDelegate;
|
||||
|
||||
MenuSettingDir::MenuSettingDir(
|
||||
GMenu2X *gmenu2x, const string &name,
|
||||
const string &description, string *value)
|
||||
GMenu2X *gmenu2x, Touchscreen &ts_,
|
||||
const string &name, const string &description, string *value)
|
||||
: MenuSettingStringBase(gmenu2x, name, description, value)
|
||||
, ts(ts_)
|
||||
{
|
||||
IconButton *btn;
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/cancel.png",
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png",
|
||||
gmenu2x->tr["Clear"]);
|
||||
btn->setAction(MakeDelegate(this, &MenuSettingDir::clear));
|
||||
buttonBox.add(btn);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/accept.png",
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png",
|
||||
gmenu2x->tr["Select a directory"]);
|
||||
btn->setAction(MakeDelegate(this, &MenuSettingDir::edit));
|
||||
buttonBox.add(btn);
|
||||
@ -47,6 +48,6 @@ MenuSettingDir::MenuSettingDir(
|
||||
|
||||
void MenuSettingDir::edit()
|
||||
{
|
||||
DirDialog dd(gmenu2x, description, value());
|
||||
DirDialog dd(gmenu2x, ts, description, value());
|
||||
if (dd.exec()) setValue(dd.getPath());
|
||||
}
|
||||
|
@ -22,14 +22,20 @@
|
||||
|
||||
#include "menusettingstringbase.h"
|
||||
|
||||
class Touchscreen;
|
||||
|
||||
class MenuSettingDir : public MenuSettingStringBase {
|
||||
private:
|
||||
Touchscreen &ts;
|
||||
|
||||
protected:
|
||||
virtual void edit();
|
||||
|
||||
public:
|
||||
MenuSettingDir(
|
||||
GMenu2X *gmenu2x, const std::string &name,
|
||||
const std::string &description, std::string *value);
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &name, const std::string &description,
|
||||
std::string *value);
|
||||
virtual ~MenuSettingDir() {}
|
||||
};
|
||||
|
||||
|
@ -28,25 +28,27 @@ using std::string;
|
||||
using fastdelegate::MakeDelegate;
|
||||
|
||||
MenuSettingFile::MenuSettingFile(
|
||||
GMenu2X *gmenu2x, const string &name,
|
||||
const string &description, string *value, const string &filter_)
|
||||
GMenu2X *gmenu2x, Touchscreen &ts_,
|
||||
const string &name, const string &description,
|
||||
string *value, const string &filter_)
|
||||
: MenuSettingStringBase(gmenu2x, name, description, value)
|
||||
, ts(ts_)
|
||||
, filter(filter_)
|
||||
{
|
||||
IconButton *btn;
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Clear"]);
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Clear"]);
|
||||
btn->setAction(MakeDelegate(this, &MenuSettingFile::clear));
|
||||
buttonBox.add(btn);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/accept.png", gmenu2x->tr["Select a file"]);
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Select a file"]);
|
||||
btn->setAction(MakeDelegate(this, &MenuSettingFile::edit));
|
||||
buttonBox.add(btn);
|
||||
}
|
||||
|
||||
void MenuSettingFile::edit()
|
||||
{
|
||||
FileDialog fd(gmenu2x, description, filter, value());
|
||||
FileDialog fd(gmenu2x, ts, description, filter, value());
|
||||
if (fd.exec()) {
|
||||
setValue(fd.getPath() + "/" + fd.getFile());
|
||||
}
|
||||
|
@ -22,17 +22,20 @@
|
||||
|
||||
#include "menusettingstringbase.h"
|
||||
|
||||
class Touchscreen;
|
||||
|
||||
class MenuSettingFile : public MenuSettingStringBase {
|
||||
protected:
|
||||
virtual void edit();
|
||||
|
||||
Touchscreen &ts;
|
||||
std::string filter;
|
||||
|
||||
public:
|
||||
MenuSettingFile(
|
||||
GMenu2X *gmenu2x, const std::string &name,
|
||||
const std::string &description, std::string *value,
|
||||
const std::string &filter = "");
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &name, const std::string &description,
|
||||
std::string *value, const std::string &filter = "");
|
||||
virtual ~MenuSettingFile() {}
|
||||
};
|
||||
|
||||
|
@ -26,13 +26,16 @@
|
||||
|
||||
using std::string;
|
||||
|
||||
MenuSettingImage::MenuSettingImage(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &filter)
|
||||
: MenuSettingFile(gmenu2x, name, description, value, filter)
|
||||
MenuSettingImage::MenuSettingImage(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const string &name, const string &description,
|
||||
string *value, const string &filter)
|
||||
: MenuSettingFile(gmenu2x, ts, name, description, value, filter)
|
||||
{
|
||||
}
|
||||
|
||||
void MenuSettingImage::edit() {
|
||||
ImageDialog id(gmenu2x, description, filter, value());
|
||||
ImageDialog id(gmenu2x, ts, description, filter, value());
|
||||
if (id.exec()) setValue(id.getPath() + "/" + id.getFile());
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,9 @@ protected:
|
||||
virtual void edit();
|
||||
|
||||
public:
|
||||
MenuSettingImage(GMenu2X *gmenu2x, const std::string &name,
|
||||
const std::string &description, std::string *value,
|
||||
const std::string &filter = "");
|
||||
MenuSettingImage(GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &name, const std::string &description,
|
||||
std::string *value, const std::string &filter = "");
|
||||
virtual ~MenuSettingImage() {}
|
||||
|
||||
virtual void setValue(const std::string &value);
|
||||
|
@ -30,7 +30,10 @@ 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, int increment)
|
||||
MenuSettingInt::MenuSettingInt(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const string &name, const string &description,
|
||||
int *value, int min, int max, int increment)
|
||||
: MenuSetting(gmenu2x,name,description)
|
||||
{
|
||||
IconButton *btn;
|
||||
@ -46,19 +49,19 @@ MenuSettingInt::MenuSettingInt(GMenu2X *gmenu2x, const string &name, const strin
|
||||
ButtonAction actionInc = MakeDelegate(this, &MenuSettingInt::inc);
|
||||
ButtonAction actionDec = MakeDelegate(this, &MenuSettingInt::dec);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/l.png");
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/l.png");
|
||||
btn->setAction(actionDec);
|
||||
buttonBox.add(btn);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/left.png", gmenu2x->tr["Decrease"]);
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png", gmenu2x->tr["Decrease"]);
|
||||
btn->setAction(actionDec);
|
||||
buttonBox.add(btn);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/r.png");
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/r.png");
|
||||
btn->setAction(actionInc);
|
||||
buttonBox.add(btn);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/right.png", gmenu2x->tr["Increase"]);
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/right.png", gmenu2x->tr["Increase"]);
|
||||
btn->setAction(actionInc);
|
||||
buttonBox.add(btn);
|
||||
}
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "menusetting.h"
|
||||
#include "inputmanager.h"
|
||||
|
||||
class Touchscreen;
|
||||
|
||||
class MenuSettingInt : public MenuSetting {
|
||||
private:
|
||||
int originalValue;
|
||||
@ -36,9 +38,9 @@ private:
|
||||
|
||||
public:
|
||||
MenuSettingInt(
|
||||
GMenu2X *gmenu2x, const std::string &name,
|
||||
const std::string &description, int *value, int min, int max,
|
||||
int increment = 1);
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &name, const std::string &description,
|
||||
int *value, int min, int max, int increment = 1);
|
||||
virtual ~MenuSettingInt() {}
|
||||
|
||||
virtual bool handleButtonPress(InputManager::Button button);
|
||||
|
@ -30,9 +30,9 @@ using std::vector;
|
||||
using fastdelegate::MakeDelegate;
|
||||
|
||||
MenuSettingMultiString::MenuSettingMultiString(
|
||||
GMenu2X *gmenu2x, const string &name,
|
||||
const string &description, string *value,
|
||||
const vector<string> *choices_)
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const string &name, const string &description,
|
||||
string *value, const vector<string> *choices_)
|
||||
: MenuSettingStringBase(gmenu2x, name, description, value)
|
||||
, choices(choices_)
|
||||
{
|
||||
@ -40,11 +40,11 @@ MenuSettingMultiString::MenuSettingMultiString(
|
||||
|
||||
IconButton *btn;
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/left.png");
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png");
|
||||
btn->setAction(MakeDelegate(this, &MenuSettingMultiString::decSel));
|
||||
buttonBox.add(btn);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/right.png", gmenu2x->tr["Change value"]);
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/right.png", gmenu2x->tr["Change value"]);
|
||||
btn->setAction(MakeDelegate(this, &MenuSettingMultiString::incSel));
|
||||
buttonBox.add(btn);
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class Touchscreen;
|
||||
|
||||
class MenuSettingMultiString : public MenuSettingStringBase {
|
||||
private:
|
||||
virtual void edit() {
|
||||
@ -40,9 +42,9 @@ private:
|
||||
|
||||
public:
|
||||
MenuSettingMultiString(
|
||||
GMenu2X *gmenu2x, const std::string &name,
|
||||
const std::string &description, std::string *value,
|
||||
const std::vector<std::string> *choices);
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &name, const std::string &description,
|
||||
std::string *value, const std::vector<std::string> *choices);
|
||||
virtual ~MenuSettingMultiString() {};
|
||||
|
||||
virtual bool handleButtonPress(InputManager::Button button);
|
||||
|
@ -31,9 +31,10 @@ using std::stringstream;
|
||||
using fastdelegate::MakeDelegate;
|
||||
|
||||
MenuSettingRGBA::MenuSettingRGBA(
|
||||
GMenu2X *gmenu2x, const string &name,
|
||||
const string &description, RGBAColor *value)
|
||||
: MenuSetting(gmenu2x,name,description)
|
||||
GMenu2X *gmenu2x, Touchscreen &ts_,
|
||||
const string &name, const string &description, RGBAColor *value)
|
||||
: MenuSetting(gmenu2x, name, description)
|
||||
, ts(ts_)
|
||||
{
|
||||
edit = false;
|
||||
|
||||
@ -60,9 +61,9 @@ void MenuSettingRGBA::draw(int y) {
|
||||
}
|
||||
|
||||
void MenuSettingRGBA::handleTS() {
|
||||
if (gmenu2x->ts.pressed()) {
|
||||
if (ts.pressed()) {
|
||||
for (int i=0; i<4; i++) {
|
||||
if (i!=selPart && gmenu2x->ts.inRect(166+i*36,y,36,14)) {
|
||||
if (i!=selPart && ts.inRect(166+i*36,y,36,14)) {
|
||||
selPart = i;
|
||||
i = 4;
|
||||
}
|
||||
@ -226,14 +227,14 @@ void MenuSettingRGBA::updateButtonBox()
|
||||
{
|
||||
buttonBox.clear();
|
||||
if (edit) {
|
||||
buttonBox.add(new IconButton(gmenu2x, "skin:imgs/buttons/l.png"));
|
||||
buttonBox.add(new IconButton(gmenu2x, "skin:imgs/buttons/left.png", gmenu2x->tr["Decrease"]));
|
||||
buttonBox.add(new IconButton(gmenu2x, "skin:imgs/buttons/r.png"));
|
||||
buttonBox.add(new IconButton(gmenu2x, "skin:imgs/buttons/right.png", gmenu2x->tr["Increase"]));
|
||||
buttonBox.add(new IconButton(gmenu2x, "skin:imgs/buttons/accept.png", gmenu2x->tr["Confirm"]));
|
||||
buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/l.png"));
|
||||
buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png", gmenu2x->tr["Decrease"]));
|
||||
buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/r.png"));
|
||||
buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/right.png", gmenu2x->tr["Increase"]));
|
||||
buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Confirm"]));
|
||||
} else {
|
||||
buttonBox.add(new IconButton(gmenu2x, "skin:imgs/buttons/left.png"));
|
||||
buttonBox.add(new IconButton(gmenu2x, "skin:imgs/buttons/right.png", gmenu2x->tr["Change color component"]));
|
||||
buttonBox.add(new IconButton(gmenu2x, "skin:imgs/buttons/accept.png", gmenu2x->tr["Edit"]));
|
||||
buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png"));
|
||||
buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/right.png", gmenu2x->tr["Change color component"]));
|
||||
buttonBox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Edit"]));
|
||||
}
|
||||
}
|
||||
|
@ -26,9 +26,11 @@
|
||||
#include "inputmanager.h"
|
||||
|
||||
class GMenu2X;
|
||||
class Touchscreen;
|
||||
|
||||
class MenuSettingRGBA : public MenuSetting {
|
||||
private:
|
||||
Touchscreen &ts;
|
||||
unsigned short selPart;
|
||||
int y;
|
||||
std::string strR, strG, strB, strA;
|
||||
@ -46,8 +48,9 @@ private:
|
||||
|
||||
public:
|
||||
MenuSettingRGBA(
|
||||
GMenu2X *gmenu2x, const std::string &name,
|
||||
const std::string &description, RGBAColor *value);
|
||||
GMenu2X *gmenu2x, Touchscreen &ts,
|
||||
const std::string &name, const std::string &description,
|
||||
RGBAColor *value);
|
||||
virtual ~MenuSettingRGBA() {};
|
||||
|
||||
virtual void draw(int y);
|
||||
|
@ -28,20 +28,21 @@ using std::string;
|
||||
using fastdelegate::MakeDelegate;
|
||||
|
||||
MenuSettingString::MenuSettingString(
|
||||
GMenu2X *gmenu2x, const string &name,
|
||||
const string &description, string *value,
|
||||
GMenu2X *gmenu2x, Touchscreen &ts_,
|
||||
const string &name, const string &description, string *value,
|
||||
const string &diagTitle_, const string &diagIcon_)
|
||||
: MenuSettingStringBase(gmenu2x, name, description, value)
|
||||
, ts(ts_)
|
||||
, diagTitle(diagTitle_)
|
||||
, diagIcon(diagIcon_)
|
||||
{
|
||||
IconButton *btn;
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Clear"]);
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Clear"]);
|
||||
btn->setAction(MakeDelegate(this, &MenuSettingString::clear));
|
||||
buttonBox.add(btn);
|
||||
|
||||
btn = new IconButton(gmenu2x, "skin:imgs/buttons/accept.png", gmenu2x->tr["Edit"]);
|
||||
btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Edit"]);
|
||||
btn->setAction(MakeDelegate(this, &MenuSettingString::edit));
|
||||
buttonBox.add(btn);
|
||||
}
|
||||
@ -49,7 +50,7 @@ MenuSettingString::MenuSettingString(
|
||||
void MenuSettingString::edit()
|
||||
{
|
||||
InputDialog id(
|
||||
gmenu2x, gmenu2x->input, gmenu2x->ts,
|
||||
gmenu2x, gmenu2x->input, ts,
|
||||
description, value(), diagTitle, diagIcon);
|
||||
if (id.exec()) setValue(id.getInput());
|
||||
}
|
||||
|
@ -22,17 +22,23 @@
|
||||
|
||||
#include "menusettingstringbase.h"
|
||||
|
||||
class Touchscreen;
|
||||
|
||||
class MenuSettingString : public MenuSettingStringBase {
|
||||
private:
|
||||
Touchscreen &ts;
|
||||
|
||||
protected:
|
||||
virtual void edit();
|
||||
|
||||
std::string diagTitle, diagIcon;
|
||||
|
||||
public:
|
||||
MenuSettingString(GMenu2X *gmenu2x, const std::string &name,
|
||||
const std::string &description, std::string *value,
|
||||
const std::string &diagTitle = "",
|
||||
const std::string &diagIcon = "");
|
||||
MenuSettingString(
|
||||
GMenu2X *gmenu2x, Touchscreen &ts, const std::string &name,
|
||||
const std::string &description, std::string *value,
|
||||
const std::string &diagTitle = "",
|
||||
const std::string &diagIcon = "");
|
||||
virtual ~MenuSettingString() {}
|
||||
};
|
||||
|
||||
|
@ -31,8 +31,9 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
WallpaperDialog::WallpaperDialog(GMenu2X *gmenu2x)
|
||||
WallpaperDialog::WallpaperDialog(GMenu2X *gmenu2x, Touchscreen &ts_)
|
||||
: Dialog(gmenu2x)
|
||||
, ts(ts_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -76,8 +77,8 @@ bool WallpaperDialog::exec()
|
||||
uint i, selected = 0, firstElement = 0, iY;
|
||||
|
||||
ButtonBox buttonbox(gmenu2x);
|
||||
buttonbox.add(new IconButton(gmenu2x, "skin:imgs/buttons/accept.png", gmenu2x->tr["Select wallpaper"]));
|
||||
buttonbox.add(new IconButton(gmenu2x, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Exit"]));
|
||||
buttonbox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Select wallpaper"]));
|
||||
buttonbox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Exit"]));
|
||||
|
||||
while (!close) {
|
||||
if (selected>firstElement+9) firstElement=selected-9;
|
||||
|
@ -25,9 +25,14 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
class Touchscreen;
|
||||
|
||||
class WallpaperDialog : protected Dialog {
|
||||
private:
|
||||
Touchscreen &ts;
|
||||
|
||||
public:
|
||||
WallpaperDialog(GMenu2X *gmenu2x);
|
||||
WallpaperDialog(GMenu2X *gmenu2x, Touchscreen &ts);
|
||||
std::string wallpaper;
|
||||
|
||||
bool exec();
|
||||
|
Loading…
Reference in New Issue
Block a user