mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 11:46:14 +02:00
Renamed SettingsDialog::voices to settings
I have no idea where that original name came from, but it didn't make any sense to me.
This commit is contained in:
parent
dc39fcc01f
commit
8a1bb5694f
@ -43,8 +43,8 @@ SettingsDialog::SettingsDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::~SettingsDialog() {
|
SettingsDialog::~SettingsDialog() {
|
||||||
for (vector<MenuSetting *>::iterator it = voices.begin();
|
for (vector<MenuSetting *>::iterator it = settings.begin();
|
||||||
it != voices.end(); ++it) {
|
it != settings.end(); ++it) {
|
||||||
delete *it;
|
delete *it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ bool SettingsDialog::exec() {
|
|||||||
uint numRows = (gmenu2x->resY - topBarHeight - 20) / rowHeight;
|
uint numRows = (gmenu2x->resY - topBarHeight - 20) / rowHeight;
|
||||||
|
|
||||||
uint maxNameWidth = 0;
|
uint maxNameWidth = 0;
|
||||||
for (auto it = voices.begin(); it != voices.end(); it++) {
|
for (auto it = settings.begin(); it != settings.end(); it++) {
|
||||||
maxNameWidth = max(maxNameWidth, (uint) gmenu2x->font->getTextWidth((*it)->getName()));
|
maxNameWidth = max(maxNameWidth, (uint) gmenu2x->font->getTextWidth((*it)->getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ bool SettingsDialog::exec() {
|
|||||||
uint iY = topBarHeight + 2 + (sel - firstElement) * rowHeight;
|
uint iY = topBarHeight + 2 + (sel - firstElement) * rowHeight;
|
||||||
|
|
||||||
//selected option
|
//selected option
|
||||||
voices[sel]->drawSelected(maxNameWidth + 15, iY, rowHeight);
|
settings[sel]->drawSelected(maxNameWidth + 15, iY, rowHeight);
|
||||||
|
|
||||||
if (ts_pressed && !ts.pressed()) {
|
if (ts_pressed && !ts.pressed()) {
|
||||||
ts_pressed = false;
|
ts_pressed = false;
|
||||||
@ -106,9 +106,9 @@ bool SettingsDialog::exec() {
|
|||||||
if (ts.available() && ts.pressed() && !ts.inRect(touchRect)) {
|
if (ts.available() && ts.pressed() && !ts.inRect(touchRect)) {
|
||||||
ts_pressed = false;
|
ts_pressed = false;
|
||||||
}
|
}
|
||||||
for (i=firstElement; i<voices.size() && i<firstElement+numRows; i++) {
|
for (i=firstElement; i<settings.size() && i<firstElement+numRows; i++) {
|
||||||
iY = i-firstElement;
|
iY = i-firstElement;
|
||||||
voices[i]->draw(maxNameWidth + 15, iY * rowHeight + topBarHeight + 2, rowHeight);
|
settings[i]->draw(maxNameWidth + 15, iY * rowHeight + topBarHeight + 2, rowHeight);
|
||||||
if (ts.available() && ts.pressed() && ts.inRect(
|
if (ts.available() && ts.pressed() && ts.inRect(
|
||||||
touchRect.x, touchRect.y + (iY * rowHeight),
|
touchRect.x, touchRect.y + (iY * rowHeight),
|
||||||
touchRect.w, rowHeight
|
touchRect.w, rowHeight
|
||||||
@ -118,30 +118,30 @@ bool SettingsDialog::exec() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gmenu2x->drawScrollBar(numRows, voices.size(), firstElement);
|
gmenu2x->drawScrollBar(numRows, settings.size(), firstElement);
|
||||||
|
|
||||||
//description
|
//description
|
||||||
writeSubTitle(s, voices[sel]->getDescription());
|
writeSubTitle(s, settings[sel]->getDescription());
|
||||||
|
|
||||||
s.flip();
|
s.flip();
|
||||||
voices[sel]->handleTS(maxNameWidth + 15, iY, rowHeight);
|
settings[sel]->handleTS(maxNameWidth + 15, iY, rowHeight);
|
||||||
|
|
||||||
InputManager::Button button = inputMgr.waitForPressedButton();
|
InputManager::Button button = inputMgr.waitForPressedButton();
|
||||||
if (!voices[sel]->handleButtonPress(button)) {
|
if (!settings[sel]->handleButtonPress(button)) {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case InputManager::SETTINGS:
|
case InputManager::SETTINGS:
|
||||||
close = true;
|
close = true;
|
||||||
break;
|
break;
|
||||||
case InputManager::UP:
|
case InputManager::UP:
|
||||||
if (sel == 0) {
|
if (sel == 0) {
|
||||||
sel = voices.size() - 1;
|
sel = settings.size() - 1;
|
||||||
} else {
|
} else {
|
||||||
sel -= 1;
|
sel -= 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case InputManager::DOWN:
|
case InputManager::DOWN:
|
||||||
sel += 1;
|
sel += 1;
|
||||||
if (sel>=voices.size()) sel = 0;
|
if (sel>=settings.size()) sel = 0;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -152,12 +152,12 @@ bool SettingsDialog::exec() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::addSetting(MenuSetting *set) {
|
void SettingsDialog::addSetting(MenuSetting *set) {
|
||||||
voices.push_back(set);
|
settings.push_back(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SettingsDialog::edited() {
|
bool SettingsDialog::edited() {
|
||||||
for (uint i=0; i < voices.size(); i++) {
|
for (uint i=0; i < settings.size(); i++) {
|
||||||
if (voices[i]->edited()) return true;
|
if (settings[i]->edited()) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class SettingsDialog : protected Dialog {
|
|||||||
private:
|
private:
|
||||||
InputManager &inputMgr;
|
InputManager &inputMgr;
|
||||||
Touchscreen &ts;
|
Touchscreen &ts;
|
||||||
std::vector<MenuSetting *> voices;
|
std::vector<MenuSetting *> settings;
|
||||||
std::string text, icon;
|
std::string text, icon;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user