|
@@ -17,23 +17,15 @@ MainDialog::MainDialog(QWidget *parent) :
|
17
|
17
|
QStringList layouts;
|
18
|
18
|
for (int l = QLocale::Abkhazian; l <= QLocale::Shambala; ++l)
|
19
|
19
|
{
|
20
|
|
- QString name = QLocale((QLocale::Language)l).name();
|
|
20
|
+ QString name = QLocale((QLocale::Language)l).name().replace("_", "-").toLower();
|
21
|
21
|
if (!layouts.contains(name))
|
22
|
22
|
layouts.append(name);
|
23
|
23
|
}
|
24
|
24
|
layouts.sort();
|
25
|
25
|
ui->comboKeyboard->addItems(layouts);
|
26
|
|
- ui->comboKeyboard->setCurrentIndex(ui->comboKeyboard->findText("en_US"));
|
|
26
|
+ ui->comboKeyboard->lineEdit()->setText("en-us");
|
27
|
27
|
|
28
|
|
- m_rdpOptions = RdpOptionsHelper::loadAll();
|
29
|
|
- ui->lineComputer->addItem("");
|
30
|
|
- for (int i = 1; i < m_rdpOptions.size(); ++i)
|
31
|
|
- {
|
32
|
|
- RdpOptions opt = m_rdpOptions.at(i);
|
33
|
|
- ui->lineComputer->addItem(opt.host());
|
34
|
|
- }
|
35
|
|
-
|
36
|
|
- ui->lineComputer->setFocus();
|
|
28
|
+ loadAll();
|
37
|
29
|
}
|
38
|
30
|
|
39
|
31
|
MainDialog::~MainDialog()
|
|
@@ -115,7 +107,21 @@ void MainDialog::setRdpOptions(const RdpOptions &opt)
|
115
|
107
|
ui->comboExperience->setCurrentIndex((int)opt.experience());
|
116
|
108
|
ui->checkCacheBitmap->setChecked(opt.bitmapCache());
|
117
|
109
|
ui->checkAutoReconnect->setChecked(opt.autoReconnect());
|
118
|
|
- ui->comboKeyboard->setCurrentIndex(ui->comboKeyboard->findText(opt.keymap()));
|
|
110
|
+ ui->comboKeyboard->lineEdit()->setText(opt.keymap());
|
|
111
|
+}
|
|
112
|
+
|
|
113
|
+void MainDialog::loadAll()
|
|
114
|
+{
|
|
115
|
+ m_rdpOptions = RdpOptionsHelper::loadAll();
|
|
116
|
+ ui->lineComputer->clear();
|
|
117
|
+ ui->lineComputer->addItem("");
|
|
118
|
+ for (int i = 1; i < m_rdpOptions.size(); ++i)
|
|
119
|
+ {
|
|
120
|
+ RdpOptions opt = m_rdpOptions.at(i);
|
|
121
|
+ ui->lineComputer->addItem(opt.host());
|
|
122
|
+ }
|
|
123
|
+
|
|
124
|
+ ui->lineComputer->setFocus();
|
119
|
125
|
}
|
120
|
126
|
|
121
|
127
|
void MainDialog::on_btnConnect_clicked()
|
|
@@ -155,6 +161,7 @@ void MainDialog::on_slidResolution_valueChanged(int value)
|
155
|
161
|
void MainDialog::on_btnSaveSession_clicked()
|
156
|
162
|
{
|
157
|
163
|
RdpOptionsHelper::save(getRdpOptions());
|
|
164
|
+ loadAll();
|
158
|
165
|
}
|
159
|
166
|
|
160
|
167
|
void MainDialog::on_btnSaveAsSession_clicked()
|
|
@@ -169,5 +176,14 @@ void MainDialog::on_btnOpenSession_clicked()
|
169
|
176
|
|
170
|
177
|
void MainDialog::on_lineComputer_currentIndexChanged(int index)
|
171
|
178
|
{
|
172
|
|
- setRdpOptions(m_rdpOptions.at(index));
|
|
179
|
+ if (index >= 0 && index < m_rdpOptions.size())
|
|
180
|
+ {
|
|
181
|
+ setRdpOptions(m_rdpOptions.at(index));
|
|
182
|
+ }
|
|
183
|
+}
|
|
184
|
+
|
|
185
|
+void MainDialog::on_btnRemoveSession_clicked()
|
|
186
|
+{
|
|
187
|
+ RdpOptionsHelper::remove(getRdpOptions());
|
|
188
|
+ loadAll();
|
173
|
189
|
}
|