Changeset a4ed73e


Ignore:
Timestamp:
07/13/11 21:42:48 (10 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
268d58f
Parents:
6817002
Message:

The cancel button on the settings dialog works now (ticket #14) and the layout of the settings dialog is stable now (ticket #15).

Location:
src/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    r6817002 ra4ed73e  
    222222{
    223223    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    }
    233235}
    234236
  • src/gui/settingsdialog.cpp

    r6817002 ra4ed73e  
    2727{
    2828    setupUi(this);
     29    connect(directConnection, SIGNAL(clicked(bool)), SLOT(connectionTypeChanged(bool)));
     30}
    2931
     32
     33void SettingsDialog::loadDialogData()
     34{
    3035    // deserialize dialog data
    3136    address->setText(AppSettings::proxyAddress());
    3237    port->setValue(AppSettings::proxyPort());
    3338    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());
    4040}
    4141
    42 void SettingsDialog::connectionTypeChanged(bool aState)
    43 {
    44     aState ? proxyWidget->hide() : proxyWidget->show();
    45 }
    4642
    4743void SettingsDialog::saveDialogData()
     
    5147    AppSettings::setProxyPort(port->value());
    5248    AppSettings::setDirectConnection(directConnection->isChecked());
    53 
    54     close();
    5549}
    5650
     51
     52void SettingsDialog::connectionTypeChanged(bool aState)
     53{
     54    proxyWidget->setDisabled(aState);
     55}
     56
     57
  • src/gui/settingsdialog.h

    r6817002 ra4ed73e  
    3030    SettingsDialog(QWidget *aParent = NULL);
    3131    ~SettingsDialog() {}
     32    void loadDialogData();
     33    void saveDialogData();
    3234private slots:
    3335    void connectionTypeChanged(bool aState);
    34     void saveDialogData();
    3536};
    3637
  • src/gui/settingsdialog.ui

    r6817002 ra4ed73e  
    33 <class>SettingsDialog</class>
    44 <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>
    513  <property name="sizePolicy">
    614   <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
     
    3644      </item>
    3745      <item>
    38        <widget class="QWidget" name="proxyWidget" native="true">
     46       <widget class="QFrame" name="proxyWidget">
    3947        <layout class="QHBoxLayout" name="horizontalLayout_3">
    4048         <item>
     
    8492 </widget>
    8593 <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>
    87128</ui>
Note: See TracChangeset for help on using the changeset viewer.