Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/dialogs/kequitypriceupdateconfdlg.cpp
Context not available. | |||||
19 | 19 | | |||
---|---|---|---|---|---|
20 | #include "ui_kequitypriceupdateconfdlg.h" | 20 | #include "ui_kequitypriceupdateconfdlg.h" | ||
21 | 21 | | |||
22 | EquityPriceUpdateConfDlg::EquityPriceUpdateConfDlg(const updatingPricePolicyE policy) : ui(new Ui::EquityPriceUpdateConfDlg) | 22 | #include "dialogenums.h" | ||
23 | | ||||
24 | class EquityPriceUpdateConfDlgPrivate | ||||
25 | { | ||||
26 | Q_DISABLE_COPY(EquityPriceUpdateConfDlgPrivate) | ||||
27 | | ||||
28 | public: | ||||
29 | EquityPriceUpdateConfDlgPrivate() : | ||||
30 | ui(new Ui::EquityPriceUpdateConfDlg) | ||||
31 | { | ||||
32 | } | ||||
33 | | ||||
34 | ~EquityPriceUpdateConfDlgPrivate() | ||||
35 | { | ||||
36 | delete ui; | ||||
37 | } | ||||
38 | | ||||
39 | void updatingPricePolicyChanged(const eDialogs::UpdatePrice policy, bool toggled) | ||||
40 | { | ||||
41 | if (!toggled) | ||||
42 | return; | ||||
43 | | ||||
44 | switch(policy) { | ||||
45 | case eDialogs::UpdatePrice::All: | ||||
46 | ui->m_updateMissing->setChecked(false); | ||||
47 | ui->m_updateDownloaded->setChecked(false); | ||||
48 | ui->m_updateSource->setChecked(false); | ||||
49 | ui->m_ask->setChecked(false); | ||||
50 | break; | ||||
51 | case eDialogs::UpdatePrice::Missing: | ||||
52 | ui->m_updateAll->setChecked(false); | ||||
53 | ui->m_updateDownloaded->setChecked(false); | ||||
54 | ui->m_updateSource->setChecked(false); | ||||
55 | ui->m_ask->setChecked(false); | ||||
56 | break; | ||||
57 | case eDialogs::UpdatePrice::Downloaded: | ||||
58 | ui->m_updateAll->setChecked(false); | ||||
59 | ui->m_updateMissing->setChecked(false); | ||||
60 | ui->m_updateSource->setChecked(false); | ||||
61 | ui->m_ask->setChecked(false); | ||||
62 | break; | ||||
63 | case eDialogs::UpdatePrice::SameSource: | ||||
64 | ui->m_updateAll->setChecked(false); | ||||
65 | ui->m_updateMissing->setChecked(false); | ||||
66 | ui->m_updateDownloaded->setChecked(false); | ||||
67 | ui->m_ask->setChecked(false); | ||||
68 | break; | ||||
69 | case eDialogs::UpdatePrice::Ask: | ||||
70 | ui->m_updateAll->setChecked(false); | ||||
71 | ui->m_updateDownloaded->setChecked(false); | ||||
72 | ui->m_updateSource->setChecked(false); | ||||
73 | ui->m_updateMissing->setChecked(false); | ||||
74 | break; | ||||
75 | } | ||||
76 | m_updatingPricePolicy = policy; | ||||
77 | } | ||||
78 | | ||||
79 | Ui::EquityPriceUpdateConfDlg *ui; | ||||
80 | eDialogs::UpdatePrice m_updatingPricePolicy; | ||||
81 | }; | ||||
82 | | ||||
83 | EquityPriceUpdateConfDlg::EquityPriceUpdateConfDlg(eDialogs::UpdatePrice policy) : | ||||
84 | QDialog(nullptr), | ||||
85 | d_ptr(new EquityPriceUpdateConfDlgPrivate) | ||||
23 | { | 86 | { | ||
24 | ui->setupUi(this); | 87 | Q_D(EquityPriceUpdateConfDlg); | ||
88 | d->ui->setupUi(this); | ||||
25 | switch(policy) { | 89 | switch(policy) { | ||
26 | case eUpdateAllPrices: | 90 | case eDialogs::UpdatePrice::All: | ||
27 | ui->m_updateAll->setChecked(true); | 91 | d->ui->m_updateAll->setChecked(true); | ||
28 | break; | | |||
29 | case eUpdateMissingPrices: | | |||
30 | ui->m_updateMissing->setChecked(true); | | |||
31 | break; | 92 | break; | ||
32 | case eUpdateDownloadedPrices: | 93 | case eDialogs::UpdatePrice::Missing: | ||
33 | ui->m_updateDownloaded->setChecked(true); | 94 | d->ui->m_updateMissing->setChecked(true); | ||
34 | break; | 95 | break; | ||
35 | case eUpdateSameSourcePrices: | 96 | case eDialogs::UpdatePrice::Downloaded: | ||
36 | ui->m_updateSource->setChecked(true); | 97 | d->ui->m_updateDownloaded->setChecked(true); | ||
37 | break; | 98 | break; | ||
38 | case eAsk: | 99 | case eDialogs::UpdatePrice::SameSource: | ||
39 | ui->m_ask->setChecked(true); | 100 | d->ui->m_updateSource->setChecked(true); | ||
40 | break; | 101 | break; | ||
41 | default: | 102 | case eDialogs::UpdatePrice::Ask: | ||
103 | d->ui->m_ask->setChecked(true); | ||||
42 | break; | 104 | break; | ||
43 | } | 105 | } | ||
44 | 106 | | |||
45 | m_updatingPricePolicy = policy; | 107 | d->m_updatingPricePolicy = policy; | ||
46 | connect(ui->m_updateAll, &QAbstractButton::toggled, this, &EquityPriceUpdateConfDlg::updateAllToggled); | 108 | connect(d->ui->m_updateAll, &QAbstractButton::toggled, this, &EquityPriceUpdateConfDlg::updateAllToggled); | ||
47 | connect(ui->m_updateMissing, &QAbstractButton::toggled, this, &EquityPriceUpdateConfDlg::updateMissingToggled); | 109 | connect(d->ui->m_updateMissing, &QAbstractButton::toggled, this, &EquityPriceUpdateConfDlg::updateMissingToggled); | ||
48 | connect(ui->m_updateDownloaded, &QAbstractButton::toggled, this, &EquityPriceUpdateConfDlg::updateDownloadedToggled); | 110 | connect(d->ui->m_updateDownloaded, &QAbstractButton::toggled, this, &EquityPriceUpdateConfDlg::updateDownloadedToggled); | ||
49 | connect(ui->m_updateSource, &QAbstractButton::toggled, this, &EquityPriceUpdateConfDlg::updateSameSourceToggled); | 111 | connect(d->ui->m_updateSource, &QAbstractButton::toggled, this, &EquityPriceUpdateConfDlg::updateSameSourceToggled); | ||
50 | connect(ui->m_ask, &QAbstractButton::toggled, this, &EquityPriceUpdateConfDlg::askToggled); | 112 | connect(d->ui->m_ask, &QAbstractButton::toggled, this, &EquityPriceUpdateConfDlg::askToggled); | ||
51 | } | 113 | } | ||
52 | 114 | | |||
53 | EquityPriceUpdateConfDlg::~EquityPriceUpdateConfDlg() | 115 | EquityPriceUpdateConfDlg::~EquityPriceUpdateConfDlg() | ||
54 | { | 116 | { | ||
55 | delete ui; | 117 | Q_D(EquityPriceUpdateConfDlg); | ||
118 | delete d; | ||||
56 | } | 119 | } | ||
57 | 120 | | |||
58 | void EquityPriceUpdateConfDlg::updateAllToggled(bool toggled) | 121 | void EquityPriceUpdateConfDlg::updateAllToggled(bool toggled) | ||
59 | { | 122 | { | ||
60 | updatingPricePolicyChanged(eUpdateAllPrices, toggled); | 123 | Q_D(EquityPriceUpdateConfDlg); | ||
124 | d->updatingPricePolicyChanged(eDialogs::UpdatePrice::All, toggled); | ||||
61 | } | 125 | } | ||
62 | 126 | | |||
63 | void EquityPriceUpdateConfDlg::updateMissingToggled(bool toggled) | 127 | void EquityPriceUpdateConfDlg::updateMissingToggled(bool toggled) | ||
64 | { | 128 | { | ||
65 | updatingPricePolicyChanged(eUpdateMissingPrices, toggled); | 129 | Q_D(EquityPriceUpdateConfDlg); | ||
130 | d->updatingPricePolicyChanged(eDialogs::UpdatePrice::Missing, toggled); | ||||
66 | } | 131 | } | ||
67 | 132 | | |||
68 | void EquityPriceUpdateConfDlg::updateDownloadedToggled(bool toggled) | 133 | void EquityPriceUpdateConfDlg::updateDownloadedToggled(bool toggled) | ||
69 | { | 134 | { | ||
70 | updatingPricePolicyChanged(eUpdateDownloadedPrices, toggled); | 135 | Q_D(EquityPriceUpdateConfDlg); | ||
136 | d->updatingPricePolicyChanged(eDialogs::UpdatePrice::Downloaded, toggled); | ||||
71 | } | 137 | } | ||
72 | 138 | | |||
73 | void EquityPriceUpdateConfDlg::updateSameSourceToggled(bool toggled) | 139 | void EquityPriceUpdateConfDlg::updateSameSourceToggled(bool toggled) | ||
74 | { | 140 | { | ||
75 | updatingPricePolicyChanged(eUpdateSameSourcePrices, toggled); | 141 | Q_D(EquityPriceUpdateConfDlg); | ||
142 | d->updatingPricePolicyChanged(eDialogs::UpdatePrice::SameSource, toggled); | ||||
76 | } | 143 | } | ||
77 | 144 | | |||
78 | void EquityPriceUpdateConfDlg::askToggled(bool toggled) | 145 | void EquityPriceUpdateConfDlg::askToggled(bool toggled) | ||
79 | { | 146 | { | ||
80 | updatingPricePolicyChanged(eAsk, toggled); | 147 | Q_D(EquityPriceUpdateConfDlg); | ||
148 | d->updatingPricePolicyChanged(eDialogs::UpdatePrice::Ask, toggled); | ||||
81 | } | 149 | } | ||
82 | 150 | | |||
83 | updatingPricePolicyE EquityPriceUpdateConfDlg::policy() | 151 | eDialogs::UpdatePrice EquityPriceUpdateConfDlg::policy() const | ||
84 | { | 152 | { | ||
85 | return m_updatingPricePolicy; | 153 | Q_D(const EquityPriceUpdateConfDlg); | ||
86 | } | 154 | return d->m_updatingPricePolicy; | ||
87 | | ||||
88 | void EquityPriceUpdateConfDlg::updatingPricePolicyChanged(const updatingPricePolicyE policy, bool toggled) | | |||
89 | { | | |||
90 | if (!toggled) | | |||
91 | return; | | |||
92 | | ||||
93 | switch(policy) { | | |||
94 | case eUpdateAllPrices: | | |||
95 | ui->m_updateMissing->setChecked(false); | | |||
96 | ui->m_updateDownloaded->setChecked(false); | | |||
97 | ui->m_updateSource->setChecked(false); | | |||
98 | ui->m_ask->setChecked(false); | | |||
99 | break; | | |||
100 | case eUpdateMissingPrices: | | |||
101 | ui->m_updateAll->setChecked(false); | | |||
102 | ui->m_updateDownloaded->setChecked(false); | | |||
103 | ui->m_updateSource->setChecked(false); | | |||
104 | ui->m_ask->setChecked(false); | | |||
105 | break; | | |||
106 | case eUpdateDownloadedPrices: | | |||
107 | ui->m_updateAll->setChecked(false); | | |||
108 | ui->m_updateMissing->setChecked(false); | | |||
109 | ui->m_updateSource->setChecked(false); | | |||
110 | ui->m_ask->setChecked(false); | | |||
111 | break; | | |||
112 | case eUpdateSameSourcePrices: | | |||
113 | ui->m_updateAll->setChecked(false); | | |||
114 | ui->m_updateMissing->setChecked(false); | | |||
115 | ui->m_updateDownloaded->setChecked(false); | | |||
116 | ui->m_ask->setChecked(false); | | |||
117 | break; | | |||
118 | case eAsk: | | |||
119 | ui->m_updateAll->setChecked(false); | | |||
120 | ui->m_updateDownloaded->setChecked(false); | | |||
121 | ui->m_updateSource->setChecked(false); | | |||
122 | ui->m_updateMissing->setChecked(false); | | |||
123 | break; | | |||
124 | default: | | |||
125 | break; | | |||
126 | } | | |||
127 | m_updatingPricePolicy = policy; | | |||
128 | } | 155 | } | ||
Context not available. |