Changeset a4ed73e
- Timestamp:
- 07/13/11 21:42:48 (12 years ago)
- Branches:
- master, qt5
- Children:
- 268d58f
- Parents:
- 6817002
- Location:
- src/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/mainwindow.cpp
r6817002 ra4ed73e 222 222 { 223 223 SettingsDialog dialog; 224 dialog.exec(); 225 226 QNetworkProxy proxy( 227 AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy, 228 AppSettings::proxyAddress(), 229 AppSettings::proxyPort(), 230 PROXY_USERNAME, 231 PROXY_PASSWD); 232 QNetworkProxy::setApplicationProxy(proxy); 224 dialog.loadDialogData(); 225 if (dialog.exec() == QDialog::Accepted) { 226 dialog.saveDialogData(); 227 QNetworkProxy proxy( 228 AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy, 229 AppSettings::proxyAddress(), 230 AppSettings::proxyPort(), 231 PROXY_USERNAME, 232 PROXY_PASSWD); 233 QNetworkProxy::setApplicationProxy(proxy); 234 } 233 235 } 234 236 -
src/gui/settingsdialog.cpp
r6817002 ra4ed73e 27 27 { 28 28 setupUi(this); 29 connect(directConnection, SIGNAL(clicked(bool)), SLOT(connectionTypeChanged(bool))); 30 } 29 31 32 33 void SettingsDialog::loadDialogData() 34 { 30 35 // deserialize dialog data 31 36 address->setText(AppSettings::proxyAddress()); 32 37 port->setValue(AppSettings::proxyPort()); 33 38 directConnection->setChecked(AppSettings::isDirectConnection()); 34 35 connect(buttonBox, SIGNAL(accepted()), SLOT(saveDialogData())); 36 connect(directConnection, SIGNAL(clicked(bool)), SLOT(connectionTypeChanged(bool))); 37 38 if(directConnection->isChecked()) 39 proxyWidget->hide(); 39 proxyWidget->setDisabled(directConnection->isChecked()); 40 40 } 41 41 42 void SettingsDialog::connectionTypeChanged(bool aState)43 {44 aState ? proxyWidget->hide() : proxyWidget->show();45 }46 42 47 43 void SettingsDialog::saveDialogData() … … 51 47 AppSettings::setProxyPort(port->value()); 52 48 AppSettings::setDirectConnection(directConnection->isChecked()); 53 54 close();55 49 } 56 50 51 52 void SettingsDialog::connectionTypeChanged(bool aState) 53 { 54 proxyWidget->setDisabled(aState); 55 } 56 57 -
src/gui/settingsdialog.h
r6817002 ra4ed73e 30 30 SettingsDialog(QWidget *aParent = NULL); 31 31 ~SettingsDialog() {} 32 void loadDialogData(); 33 void saveDialogData(); 32 34 private slots: 33 35 void connectionTypeChanged(bool aState); 34 void saveDialogData();35 36 }; 36 37 -
src/gui/settingsdialog.ui
r6817002 ra4ed73e 3 3 <class>SettingsDialog</class> 4 4 <widget class="QDialog" name="SettingsDialog"> 5 <property name="geometry"> 6 <rect> 7 <x>0</x> 8 <y>0</y> 9 <width>500</width> 10 <height>152</height> 11 </rect> 12 </property> 5 13 <property name="sizePolicy"> 6 14 <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> … … 36 44 </item> 37 45 <item> 38 <widget class="Q Widget" name="proxyWidget" native="true">46 <widget class="QFrame" name="proxyWidget"> 39 47 <layout class="QHBoxLayout" name="horizontalLayout_3"> 40 48 <item> … … 84 92 </widget> 85 93 <resources/> 86 <connections/> 94 <connections> 95 <connection> 96 <sender>buttonBox</sender> 97 <signal>accepted()</signal> 98 <receiver>SettingsDialog</receiver> 99 <slot>accept()</slot> 100 <hints> 101 <hint type="sourcelabel"> 102 <x>288</x> 103 <y>128</y> 104 </hint> 105 <hint type="destinationlabel"> 106 <x>325</x> 107 <y>147</y> 108 </hint> 109 </hints> 110 </connection> 111 <connection> 112 <sender>buttonBox</sender> 113 <signal>rejected()</signal> 114 <receiver>SettingsDialog</receiver> 115 <slot>reject()</slot> 116 <hints> 117 <hint type="sourcelabel"> 118 <x>202</x> 119 <y>130</y> 120 </hint> 121 <hint type="destinationlabel"> 122 <x>226</x> 123 <y>147</y> 124 </hint> 125 </hints> 126 </connection> 127 </connections> 87 128 </ui>
Note: See TracChangeset
for help on using the changeset viewer.