Browse Source

ui improvement; added rdp options

tags/v0.5
Robin Thoni 9 years ago
parent
commit
27b5f1700c
5 changed files with 141 additions and 35 deletions
  1. 79
    15
      maindialog.cpp
  2. 12
    0
      maindialog.h
  3. 1
    16
      maindialog.ui
  4. 30
    0
      rdpoptions.cpp
  5. 19
    4
      rdpoptions.h

+ 79
- 15
maindialog.cpp View File

3
 #include <QDebug>
3
 #include <QDebug>
4
 #include "maindialog.h"
4
 #include "maindialog.h"
5
 #include "ui_maindialog.h"
5
 #include "ui_maindialog.h"
6
-#include "rdpoptions.h"
7
 #include "rdesktoplauncher.h"
6
 #include "rdesktoplauncher.h"
8
 
7
 
9
 MainDialog::MainDialog(QWidget *parent) :
8
 MainDialog::MainDialog(QWidget *parent) :
22
     delete ui;
21
     delete ui;
23
 }
22
 }
24
 
23
 
25
-void MainDialog::on_btnConnect_clicked()
24
+RdpOptions MainDialog::getRdpOptions() const
26
 {
25
 {
27
     RdpOptions opt;
26
     RdpOptions opt;
28
-    opt.setBitmapCache(ui->checkCacheBitmap->isChecked());
29
-    opt.setExperience((RdpOptions::Experience)ui->comboExperience->currentIndex());
30
-    opt.setFullescreen(ui->slidResolution->value() == m_resolutions.size());
31
     opt.setHost(ui->lineComputer->currentText());
27
     opt.setHost(ui->lineComputer->currentText());
32
-    int meta = ui->comboMetaKeys->currentIndex();
33
-    opt.setMetaKeys(meta == 0 || (opt.fullescreen() && meta == 2));
34
-    opt.setPassword(ui->linePassword->text());
35
-    opt.setResolution(m_resolutions.at(m_resolutions.size() - 1));
36
     opt.setUsername(ui->lineUsername->text());
28
     opt.setUsername(ui->lineUsername->text());
37
-    opt.setUseShell(ui->checkShell->isChecked());
38
-    if (opt.useShell())
39
-    {
40
-        opt.setShell(ui->lineShellPath->text());
41
-        opt.setShellWorkingDir(ui->lineShellWorkingDir->text());
42
-    }
29
+    opt.setPassword(ui->linePassword->text());
30
+    opt.setFullescreen(ui->slidResolution->value() == m_resolutions.size());
31
+    if (!opt.fullescreen())
32
+        opt.setResolution(m_resolutions.at(m_resolutions.size() - 1));
33
+    opt.setUseAllMonitors(ui->checkAllDisplays->isChecked());
34
+
43
     int colors = ui->comboColors->currentIndex();
35
     int colors = ui->comboColors->currentIndex();
44
     RdpOptions::Colors c;
36
     RdpOptions::Colors c;
45
     if (colors == 0)
37
     if (colors == 0)
51
     else if (colors == 3)
43
     else if (colors == 3)
52
         c = RdpOptions::HighestQuality;
44
         c = RdpOptions::HighestQuality;
53
     opt.setColors(c);
45
     opt.setColors(c);
46
+
47
+    opt.setFullscreenBar(ui->checkFullscreenBar->isChecked());
48
+    int meta = ui->comboMetaKeys->currentIndex();
49
+    opt.setMetaKeys(meta == 0 || (opt.fullescreen() && meta == 2));
50
+    opt.setUseShell(ui->checkShell->isChecked());
51
+    if (opt.useShell())
52
+    {
53
+        opt.setShell(ui->lineShellPath->text());
54
+        opt.setShellWorkingDir(ui->lineShellWorkingDir->text());
55
+    }
56
+    opt.setExperience((RdpOptions::Experience)ui->comboExperience->currentIndex());
57
+    opt.setBitmapCache(ui->checkCacheBitmap->isChecked());
58
+    opt.setAutoReconnect(ui->checkAutoReconnect->isChecked());
59
+    return opt;
60
+}
61
+
62
+void MainDialog::setRdpOptions(const RdpOptions &opt)
63
+{
64
+    ui->lineComputer->lineEdit()->setText(opt.host());
65
+    ui->lineUsername->setText(opt.username());
66
+    ui->linePassword->setText(opt.password());
67
+    if (opt.fullescreen())
68
+    {
69
+        ui->slidResolution->setValue(ui->slidResolution->maximum());
70
+    }
71
+    else
72
+    {
73
+
74
+    }
75
+    ui->checkAllDisplays->setChecked(opt.useAllMonitors());
76
+
77
+    int index = 0;
78
+    RdpOptions::Colors c = opt.colors();
79
+    if (c == RdpOptions::HighColor_15)
80
+        index = 0;
81
+    else if (c == RdpOptions::HighColor_16)
82
+        index = 1;
83
+    else if (c == RdpOptions::TrueColor)
84
+        index = 2;
85
+    else if (c == RdpOptions::HighestQuality)
86
+        index = 3;
87
+    ui->comboColors->setCurrentIndex(index);
88
+
89
+    ui->checkFullscreenBar->setChecked(opt.fullscreenBar());
90
+    ui->comboMetaKeys->setCurrentIndex(opt.metaKeys() ? 2 : 1);
91
+    ui->checkShell->setChecked(opt.useShell());
92
+    ui->lineShellPath->setText(opt.shell());
93
+    ui->lineShellWorkingDir->setText(opt.shellWorkingDir());
94
+    ui->comboExperience->setCurrentIndex((int)opt.experience());
95
+    ui->checkCacheBitmap->setChecked(opt.bitmapCache());
96
+    ui->checkAutoReconnect->setChecked(opt.autoReconnect());
97
+}
98
+
99
+void MainDialog::on_btnConnect_clicked()
100
+{
101
+    RdpOptions opt = getRdpOptions();
102
+
54
     RDesktopLauncher launcher;
103
     RDesktopLauncher launcher;
55
     launcher.start(opt);
104
     launcher.start(opt);
56
 }
105
 }
80
         ui->lblResolution->setText(tr("Plein écran"));
129
         ui->lblResolution->setText(tr("Plein écran"));
81
     }
130
     }
82
 }
131
 }
132
+
133
+void MainDialog::on_btnSaveSession_clicked()
134
+{
135
+
136
+}
137
+
138
+void MainDialog::on_btnSaveAsSession_clicked()
139
+{
140
+
141
+}
142
+
143
+void MainDialog::on_btnOpenSession_clicked()
144
+{
145
+
146
+}

+ 12
- 0
maindialog.h View File

2
 #define MAINDIALOG_H
2
 #define MAINDIALOG_H
3
 
3
 
4
 #include <QDialog>
4
 #include <QDialog>
5
+#include "rdpoptions.h"
5
 
6
 
6
 namespace Ui {
7
 namespace Ui {
7
 class MainDialog;
8
 class MainDialog;
15
     explicit MainDialog(QWidget *parent = 0);
16
     explicit MainDialog(QWidget *parent = 0);
16
     ~MainDialog();
17
     ~MainDialog();
17
 
18
 
19
+    RdpOptions getRdpOptions() const;
20
+
21
+public slots:
22
+    void setRdpOptions(const RdpOptions& opt);
23
+
18
 private slots:
24
 private slots:
19
     void on_btnConnect_clicked();
25
     void on_btnConnect_clicked();
20
 
26
 
24
 
30
 
25
     void on_slidResolution_valueChanged(int value);
31
     void on_slidResolution_valueChanged(int value);
26
 
32
 
33
+    void on_btnSaveSession_clicked();
34
+
35
+    void on_btnSaveAsSession_clicked();
36
+
37
+    void on_btnOpenSession_clicked();
38
+
27
 private:
39
 private:
28
     Ui::MainDialog *ui;
40
     Ui::MainDialog *ui;
29
 
41
 

+ 1
- 16
maindialog.ui View File

94
       </font>
94
       </font>
95
      </property>
95
      </property>
96
      <property name="currentIndex">
96
      <property name="currentIndex">
97
-      <number>3</number>
97
+      <number>0</number>
98
      </property>
98
      </property>
99
      <widget class="QWidget" name="tabGeneral">
99
      <widget class="QWidget" name="tabGeneral">
100
       <attribute name="title">
100
       <attribute name="title">
142
           </item>
142
           </item>
143
           <item row="4" column="1" colspan="2">
143
           <item row="4" column="1" colspan="2">
144
            <widget class="QCheckBox" name="checkSaveSession">
144
            <widget class="QCheckBox" name="checkSaveSession">
145
-            <property name="enabled">
146
-             <bool>false</bool>
147
-            </property>
148
             <property name="text">
145
             <property name="text">
149
              <string>Me permettre d'enregistrer les informations d'idenfication</string>
146
              <string>Me permettre d'enregistrer les informations d'idenfication</string>
150
             </property>
147
             </property>
204
        </item>
201
        </item>
205
        <item>
202
        <item>
206
         <widget class="QGroupBox" name="groupBox_2">
203
         <widget class="QGroupBox" name="groupBox_2">
207
-         <property name="enabled">
208
-          <bool>false</bool>
209
-         </property>
210
          <property name="title">
204
          <property name="title">
211
           <string>Paramètres de connexion</string>
205
           <string>Paramètres de connexion</string>
212
          </property>
206
          </property>
292
          <layout class="QGridLayout" name="gridLayout_3">
286
          <layout class="QGridLayout" name="gridLayout_3">
293
           <item row="3" column="1" colspan="3">
287
           <item row="3" column="1" colspan="3">
294
            <widget class="QCheckBox" name="checkAllDisplays">
288
            <widget class="QCheckBox" name="checkAllDisplays">
295
-            <property name="enabled">
296
-             <bool>false</bool>
297
-            </property>
298
             <property name="sizePolicy">
289
             <property name="sizePolicy">
299
              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
290
              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
300
               <horstretch>0</horstretch>
291
               <horstretch>0</horstretch>
475
        </item>
466
        </item>
476
        <item>
467
        <item>
477
         <widget class="QCheckBox" name="checkFullscreenBar">
468
         <widget class="QCheckBox" name="checkFullscreenBar">
478
-         <property name="enabled">
479
-          <bool>false</bool>
480
-         </property>
481
          <property name="text">
469
          <property name="text">
482
           <string>Afficher la barre de connexion en cas de mode plein écran</string>
470
           <string>Afficher la barre de connexion en cas de mode plein écran</string>
483
          </property>
471
          </property>
928
        </item>
916
        </item>
929
        <item>
917
        <item>
930
         <widget class="QCheckBox" name="checkAutoReconnect">
918
         <widget class="QCheckBox" name="checkAutoReconnect">
931
-         <property name="enabled">
932
-          <bool>false</bool>
933
-         </property>
934
          <property name="text">
919
          <property name="text">
935
           <string>Rétablir la connexion si elle est interrompue</string>
920
           <string>Rétablir la connexion si elle est interrompue</string>
936
          </property>
921
          </property>

+ 30
- 0
rdpoptions.cpp View File

122
 {
122
 {
123
     m_colors = colors;
123
     m_colors = colors;
124
 }
124
 }
125
+bool RdpOptions::useAllMonitors() const
126
+{
127
+    return m_useAllMonitors;
128
+}
129
+
130
+void RdpOptions::setUseAllMonitors(bool useAllMonitors)
131
+{
132
+    m_useAllMonitors = useAllMonitors;
133
+}
134
+bool RdpOptions::fullscreenBar() const
135
+{
136
+    return m_fullscreenBar;
137
+}
138
+
139
+void RdpOptions::setFullscreenBar(bool fullscreenBar)
140
+{
141
+    m_fullscreenBar = fullscreenBar;
142
+}
143
+bool RdpOptions::autoReconnect() const
144
+{
145
+    return m_autoReconnect;
146
+}
147
+
148
+void RdpOptions::setAutoReconnect(bool autoReconnect)
149
+{
150
+    m_autoReconnect = autoReconnect;
151
+}
152
+
153
+
154
+
125
 
155
 
126
 
156
 
127
 
157
 

+ 19
- 4
rdpoptions.h View File

64
     Colors colors() const;
64
     Colors colors() const;
65
     void setColors(const Colors &colors);
65
     void setColors(const Colors &colors);
66
 
66
 
67
+    bool useAllMonitors() const;
68
+    void setUseAllMonitors(bool useAllMonitors);
69
+
70
+    bool fullscreenBar() const;
71
+    void setFullscreenBar(bool fullscreenBar);
72
+
73
+    bool autoReconnect() const;
74
+    void setAutoReconnect(bool autoReconnect);
75
+
67
 private:
76
 private:
68
     QString m_host;
77
     QString m_host;
69
 
78
 
71
 
80
 
72
     QString m_password;
81
     QString m_password;
73
 
82
 
83
+    bool m_fullescreen;
84
+
74
     QSize m_resolution;
85
     QSize m_resolution;
75
 
86
 
76
-    bool m_fullescreen;
87
+    bool m_useAllMonitors;
77
 
88
 
78
-    Experience m_experience;
89
+    Colors m_colors;
79
 
90
 
80
-    bool m_bitmapCache;
91
+    bool m_fullscreenBar;
81
 
92
 
82
     bool m_metaKeys;
93
     bool m_metaKeys;
83
 
94
 
87
 
98
 
88
     QString m_shellWorkingDir;
99
     QString m_shellWorkingDir;
89
 
100
 
90
-    Colors m_colors;
101
+    Experience m_experience;
102
+
103
+    bool m_bitmapCache;
104
+
105
+    bool m_autoReconnect;
91
 };
106
 };
92
 
107
 
93
 #endif // RDPOPTIONS_H
108
 #endif // RDPOPTIONS_H

Loading…
Cancel
Save