From: kirilma Date: Tue, 13 Apr 2010 14:20:00 +0000 (+0000) Subject: move Settings and About to Window Menu X-Git-Tag: 0.5.0~102 X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/commitdiff_plain/ad5c62fac012fe12f6c3063c08b912a8f23d901a move Settings and About to Window Menu * 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 --- diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 6a4cbed..7782d8e 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -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 diff --git a/src/gui/importschedulewidget.cpp b/src/gui/importschedulewidget.cpp index 04c606b..1ab7c7b 100644 --- a/src/gui/importschedulewidget.cpp +++ b/src/gui/importschedulewidget.cpp @@ -19,7 +19,6 @@ #include "importschedulewidget.h" #include -#include "proxysettingsdialog.h" #include #include @@ -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()); -} - diff --git a/src/gui/importschedulewidget.h b/src/gui/importschedulewidget.h index 2fb8545..6f25d22 100644 --- a/src/gui/importschedulewidget.h +++ b/src/gui/importschedulewidget.h @@ -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: diff --git a/src/gui/importschedulewidget.ui b/src/gui/importschedulewidget.ui index 4c76ed2..d8493d0 100644 --- a/src/gui/importschedulewidget.ui +++ b/src/gui/importschedulewidget.ui @@ -68,23 +68,9 @@ - - - ... - - - - :/icons/settings.png:/icons/settings.png - - - true - - - - - - - + + + 0 0 diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index ad53d9d..552224a 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -37,6 +37,7 @@ #include "daynavigatorwidget.h" #include "importschedulewidget.h" #include "mapwindow.h" +#include "settingsdialog.h" #include #include @@ -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); +} diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 4bf4e82..4309915 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -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(); diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index 94765da..bd8a4a4 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -21,7 +21,7 @@ - + 2 @@ -305,14 +305,49 @@ + + + + 0 + 0 + 903 + 25 + + + + + Menu + + + + + + + + + Settings + + + + + + :/icons/settings.png:/icons/settings.png + + + Settings + + + + + + :/icons/info.png:/icons/info.png + + + About + + - - TabWidget - QTabWidget -
tabwidget.h
- 1 -
ImportScheduleWidget QWidget diff --git a/src/gui/proxysettingsdialog.cpp b/src/gui/proxysettingsdialog.cpp deleted file mode 100644 index 844e54d..0000000 --- a/src/gui/proxysettingsdialog.cpp +++ /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 . - */ -#include "proxysettingsdialog.h" - -#include -#include - -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 index d13f9f1..0000000 --- a/src/gui/proxysettingsdialog.h +++ /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 . - */ -#ifndef PROXYSETTINGSDIALOG_H -#define PROXYSETTINGSDIALOG_H - -#include -#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 index 2b85c58..0000000 --- a/src/gui/proxysettingsdialog.ui +++ /dev/null @@ -1,106 +0,0 @@ - - ProxySettingsDialog - - - - 0 - 0 - 469 - 146 - - - - - 0 - 0 - - - - Proxy settings - - - - - - Direct connection - - - true - - - - - - - - - - Address: - - - - - - - - - - Port: - - - - - - - 9999 - - - 8080 - - - - - - - - - - Qt::Vertical - - - - 20 - 10 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - OK - - - - - - - - - - diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp new file mode 100644 index 0000000..2e47556 --- /dev/null +++ b/src/gui/settingsdialog.cpp @@ -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 . + */ +#include "settingsdialog.h" + +#include +#include + +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 index 0000000..05f8bb2 --- /dev/null +++ b/src/gui/settingsdialog.h @@ -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 . + */ +#ifndef SETTINGSDIALOG_H +#define SETTINGSDIALOG_H + +#include +#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 index 0000000..9fa249f --- /dev/null +++ b/src/gui/settingsdialog.ui @@ -0,0 +1,115 @@ + + SettingsDialog + + + + 0 + 0 + 469 + 146 + + + + + 0 + 0 + + + + Settings + + + + + + Proxy Settings + + + + + + Direct connection + + + true + + + + + + + + + + Address: + + + + + + + + + + Port: + + + + + + + 9999 + + + 8080 + + + + + + + + + + Qt::Vertical + + + + 20 + 24 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + + + + + + + + + + +