Kaynağa Gözat

ui improvement; added rdp options

tags/v0.5
Robin Thoni 8 yıl önce
ebeveyn
işleme
27b5f1700c
5 değiştirilmiş dosya ile 141 ekleme ve 35 silme
  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 Dosyayı Görüntüle

@@ -3,7 +3,6 @@
3 3
 #include <QDebug>
4 4
 #include "maindialog.h"
5 5
 #include "ui_maindialog.h"
6
-#include "rdpoptions.h"
7 6
 #include "rdesktoplauncher.h"
8 7
 
9 8
 MainDialog::MainDialog(QWidget *parent) :
@@ -22,24 +21,17 @@ MainDialog::~MainDialog()
22 21
     delete ui;
23 22
 }
24 23
 
25
-void MainDialog::on_btnConnect_clicked()
24
+RdpOptions MainDialog::getRdpOptions() const
26 25
 {
27 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 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 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 35
     int colors = ui->comboColors->currentIndex();
44 36
     RdpOptions::Colors c;
45 37
     if (colors == 0)
@@ -51,6 +43,63 @@ void MainDialog::on_btnConnect_clicked()
51 43
     else if (colors == 3)
52 44
         c = RdpOptions::HighestQuality;
53 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 103
     RDesktopLauncher launcher;
55 104
     launcher.start(opt);
56 105
 }
@@ -80,3 +129,18 @@ void MainDialog::on_slidResolution_valueChanged(int value)
80 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 Dosyayı Görüntüle

@@ -2,6 +2,7 @@
2 2
 #define MAINDIALOG_H
3 3
 
4 4
 #include <QDialog>
5
+#include "rdpoptions.h"
5 6
 
6 7
 namespace Ui {
7 8
 class MainDialog;
@@ -15,6 +16,11 @@ public:
15 16
     explicit MainDialog(QWidget *parent = 0);
16 17
     ~MainDialog();
17 18
 
19
+    RdpOptions getRdpOptions() const;
20
+
21
+public slots:
22
+    void setRdpOptions(const RdpOptions& opt);
23
+
18 24
 private slots:
19 25
     void on_btnConnect_clicked();
20 26
 
@@ -24,6 +30,12 @@ private slots:
24 30
 
25 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 39
 private:
28 40
     Ui::MainDialog *ui;
29 41
 

+ 1
- 16
maindialog.ui Dosyayı Görüntüle

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

+ 30
- 0
rdpoptions.cpp Dosyayı Görüntüle

@@ -122,6 +122,36 @@ void RdpOptions::setColors(const Colors &colors)
122 122
 {
123 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 Dosyayı Görüntüle

@@ -64,6 +64,15 @@ public:
64 64
     Colors colors() const;
65 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 76
 private:
68 77
     QString m_host;
69 78
 
@@ -71,13 +80,15 @@ private:
71 80
 
72 81
     QString m_password;
73 82
 
83
+    bool m_fullescreen;
84
+
74 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 93
     bool m_metaKeys;
83 94
 
@@ -87,7 +98,11 @@ private:
87 98
 
88 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 108
 #endif // RDPOPTIONS_H

Loading…
İptal
Kaydet