Changeset 14393
- Timestamp:
- Dec 21, 2014, 11:46:31 PM (8 years ago)
- Location:
- trunk/qt
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt/CMakeLists.txt
r14391 r14393 104 104 details.ui 105 105 mainwin.ui 106 session-dialog.ui 106 107 stats-dialog.ui 107 108 ) -
trunk/qt/qtr.pro
r14391 r14393 49 49 FORMS += details.ui \ 50 50 mainwin.ui \ 51 session-dialog.ui \ 51 52 stats-dialog.ui 52 53 RESOURCES += application.qrc -
trunk/qt/session-dialog.cc
r14377 r14393 8 8 */ 9 9 10 #include <QCheckBox>11 #include <QDialogButtonBox>12 #include <QLabel>13 #include <QLineEdit>14 #include <QRadioButton>15 #include <QSpinBox>16 #include <QVBoxLayout>17 18 #include "hig.h"19 10 #include "prefs.h" 20 11 #include "session.h" … … 28 19 SessionDialog::onAccepted () 29 20 { 30 myPrefs.set (Prefs::SESSION_IS_REMOTE, myRemoteRadioButton->isChecked ());31 myPrefs.set (Prefs::SESSION_REMOTE_HOST, myHostLineEdit->text ());32 myPrefs.set (Prefs::SESSION_REMOTE_PORT, myPortSpinBox->value ());33 myPrefs.set (Prefs::SESSION_REMOTE_AUTH, myAuthCheckBox->isChecked ());34 myPrefs.set (Prefs::SESSION_REMOTE_USERNAME, myUsernameLineEdit->text ());35 myPrefs.set (Prefs::SESSION_REMOTE_PASSWORD, myPasswordLineEdit->text ());21 myPrefs.set (Prefs::SESSION_IS_REMOTE, ui.remoteSessionRadio->isChecked ()); 22 myPrefs.set (Prefs::SESSION_REMOTE_HOST, ui.hostEdit->text ()); 23 myPrefs.set (Prefs::SESSION_REMOTE_PORT, ui.portSpin->value ()); 24 myPrefs.set (Prefs::SESSION_REMOTE_AUTH, ui.authCheck->isChecked ()); 25 myPrefs.set (Prefs::SESSION_REMOTE_USERNAME, ui.usernameEdit->text ()); 26 myPrefs.set (Prefs::SESSION_REMOTE_PASSWORD, ui.passwordEdit->text ()); 36 27 mySession.restart (); 37 28 hide (); … … 41 32 SessionDialog::resensitize () 42 33 { 43 const bool isRemote = myRemoteRadioButton->isChecked();44 const bool useAuth = myAuthCheckBox->isChecked();34 const bool isRemote = ui.remoteSessionRadio->isChecked (); 35 const bool useAuth = ui.authCheck->isChecked (); 45 36 46 37 foreach (QWidget * w, myRemoteWidgets) … … 60 51 myPrefs (prefs) 61 52 { 62 QWidget * l; 63 QSpinBox * sb; 64 QCheckBox * cb; 65 QLineEdit * le; 66 QRadioButton * rb; 53 ui.setupUi (this); 67 54 68 setWindowTitle (tr ("Change Session")); 69 QVBoxLayout * top = new QVBoxLayout (this); 70 top->setSpacing (HIG::PAD); 55 ui.localSessionRadio->setChecked (!prefs.get<bool> (Prefs::SESSION_IS_REMOTE)); 56 connect (ui.localSessionRadio, SIGNAL (toggled (bool)), this, SLOT (resensitize ())); 71 57 72 HIG * hig = new HIG; 73 hig->setContentsMargins (0, 0, 0, 0); 74 hig->addSectionTitle (tr ("Source")); 75 rb = new QRadioButton (tr ("Start &Local Session")); 76 rb->setChecked (!prefs.get<bool>(Prefs::SESSION_IS_REMOTE)); 77 connect (rb, SIGNAL(toggled(bool)), this, SLOT(resensitize())); 78 hig->addWideControl (rb); 79 rb = myRemoteRadioButton = new QRadioButton (tr ("Connect to &Remote Session")); 80 rb->setChecked (prefs.get<bool>(Prefs::SESSION_IS_REMOTE)); 81 connect (rb, SIGNAL(toggled(bool)), this, SLOT(resensitize())); 82 hig->addWideControl (rb); 83 le = myHostLineEdit = new QLineEdit (); 84 le->setText (prefs.get<QString>(Prefs::SESSION_REMOTE_HOST)); 85 l = hig->addRow (tr ("&Host:"), le); 86 myRemoteWidgets << l << le; 87 sb = myPortSpinBox = new QSpinBox; 88 sb->setRange (1, 65535); 89 sb->setValue (prefs.get<int>(Prefs::SESSION_REMOTE_PORT)); 90 l = hig->addRow (tr ("&Port:"), sb); 91 myRemoteWidgets << l << sb; 92 cb = myAuthCheckBox = new QCheckBox (tr ("&Authentication required")); 93 cb->setChecked (prefs.get<bool>(Prefs::SESSION_REMOTE_AUTH)); 94 connect (cb, SIGNAL(toggled(bool)), this, SLOT(resensitize())); 95 myRemoteWidgets << cb; 96 hig->addWideControl (cb); 97 le = myUsernameLineEdit = new QLineEdit (); 98 le->setText (prefs.get<QString>(Prefs::SESSION_REMOTE_USERNAME)); 99 l = hig->addRow (tr ("&Username:"), le); 100 myAuthWidgets << l << le; 101 le = myPasswordLineEdit = new QLineEdit (); 102 le->setEchoMode (QLineEdit::Password); 103 le->setText (prefs.get<QString>(Prefs::SESSION_REMOTE_PASSWORD)); 104 l = hig->addRow (tr ("Pass&word:"), le); 105 myAuthWidgets << l << le; 106 hig->finish (); 107 top->addWidget (hig, 1); 58 ui.remoteSessionRadio->setChecked (prefs.get<bool> (Prefs::SESSION_IS_REMOTE)); 59 connect (ui.remoteSessionRadio, SIGNAL (toggled (bool)), this, SLOT (resensitize ())); 60 61 ui.hostEdit->setText (prefs.get<QString> (Prefs::SESSION_REMOTE_HOST)); 62 myRemoteWidgets << ui.hostLabel << ui.hostEdit; 63 64 ui.portSpin->setValue (prefs.get<int> (Prefs::SESSION_REMOTE_PORT)); 65 myRemoteWidgets << ui.portLabel << ui.portSpin; 66 67 ui.authCheck->setChecked (prefs.get<bool> (Prefs::SESSION_REMOTE_AUTH)); 68 connect (ui.authCheck, SIGNAL (toggled (bool)), this, SLOT (resensitize ())); 69 myRemoteWidgets << ui.authCheck; 70 71 ui.usernameEdit->setText (prefs.get<QString> (Prefs::SESSION_REMOTE_USERNAME)); 72 myAuthWidgets << ui.usernameLabel << ui.usernameEdit; 73 74 ui.passwordEdit->setText (prefs.get<QString> (Prefs::SESSION_REMOTE_PASSWORD)); 75 myAuthWidgets << ui.passwordLabel << ui.passwordEdit; 76 108 77 resensitize (); 109 78 110 QDialogButtonBox * buttons = new QDialogButtonBox (QDialogButtonBox::Cancel|QDialogButtonBox::Ok); 111 connect (buttons, SIGNAL(rejected()), this, SLOT(hide())); 112 connect (buttons, SIGNAL(accepted()), this, SLOT(onAccepted())); 113 top->addWidget (buttons, 0); 79 connect (ui.dialogButtons, SIGNAL (rejected ()), this, SLOT (hide ())); 80 connect (ui.dialogButtons, SIGNAL (accepted ()), this, SLOT (onAccepted ())); 114 81 } -
trunk/qt/session-dialog.h
r14241 r14393 14 14 #include <QWidgetList> 15 15 16 #include "ui_session-dialog.h" 17 16 18 class Prefs; 17 19 class Session; 18 class QCheckBox;19 class QLineEdit;20 class QRadioButton;21 class QSpinBox;22 20 23 21 class SessionDialog: public QDialog … … 34 32 35 33 private: 36 QCheckBox * myAuthCheckBox;37 QRadioButton * myRemoteRadioButton;38 QLineEdit * myHostLineEdit;39 QSpinBox * myPortSpinBox;40 QLineEdit * myUsernameLineEdit;41 QLineEdit * myPasswordLineEdit;42 QCheckBox * myAutomaticCheckBox;43 44 private:45 34 Session& mySession; 46 35 Prefs& myPrefs; 36 Ui::SessionDialog ui; 47 37 QWidgetList myRemoteWidgets; 48 38 QWidgetList myAuthWidgets; -
trunk/qt/stats-dialog.cc
r14391 r14393 11 11 12 12 #include "formatter.h" 13 #include "hig.h"14 13 #include "session.h" 15 14 #include "stats-dialog.h"
Note: See TracChangeset
for help on using the changeset viewer.