|
31 | 31 | #include <runtime/client_runmessage.h> |
32 | 32 |
|
33 | 33 | mbClientSendMessageUi::Strings::Strings() : |
34 | | - function (QStringLiteral("function")), |
35 | | - readAdrType (QStringLiteral("readAdrType")), |
36 | | - readAddress (QStringLiteral("readAddress")), |
37 | | - readFormat (QStringLiteral("readFormat")), |
38 | | - readCount (QStringLiteral("readCount")), |
39 | | - writeAdrType (QStringLiteral("writeAdrType")), |
40 | | - writeAddress (QStringLiteral("writeAddress")), |
41 | | - writeFormat (QStringLiteral("writeFormat")), |
42 | | - writeCount (QStringLiteral("writeCount")), |
43 | | - writeData (QStringLiteral("writeData")), |
44 | | - period (QStringLiteral("period")), |
45 | | - writeMaskAnd (QStringLiteral("writeMaskAnd")), |
46 | | - writeMaskOr (QStringLiteral("writeMaskOr")), |
47 | | - settings_prefix(QStringLiteral("Ui.SendMessage.")) |
| 34 | + prefix (QStringLiteral("Ui.SendMessage.")), |
| 35 | + function (prefix+QStringLiteral("function")), |
| 36 | + readAdrType (prefix+QStringLiteral("readAdrType")), |
| 37 | + readAddress (prefix+QStringLiteral("readAddress")), |
| 38 | + readFormat (prefix+QStringLiteral("readFormat")), |
| 39 | + readCount (prefix+QStringLiteral("readCount")), |
| 40 | + writeAdrType (prefix+QStringLiteral("writeAdrType")), |
| 41 | + writeAddress (prefix+QStringLiteral("writeAddress")), |
| 42 | + writeFormat (prefix+QStringLiteral("writeFormat")), |
| 43 | + writeCount (prefix+QStringLiteral("writeCount")), |
| 44 | + writeData (prefix+QStringLiteral("writeData")), |
| 45 | + period (prefix+QStringLiteral("period")), |
| 46 | + writeMaskAnd (prefix+QStringLiteral("writeMaskAnd")), |
| 47 | + writeMaskOr (prefix+QStringLiteral("writeMaskOr")), |
| 48 | + wGeometry (prefix+QStringLiteral("geometry")) |
48 | 49 | { |
49 | 50 | } |
50 | 51 |
|
@@ -181,47 +182,47 @@ MBSETTINGS mbClientSendMessageUi::cachedSettings() const |
181 | 182 | { |
182 | 183 | MBSETTINGS m; |
183 | 184 | const Strings &s = Strings::instance(); |
184 | | - const QString &prefix = s.settings_prefix; |
185 | | - |
186 | | - m[prefix+s.function ] = getCurrentFuncNum(); |
187 | | - //m[prefix+s.readAdrType ] = ui->cmbReadAdrType ->currentText(); |
188 | | - m[prefix+s.readAddress ] = ui->spReadAddress ->value (); |
189 | | - m[prefix+s.readFormat ] = ui->cmbReadFormat ->currentText(); |
190 | | - m[prefix+s.readCount ] = ui->spReadCount ->value (); |
191 | | - //m[prefix+s.writeAdrType] = ui->cmbWriteAdrType->currentText(); |
192 | | - m[prefix+s.writeAddress] = ui->spWriteAddress ->value (); |
193 | | - m[prefix+s.writeFormat ] = ui->cmbWriteFormat ->currentText(); |
194 | | - m[prefix+s.writeCount ] = ui->spWriteCount ->value (); |
195 | | - m[prefix+s.writeData ] = ui->txtWriteData ->toPlainText(); |
196 | | - m[prefix+s.period ] = ui->spPeriod ->value (); |
197 | | - m[prefix+s.writeMaskAnd] = ui->spWriteMaskAnd ->value (); |
198 | | - m[prefix+s.writeMaskOr ] = ui->spWriteMaskOr ->value (); |
| 185 | + |
| 186 | + m[s.function ] = getCurrentFuncNum(); |
| 187 | + //m[s.readAdrType ] = ui->cmbReadAdrType ->currentText(); |
| 188 | + m[s.readAddress ] = ui->spReadAddress ->value (); |
| 189 | + m[s.readFormat ] = ui->cmbReadFormat ->currentText(); |
| 190 | + m[s.readCount ] = ui->spReadCount ->value (); |
| 191 | + //m[s.writeAdrType] = ui->cmbWriteAdrType->currentText(); |
| 192 | + m[s.writeAddress] = ui->spWriteAddress ->value (); |
| 193 | + m[s.writeFormat ] = ui->cmbWriteFormat ->currentText(); |
| 194 | + m[s.writeCount ] = ui->spWriteCount ->value (); |
| 195 | + m[s.writeData ] = ui->txtWriteData ->toPlainText(); |
| 196 | + m[s.period ] = ui->spPeriod ->value (); |
| 197 | + m[s.writeMaskAnd] = ui->spWriteMaskAnd ->value (); |
| 198 | + m[s.writeMaskOr ] = ui->spWriteMaskOr ->value (); |
| 199 | + m[s.wGeometry ] = this->saveGeometry(); |
199 | 200 |
|
200 | 201 | return m; |
201 | 202 | } |
202 | 203 |
|
203 | 204 | void mbClientSendMessageUi::setCachedSettings(const MBSETTINGS &m) |
204 | 205 | { |
205 | 206 | const Strings &s = Strings::instance(); |
206 | | - const QString &prefix = s.settings_prefix; |
207 | 207 |
|
208 | 208 | MBSETTINGS::const_iterator it; |
209 | 209 | MBSETTINGS::const_iterator end = m.end(); |
210 | 210 | //bool ok; |
211 | 211 |
|
212 | | - it = m.find(prefix+s.function ); if (it != end) setCurrentFuncNum(static_cast<uint8_t>(it.value().toInt())); |
213 | | - //it = m.find(prefix+s.readAdrType ); if (it != end) ui->cmbReadAdrType ->setCurrentText(it.value().toString()); |
214 | | - it = m.find(prefix+s.readAddress ); if (it != end) ui->spReadAddress ->setValue (it.value().toInt() ); |
215 | | - it = m.find(prefix+s.readFormat ); if (it != end) ui->cmbReadFormat ->setCurrentText(it.value().toString()); |
216 | | - it = m.find(prefix+s.readCount ); if (it != end) ui->spReadCount ->setValue (it.value().toInt() ); |
217 | | - //it = m.find(prefix+s.writeAdrType); if (it != end) ui->cmbWriteAdrType->setCurrentText(it.value().toString()); |
218 | | - it = m.find(prefix+s.writeAddress); if (it != end) ui->spWriteAddress ->setValue (it.value().toInt() ); |
219 | | - it = m.find(prefix+s.writeFormat ); if (it != end) ui->cmbWriteFormat ->setCurrentText(it.value().toString()); |
220 | | - it = m.find(prefix+s.writeCount ); if (it != end) ui->spWriteCount ->setValue (it.value().toInt() ); |
221 | | - it = m.find(prefix+s.writeData ); if (it != end) ui->txtWriteData ->setPlainText (it.value().toString()); |
222 | | - it = m.find(prefix+s.period ); if (it != end) ui->spPeriod ->setValue (it.value().toInt() ); |
223 | | - it = m.find(prefix+s.writeMaskAnd); if (it != end) ui->spWriteMaskAnd ->setValue (it.value().toInt() ); |
224 | | - it = m.find(prefix+s.writeMaskOr ); if (it != end) ui->spWriteMaskOr ->setValue (it.value().toInt() ); |
| 212 | + it = m.find(s.function ); if (it != end) setCurrentFuncNum(static_cast<uint8_t>(it.value().toInt())); |
| 213 | + //it = m.find(s.readAdrType ); if (it != end) ui->cmbReadAdrType ->setCurrentText (it.value().toString()); |
| 214 | + it = m.find(s.readAddress ); if (it != end) ui->spReadAddress ->setValue (it.value().toInt() ); |
| 215 | + it = m.find(s.readFormat ); if (it != end) ui->cmbReadFormat ->setCurrentText (it.value().toString()); |
| 216 | + it = m.find(s.readCount ); if (it != end) ui->spReadCount ->setValue (it.value().toInt() ); |
| 217 | + //it = m.find(s.writeAdrType); if (it != end) ui->cmbWriteAdrType->setCurrentText (it.value().toString()); |
| 218 | + it = m.find(s.writeAddress); if (it != end) ui->spWriteAddress ->setValue (it.value().toInt() ); |
| 219 | + it = m.find(s.writeFormat ); if (it != end) ui->cmbWriteFormat ->setCurrentText (it.value().toString()); |
| 220 | + it = m.find(s.writeCount ); if (it != end) ui->spWriteCount ->setValue (it.value().toInt() ); |
| 221 | + it = m.find(s.writeData ); if (it != end) ui->txtWriteData ->setPlainText (it.value().toString()); |
| 222 | + it = m.find(s.period ); if (it != end) ui->spPeriod ->setValue (it.value().toInt() ); |
| 223 | + it = m.find(s.writeMaskAnd); if (it != end) ui->spWriteMaskAnd ->setValue (it.value().toInt() ); |
| 224 | + it = m.find(s.writeMaskOr ); if (it != end) ui->spWriteMaskOr ->setValue (it.value().toInt() ); |
| 225 | + it = m.find(s.wGeometry ); if (it != end) this ->restoreGeometry(it.value().toByteArray()); |
225 | 226 | } |
226 | 227 |
|
227 | 228 | void mbClientSendMessageUi::setProject(mbCoreProject *p) |
|
0 commit comments