diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp index fbd5041d5..c9a7bb341 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.cpp +++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -26,14 +26,14 @@ /** Constructor */ AppearancePage::AppearancePage(QWidget * parent, Qt::WFlags flags) - : QWidget(parent, flags) + : ConfigPage(parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); /* Create RshareSettings object */ _settings = new RshareSettings(); - + connect(ui.styleSheetCombo, SIGNAL(clicked()), this, SLOT(loadStyleSheet())); /* Populate combo boxes */ @@ -45,13 +45,13 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WFlags flags) foreach (QString style, QStyleFactory::keys()) { ui.cmboStyle->addItem(style, style.toLower()); } - + ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText("Default")); //loadStyleSheet("Default"); loadqss(); - + load(); - + /* Hide platform specific features */ #ifdef Q_WS_WIN @@ -66,11 +66,11 @@ AppearancePage::save(QString &errmsg) Q_UNUSED(errmsg); QString languageCode = LanguageSupport::languageCode(ui.cmboLanguage->currentText()); - + _settings->setLanguageCode(languageCode); _settings->setInterfaceStyle(ui.cmboStyle->currentText()); _settings->setSheetName(ui.styleSheetCombo->currentText()); - + /* Set to new style */ Rshare::setStyle(ui.cmboStyle->currentText()); return true; @@ -82,21 +82,21 @@ AppearancePage::save(QString &errmsg) void AppearancePage::load() { - + int index = ui.cmboLanguage->findData(_settings->getLanguageCode()); ui.cmboLanguage->setCurrentIndex(index); - + index = ui.cmboStyle->findData(Rshare::style().toLower()); ui.cmboStyle->setCurrentIndex(index); - - ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText(_settings->getSheetName())); - + + ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText(_settings->getSheetName())); + /** load saved internal styleSheet **/ //QFile file(":/qss/" + (_settings->getSheetName().toLower()) + ".qss"); - + /** load saved extern Stylesheets **/ QFile file(QApplication::applicationDirPath() + "/qss/" + (_settings->getSheetName().toLower()) + ".qss"); - + file.open(QFile::ReadOnly); QString styleSheet = QLatin1String(file.readAll()); qApp->setStyleSheet(styleSheet); @@ -112,16 +112,16 @@ void AppearancePage::loadStyleSheet(const QString &sheetName) { /** internal Stylesheets **/ //QFile file(":/qss/" + sheetName.toLower() + ".qss"); - + /** extern Stylesheets **/ QFile file(QApplication::applicationDirPath() + "/qss/" + sheetName.toLower() + ".qss"); - + file.open(QFile::ReadOnly); QString styleSheet = QLatin1String(file.readAll()); - + qApp->setStyleSheet(styleSheet); - + } void AppearancePage::loadqss() @@ -133,5 +133,5 @@ void AppearancePage::loadqss() if(st.fileName() != "." && st.fileName() != ".." && st.isFile()) ui.styleSheetCombo->addItem(st.fileName().remove(".qss")); } - -} \ No newline at end of file + +} diff --git a/retroshare-gui/src/gui/settings/AppearancePage.h b/retroshare-gui/src/gui/settings/AppearancePage.h index 35295f84c..d8a0e02cc 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.h +++ b/retroshare-gui/src/gui/settings/AppearancePage.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -29,9 +29,10 @@ #include "gui/Preferences/rsharesettings.h" #include +#include "configpage.h" #include "ui_AppearancePage.h" -class AppearancePage : public QWidget +class AppearancePage : public ConfigPage { Q_OBJECT @@ -50,11 +51,11 @@ class AppearancePage : public QWidget void on_styleSheetCombo_activated(const QString &styleSheetName); - + private: /** A RshareSettings object used for saving/loading settings */ RshareSettings* _settings; - + void loadStyleSheet(const QString &sheetName); void loadqss(); diff --git a/retroshare-gui/src/gui/settings/CryptoPage.cpp b/retroshare-gui/src/gui/settings/CryptoPage.cpp index fc6309274..dd05d9852 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.cpp +++ b/retroshare-gui/src/gui/settings/CryptoPage.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -34,7 +34,7 @@ /** Constructor */ CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags) - : QWidget(parent, flags) + : ConfigPage(parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); @@ -114,7 +114,7 @@ CryptoPage::copyPublicKey() tr("Your Public Key is copied to Clipbard, paste and send it to your" "friend via email or some other way")); QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(ui.certtextEdit->toPlainText()); + clipboard->setText(ui.certtextEdit->toPlainText()); } diff --git a/retroshare-gui/src/gui/settings/CryptoPage.h b/retroshare-gui/src/gui/settings/CryptoPage.h index b3af83201..a54a30906 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.h +++ b/retroshare-gui/src/gui/settings/CryptoPage.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -28,9 +28,10 @@ #include #include "gui/connect/ConnectFriendWizard.h" +#include "configpage.h" #include "ui_CryptoPage.h" -class CryptoPage : public QWidget +class CryptoPage : public ConfigPage { Q_OBJECT @@ -54,11 +55,11 @@ class CryptoPage : public QWidget void exportPublicKey(); - + private: /** A RshareSettings object used for saving/loading settings */ RshareSettings* _settings; - + void closeEvent (QCloseEvent * event); diff --git a/retroshare-gui/src/gui/settings/DirectoriesPage.cpp b/retroshare-gui/src/gui/settings/DirectoriesPage.cpp index c3b78ee65..37695801d 100755 --- a/retroshare-gui/src/gui/settings/DirectoriesPage.cpp +++ b/retroshare-gui/src/gui/settings/DirectoriesPage.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -27,15 +27,14 @@ #include - DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags) - : QWidget(parent, flags) + : ConfigPage(parent, flags) { ui.setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); load(); - + connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) ); connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) ); connect(ui.checkBox, SIGNAL(stateChanged(int)), this, SLOT(shareDownloadDirectory(int))); @@ -108,7 +107,7 @@ bool DirectoriesPage::save(QString &errmsg) return true; } - + /** Loads the settings for this page */ void DirectoriesPage::load() { diff --git a/retroshare-gui/src/gui/settings/DirectoriesPage.h b/retroshare-gui/src/gui/settings/DirectoriesPage.h index 3a7d0aafb..cf6c6724c 100755 --- a/retroshare-gui/src/gui/settings/DirectoriesPage.h +++ b/retroshare-gui/src/gui/settings/DirectoriesPage.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -26,17 +26,17 @@ #include #include +#include "configpage.h" +#include "ui_DirectoriesPage.h" -# include "ui_DirectoriesPage.h" - -class DirectoriesPage: public QWidget +class DirectoriesPage: public ConfigPage { Q_OBJECT public: DirectoriesPage(QWidget * parent = 0, Qt::WFlags flags = 0); // ~DirectoriesPage() {} - + /** Saves the changes on this page */ bool save(QString &errmsg); /** Loads the settings for this page */ @@ -45,7 +45,7 @@ class DirectoriesPage: public QWidget private slots: - + #ifdef TO_REMOVE void addShareDirectory(); void removeShareDirectory(); @@ -57,9 +57,9 @@ class DirectoriesPage: public QWidget void shareDownloadDirectory(int state); private: - + void closeEvent (QCloseEvent * event); - + Ui::DirectoriesPage ui; }; diff --git a/retroshare-gui/src/gui/settings/FileAssociationsPage.cpp b/retroshare-gui/src/gui/settings/FileAssociationsPage.cpp index 6122532ae..8ea1098e7 100755 --- a/retroshare-gui/src/gui/settings/FileAssociationsPage.cpp +++ b/retroshare-gui/src/gui/settings/FileAssociationsPage.cpp @@ -54,7 +54,7 @@ //============================================================================ FileAssociationsPage::FileAssociationsPage(QWidget * parent, Qt::WFlags flags) - : QWidget(parent, flags) + : ConfigPage(parent, flags) //:QFrame() { QVBoxLayout* pageLay = new QVBoxLayout(this); @@ -82,7 +82,7 @@ FileAssociationsPage::FileAssociationsPage(QWidget * parent, Qt::WFlags flags) table = new QTableWidget(5,2,this);//default 5 rows, 2 columns table->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("File type") ) ); - + table->setHorizontalHeaderItem(1, new QTableWidgetItem("Command") ); connect( table, SIGNAL( cellActivated(int, int)), this, SLOT( tableCellActivated(int, int)) ); @@ -194,7 +194,7 @@ FileAssociationsPage::load() removeAction->setEnabled(false); editAction->setEnabled(false); } - + table->selectRow(0); } @@ -255,7 +255,7 @@ FileAssociationsPage::addnew() } } } - + settings->setValue(currType, currCmd); removeAction->setEnabled(true); @@ -279,17 +279,17 @@ FileAssociationsPage::edit() QString currCmd = (titem->data(QTableWidgetItem::Type)).toString(); afad.setCommand(currCmd); afad.setFileType(currType); - + int ti = afad.exec(); if (ti==QDialog::Accepted) { currCmd = afad.resultCommand() ; titem = table->item( currentRow,1); - + titem->setData(QTableWidgetItem::Type, currCmd); - settings->setValue(currType, currCmd); + settings->setValue(currType, currCmd); } } diff --git a/retroshare-gui/src/gui/settings/FileAssociationsPage.h b/retroshare-gui/src/gui/settings/FileAssociationsPage.h index 7b5ee87ca..7b040b7cb 100755 --- a/retroshare-gui/src/gui/settings/FileAssociationsPage.h +++ b/retroshare-gui/src/gui/settings/FileAssociationsPage.h @@ -22,7 +22,7 @@ #ifndef __FileAssociationsPage__ #define __FileAssociationsPage__ -//#include "configpage.h" +#include "configpage.h" #include #include @@ -52,11 +52,11 @@ class RshareSettings; //! With this config page user can specify, what programs should be executed //! to open some types of files. Here 'type' means 'file extension'(and //! 'file extension' means 'some symbols after last dot in filename'). -class FileAssociationsPage : public QWidget +class FileAssociationsPage : public ConfigPage { Q_OBJECT -public: +public: FileAssociationsPage(QWidget * parent = 0, Qt::WFlags flags = 0); virtual ~FileAssociationsPage(); diff --git a/retroshare-gui/src/gui/settings/GeneralPage.cpp b/retroshare-gui/src/gui/settings/GeneralPage.cpp index 9ae5bf879..f279bc528 100755 --- a/retroshare-gui/src/gui/settings/GeneralPage.cpp +++ b/retroshare-gui/src/gui/settings/GeneralPage.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -26,14 +26,14 @@ /** Constructor */ GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags) -: QWidget(parent, flags) +: ConfigPage(parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); /* Create RshareSettings object */ _settings = new RshareSettings(); - + load(); /* Hide platform specific features */ @@ -41,7 +41,7 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags) ui.chkRunRetroshareAtSystemStartup->setVisible(false); //ui.autologincheckBox->setEnabled(false) ; //ui.autologincheckBox->setChecked(false) ; -#endif +#endif } /** Destructor */ @@ -53,30 +53,30 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags) /** Saves the changes on this page */ bool GeneralPage::save(QString &errmsg) -{ +{ _settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized()); _settings->setValue(QString::fromUtf8("doQuit"), quit()); - + _settings->setRunRetroshareOnBoot( ui.chkRunRetroshareAtSystemStartup->isChecked()); return true; } - + /** Loads the settings for this page */ void GeneralPage::load() -{ +{ ui.chkRunRetroshareAtSystemStartup->setChecked( _settings->runRetroshareOnBoot()); - + ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool()); ui.checkQuit->setChecked(_settings->value(QString::fromUtf8("doQuit"), false).toBool()); - + } - + bool GeneralPage::quit() const { if(ui.checkQuit->isChecked()) return true; return ui.checkQuit->isChecked(); diff --git a/retroshare-gui/src/gui/settings/GeneralPage.h b/retroshare-gui/src/gui/settings/GeneralPage.h index dac2105c5..416e5117f 100755 --- a/retroshare-gui/src/gui/settings/GeneralPage.h +++ b/retroshare-gui/src/gui/settings/GeneralPage.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -29,17 +29,18 @@ #include "gui/Preferences/rsharesettings.h" +#include "configpage.h" #include "ui_GeneralPage.h" -class GeneralPage : public QWidget +class GeneralPage : public ConfigPage { Q_OBJECT public: /** Default Constructor */ GeneralPage(QWidget * parent = 0, Qt::WFlags flags = 0); - /** Default Destructor */ + /** Default Destructor */ ~GeneralPage() {} /** Saves the changes on this page */ @@ -54,13 +55,13 @@ private slots: /** Called when the "show on startup" checkbox is toggled. */ void toggleShowOnStartup(bool checked); - + private: /** A RetroShare Settings object used for saving/loading settings */ RshareSettings *_settings; - - + + /** Qt Designer generated object */ Ui::GeneralPage ui; }; diff --git a/retroshare-gui/src/gui/settings/NetworkPage.cpp b/retroshare-gui/src/gui/settings/NetworkPage.cpp index 5209ec2bb..10c855c8e 100755 --- a/retroshare-gui/src/gui/settings/NetworkPage.cpp +++ b/retroshare-gui/src/gui/settings/NetworkPage.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -23,7 +23,7 @@ #include "rshare.h" NetworkPage::NetworkPage(QWidget * parent, Qt::WFlags flags) - : QWidget(parent, flags) + : ConfigPage(parent, flags) { ui.setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); @@ -41,9 +41,9 @@ NetworkPage::closeEvent (QCloseEvent * event) bool NetworkPage::save(QString &errmsg) { - + return true; } - + /** Loads the settings for this page */ void NetworkPage::load() diff --git a/retroshare-gui/src/gui/settings/NetworkPage.h b/retroshare-gui/src/gui/settings/NetworkPage.h index a3b576e06..6ed27a812 100755 --- a/retroshare-gui/src/gui/settings/NetworkPage.h +++ b/retroshare-gui/src/gui/settings/NetworkPage.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -23,23 +23,25 @@ #define NETWORKPAGE_H #include + +#include "configpage.h" #include "ui_NetworkPage.h" -class NetworkPage: public QWidget +class NetworkPage : public ConfigPage { public: NetworkPage(QWidget * parent = 0, Qt::WFlags flags = 0); ~NetworkPage() {} - + /** Saves the changes on this page */ bool save(QString &errmsg); /** Loads the settings for this page */ void load(); private: - + void closeEvent (QCloseEvent * event); - + Ui::NetworkPage ui; }; diff --git a/retroshare-gui/src/gui/settings/NotifyPage.cpp b/retroshare-gui/src/gui/settings/NotifyPage.cpp index 92d993099..e8872dd94 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.cpp +++ b/retroshare-gui/src/gui/settings/NotifyPage.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -32,13 +32,13 @@ /** Constructor */ NotifyPage::NotifyPage(QWidget * parent, Qt::WFlags flags) - : QWidget(parent, flags) + : ConfigPage(parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); setWindowTitle(windowTitle() + QLatin1String(" - Notify")); - + /* Create RshareSettings object */ _settings = new RshareSettings(); diff --git a/retroshare-gui/src/gui/settings/NotifyPage.h b/retroshare-gui/src/gui/settings/NotifyPage.h index 88af73d4c..46b835f4d 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.h +++ b/retroshare-gui/src/gui/settings/NotifyPage.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -27,13 +27,13 @@ #include "gui/Preferences/rsharesettings.h" - +#include "configpage.h" #include "ui_NotifyPage.h" -class NotifyPage : public QWidget +class NotifyPage : public ConfigPage { Q_OBJECT - + public: /** Default Constructor */ NotifyPage(QWidget * parent = 0, Qt::WFlags flags = 0); @@ -51,9 +51,9 @@ class NotifyPage : public QWidget private slots: private: - + void closeEvent (QCloseEvent * event); - + /** A RshareSettings object used for saving/loading settings */ RshareSettings* _settings; diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index 8c50acb66..a8f9133b0 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -33,7 +33,7 @@ #include ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags) - : QWidget(parent, flags) + : ConfigPage(parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); @@ -154,7 +154,7 @@ void ServerPage::load() toggleUPnP(); - + /* Addresses must be set here - otherwise can't edit it */ /* set local address */ @@ -262,7 +262,7 @@ void ServerPage::updateStatus() ui.netStatusBox->setText(QString::fromStdString(out.str())); ui.netStatusBox ->setReadOnly(true); -#endif +#endif diff --git a/retroshare-gui/src/gui/settings/ServerPage.h b/retroshare-gui/src/gui/settings/ServerPage.h index 5535edc1f..0af5a4ae4 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.h +++ b/retroshare-gui/src/gui/settings/ServerPage.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -23,16 +23,18 @@ # define SERVERPAGE_H # include -# include "ui_ServerPage.h" -class ServerPage: public QWidget +#include "configpage.h" +#include "ui_ServerPage.h" + +class ServerPage: public ConfigPage { Q_OBJECT public: ServerPage(QWidget * parent = 0, Qt::WFlags flags = 0); ~ServerPage() {} - + /** Saves the changes on this page */ bool save(QString &errmsg); /** Loads the settings for this page */ @@ -45,13 +47,13 @@ private slots: void saveAddresses(); void toggleUPnP(); void toggleIpDetermination(bool) ; - void showTurtleRouterDialog(); + void showTurtleRouterDialog(); private: - + void closeEvent (QCloseEvent * event); - + Ui::ServerPage ui; }; diff --git a/retroshare-gui/src/gui/settings/SoundPage.cpp b/retroshare-gui/src/gui/settings/SoundPage.cpp index 4532af674..fbd658720 100644 --- a/retroshare-gui/src/gui/settings/SoundPage.cpp +++ b/retroshare-gui/src/gui/settings/SoundPage.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -26,14 +26,14 @@ /** Constructor */ SoundPage::SoundPage(QWidget * parent, Qt::WFlags flags) - : QWidget(parent, flags) + : ConfigPage(parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); /* Create RshareSettings object */ _settings = new RshareSettings(); - + connect(ui.cmd_openFile, SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile())); connect(ui.cmd_openFile_2,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile2())); connect(ui.cmd_openFile_3,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile3())); @@ -104,7 +104,7 @@ SoundPage::load() ui.checkBoxSound_4->setChecked(_settings->value("FileRecive_Incoming",false).toBool()); ui.checkBoxSound_5->setChecked(_settings->value("FileRecive_Finished",false).toBool()); ui.checkBoxSound_6->setChecked(_settings->value("NewChatMessage",false).toBool()); - _settings->endGroup(); + _settings->endGroup(); _settings->endGroup(); } @@ -123,10 +123,10 @@ void SoundPage::on_cmd_openFile() void SoundPage::on_cmd_openFile2() { ui.txt_SoundFile2->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)")); - if(ui.txt_SoundFile2->text().isEmpty()){ + if(ui.txt_SoundFile2->text().isEmpty()){ ui.checkBoxSound_2->setChecked(false); ui.checkBoxSound_2->setEnabled(false); - } + } else ui.checkBoxSound_2->setEnabled(true); @@ -170,5 +170,5 @@ void SoundPage::on_cmd_openFile6() } else ui.checkBoxSound_6->setEnabled(true); - + } diff --git a/retroshare-gui/src/gui/settings/SoundPage.h b/retroshare-gui/src/gui/settings/SoundPage.h index 14b222e39..3d9e5c158 100644 --- a/retroshare-gui/src/gui/settings/SoundPage.h +++ b/retroshare-gui/src/gui/settings/SoundPage.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -26,15 +26,16 @@ #include +#include "configpage.h" #include "ui_SoundPage.h" -class SoundPage : public QWidget +class SoundPage : public ConfigPage { Q_OBJECT public: /** Default Constructor */ - SoundPage(QWidget * parent = 0, Qt::WFlags flags = 0); + SoundPage(QWidget * parent = 0, Qt::WFlags flags = 0); /** Default Destructor */ ~SoundPage() {} @@ -51,7 +52,7 @@ private slots: void on_cmd_openFile4(); void on_cmd_openFile5(); void on_cmd_openFile6(); - + private: /** A RshareSettings object used for saving/loading settings */ RshareSettings* _settings; diff --git a/retroshare-gui/src/gui/settings/configpage.h b/retroshare-gui/src/gui/settings/configpage.h new file mode 100644 index 000000000..0e87e505a --- /dev/null +++ b/retroshare-gui/src/gui/settings/configpage.h @@ -0,0 +1,43 @@ +/**************************************************************** + * This file is distributed under the following license: + * + * Copyright (c) 2006-2007, crypton + * Copyright (c) 2006, Matt Edman, Justin Hipple + * + * This program 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. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + ****************************************************************/ + +#ifndef _CONFIGPAGE_H +#define _CONFIGPAGE_H + +#include + + +class ConfigPage : public QWidget +{ +public: + /** Default Constructor */ + ConfigPage(QWidget *parent = 0, Qt::WFlags flags = 0) : QWidget(parent, flags) {} + + /** Pure virtual method. Subclassed pages load their config settings here. */ + virtual void load() = 0; + /** Pure virtual method. Subclassed pages save their config settings here + * and return true if everything was saved successfully. */ + virtual bool save(QString &errmsg) = 0; +}; + +#endif + diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index d8ada2349..4009c6b24 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -43,18 +43,20 @@ RSettingsWin::RSettingsWin(QWidget * parent, Qt::WFlags flags) initStackedWidget(); - connect(listWidget, SIGNAL(currentRowChanged(int)), - this, SLOT(setNewPage(int))); - + connect(listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(setNewPage(int))); connect(okButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) ); +} - +void +RSettingsWin::showWindow(int page) +{ + setNewPage(page); + QDialog::show(); } void RSettingsWin::closeEvent (QCloseEvent * event) { - QWidget::closeEvent(event); } @@ -64,8 +66,7 @@ RSettingsWin::initStackedWidget() stackedWidget->setCurrentIndex(-1); stackedWidget->removeWidget(stackedWidget->widget(0)); - stackedWidget->addWidget(new GeneralPage(false)); - stackedWidget->addWidget(new NetworkPage()); + stackedWidget->addWidget(new GeneralPage(false)); stackedWidget->addWidget(new ServerPage()); stackedWidget->addWidget(new DirectoriesPage()); stackedWidget->addWidget(new NotifyPage()); @@ -73,9 +74,8 @@ RSettingsWin::initStackedWidget() stackedWidget->addWidget(new AppearancePage()); stackedWidget->addWidget(new FileAssociationsPage() ); stackedWidget->addWidget(new SoundPage() ); - + setNewPage(General); - } void @@ -89,10 +89,6 @@ RSettingsWin::setNewPage(int page) text = tr("General"); pageicon->setPixmap(QPixmap(":/images/kcmsystem24.png")); break; - case Network: - text = tr("Network"); - pageicon->setPixmap(QPixmap(":/images/network32.png")); - break; case Directories: text = tr("Directories"); pageicon->setPixmap(QPixmap(":/images/folder_doments.png")); @@ -124,8 +120,8 @@ RSettingsWin::setNewPage(int page) default: text = tr("UnknownPage");// impossible case } - - pageName->setText(text); //tr("%1").arg( + + pageName->setText(text); stackedWidget->setCurrentIndex(page); listWidget->setCurrentRow(page); } @@ -134,53 +130,31 @@ RSettingsWin::setNewPage(int page) void RSettingsWin::saveChanges() { - bool saveOk; - QString errmsg; + bool saveOk; + QString errmsg; - GeneralPage *gp; - NetworkPage *np; - CryptoPage *cp; - ServerPage *sp; - NotifyPage *nfp; - AppearancePage *ap; - - /* Call each config page's save() method to save its data */ - int i, count = stackedWidget->count(); - for (i = 0; i < count; i++) { - QWidget *page = stackedWidget->widget(i); - if (NULL != (gp = dynamic_cast(page))) {saveOk = gp->save(errmsg);} - else - if (NULL !=(np = dynamic_cast(page))) {saveOk = np->save(errmsg);} - else - if (NULL !=(sp = dynamic_cast(page))) {saveOk = sp->save(errmsg);} - else - if (NULL !=(cp = dynamic_cast(page))) {saveOk = cp->save(errmsg);} - else - if (NULL !=(nfp = dynamic_cast(page))) {saveOk = nfp->save(errmsg);} - else if (NULL !=(ap = dynamic_cast(page))) {saveOk = ap->save(errmsg);} + /* Call each config page's save() method to save its data */ + int i, count = stackedWidget->count(); + for (i = 0; i < count; i++) { + ConfigPage *page = (ConfigPage *) stackedWidget->widget(i); + saveOk = page->save(errmsg); + if (!saveOk) { + /* Display the offending page */ + stackedWidget->setCurrentWidget(page); - if (!saveOk) { - /* Display the offending page */ - stackedWidget->setCurrentWidget(page); - - /* Show the user what went wrong */ - QMessageBox::warning(this, - tr("Error Saving Configuration"), errmsg, - QMessageBox::Ok, QMessageBox::NoButton); + /* Show the user what went wrong */ + QMessageBox::warning(this, + tr("Error Saving Configuration"), errmsg, + QMessageBox::Ok, QMessageBox::NoButton); - /* Don't process the rest of the pages */ - return; - } - } + /* Don't process the rest of the pages */ + return; + } + } + /* call to RsIface save function.... */ + //rsicontrol -> ConfigSave(); - /* call to RsIface save function.... */ - //rsicontrol -> ConfigSave(); - - QDialog::close(); + QDialog::close(); } - - - - diff --git a/retroshare-gui/src/gui/settings/rsettingswin.h b/retroshare-gui/src/gui/settings/rsettingswin.h index 3ce20d262..a63a77654 100755 --- a/retroshare-gui/src/gui/settings/rsettingswin.h +++ b/retroshare-gui/src/gui/settings/rsettingswin.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -31,22 +31,25 @@ class RSettingsWin: public QDialog, private Ui::Settings Q_OBJECT public: - enum PageType { General = 0, Network, Server, - Directories, Notify, Security, Appearance, Fileassociations, Sound }; + enum PageType { General = 0, Server, + Directories, Notify, Security, Appearance, Fileassociations, Sound }; RSettingsWin(QWidget * parent = 0, Qt::WFlags flags = 0); ~RSettingsWin() {} + void showWindow(int page); + public slots: //! Go to a specific part of the control panel. void setNewPage(int page); + private slots: + /** Called when user clicks "Save Settings" */ + void saveChanges(); + private: void closeEvent (QCloseEvent * event); void initStackedWidget(); - - /** Called when user clicks "Save Settings" */ - void saveChanges(); }; #endif // !RSETTINGSWIN_HPP_ diff --git a/retroshare-gui/src/gui/settings/settings.ui b/retroshare-gui/src/gui/settings/settings.ui index c14331320..1b1f3c62c 100755 --- a/retroshare-gui/src/gui/settings/settings.ui +++ b/retroshare-gui/src/gui/settings/settings.ui @@ -87,15 +87,6 @@ :/images/kcmsystem24.png:/images/kcmsystem24.png - - - Network - - - - :/images/network.png:/images/network.png - - Server