move Settings and About to Window Menu
authorkirilma <kirilma@localhost>
Tue, 13 Apr 2010 14:20:00 +0000 (14:20 +0000)
committerkirilma <kirilma@localhost>
Tue, 13 Apr 2010 14:20:00 +0000 (14:20 +0000)
* remove Setting and About controls from widgets
* make instead a window menus with the corresponding actions
* rename "Proxy settings" to "Settings", placing the proxy button in a control group

13 files changed:
src/gui/gui.pro
src/gui/importschedulewidget.cpp
src/gui/importschedulewidget.h
src/gui/importschedulewidget.ui
src/gui/mainwindow.cpp
src/gui/mainwindow.h
src/gui/mainwindow.ui
src/gui/proxysettingsdialog.cpp [deleted file]
src/gui/proxysettingsdialog.h [deleted file]
src/gui/proxysettingsdialog.ui [deleted file]
src/gui/settingsdialog.cpp [new file with mode: 0644]
src/gui/settingsdialog.h [new file with mode: 0644]
src/gui/settingsdialog.ui [new file with mode: 0644]

index 6a4cbed..7782d8e 100644 (file)
@@ -45,7 +45,7 @@ FORMS += searchhead.ui \
     conflictsdialog.ui \
     tabcontainer.ui \
     mapwindow.ui \
-    proxysettingsdialog.ui
+    settingsdialog.ui
 
 HEADERS += roomstabcontainer.h \
     nowtabcontainer.h \
@@ -63,7 +63,7 @@ HEADERS += roomstabcontainer.h \
     tabwidget.h \
     tabcontainer.h \
     mapwindow.h \
-    proxysettingsdialog.h
+    settingsdialog.h
 
 SOURCES += roomstabcontainer.cpp \
     nowtabcontainer.cpp \
@@ -81,7 +81,7 @@ SOURCES += roomstabcontainer.cpp \
     tabwidget.cpp \
     tabcontainer.cpp \
     mapwindow.cpp \
-    proxysettingsdialog.cpp
+    settingsdialog.cpp
 
 #maemo { 
 #    FORMS += alarmdialog.ui
index 04c606b..1ab7c7b 100644 (file)
@@ -19,7 +19,6 @@
 #include "importschedulewidget.h"
 
 #include <schedulexmlparser.h>
-#include "proxysettingsdialog.h"
 
 #include <QDir>
 #include <QFile>
@@ -51,7 +50,6 @@ ImportScheduleWidget::ImportScheduleWidget(QWidget *aParent)
     importAction->hide();
     connect(online, SIGNAL(clicked()), SLOT(downloadSchedule()));
 
-    connect(proxySettings, SIGNAL(clicked()), SLOT(setupProxy()));
     mNetworkAccessManager = new QNetworkAccessManager(this);
     connect(mNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkQueryFinished(QNetworkReply*)));
     mNetworkAccessManager->setProxy(QNetworkProxy::applicationProxy());
@@ -118,6 +116,8 @@ void ImportScheduleWidget::downloadSchedule()
 {
     QNetworkRequest request;
     request.setUrl(QUrl(SCHEDULE_URL));
+
+    mNetworkAccessManager->setProxy(QNetworkProxy::applicationProxy());
     mNetworkAccessManager->get(request);
 }
 
@@ -126,33 +126,16 @@ void ImportScheduleWidget::importData(const QByteArray &aData)
     browse->hide();
     online->hide();
     progressBar->show();
-    proxySettings->hide();
+    // proxySettings->hide();
 
     int confId = mXmlParser->parseData(aData);
 
     progressBar->hide();
     browse->show();
     online->show();
-    proxySettings->show();
+    // proxySettings->show();
     importScheduleLabel->setText("Import schedule: ");
 
     emit(scheduleImported(confId));
 }
 
