Fix some row refrences and explain some parts of functions

Co-Authored-By: null <MixedMatched@users.noreply.github.com>
This commit is contained in:
BuildTools
2019-11-03 16:32:03 -05:00
parent a5ced0a451
commit 5454b3142b

View File

@@ -140,26 +140,30 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
Preferences * preferences = Preferences::sharedPreferences();
MessageTableCell * myCell = (MessageTableCell *)cell;
myCell->setMessage(model()->children(index)->label());
if (model()->children(selectedRow())->label() == I18n::Message::Brightness) {
//switch to irregular cell types
if (model()->children(index)->label() == I18n::Message::Brightness) {
MessageTableCellWithGauge * myGaugeCell = (MessageTableCellWithGauge *)cell;
GaugeView * myGauge = (GaugeView *)myGaugeCell->accessoryView();
myGauge->setLevel((float)globalPreferences->brightnessLevel()/(float)Ion::Backlight::MaxBrightness);
return;
}
if (model()->children(selectedRow())->label() == I18n::Message::Language) {
if (model()->children(index)->label() == I18n::Message::Language) {
int index = (int)globalPreferences->language()-1;
static_cast<MessageTableCellWithChevronAndMessage *>(cell)->setSubtitle(I18n::LanguageNames[index]);
return;
}
if (hasPrompt() && (model()->children(selectedRow())->label() == I18n::Message::UpdatePopUp || model()->children(selectedRow())->label() == I18n::Message::BetaPopUp)) {
if (hasPrompt() && (model()->children(index)->label() == I18n::Message::UpdatePopUp || model()->children(index)->label() == I18n::Message::BetaPopUp)) {
MessageTableCellWithSwitch * mySwitchCell = (MessageTableCellWithSwitch *)cell;
SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView();
mySwitch->setState(globalPreferences->showPopUp());
return;
}
//add text for preferences
MessageTableCellWithChevronAndMessage * myTextCell = (MessageTableCellWithChevronAndMessage *)cell;
int childIndex = -1;
switch (model()->children(selectedRow())->label()) {
switch (model()->children(index)->label()) {
case I18n::Message::AngleUnit:
childIndex = (int)preferences->angleUnit();
break;