Changeset View
Changeset View
Standalone View
Standalone View
src/options/ksaneoptcheckbox.cpp
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 46 | { | |||
---|---|---|---|---|---|
51 | readOption(); | 51 | readOption(); | ||
52 | 52 | | |||
53 | if (!m_optDesc) { | 53 | if (!m_optDesc) { | ||
54 | qDebug() << "This is a bug"; | 54 | qDebug() << "This is a bug"; | ||
55 | m_widget = new KSaneOptionWidget(parent, QStringLiteral("")); | 55 | m_widget = new KSaneOptionWidget(parent, QStringLiteral("")); | ||
56 | return; | 56 | return; | ||
57 | } | 57 | } | ||
58 | 58 | | |||
59 | m_widget = m_checkbox = new LabeledCheckbox(parent, i18n(m_optDesc->title)); | 59 | m_widget = m_checkbox = new LabeledCheckbox(parent, sane_i18n(m_optDesc->title)); | ||
60 | m_widget->setToolTip(i18n(m_optDesc->desc)); | 60 | m_widget->setToolTip(sane_i18n(m_optDesc->desc)); | ||
61 | 61 | | |||
62 | connect(m_checkbox, &LabeledCheckbox::toggled, this, &KSaneOptCheckBox::checkboxChanged); | 62 | connect(m_checkbox, &LabeledCheckbox::toggled, this, &KSaneOptCheckBox::checkboxChanged); | ||
63 | 63 | | |||
64 | updateVisibility(); | 64 | updateVisibility(); | ||
65 | readValue(); | 65 | readValue(); | ||
66 | } | 66 | } | ||
67 | 67 | | |||
68 | void KSaneOptCheckBox::checkboxChanged(bool toggled) | 68 | void KSaneOptCheckBox::checkboxChanged(bool toggled) | ||
Show All 20 Lines | 88 | if (status != SANE_STATUS_GOOD) { | |||
89 | return; | 89 | return; | ||
90 | } | 90 | } | ||
91 | bool old = m_checked; | 91 | bool old = m_checked; | ||
92 | m_checked = (toSANE_Word(data.data()) != 0) ? true : false; | 92 | m_checked = (toSANE_Word(data.data()) != 0) ? true : false; | ||
93 | if (m_checkbox) { | 93 | if (m_checkbox) { | ||
94 | m_checkbox->setChecked(m_checked); | 94 | m_checkbox->setChecked(m_checked); | ||
95 | } | 95 | } | ||
96 | if ((old != m_checked) && ((m_optDesc->cap & SANE_CAP_SOFT_SELECT) == 0)) { | 96 | if ((old != m_checked) && ((m_optDesc->cap & SANE_CAP_SOFT_SELECT) == 0)) { | ||
97 | emit buttonPressed(name(), i18n(m_optDesc->title), m_checked); | 97 | emit buttonPressed(name(), sane_i18n(m_optDesc->title), m_checked); | ||
98 | } | 98 | } | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | bool KSaneOptCheckBox::getValue(float &val) | 101 | bool KSaneOptCheckBox::getValue(float &val) | ||
102 | { | 102 | { | ||
103 | if (state() == STATE_HIDDEN) { | 103 | if (state() == STATE_HIDDEN) { | ||
104 | return false; | 104 | return false; | ||
105 | } | 105 | } | ||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |