Add update of GenlistItem fields when text and description are changed 93/204693/1
authorLukasz Wlazly <l.wlazly@partner.samsung.com>
Thu, 25 Apr 2019 14:32:46 +0000 (16:32 +0200)
committerLukasz Wlazly <l.wlazly@partner.samsung.com>
Thu, 25 Apr 2019 14:42:48 +0000 (16:42 +0200)
Change-Id: Ib40bb75a561c826f30afce02927889c9ddbb004a

src/RemoveSwitchPage.cpp
src/ScreenReaderPage.cpp
src/ScreenReaderSettingsPage.cpp
src/UniversalSwitchPage.cpp
src/UniversalSwitchSettingsPage.cpp
src/ui/GenlistItem.cpp

index 0470bf2d360f05f765f8fdf20b6f1dab4dcbab3b..6b0c207b40ae19f1a63b3fde5a87896d9b809532 100644 (file)
@@ -77,7 +77,6 @@ RemoveSwitchPage::RemoveSwitchPage()
                                allCheckbox_->setState(state);
 
                                removeSwitchPopupBtn_->disable(switchesToRemoveCounter_ ? false : true);
-                               item->update();
                        },
                        GenlistItem::WidgetType::check});
        }
index b5b235ae9e1fc3c770ef3310c7e320c723921736..0e85f2ccc96fced551e453ea8d1ab58cf594d24c 100644 (file)
@@ -48,7 +48,6 @@ ScreenReaderPage::ScreenReaderPage()
        auto onVConfValueChangeCb = [this](bool screenReaderState) {
                screenReaderItem_->setState(screenReaderState);
                screenReaderItem_->setDescription(screenReaderState ? "IDS_ST_BODY_ON" : "IDS_ST_BODY_OFF");
-               screenReaderItem_->update();
        };
        screenReaderStateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>({VCONFKEY_SETAPPL_ACCESSIBILITY_TTS}, false, onVConfValueChangeCb);
 
index d9a2922b0cc73a080020f89127f10d081f0e6a21..b324e8c3581c0fe5b7ba4b3603652b0f33a8e28d 100644 (file)
@@ -67,7 +67,6 @@ ScreenReaderSettingsPage::ScreenReaderSettingsPage()
        Singleton<TextToSpeech>::instance().addSpeedChangedCb([item = speechRateItem_](auto val) {
                DEBUG("Speed changed to (%d)", static_cast<int>(val));
                item->setDescription(std::to_string(val));
-               item->update();
        });
 
        auto item = genlist->appendItem({"multiline",
@@ -235,5 +234,4 @@ void ScreenReaderSettingsPage::onPopupDel(void *data, Evas *e, Evas_Object *obj,
        auto self = static_cast<ScreenReaderSettingsPage *>(data);
        auto percentage = self->calculateSpeedPercentage();
        self->speechRateItem_->setDescription(percentage);
-       self->speechRateItem_->update();
 }
index 2792484c76c3b7cf2b78953cc0ab970a536f3136..bc6d37bdc10e1aec636d839e305a03af8c50e0c7 100644 (file)
@@ -48,7 +48,6 @@ UniversalSwitchPage::UniversalSwitchPage()
        auto onUsVconfKeyChange = [this](auto state) {
                universalSwitchOffCheckbox_->setText(state ? "IDS_ACCS_UNIVERSAL_SWITCH_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_OFF");
                universalSwitchOffCheckbox_->setState(state);
-               universalSwitchOffCheckbox_->update();
        };
        universalSwitchStateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>({VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_INTERACTION_SERVICE}, false, onUsVconfKeyChange);
 
@@ -172,7 +171,6 @@ void UniversalSwitchPage::onVconfKeyChange(keynode_t *node, void *user_data)
                self->universalSwitchOffCheckbox_->setText(
                        state ? "IDS_ACCS_UNIVERSAL_SWITCH_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_OFF");
                self->universalSwitchOffCheckbox_->setState(state);
-               self->universalSwitchOffCheckbox_->update();
        } else {
                ERROR("vconf_keynode_get_bool(node) failed");
        }
index 5973b3c19495e9f5ed4865bef2c99931302289d1..3619b67d03dbd941746b38dcb2524ca85d893ce7 100644 (file)
@@ -147,7 +147,6 @@ void UniversalSwitchSettingsPage::createFeedbackGroup()
                [this](auto item) {
                        context_.usScanningProperties.getScanningProperty(Property::FEEDBACK_SOUND)->setState(item->getState());
                        item->setDescription(item->getState() ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
-                       item->update();
                },
                GenlistItem::WidgetType::toggle});
        feedbackSound_->setState(context_.usScanningProperties.getScanningProperty(Property::FEEDBACK_SOUND)->getState());
@@ -159,8 +158,7 @@ void UniversalSwitchSettingsPage::createFeedbackGroup()
                [this](auto item) {
                        context_.usScanningProperties.getScanningProperty(Property::FEEDBACK_VOICE)->setState(item->getState());
 
-                       item->setDescription(item->getState() ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
-                       item->update(); },
+                       item->setDescription(item->getState() ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"); },
                GenlistItem::WidgetType::toggle});
        feedbackVoice_->setState(context_.usScanningProperties.getScanningProperty(Property::FEEDBACK_VOICE)->getState());
 }
@@ -200,8 +198,7 @@ void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
                                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS",
                                !item->getState(),
                                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
-                       item->setDescription(str);
-                       item->update(); },
+                       item->setDescription(str); },
                GenlistItem::WidgetType::toggle});
        if (context_.usScanningProperties.getScanningProperty(Property::PAUSE_ON_FIRST_ITEM)->getState()) {
                pauseOnFirst_->setState(true);
@@ -212,7 +209,6 @@ void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
                        false,
                        "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
                pauseOnFirst_->setDescription(str);
-               pauseOnFirst_->update();
        }
        if (!context_.usScanningProperties.getScanningProperty(Property::AUTO_SCAN)->getState())
                pauseOnFirst_->disable();
@@ -242,8 +238,7 @@ void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
                                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS",
                                !item->getState(),
                                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
-                       item->setDescription(str);
-                       item->update(); },
+                       item->setDescription(str); },
                GenlistItem::WidgetType::toggle});
 
        if (context_.usScanningProperties.getScanningProperty(Property::TAP_DURATION)->getState()) {
@@ -255,7 +250,6 @@ void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
                        false,
                        "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
                tapDuration_->setDescription(str);
-               tapDuration_->update();
        }
        auto sglIntInterval = context_.usScanningProperties.getScanningProperty(Property::SINGLE_INTERACTION_INTERVAL)->getFirstValue<double>();
        str = getValueUnitText(NULL, &sglIntInterval, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", !context_.usScanningProperties.getScanningProperty(Property::SINGLE_INTERACTION_INTERVAL)->getState(), "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
@@ -283,8 +277,7 @@ void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
                                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS",
                                !item->getState(),
                                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
-                       item->setDescription(str);
-                       item->update(); },
+                       item->setDescription(str); },
                GenlistItem::WidgetType::toggle});
 
        if (context_.usScanningProperties.getScanningProperty(Property::SINGLE_INTERACTION_INTERVAL)->getState()) {
@@ -296,7 +289,6 @@ void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
                        false,
                        "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
                singleInteractionInterval_->setDescription(str);
-               singleInteractionInterval_->update();
        }
        auto autoTapValue = context_.usScanningProperties.getScanningProperty(Property::AUTO_TAP)->getFirstValue<double>();
        str = getValueUnitText(NULL, &autoTapValue, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", !context_.usScanningProperties.getScanningProperty(Property::AUTO_TAP)->getState(), "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
@@ -324,8 +316,7 @@ void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
                                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS",
                                !item->getState(),
                                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
-                       item->setDescription(str);
-                       item->update(); },
+                       item->setDescription(str); },
                GenlistItem::WidgetType::toggle});
 
        if (context_.usScanningProperties.getScanningProperty(Property::AUTO_TAP)->getState()) {
@@ -337,7 +328,6 @@ void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
                        false,
                        "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
                autoTap_->setDescription(str);
-               autoTap_->update();
        }
        auto moveIntervalValue = context_.usScanningProperties.getScanningProperty(Property::AUTO_MOVE_INTERVAL)->getFirstValue<double>();
        str = getValueUnitText(NULL, &moveIntervalValue, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", !context_.usScanningProperties.getScanningProperty(Property::AUTO_MOVE_INTERVAL)->getState(), "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
@@ -362,8 +352,7 @@ void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
                        auto moveIntervalValue = context_.usScanningProperties.getScanningProperty(Property::AUTO_MOVE_INTERVAL)->getFirstValue<double>();
                        auto str = getValueUnitText(NULL, &moveIntervalValue, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS",
                                                                                !item->getState(), "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
-                       item->setDescription(str);
-                       item->update(); },
+                       item->setDescription(str); },
                GenlistItem::WidgetType::toggle});
        if (context_.usScanningProperties.getScanningProperty(Property::AUTO_MOVE_INTERVAL)->getState()) {
                autoMoveInterval_->setState(true);
@@ -374,7 +363,6 @@ void UniversalSwitchSettingsPage::createAdditionalSettingsGroup()
                        !context_.usScanningProperties.getScanningProperty(Property::AUTO_MOVE_INTERVAL)->getState(),
                        "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
                autoMoveInterval_->setDescription(str);
-               autoMoveInterval_->update();
        }
        if (context_.usScanningProperties.getScanningProperty(Property::AUTO_SCAN)->getState())
                autoMoveInterval_->disable();
@@ -533,7 +521,6 @@ void UniversalSwitchSettingsPage::updateSwitchesCount(void *data)
        int switch_count = setting_accessibility_universal_switch_dbus_config_get_switch_count(&self->context_.config);
 
        self->switchesItem_->setDescription(getValueUnitText(&switch_count, NULL, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SWITCHES", false, {}));
-       self->switchesItem_->update();
 }
 
 void UniversalSwitchSettingsPage::feedbackVoiceCb()
@@ -546,7 +533,6 @@ void UniversalSwitchSettingsPage::feedbackVoiceCb()
                feedbackVoice_->setDescription(
                        state ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
                feedbackVoice_->setState(state);
-               feedbackVoice_->update();
                context_.usScanningProperties.getScanningProperty(Property::FEEDBACK_VOICE)->setState(state);
        });
        auto nestedSetValuePagePtr = nestedSetValuePage_.get();
@@ -598,7 +584,6 @@ void UniversalSwitchSettingsPage::feedbackVoiceSpeechVolumeChangedCb(size_t item
        context_.usScanningProperties.getScanningProperty(Property::FEEDBACK_VOICE)->setSecondValue(media_level);
 
        feedbackVoiceSpeechVolume_->setDescription(mediaLevel[item_id].first);
-       feedbackVoiceSpeechVolume_->update();
 }
 
 void UniversalSwitchSettingsPage::feedbackVoiceSpeechRateChangedCb(size_t item_id)
@@ -609,7 +594,6 @@ void UniversalSwitchSettingsPage::feedbackVoiceSpeechRateChangedCb(size_t item_i
        context_.usScanningProperties.getScanningProperty(Property::FEEDBACK_VOICE)->setFirstValue(media_level);
 
        feedbackVoiceSpeechRate_->setDescription(mediaLevel[item_id].first);
-       feedbackVoiceSpeechRate_->update();
 }
 
 void UniversalSwitchSettingsPage::feedbackSoundCb()
@@ -647,7 +631,6 @@ void UniversalSwitchSettingsPage::feedbackSoundVolumeChangedCb(size_t item_id)
        context_.usScanningProperties.getScanningProperty(Property::FEEDBACK_SOUND)->setFirstValue(media_level);
 
        feedbackSoundVolume_->setDescription(mediaLevel[item_id].first);
-       feedbackSoundVolume_->update();
 }
 
 void UniversalSwitchSettingsPage::feedbackSoundSwitchChangedCb(bool state)
@@ -655,7 +638,6 @@ void UniversalSwitchSettingsPage::feedbackSoundSwitchChangedCb(bool state)
        context_.usScanningProperties.getScanningProperty(Property::FEEDBACK_SOUND)->setState(state);
        feedbackSound_->setState(state);
        feedbackSound_->setDescription(state ? "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
-       feedbackSound_->update();
 }
 
 void UniversalSwitchSettingsPage::cursorColorListItemChangedCb(size_t item_id)
@@ -664,7 +646,6 @@ void UniversalSwitchSettingsPage::cursorColorListItemChangedCb(size_t item_id)
 
        context_.usScanningProperties.getScanningProperty(Property::CURSOR_COLOR)->setFirstValue<int>(cursorColors[item_id].second);
        cursorColor_->setDescription(cursorColors[item_id].first);
-       cursorColor_->update();
 }
 
 void UniversalSwitchSettingsPage::autoMoveIntervalSwitchChangedCb(bool state)
@@ -678,7 +659,6 @@ void UniversalSwitchSettingsPage::autoMoveIntervalSwitchChangedCb(bool state)
                !context_.usScanningProperties.getScanningProperty(Property::AUTO_MOVE_INTERVAL)->getState(),
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
        autoMoveInterval_->setDescription(str);
-       autoMoveInterval_->update();
 }
 
 void UniversalSwitchSettingsPage::autoTapSwitchChangedCb(bool state)
@@ -692,7 +672,6 @@ void UniversalSwitchSettingsPage::autoTapSwitchChangedCb(bool state)
                !state,
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
        autoTap_->setDescription(str);
-       autoTap_->update();
 }
 
 void UniversalSwitchSettingsPage::autoTapValueChangedCb(double value)
@@ -704,7 +683,6 @@ void UniversalSwitchSettingsPage::autoTapValueChangedCb(double value)
                !context_.usScanningProperties.getScanningProperty(Property::AUTO_TAP)->getState(),
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
        autoTap_->setDescription(str);
-       autoTap_->update();
 }
 
 void UniversalSwitchSettingsPage::sglInactionIntervalSwitchChangedCb(bool state)
@@ -718,7 +696,6 @@ void UniversalSwitchSettingsPage::sglInactionIntervalSwitchChangedCb(bool state)
                !state,
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
        singleInteractionInterval_->setDescription(str);
-       singleInteractionInterval_->update();
 }
 
 void UniversalSwitchSettingsPage::sglInactionIntervalValueChangedCb(double value)
@@ -726,7 +703,6 @@ void UniversalSwitchSettingsPage::sglInactionIntervalValueChangedCb(double value
        context_.usScanningProperties.getScanningProperty(Property::SINGLE_INTERACTION_INTERVAL)->setFirstValue(value);
        auto str = getValueUnitText(NULL, &value, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", !context_.usScanningProperties.getScanningProperty(Property::SINGLE_INTERACTION_INTERVAL)->getState(), "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
        singleInteractionInterval_->setDescription(str);
-       singleInteractionInterval_->update();
 }
 
 void UniversalSwitchSettingsPage::tapDurationSwitchChangedCb(bool state)
@@ -740,7 +716,6 @@ void UniversalSwitchSettingsPage::tapDurationSwitchChangedCb(bool state)
                !state,
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
        tapDuration_->setDescription(str);
-       tapDuration_->update();
 }
 
 void UniversalSwitchSettingsPage::tapDurationValueChangedCb(double value)
@@ -752,7 +727,6 @@ void UniversalSwitchSettingsPage::tapDurationValueChangedCb(double value)
                !context_.usScanningProperties.getScanningProperty(Property::TAP_DURATION)->getState(),
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
        tapDuration_->setDescription(str);
-       tapDuration_->update();
 }
 
 void UniversalSwitchSettingsPage::pauseOnFirstSwitchChangedCb(bool state)
@@ -766,7 +740,6 @@ void UniversalSwitchSettingsPage::pauseOnFirstSwitchChangedCb(bool state)
                !state,
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
        pauseOnFirst_->setDescription(str);
-       pauseOnFirst_->update();
 }
 
 void UniversalSwitchSettingsPage::pauseOnFirstValueChangedCb(double value)
@@ -778,7 +751,6 @@ void UniversalSwitchSettingsPage::pauseOnFirstValueChangedCb(double value)
                !context_.usScanningProperties.getScanningProperty(Property::PAUSE_ON_FIRST_ITEM)->getState(),
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
        pauseOnFirst_->setDescription(str);
-       pauseOnFirst_->update();
 }
 
 void UniversalSwitchSettingsPage::scanSpeedChangedCb(double value)
@@ -786,7 +758,6 @@ void UniversalSwitchSettingsPage::scanSpeedChangedCb(double value)
        // TODO change type to avoid below cast
        context_.usScanningProperties.getScanningProperty(Property::POINT_SCAN_SPEED)->setFirstValue<int>(value);
        scanSpeed_->setDescription(std::to_string(static_cast<int>(value)));
-       scanSpeed_->update();
 }
 
 void UniversalSwitchSettingsPage::createScanDirectionCtxPopup()
@@ -818,7 +789,6 @@ void UniversalSwitchSettingsPage::scanDirectionCtxPopupItemClicked(ScanDirection
 {
        context_.usScanningProperties.getScanningProperty(Property::SCAN_DIRECTION)->setFirstValue(scan_dir);
        scanDirection_->setDescription(getScanDirectionText(scan_dir));
-       scanDirection_->update();
 }
 
 void UniversalSwitchSettingsPage::createScanMethodCtxPopup()
@@ -850,14 +820,12 @@ void UniversalSwitchSettingsPage::scanMethodCtxPopupItemClicked(ScanMethod scan_
 {
        context_.usScanningProperties.getScanningProperty(Property::SCAN_METHOD)->setFirstValue(scan_method);
        scanMethod_->setDescription(getScanMethodText(scan_method));
-       scanMethod_->update();
 }
 
 void UniversalSwitchSettingsPage::scanNumberChangedCb(double value)
 {
        context_.usScanningProperties.getScanningProperty(Property::AUTO_SCAN)->setSecondValue(static_cast<int>(value));
        scansNum_->setDescription(std::to_string(static_cast<double>(value)));
-       scansNum_->update();
 }
 
 void UniversalSwitchSettingsPage::autoScanIntervalChangedCb(double value)
@@ -865,7 +833,6 @@ void UniversalSwitchSettingsPage::autoScanIntervalChangedCb(double value)
        context_.usScanningProperties.getScanningProperty(Property::AUTO_SCAN)->setFirstValue(value);
        autoScanInterval_->setDescription(
                getValueUnitText(NULL, &value, "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", false, {}));
-       autoScanInterval_->update();
 }
 
 void UniversalSwitchSettingsPage::autoMoveIntervalValueChangedCb(double value)
@@ -877,7 +844,6 @@ void UniversalSwitchSettingsPage::autoMoveIntervalValueChangedCb(double value)
                !context_.usScanningProperties.getScanningProperty(Property::AUTO_MOVE_INTERVAL)->getState(),
                "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF");
        autoMoveInterval_->setDescription(str);
-       autoMoveInterval_->update();
 }
 
 void UniversalSwitchSettingsPage::onManageMenuOptions()
index dedc863c254bc1aee89532d015f5bf906bcf2611..1b4b577138bdf1b3dce703ec8026b2d8bae13827 100644 (file)
@@ -53,11 +53,13 @@ GenlistItem::GenlistItem(std::string style,
 void GenlistItem::setText(const TranslatedString &text)
 {
        text_ = text;
+       update();
 }
 
 void GenlistItem::setDescription(const TranslatedString &desc)
 {
        description_ = desc;
+       update();
 }
 
 void GenlistItem::update()