mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 17:51:34 +02:00
Give SettingsDialog a direct reference to the Touchscreen and InputManager objects instead of fetching them from the GMenu2X object.
This commit is contained in:
parent
d03dbea9bd
commit
0ce743426a
@ -1027,7 +1027,7 @@ void GMenu2X::options() {
|
||||
encodings.push_back("NTSC");
|
||||
encodings.push_back("PAL");
|
||||
|
||||
SettingsDialog sd(this,tr["Settings"]);
|
||||
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"],200,430));
|
||||
@ -1055,7 +1055,7 @@ void GMenu2X::options() {
|
||||
}
|
||||
|
||||
void GMenu2X::settingsOpen2x() {
|
||||
SettingsDialog sd(this,tr["Open2x Settings"]);
|
||||
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));
|
||||
@ -1085,7 +1085,7 @@ void GMenu2X::skinMenu() {
|
||||
fl_sk.browse();
|
||||
string curSkin = confStr["skin"];
|
||||
|
||||
SettingsDialog sd(this,tr["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]));
|
||||
@ -1430,7 +1430,7 @@ void GMenu2X::editLink() {
|
||||
string diagTitle = tr.translate("Edit link: $1",linkTitle.c_str(),NULL);
|
||||
string diagIcon = menu->selLinkApp()->getIconPath();
|
||||
|
||||
SettingsDialog sd(this,diagTitle,diagIcon);
|
||||
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()));
|
||||
|
@ -25,11 +25,14 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
SettingsDialog::SettingsDialog(GMenu2X *gmenu2x, const string &text, const string &icon)
|
||||
: Dialog(gmenu2x)
|
||||
SettingsDialog::SettingsDialog(
|
||||
GMenu2X *gmenu2x_, InputManager &inputMgr_, Touchscreen &ts_,
|
||||
const string &text_, const string &icon)
|
||||
: Dialog(gmenu2x_)
|
||||
, inputMgr(inputMgr_)
|
||||
, ts(ts_)
|
||||
, text(text_)
|
||||
{
|
||||
this->text = text;
|
||||
|
||||
if (icon!="" && gmenu2x->sc[icon] != NULL)
|
||||
this->icon = icon;
|
||||
else
|
||||
@ -56,7 +59,7 @@ bool SettingsDialog::exec() {
|
||||
|
||||
while (!close) {
|
||||
action = SD_NO_ACTION;
|
||||
if (gmenu2x->f200) gmenu2x->ts.poll();
|
||||
if (gmenu2x->f200) ts.poll();
|
||||
|
||||
bg.blit(gmenu2x->s,0,0);
|
||||
|
||||
@ -82,12 +85,12 @@ bool SettingsDialog::exec() {
|
||||
voices[sel]->drawSelected(iY);
|
||||
|
||||
gmenu2x->s->setClipRect(clipRect);
|
||||
if (ts_pressed && !gmenu2x->ts.pressed()) ts_pressed = false;
|
||||
if (gmenu2x->f200 && gmenu2x->ts.pressed() && !gmenu2x->ts.inRect(touchRect)) ts_pressed = false;
|
||||
if (ts_pressed && !ts.pressed()) ts_pressed = false;
|
||||
if (gmenu2x->f200 && ts.pressed() && !ts.inRect(touchRect)) ts_pressed = false;
|
||||
for (i=firstElement; i<voices.size() && i<firstElement+numRows; i++) {
|
||||
iY = i-firstElement;
|
||||
voices[i]->draw(iY*rowHeight+gmenu2x->skinConfInt["topBarHeight"]+2);
|
||||
if (gmenu2x->f200 && gmenu2x->ts.pressed() && gmenu2x->ts.inRect(touchRect.x, touchRect.y+(iY*rowHeight), touchRect.w, rowHeight)) {
|
||||
if (gmenu2x->f200 && ts.pressed() && ts.inRect(touchRect.x, touchRect.y+(iY*rowHeight), touchRect.w, rowHeight)) {
|
||||
ts_pressed = true;
|
||||
sel = i;
|
||||
}
|
||||
@ -102,10 +105,10 @@ bool SettingsDialog::exec() {
|
||||
gmenu2x->s->flip();
|
||||
voices[sel]->handleTS();
|
||||
|
||||
gmenu2x->input.update();
|
||||
if ( gmenu2x->input[ACTION_START] ) action = SD_ACTION_CLOSE;
|
||||
if ( gmenu2x->input[ACTION_UP ] ) action = SD_ACTION_UP;
|
||||
if ( gmenu2x->input[ACTION_DOWN ] ) action = SD_ACTION_DOWN;
|
||||
inputMgr.update();
|
||||
if ( inputMgr[ACTION_START] ) action = SD_ACTION_CLOSE;
|
||||
if ( inputMgr[ACTION_UP ] ) action = SD_ACTION_UP;
|
||||
if ( inputMgr[ACTION_DOWN ] ) action = SD_ACTION_DOWN;
|
||||
voices[sel]->manageInput();
|
||||
|
||||
switch (action) {
|
||||
|
@ -34,13 +34,18 @@
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
class InputManager;
|
||||
class Touchscreen;
|
||||
|
||||
class SettingsDialog : protected Dialog {
|
||||
private:
|
||||
InputManager &inputMgr;
|
||||
Touchscreen &ts;
|
||||
vector<MenuSetting *> voices;
|
||||
string text, icon;
|
||||
|
||||
public:
|
||||
SettingsDialog(GMenu2X *gmenu2x, const string &text, const string &icon="skin:sections/settings.png");
|
||||
SettingsDialog(GMenu2X *gmenu2x, InputManager &inputMgr, Touchscreen &ts, const string &text, const string &icon="skin:sections/settings.png");
|
||||
~SettingsDialog();
|
||||
|
||||
bool edited();
|
||||
|
Loading…
Reference in New Issue
Block a user