-void ImportScheduleWidget::setupProxy()
-{
-    ProxySettingsDialog dialog;
-    dialog.exec();
-
-    qDebug() << "Setting-up proxy: " << AppSettings::proxyAddress() << ":" << AppSettings::proxyPort();
-    QNetworkProxy proxy(
-            AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
-            AppSettings::proxyAddress(),
-            AppSettings::proxyPort(),
-            PROXY_USERNAME,
-            PROXY_PASSWD);
-    QNetworkProxy::setApplicationProxy(proxy);
-
-    mNetworkAccessManager->setProxy(QNetworkProxy::applicationProxy());
-}
-
index 2fb8545..6f25d22 100644 (file)
@@ -38,7 +38,6 @@ class ImportScheduleWidget : public QWidget, Ui::ImportScheduleWidget
         void showParsingProgress(int progress);
         void networkQueryFinished(QNetworkReply *aReply);
         void downloadSchedule();
-        void setupProxy();
     signals:
         void scheduleImported(int confId);
     private:
index 4c76ed2..d8493d0 100644 (file)
       </widget>
      </item>
      <item>
-      <widget class="QToolButton" name="proxySettings" >
-       <property name="text" >
-        <string>...</string>
-       </property>
-       <property name="icon" >
-        <iconset resource="../icons.qrc" >
-         <normaloff>:/icons/settings.png</normaloff>:/icons/settings.png</iconset>
-       </property>
-       <property name="autoRaise" >
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="browse" >
-       <property name="sizePolicy" >
-        <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+      <widget class="QPushButton" name="browse">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
index ad53d9d..552224a 100644 (file)
@@ -37,6 +37,7 @@
 #include "daynavigatorwidget.h"
 #include "importschedulewidget.h"
 #include "mapwindow.h"
+#include "settingsdialog.h"
 
 #include <tabcontainer.h>
 #include <appsettings.h>
@@ -85,7 +86,8 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent)
     // event conference map button clicked
     connect(showMapButton, SIGNAL(clicked()), SLOT(conferenceMapClicked()));
 
-    connect(tabWidget, SIGNAL(infoIconClicked()), SLOT(aboutApp()));
+    connect(aboutAction, SIGNAL(triggered()), SLOT(aboutApp()));
+    connect(settingsAction, SIGNAL(triggered()), SLOT(setup()));
 
     selectConference->setDuplicatesEnabled(false);
     int confCount = Conference::getAll().count();
@@ -231,3 +233,17 @@ void MainWindow::conferenceChanged(int aIndex)
     setWindowTitle(Conference::getById(Conference::activeConference()).title());
 }
 
+void MainWindow::setup()
+{
+    SettingsDialog dialog;
+    dialog.exec();
+
+    qDebug() << "Setting-up proxy: " << AppSettings::proxyAddress() << ":" << AppSettings::proxyPort();
+    QNetworkProxy proxy(
+            AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
+            AppSettings::proxyAddress(),
+            AppSettings::proxyPort(),
+            PROXY_USERNAME,
+            PROXY_PASSWD);
+    QNetworkProxy::setApplicationProxy(proxy);
+}
index 4bf4e82..4309915 100644 (file)
@@ -37,6 +37,7 @@ private slots:
     void conferenceMapClicked();
     void eventHasChanged(int aEventId, bool aReloadModel);
     void conferenceChanged(int aIndex);
+    void setup();
 private:
     void fillAndShowConferenceHeader();
     void initTabs();
index 94765da..bd8a4a4 100644 (file)
@@ -21,7 +21,7 @@
   <widget class="QWidget" name="centralwidget" >
    <layout class="QGridLayout" name="gridLayout" >
     <item row="0" column="0" >
-     <widget class="TabWidget" name="tabWidget" >
+     <widget class="QTabWidget" name="tabWidget" >
       <property name="currentIndex" >
        <number>2</number>
       </property>
    </layout>
   </widget>
   <widget class="QStatusBar" name="statusbar" />
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>903</width>
+     <height>25</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuMenu">
+    <property name="title">
+     <string>Menu</string>
+    </property>
+    <addaction name="settingsAction"/>
+    <addaction name="aboutAction"/>
+   </widget>
+   <addaction name="menuMenu"/>
+  </widget>
+  <action name="actionSettings">
+   <property name="text">
+    <string>Settings</string>
+   </property>
+  </action>
+  <action name="settingsAction">
+   <property name="icon">
+    <iconset resource="../icons.qrc">
+     <normaloff>:/icons/settings.png</normaloff>:/icons/settings.png</iconset>
+   </property>
+   <property name="text">
+    <string>Settings</string>
+   </property>
+  </action>
+  <action name="aboutAction">
+   <property name="icon">
+    <iconset resource="../icons.qrc">
+     <normaloff>:/icons/info.png</normaloff>:/icons/info.png</iconset>
+   </property>
+   <property name="text">
+    <string>About</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
-  <customwidget>
-   <class>TabWidget</class>
-   <extends>QTabWidget</extends>
-   <header>tabwidget.h</header>
-   <container>1</container>
-  </customwidget>
   <customwidget>
    <class>ImportScheduleWidget</class>
    <extends>QWidget</extends>
diff --git a/src/gui/proxysettingsdialog.cpp b/src/gui/proxysettingsdialog.cpp
deleted file mode 100644 (file)
index 844e54d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2010 Ixonos Plc.
- *
- * This file is part of fosdem-schedule.
- *
- * fosdem-schedule is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 2 of the License, or (at your option)
- * any later version.
- *
- * fosdem-schedule is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * fosdem-schedule.  If not, see <http://www.gnu.org/licenses/>.
- */
-#include "proxysettingsdialog.h"
-
-#include <appsettings.h>
-#include <QDebug>
-
-ProxySettingsDialog::ProxySettingsDialog(QWidget *aParent)
-    : QDialog(aParent)
-{
-    setupUi(this);
-
-    // deserialize dialog data
-    address->setText(AppSettings::proxyAddress());
-    port->setValue(AppSettings::proxyPort());
-    directConnection->setChecked(AppSettings::isDirectConnection());
-
-    connect(okButton, SIGNAL(clicked()), SLOT(saveDialogData()));
-    connect(directConnection, SIGNAL(clicked(bool)), SLOT(connectionTypeChanged(bool)));
-
-    if(directConnection->isChecked())
-        proxyWidget->hide();
-}
-
-void ProxySettingsDialog::connectionTypeChanged(bool aState)
-{
-    aState ? proxyWidget->hide() : proxyWidget->show();
-}
-
-void ProxySettingsDialog::saveDialogData()
-{
-    // serialize dialog data
-    AppSettings::setProxyAddress(address->text());
-    AppSettings::setProxyPort(port->value());
-    AppSettings::setDirectConnection(directConnection->isChecked());
-
-    close();
-}
-
diff --git a/src/gui/proxysettingsdialog.h b/src/gui/proxysettingsdialog.h
deleted file mode 100644 (file)
index d13f9f1..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2010 Ixonos Plc.
- *
- * This file is part of fosdem-schedule.
- *
- * fosdem-schedule is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 2 of the License, or (at your option)
- * any later version.
- *
- * fosdem-schedule is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * fosdem-schedule.  If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef PROXYSETTINGSDIALOG_H
-#define PROXYSETTINGSDIALOG_H
-
-#include <QDialog>
-#include "ui_proxysettingsdialog.h"
-
-class ProxySettingsDialog : public QDialog, Ui::ProxySettingsDialog
-{
-    Q_OBJECT
-public:
-    ProxySettingsDialog(QWidget *aParent = NULL);
-    ~ProxySettingsDialog() {}
-private slots:
-    void connectionTypeChanged(bool aState);
-    void saveDialogData();
-};
-
-#endif /* PROXYSETTINGSDIALOG_H */  
-
diff --git a/src/gui/proxysettingsdialog.ui b/src/gui/proxysettingsdialog.ui
deleted file mode 100644 (file)
index 2b85c58..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-<ui version="4.0" >
- <class>ProxySettingsDialog</class>
- <widget class="QDialog" name="ProxySettingsDialog" >
-  <property name="geometry" >
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>469</width>
-    <height>146</height>
-   </rect>
-  </property>
-  <property name="sizePolicy" >
-   <sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle" >
-   <string>Proxy settings</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout" >
-   <item>
-    <widget class="QCheckBox" name="directConnection" >
-     <property name="text" >
-      <string>Direct connection</string>
-     </property>
-     <property name="checked" >
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QWidget" native="1" name="proxyWidget" >
-     <layout class="QHBoxLayout" name="horizontalLayout_3" >
-      <item>
-       <widget class="QLabel" name="label" >
-        <property name="text" >
-         <string>Address: </string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLineEdit" name="address" />
-      </item>
-      <item>
-       <widget class="QLabel" name="label_2" >
-        <property name="text" >
-         <string>Port:</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QSpinBox" name="port" >
-        <property name="maximum" >
-         <number>9999</number>
-        </property>
-        <property name="value" >
-         <number>8080</number>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer" >
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0" >
-      <size>
-       <width>20</width>
-       <height>10</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout" >
-     <item>
-      <spacer name="horizontalSpacer" >
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0" >
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QPushButton" name="okButton" >
-       <property name="text" >
-        <string>OK</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp
new file mode 100644 (file)
index 0000000..2e47556
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Ixonos Plc.
+ *
+ * This file is part of fosdem-schedule.
+ *
+ * fosdem-schedule is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * fosdem-schedule is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * fosdem-schedule.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "settingsdialog.h"
+
+#include <appsettings.h>
+#include <QDebug>
+
+SettingsDialog::SettingsDialog(QWidget *aParent)
+    : QDialog(aParent)
+{
+    setupUi(this);
+
+    // deserialize dialog data
+    address->setText(AppSettings::proxyAddress());
+    port->setValue(AppSettings::proxyPort());
+    directConnection->setChecked(AppSettings::isDirectConnection());
+
+    connect(okButton, SIGNAL(clicked()), SLOT(saveDialogData()));
+    connect(directConnection, SIGNAL(clicked(bool)), SLOT(connectionTypeChanged(bool)));
+
+    if(directConnection->isChecked())
+        proxyWidget->hide();
+}
+
+void SettingsDialog::connectionTypeChanged(bool aState)
+{
+    aState ? proxyWidget->hide() : proxyWidget->show();
+}
+
+void SettingsDialog::saveDialogData()
+{
+    // serialize dialog data
+    AppSettings::setProxyAddress(address->text());
+    AppSettings::setProxyPort(port->value());
+    AppSettings::setDirectConnection(directConnection->isChecked());
+
+    close();
+}
+
diff --git a/src/gui/settingsdialog.h b/src/gui/settingsdialog.h
new file mode 100644 (file)
index 0000000..05f8bb2
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010 Ixonos Plc.
+ *
+ * This file is part of fosdem-schedule.
+ *
+ * fosdem-schedule is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * fosdem-schedule is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * fosdem-schedule.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include <QDialog>
+#include "ui_settingsdialog.h"
+
+class SettingsDialog : public QDialog, Ui::SettingsDialog
+{
+    Q_OBJECT
+public:
+    SettingsDialog(QWidget *aParent = NULL);
+    ~SettingsDialog() {}
+private slots:
+    void connectionTypeChanged(bool aState);
+    void saveDialogData();
+};
+
+#endif /* PROXYSETTINGSDIALOG_H */  
+
diff --git a/src/gui/settingsdialog.ui b/src/gui/settingsdialog.ui
new file mode 100644 (file)
index 0000000..9fa249f
--- /dev/null
@@ -0,0 +1,115 @@
+<ui version="4.0" >
+ <class>SettingsDialog</class>
+ <widget class="QDialog" name="SettingsDialog" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>469</width>
+    <height>146</height>
+   </rect>
+  </property>
+  <property name="sizePolicy" >
+   <sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle" >
+   <string>Settings</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout" >
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>Proxy Settings</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+    <widget class="QCheckBox" name="directConnection" >
+     <property name="text" >
+      <string>Direct connection</string>
+     </property>
+     <property name="checked" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QWidget" native="1" name="proxyWidget" >
+     <layout class="QHBoxLayout" name="horizontalLayout_3" >
+      <item>
+       <widget class="QLabel" name="label" >
+        <property name="text" >
+         <string>Address: </string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLineEdit" name="address" />
+      </item>
+      <item>
+       <widget class="QLabel" name="label_2" >
+        <property name="text" >
+         <string>Port:</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSpinBox" name="port" >
+        <property name="maximum" >
+         <number>9999</number>
+        </property>
+        <property name="value" >
+         <number>8080</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer" >
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>20</width>
+          <height>24</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout" >
+     <item>
+      <spacer name="horizontalSpacer" >
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0" >
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okButton" >
+       <property name="text" >
+        <string>OK</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>