diff --git a/retroshare-gui/src/gui/Preferences/AppearanceDialog.ui b/retroshare-gui/src/gui/Preferences/AppearanceDialog.ui index 9f775ec3e..0116ca0f7 100644 --- a/retroshare-gui/src/gui/Preferences/AppearanceDialog.ui +++ b/retroshare-gui/src/gui/Preferences/AppearanceDialog.ui @@ -5,8 +5,8 @@ 0 0 - 440 - 311 + 410 + 300 @@ -492,223 +492,292 @@ Qt::NoContextMenu - - - - 0 - 0 - 441 - 75 - + + + 6 - - Qt::NoContextMenu + + 6 - - Language + + 6 - - - - 10 - 44 - 341 - 26 - - - - - 0 + + 6 + + + 0 + + + 0 + + + + + + 0 + 75 + - - 6 + + Qt::NoContextMenu - - - - Qt::Horizontal + + Language + + + + + 10 + 44 + 341 + 26 + + + + + 0 - - - 300 - 16 - + + 0 - - - - - - - 150 - 0 - + + 0 - - Qt::NoContextMenu + + 0 - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + + 6 + + + 6 + + + + + Qt::Horizontal + + + + 300 + 16 + + + + + + + + + 150 + 0 + + + + Qt::NoContextMenu + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Choose the language used in RetroShare</p></body></html> - - - false - - - - 24 - 16 - - - - - - - - - - 10 - 27 - 591 - 17 - - - - Qt::NoContextMenu - - - <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Changes to language will only take effect after restarting RetroShare!</p></body></html> - - - - - - - 0 - 80 - 441 - 55 - - - - Qt::NoContextMenu - - - - - - Style - - - - - 10 - 24 - 341 - 26 - - - - - 0 + + + false + + + + 24 + 16 + + + + + + + + + + 10 + 27 + 591 + 17 + + + + Qt::NoContextMenu + + + <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Changes to language will only take effect after restarting RetroShare!</p></body></html> + + + + + + + + + 0 + 64 + - - 6 + + Qt::NoContextMenu - - - - - 150 - 0 - + + + + + Style + + + + + 10 + 24 + 341 + 26 + + + + + 0 - - Qt::NoContextMenu + + 0 - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + + 0 + + + 0 + + + 6 + + + 6 + + + + + + 150 + 0 + + + + Qt::NoContextMenu + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Choose RetroShare's interface style</p></body></html> - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 0 - 140 - 441 - 61 - - - - Style Sheet - - - - - 11 - 20 - 341 - 25 - - - - - 0 + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 0 + 64 + - - 6 + + Style Sheet - - - - Qt::Horizontal + + + + 11 + 20 + 341 + 25 + + + + + 0 - - - 181 - 20 - + + 0 - - - - - - - 150 - 0 - + + 0 - - - - - + + 0 + + + 6 + + + 6 + + + + + Qt::Horizontal + + + + 181 + 20 + + + + + + + + + 150 + 0 + + + + + + + + + + + + Qt::Vertical + + + + 361 + 61 + + + + + diff --git a/retroshare-gui/src/gui/Preferences/DirectoriesDialog.ui b/retroshare-gui/src/gui/Preferences/DirectoriesDialog.ui index 058ffa7d9..efcb7ca35 100644 --- a/retroshare-gui/src/gui/Preferences/DirectoriesDialog.ui +++ b/retroshare-gui/src/gui/Preferences/DirectoriesDialog.ui @@ -5,8 +5,8 @@ 0 0 - 456 - 356 + 452 + 349 @@ -501,197 +501,195 @@ Qt::NoContextMenu - - - - 0 - 200 - 441 - 72 - + + + 6 - - Incoming Directory + + 6 - - - - - true - - - - - - - - 31 - 31 - - - - - 31 - 31 - - - - - - - :/images/directoryselect_24x24_shadow.png - - - - 24 - 24 - - - - - - - - - - 0 - 0 - 441 - 200 - + + 6 - - Shared Directories + + 6 - - - - 10 - 20 - 381 - 171 - - - - - - - 400 - 20 - 34 - 34 - - - - - 34 - 34 - - - - - 34 - 34 - - - - - - - :/images/directoryadd_24x24_shadow.png - - - - 24 - 24 - - - - - - - 400 - 60 - 34 - 34 - - - - - 34 - 34 - - - - - 34 - 34 - - - - - - - :/images/directoryremove_24x24_shadow.png - - - - 24 - 24 - - - - - - - - 0 - 270 - 441 - 72 - + + 0 - - Partials Direcrtory + + 0 - - - - - true - - - - - - - - 31 - 31 - - - - - 31 - 31 - - - - - - - :/images/directoryselect_24x24_shadow.png - - - - 24 - 24 - - - - - - + + + + Shared Directories + + + + + + + + + + 34 + 34 + + + + + 34 + 34 + + + + + + + :/images/directoryadd_24x24_shadow.png + + + + 24 + 24 + + + + + + + + + 34 + 34 + + + + + 34 + 34 + + + + + + + :/images/directoryremove_24x24_shadow.png + + + + 24 + 24 + + + + + + + + Qt::Vertical + + + + 20 + 71 + + + + + + + + + + + Incoming Directory + + + + + + true + + + + + + + + 31 + 31 + + + + + 31 + 31 + + + + + + + :/images/directoryselect_24x24_shadow.png + + + + 24 + 24 + + + + + + + + + + + Partials Direcrtory + + + + + + true + + + + + + + + 31 + 31 + + + + + 31 + 31 + + + + + + + :/images/directoryselect_24x24_shadow.png + + + + 24 + 24 + + + + + + + + incomingDir diff --git a/retroshare-gui/src/gui/Preferences/GeneralDialog.ui b/retroshare-gui/src/gui/Preferences/GeneralDialog.ui index 7ad9b1563..b5051d04d 100644 --- a/retroshare-gui/src/gui/Preferences/GeneralDialog.ui +++ b/retroshare-gui/src/gui/Preferences/GeneralDialog.ui @@ -5,10 +5,16 @@ 0 0 - 466 - 405 + 431 + 250 + + + 0 + 64 + + @@ -492,90 +498,123 @@ Qt::NoContextMenu - - - - 0 - 0 - 441 - 61 - + + + 6 - - Login + + 6 - - - - 10 - 20 - 141 - 18 - - - - Auto Login - - - - - - - 0 - 60 - 441 - 111 - + + 6 - - Misc + + 6 - - - - 10 - 40 - 401 - 20 - - - - Show MainWindow at Startup - - - false - - - - - - 10 - 60 - 401 - 20 - - - - Start minimized - - - true - - - - - - 10 - 20 - 411 - 18 - - - - Start RetroShare when my system starts - - - + + 0 + + + 0 + + + + + + 0 + 48 + + + + Login + + + + + 10 + 20 + 141 + 18 + + + + Auto Login + + + + + + + + + 0 + 80 + + + + Misc + + + + + 10 + 40 + 401 + 20 + + + + Show MainWindow at Startup + + + false + + + + + + 10 + 60 + 401 + 20 + + + + Start minimized + + + true + + + + + + 10 + 20 + 411 + 18 + + + + Start RetroShare when my system starts + + + + + + + + Qt::Vertical + + + + 401 + 91 + + + + + diff --git a/retroshare-gui/src/gui/Preferences/NotifyDialog.ui b/retroshare-gui/src/gui/Preferences/NotifyDialog.ui index 17c692fee..a3d1570e7 100644 --- a/retroshare-gui/src/gui/Preferences/NotifyDialog.ui +++ b/retroshare-gui/src/gui/Preferences/NotifyDialog.ui @@ -5,8 +5,8 @@ 0 0 - 404 - 270 + 388 + 332 @@ -499,6 +499,18 @@ Qt::NoContextMenu + + 6 + + + 6 + + + 6 + + + 6 + @@ -509,16 +521,16 @@ 0 - 0 + 6 - 0 + 6 - 0 + 6 - 0 + 6 @@ -578,6 +590,12 @@ Popups + + 9 + + + 9 + @@ -632,6 +650,19 @@ + + + + Qt::Vertical + + + + 361 + 40 + + + + diff --git a/retroshare-gui/src/gui/Preferences/ServerDialog.cpp b/retroshare-gui/src/gui/Preferences/ServerDialog.cpp index 7c232340e..74eea2f27 100644 --- a/retroshare-gui/src/gui/Preferences/ServerDialog.cpp +++ b/retroshare-gui/src/gui/Preferences/ServerDialog.cpp @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - ****************************************************************/ - - -#include -#include "ServerDialog.h" + ****************************************************************/ + + +#include +#include "ServerDialog.h" #include #include @@ -30,14 +30,14 @@ #include - - -/** Constructor */ -ServerDialog::ServerDialog(QWidget *parent) -: ConfigPage(parent) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); + + +/** Constructor */ +ServerDialog::ServerDialog(QWidget *parent) +: ConfigPage(parent) +{ + /* Invoke the Qt Designer generated object setup routine */ + ui.setupUi(this); /* Create RshareSettings object */ _settings = new RshareSettings(); @@ -48,16 +48,19 @@ ServerDialog::ServerDialog(QWidget *parent) timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus())); timer->start(1000); + load(); + updateStatus(); - /* Hide platform specific features */ -#ifdef Q_WS_WIN - -#endif -} - -/** Saves the changes on this page */ -bool -ServerDialog::save(QString &errmsg) + + /* Hide platform specific features */ +#ifdef Q_WS_WIN + +#endif +} + +/** Saves the changes on this page */ +bool +ServerDialog::save(QString &errmsg) { /* save the server address */ diff --git a/retroshare-gui/src/gui/Preferences/ServerDialog.ui b/retroshare-gui/src/gui/Preferences/ServerDialog.ui index d40847112..3c99951ce 100644 --- a/retroshare-gui/src/gui/Preferences/ServerDialog.ui +++ b/retroshare-gui/src/gui/Preferences/ServerDialog.ui @@ -5,8 +5,8 @@ 0 0 - 636 - 418 + 409 + 373 @@ -488,6 +488,24 @@ Qt::NoContextMenu + + 6 + + + 6 + + + 6 + + + 6 + + + 0 + + + 0 + @@ -572,180 +590,214 @@ - - - - 0 - 0 - + + + 0 - - Network Configuration - - - - - - - - - - No Conectivity - - - - - - - Limited - - - - - - - Udp - - - - - - - Retroshare Server - - - - - - - - - - - UDP Connections - - - false - - - - - - - Stable External IP Addrress - - - false - - - - - - - DHT Okay - - - false - - - - - - - UPnP Active - - - false - - - - - - - TCP server - - - false - - - - - - - - - - - - - - - Local Address - - - - - - - External Address - - - - - - + + + Network Configuration + + + + + + + 0 + 0 + + + + Network Configuration + - - - - - - Port: - - - - - - - 0 - - - 65535 - - - 7812 - - + + + + + + + Local Address + + + + + + + External Address + + + + + + + + + + + + + + Port: + + + + + + + 0 + + + 65535 + + + 7812 + + + + + + + + + + Port: + + + + + + + 0 + + + 65535 + + + 7812 + + + + + + - - - - - - Port: + + + Qt::Vertical - - - - - - 0 + + + 301 + 20 + - - 65535 - - - 7812 - - + - - - - + + + + + + + Network Status + + + + + + + + + + No Conectivity + + + + + + + Limited + + + + + + + Udp + + + + + + + Retroshare Server + + + + + + + + + + + UDP Connections + + + false + + + + + + + Stable External IP Addrress + + + false + + + + + + + DHT Okay + + + false + + + + + + + UPnP Active + + + false + + + + + + + TCP server + + + false + + + + + + + + + diff --git a/retroshare-gui/src/gui/Settings/DirectoriesPage.cpp b/retroshare-gui/src/gui/Settings/DirectoriesPage.cpp index 746a7bfa8..b5b55dc5b 100644 --- a/retroshare-gui/src/gui/Settings/DirectoriesPage.cpp +++ b/retroshare-gui/src/gui/Settings/DirectoriesPage.cpp @@ -21,13 +21,21 @@ #include "DirectoriesPage.h" #include "rshare.h" +#include "rsiface/rsfiles.h" + DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags) : QWidget(parent, flags) { - ui.setupUi(this); + setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); - + + load(); + + //connect(addshareButton, SIGNAL(clicked( ) ), this , SLOT( addShareDirectory() ) ); + connect(removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) ); + connect(incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) ); + connect(partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) ); } @@ -38,17 +46,95 @@ DirectoriesPage::closeEvent (QCloseEvent * event) } -/** Saves the changes on this page */ -bool -DirectoriesPage::save(QString &errmsg) -{ - -} - -/** Loads the settings for this page */ -void -DirectoriesPage::load() -{ - -} +/** Saves the changes on this page */ +bool +DirectoriesPage::save(QString &errmsg) +{ + return true; + +} + +/** Loads the settings for this page */ +void DirectoriesPage::load() +{ + std::list::const_iterator it; + std::list dirs; + rsFiles->getSharedDirectories(dirs); + + /* get a link to the table */ + QListWidget *listWidget = dirList; + + /* remove old items ??? */ + listWidget->clear(); + + for(it = dirs.begin(); it != dirs.end(); it++) + { + /* (0) Dir Name */ + listWidget->addItem(QString::fromStdString(*it)); + } + + incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory())); + partialsDir->setText(QString::fromStdString(rsFiles->getPartialsDirectory())); + + listWidget->update(); /* update display */ + + +} + +void DirectoriesPage::on_addshareButton_clicked() +{ + + /* select a dir + */ + + + QString qdir = QFileDialog::getOpenFileName(this, tr("Add Shared Directory"),tr("All Files (*)")); + + /* add it to the server */ + std::string dir = qdir.toStdString(); + if (dir != "") + { + rsFiles->addSharedDirectory(dir); + load(); + } +} + +void DirectoriesPage::removeShareDirectory() +{ + /* id current dir */ + /* ask for removal */ + QListWidget *listWidget = dirList; + QListWidgetItem *qdir = listWidget -> currentItem(); + if (qdir) + { + rsFiles->removeSharedDirectory( qdir->text().toStdString()); + load(); + } +} + +void DirectoriesPage::setIncomingDirectory() +{ + QString qdir = QFileDialog::getExistingDirectory(this, tr("Set Incoming Directory"), "", + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + + std::string dir = qdir.toStdString(); + if (dir != "") + { + rsFiles->setDownloadDirectory(dir); + } + load(); +} + +void DirectoriesPage::setPartialsDirectory() +{ + QString qdir = QFileDialog::getExistingDirectory(this, tr("Set Partials Directory"), "", + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + + std::string dir = qdir.toStdString(); + if (dir != "") + { + rsFiles->setPartialsDirectory(dir); + } + load(); +} diff --git a/retroshare-gui/src/gui/Settings/DirectoriesPage.h b/retroshare-gui/src/gui/Settings/DirectoriesPage.h index 1f5bdf609..4915eb972 100644 --- a/retroshare-gui/src/gui/Settings/DirectoriesPage.h +++ b/retroshare-gui/src/gui/Settings/DirectoriesPage.h @@ -22,25 +22,40 @@ #ifndef DIRECTORIESPAGE_H # define DIRECTORIESPAGE_H -# include +#include +#include +#include + + # include "ui_DirectoriesPage.h" -class DirectoriesPage: public QWidget +class DirectoriesPage: public QWidget, private Ui::DirectoriesPage { + Q_OBJECT + public: DirectoriesPage(QWidget * parent = 0, Qt::WFlags flags = 0); - ~DirectoriesPage() {} + // ~DirectoriesPage() {} - /** Saves the changes on this page */ - bool save(QString &errmsg); - /** Loads the settings for this page */ + /** Saves the changes on this page */ + bool save(QString &errmsg); + /** Loads the settings for this page */ void load(); + + + private slots: + void on_addshareButton_clicked(); + void removeShareDirectory(); + void setIncomingDirectory(); + void setPartialsDirectory(); + + private: void closeEvent (QCloseEvent * event); - Ui::DirectoriesPage ui; + }; #endif // !GENERALPAGE_H diff --git a/retroshare-gui/src/gui/Settings/DirectoriesPage.ui b/retroshare-gui/src/gui/Settings/DirectoriesPage.ui index 4d6646b4e..472f6e443 100644 --- a/retroshare-gui/src/gui/Settings/DirectoriesPage.ui +++ b/retroshare-gui/src/gui/Settings/DirectoriesPage.ui @@ -5,14 +5,12 @@ 0 0 - 406 - 313 + 470 + 367 - - 7 - 7 + 0 0 @@ -503,126 +501,196 @@ Qt::NoContextMenu - - - - 10 - 60 - 381 - 200 - + + + 6 - - Shared Directories + + 6 - - - - 340 - 20 - 31 - 31 - - - - - - - :/images/directoryadd_24x24_shadow.png - - - - 24 - 24 - - - - - - - 340 - 60 - 31 - 31 - - - - - - - :/images/directoryremove_24x24_shadow.png - - - - 24 - 24 - - - - - - - 9 - 19 - 321 - 171 - - - - - - - - 10 - 0 - 381 - 61 - + + 6 - - Incoming files + + 6 - - - - 339 - 21 - 31 - 32 - - - - - - - :/images/directoryselect_24x24_shadow.png - - - - 24 - 24 - - - - - - - 11 - 26 - 321 - 23 - - - - + + 0 + + + 0 + + + + + Shared Directories + + + + + + + + + + 34 + 34 + + + + + 34 + 34 + + + + + + + :/images/directoryadd_24x24_shadow.png + + + + 24 + 24 + + + + + + + + + 34 + 34 + + + + + 34 + 34 + + + + + + + :/images/directoryremove_24x24_shadow.png + + + + 24 + 24 + + + + + + + + Qt::Vertical + + + + 20 + 71 + + + + + + + + + + + Incoming Directory + + + + + + true + + + + + + + + 31 + 31 + + + + + 31 + 31 + + + + + + + :/images/directoryselect_24x24_shadow.png + + + + 24 + 24 + + + + + + + + + + + Partials Direcrtory + + + + + + true + + + + + + + + 31 + 31 + + + + + 31 + 31 + + + + + + + :/images/directoryselect_24x24_shadow.png + + + + 24 + 24 + + + + + + + + - - lineEdit_5 - pushButton_6 - listView - pushButton - pushButton_2 - diff --git a/retroshare-gui/src/gui/Settings/GeneralPage.cpp b/retroshare-gui/src/gui/Settings/GeneralPage.cpp index 45af1f49f..fece8eb4c 100644 --- a/retroshare-gui/src/gui/Settings/GeneralPage.cpp +++ b/retroshare-gui/src/gui/Settings/GeneralPage.cpp @@ -1,7 +1,7 @@ /**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2006-2007, crypton + * 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 @@ -22,29 +22,36 @@ #include "GeneralPage.h" #include "rshare.h" +#include + +#include GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags) : QWidget(parent, flags) { ui.setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); - setWindowTitle(windowTitle() + QLatin1String(" - Gloster 2")); + setWindowTitle(windowTitle() + QLatin1String(" - General")); - //GConfig config; - //config.loadWidgetInformation(this); - /* Create RshareSettings object */ - _settings = new RshareSettings(); - - /* Populate combo boxes */ - foreach (QString code, LanguageSupport::languageCodes()) { - ui.cmboLanguage->addItem(QIcon(":/images/flags/" + code + ".png"), - LanguageSupport::languageName(code), - code); - } - foreach (QString style, QStyleFactory::keys()) { - ui.cmboStyle->addItem(style, style.toLower()); - } + /* Create RshareSettings object */ + _settings = new RshareSettings(); + + if (QSystemTrayIcon::isSystemTrayAvailable()){ + + /* Check if we are supposed to show our main window on startup */ + ui.chkShowOnStartup->setChecked(_settings->showMainWindowAtStart()); + if (ui.chkShowOnStartup->isChecked()) + show(); + } else { + /* Don't let people hide the main window, since that's all they have. */ + ui.chkShowOnStartup->hide(); + show(); + } + /* Hide platform specific features */ +#ifndef Q_WS_WIN + ui.chkRunRetroshareAtSystemStartup->setVisible(false); +#endif } void @@ -57,30 +64,40 @@ GeneralPage::closeEvent (QCloseEvent * event) } -/** Saves the changes on this page */ -bool -GeneralPage::save(QString &errmsg) -{ - Q_UNUSED(errmsg); - QString languageCode = - LanguageSupport::languageCode(ui.cmboLanguage->currentText()); - - _settings->setLanguageCode(languageCode); - _settings->setInterfaceStyle(ui.cmboStyle->currentText()); - - /* Set to new style */ - Rshare::setStyle(ui.cmboStyle->currentText()); - return true; -} - -/** Loads the settings for this page */ -void -GeneralPage::load() -{ - int index = ui.cmboLanguage->findData(_settings->getLanguageCode()); - ui.cmboLanguage->setCurrentIndex(index); - - index = ui.cmboStyle->findData(Rshare::style().toLower()); - ui.cmboStyle->setCurrentIndex(index); -} +/** Saves the changes on this page */ +bool +GeneralPage::save(QString &errmsg) +{ + Q_UNUSED(errmsg); + _settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized()); + + _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()); +} + +bool GeneralPage::startMinimized() const { + if(ui.checkStartMinimized->isChecked()) return true; + return ui.checkStartMinimized->isChecked(); +} + +/** Called when the "show on startup" checkbox is toggled. */ +void +GeneralPage::toggleShowOnStartup(bool checked) +{ + //RshareSettings _settings; + _settings->setShowMainWindowAtStart(checked); +} + diff --git a/retroshare-gui/src/gui/Settings/GeneralPage.h b/retroshare-gui/src/gui/Settings/GeneralPage.h index 6957f4bb8..3419ea84e 100644 --- a/retroshare-gui/src/gui/Settings/GeneralPage.h +++ b/retroshare-gui/src/gui/Settings/GeneralPage.h @@ -1,7 +1,7 @@ /**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2006-2007, crypton + * 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 @@ -23,10 +23,10 @@ #ifndef GENERALPAGE_H # define GENERALPAGE_H -#include +#include #include -#include "gui/Preferences/rsharesettings.h" +#include "gui/Preferences/rsharesettings.h" #include "lang/languagesupport.h" # include @@ -34,17 +34,25 @@ class GeneralPage: public QWidget { + Q_OBJECT + public: GeneralPage(QWidget * parent = 0, Qt::WFlags flags = 0); ~GeneralPage() {} - /** Saves the changes on this page */ - bool save(QString &errmsg); - /** Loads the settings for this page */ + /** Saves the changes on this page */ + bool save(QString &errmsg); + /** Loads the settings for this page */ void load(); + bool startMinimized() const; + +private slots: + + /** Called when the "show on startup" checkbox is toggled. */ + void toggleShowOnStartup(bool checked); private: - /** A VidaliaSettings object used for saving/loading settings */ + /** A VidaliaSettings object used for saving/loading settings */ RshareSettings* _settings; diff --git a/retroshare-gui/src/gui/Settings/GeneralPage.ui b/retroshare-gui/src/gui/Settings/GeneralPage.ui index cf038c283..b3277baa5 100644 --- a/retroshare-gui/src/gui/Settings/GeneralPage.ui +++ b/retroshare-gui/src/gui/Settings/GeneralPage.ui @@ -5,8 +5,8 @@ 0 0 - 400 - 364 + 430 + 296 @@ -15,168 +15,124 @@ - - - - 10 - 80 - 381 - 55 - + + + 6 - - Qt::NoContextMenu + + 6 - - + + 6 - - Style + + 6 - - - - 10 - 24 - 351 - 24 - - - - - 0 + + 0 + + + 0 + + + + + + 0 + 48 + - - 6 + + Login - - - - - 150 - 0 - - - - Qt::NoContextMenu - - - Choose RetroShare's interface style - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 10 - 0 - 381 - 75 - - - - Qt::NoContextMenu - - - Language - - - - - 10 - 27 - 591 - 17 - - - - Qt::NoContextMenu - - - <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Changes to language will only take effect after restarting RetroShare!</p></body></html> - - - - - - 10 - 44 - 351 - 24 - - - - - 0 + + + + 10 + 20 + 141 + 18 + + + + Auto Login + + + + + + + + + 0 + 80 + - - 6 + + Misc - - - - Qt::Horizontal - - - - 300 - 16 - - - - - - - - - 150 - 0 - - - - Qt::NoContextMenu - - - Choose the language used in RetroShare - - - false - - - - 24 - 16 - - - - - - - + + + + 10 + 40 + 401 + 20 + + + + Show MainWindow at Startup + + + false + + + + + + 10 + 60 + 401 + 20 + + + + Start minimized + + + true + + + + + + 10 + 20 + 411 + 18 + + + + Start RetroShare when my system starts + + + + + + + + Qt::Vertical + + + + 391 + 61 + + + + + - - cmboLanguage - cmboStyle - diff --git a/retroshare-gui/src/gui/Settings/NetworkPage.ui b/retroshare-gui/src/gui/Settings/NetworkPage.ui index 2a3dd5d94..cbdc5cc51 100644 --- a/retroshare-gui/src/gui/Settings/NetworkPage.ui +++ b/retroshare-gui/src/gui/Settings/NetworkPage.ui @@ -10,9 +10,7 @@ - - 7 - 7 + 0 0 @@ -500,91 +498,7 @@ Qt::NoContextMenu - - - - 10 - 0 - 371 - 81 - - - - Rate Options - - - - - 10 - 20 - 141 - 16 - - - - Max Total Data Rate (KB/S): - - - - - - 10 - 50 - 116 - 16 - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Rate per Person (KB/S):</p></body></html> - - - - - - 280 - 50 - 62 - 22 - - - - 1 - - - 256.000000000000000 - - - 5.000000000000000 - - - - - - 280 - 20 - 62 - 22 - - - - 1 - - - 356.000000000000000 - - - 20.000000000000000 - - - - - doubleSpinBox - doubleSpinBox_2 - diff --git a/retroshare-gui/src/gui/Settings/ServerPage.cpp b/retroshare-gui/src/gui/Settings/ServerPage.cpp index fbcb2655c..3e68f3921 100644 --- a/retroshare-gui/src/gui/Settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/Settings/ServerPage.cpp @@ -22,11 +22,27 @@ #include "ServerPage.h" #include "rshare.h" +#include +#include + +#include "rsiface/rsiface.h" +#include "rsiface/rspeers.h" + +#include + ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags) : QWidget(parent, flags) { ui.setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); + + connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) ); + + QTimer *timer = new QTimer(this); + timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus())); + timer->start(1000); + + load(); } void @@ -36,17 +52,343 @@ ServerPage::closeEvent (QCloseEvent * event) } -/** Saves the changes on this page */ -bool -ServerPage::save(QString &errmsg) -{ - -} - -/** Loads the settings for this page */ -void -ServerPage::load() -{ - -} +/** Saves the changes on this page */ +bool +ServerPage::save(QString &errmsg) +{ + +/* save the server address */ +/* save local address */ +/* save the url for DNS access */ + +/* restart server */ + +/* save all? */ + saveAddresses(); + return true; +} + + +/** Loads the settings for this page */ +void ServerPage::load() +{ + + /* load up configuration from rsPeers */ + RsPeerDetails detail; + if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail)) + { + return; + } + + /* set net mode */ + int netIndex = 0; + switch(detail.tryNetMode) + { + case RS_NETMODE_EXT: + netIndex = 2; + break; + case RS_NETMODE_UDP: + netIndex = 1; + break; + default: + case RS_NETMODE_UPNP: + netIndex = 0; + break; + } + ui.netModeComboBox->setCurrentIndex(netIndex); + + /* set dht/disc */ + netIndex = 1; + if (detail.visState & RS_VS_DHT_ON) + { + netIndex = 0; + } + ui.dhtComboBox->setCurrentIndex(netIndex); + + netIndex = 1; + if (detail.visState & RS_VS_DISC_ON) + { + netIndex = 0; + } + ui.discComboBox->setCurrentIndex(netIndex); + + rsiface->lockData(); /* Lock Interface */ + + ui.totalRate->setValue(rsiface->getConfig().maxDataRate); + ui.indivRate->setValue(rsiface->getConfig().maxIndivDataRate); + + rsiface->unlockData(); /* UnLock Interface */ + + toggleUPnP(); + + //ui.check_net->setCheckable(true); + ui.check_upnp->setCheckable(true); + ui.check_dht->setCheckable(true); + ui.check_ext->setCheckable(true); + ui.check_udp->setCheckable(true); + ui.check_tcp->setCheckable(true); + + //ui.check_net->setEnabled(false); + ui.check_upnp->setEnabled(false); + ui.check_dht->setEnabled(false); + ui.check_ext->setEnabled(false); + ui.check_udp->setEnabled(false); + ui.check_tcp->setEnabled(false); + + ui.radio_nonet->setEnabled(false); + ui.radio_netLimited->setEnabled(false); + ui.radio_netUdp->setEnabled(false); + ui.radio_netServer->setEnabled(false); + + /* Addresses must be set here - otherwise can't edit it */ + /* set local address */ + ui.localAddress->setText(QString::fromStdString(detail.localAddr)); + ui.localPort -> setValue(detail.localPort); + /* set the server address */ + ui.extAddress->setText(QString::fromStdString(detail.extAddr)); + ui.extPort -> setValue(detail.extPort); +} + + +/** Loads the settings for this page */ +void ServerPage::updateStatus() +{ + + /* load up configuration from rsPeers */ + RsPeerDetails detail; + if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail)) + { + return; + } + + /* only update if can't edit */ + if (!ui.localPort->isEnabled()) + { + /* set local address */ + ui.localPort -> setValue(detail.localPort); + ui.extPort -> setValue(detail.extPort); + } + + /* set local address */ + ui.localAddress->setText(QString::fromStdString(detail.localAddr)); + /* set the server address */ + ui.extAddress->setText(QString::fromStdString(detail.extAddr)); + +#if 0 + /* set status */ + std::ostringstream out; + out << "Attempted Network Mode: "; + switch(detail.tryNetMode) + { + case RS_NETMODE_EXT: + out << "External Forwarded Port (UltraPEER Mode)"; + break; + case RS_NETMODE_UDP: + out << "Firewalled"; + break; + default: + case RS_NETMODE_UPNP: + + out << "Automatic: UPnP Forwarded Port"; + break; + } + out << std::endl; + out << "Actual Network Mode: "; + switch(detail.netMode) + { + case RS_NETMODE_EXT: + out << "External Forwarded Port (UltraPEER Mode)"; + break; + case RS_NETMODE_UDP: + out << "Firewalled"; + break; + case RS_NETMODE_UPNP: + out << "Automatic: UPnP Forwarded Port"; + break; + default: + case RS_NETMODE_UNREACHABLE: + out << "Unreachable: Firewalled by Symmetric NAT"; + break; + } + out << std::endl; + out << "\tLocal Address: " << detail.localAddr; + out << ":" << detail.localPort; + out << std::endl; + out << "\tExternal Address: " << detail.extAddr; + out << ":" << detail.extPort; + out << std::endl; + + out << "UPnP Status: "; + out << std::endl; + + out << "DHT Status: "; + if (detail.visState & RS_VS_DHT_ON) + out << " Enabled"; + else + out << " Disabled"; + out << std::endl; + + out << "Discovery Status: "; + if (detail.visState & RS_VS_DISC_ON) + out << " Enabled"; + else + out << " Disabled"; + out << std::endl; + + + if (detail.netMode == RS_NETMODE_UNREACHABLE) + { + ui.netStatusBox->setTextColor( Qt::red ); + } + else + { + ui.netStatusBox->setTextColor( Qt::black ); + } + + ui.netStatusBox->setText(QString::fromStdString(out.str())); + ui.netStatusBox ->setReadOnly(true); +#endif + + rsiface->lockData(); /* Lock Interface */ + + /* now the extra bit .... switch on check boxes */ + const RsConfig &config = rsiface->getConfig(); + + //ui.check_net->setChecked(config.netOk); + ui.check_upnp->setChecked(config.netUpnpOk); + ui.check_dht->setChecked(config.netDhtOk); + ui.check_ext->setChecked(config.netExtOk); + ui.check_udp->setChecked(config.netUdpOk); + ui.check_tcp->setChecked(config.netTcpOk); + + if (config.netExtOk) + { + if (config.netUpnpOk || config.netTcpOk) + { + ui.radio_netServer->setChecked(true); + } + else + { + ui.radio_netUdp->setChecked(true); + } + } + else if (config.netOk) + { + ui.radio_netLimited->setChecked(true); + } + else + { + ui.radio_nonet->setChecked(true); + } + + + rsiface->unlockData(); /* UnLock Interface */ + + +} + + +void ServerPage::toggleUPnP() +{ + /* switch on the radioButton */ + bool settingChangeable = false; + if (0 != ui.netModeComboBox->currentIndex()) + { + settingChangeable = true; + } + + if (settingChangeable) + { + ui.dhtComboBox->setEnabled(true); + // disabled until we've got it all working. + //ui.discComboBox->setEnabled(true); + ui.discComboBox->setEnabled(false); + + ui.localAddress->setEnabled(false); + ui.localPort -> setEnabled(true); + ui.extAddress -> setEnabled(false); + ui.extPort -> setEnabled(true); + } + else + { + ui.dhtComboBox->setEnabled(false); + ui.discComboBox->setEnabled(false); + + ui.localAddress->setEnabled(false); + ui.localPort -> setEnabled(false); + ui.extAddress -> setEnabled(false); + ui.extPort -> setEnabled(false); + } +} + +void ServerPage::saveAddresses() +{ + QString str; + + bool saveAddr = false; + + + RsPeerDetails detail; + std::string ownId = rsPeers->getOwnId(); + + if (!rsPeers->getPeerDetails(ownId, detail)) + { + return; + } + + int netIndex = ui.netModeComboBox->currentIndex(); + + /* Check if netMode has changed */ + int netMode = 0; + switch(netIndex) + { + case 2: + netMode = RS_NETMODE_EXT; + break; + case 1: + netMode = RS_NETMODE_UDP; + break; + default: + case 0: + netMode = RS_NETMODE_UPNP; + break; + } + + if (detail.tryNetMode != netMode) + { + rsPeers->setNetworkMode(ownId, netMode); + } + + int visState = 0; + /* Check if vis has changed */ + if (0 == ui.discComboBox->currentIndex()) + { + visState |= RS_VS_DISC_ON; + } + + if (0 == ui.dhtComboBox->currentIndex()) + { + visState |= RS_VS_DHT_ON; + } + + if (visState != detail.visState) + { + rsPeers->setVisState(ownId, visState); + } + + if (0 != netIndex) + { + saveAddr = true; + } + + if (saveAddr) + { + rsPeers->setLocalAddress(rsPeers->getOwnId(), ui.localAddress->text().toStdString(), ui.localPort->value()); + rsPeers->setExtAddress(rsPeers->getOwnId(), ui.extAddress->text().toStdString(), ui.extPort->value()); + } + + rsicontrol->ConfigSetDataRates( ui.totalRate->value(), ui.indivRate->value() ); + load(); +} + diff --git a/retroshare-gui/src/gui/Settings/ServerPage.h b/retroshare-gui/src/gui/Settings/ServerPage.h index 8c0672435..1215eed32 100644 --- a/retroshare-gui/src/gui/Settings/ServerPage.h +++ b/retroshare-gui/src/gui/Settings/ServerPage.h @@ -27,15 +27,24 @@ class ServerPage: public QWidget { + 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 */ + /** Saves the changes on this page */ + bool save(QString &errmsg); + /** Loads the settings for this page */ void load(); +public slots: + void updateStatus(); + +private slots: + void saveAddresses(); + void toggleUPnP(); + private: void closeEvent (QCloseEvent * event); diff --git a/retroshare-gui/src/gui/Settings/ServerPage.ui b/retroshare-gui/src/gui/Settings/ServerPage.ui index 9128f72ab..1a0c3e94b 100644 --- a/retroshare-gui/src/gui/Settings/ServerPage.ui +++ b/retroshare-gui/src/gui/Settings/ServerPage.ui @@ -5,14 +5,12 @@ 0 0 - 399 - 389 + 437 + 388 - - 7 - 7 + 0 0 @@ -500,200 +498,421 @@ Qt::NoContextMenu - - - - 10 - 160 - 181 - 23 - + + + 6 - - Change + Restart Server + + 6 - - - - - 10 - 0 - 381 - 101 - + + 6 - - Server Settings + + 6 - - - - 12 - 61 - 80 - 21 - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">External Adress:</p></body></html> - - - - - - 12 - 21 - 66 - 21 - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Lokal Adress:</p></body></html> - - - - - - 98 - 10 - 271 - 81 - - - - + + 0 + + + 0 + + + + + + 0 + 0 + + + + Network Configuration (takes effect after restart) + + + + + + + + + Automatic + + + + + Firewalled + + + + + Forwarded Port + + + + + + + + + + + DHT Enabled + + + + + DHT Disabled + + + + + + + + + Discovery Enabled + + + + + Discovery Disabled + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 - - 6 + + + Network Configuration + + + + + + Network Configuration + + + + + + + + + + Local Address + + + + + + + External Address + + + + + + + + + + + + + + Port: + + + + + + + 0 + + + 65535 + + + 7812 + + + + + + + + + + Port: + + + + + + + 0 + + + 65535 + + + 7812 + + + + + + + + + + + Qt::Vertical + + + + 381 + 40 + + + + + + + + + + + + Network Status + + + + + + + + + + No Conectivity + + + + + + + Limited + + + + + + + Udp + + + + + + + Retroshare Server + + + + + + + + + + + UDP Connections + + + false + + + + + + + Stable External IP Addrress + + + false + + + + + + + DHT Okay + + + false + + + + + + + UPnP Active + + + false + + + + + + + TCP server + + + false + + + + + + + + + + + + + + + + 0 + 0 + - - - - 0 - - - 6 - - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Port:</p></body></html> - - - - - - - 65535 - - - 1 - - - 7812 - - - - - - - - - 0 - - - 6 - - - - - 65535 - - - 1 - - - 7812 - - - - - - - Port: - - - - - - - - - - - - - - - 10 - 100 - 381 - 51 - - - - Misc - - - - - 10 - 20 - 131 - 18 - - - - behinde Firewall - - - - - - 130 - 20 - 151 - 18 - - - - Forwarded External Port - - - + + Transfer Rates + + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Total Rate (KB/s) + + + + + + + 1 + + + 12500 + + + 1 + + + + + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Per Person + + + + + + + 1 + + + 12500 + + + 1 + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + - - lineEdit - spinBox_2 - lineEdit_2 - spinBox_3 - checkBox - checkBox_2 - pushButton - diff --git a/retroshare-gui/src/gui/Settings/gsettingswin.cpp b/retroshare-gui/src/gui/Settings/gsettingswin.cpp index 65b282001..46e055268 100644 --- a/retroshare-gui/src/gui/Settings/gsettingswin.cpp +++ b/retroshare-gui/src/gui/Settings/gsettingswin.cpp @@ -77,9 +77,13 @@ GSettingsWin::setNewPage(int page) else if (page == Directories) text = tr("Directories"); else if (page == Server) + text = tr("Server"); pageName->setText(tr("%1").arg(text)); stackedWidget->setCurrentIndex(page); listWidget->setCurrentRow(page); } + + + diff --git a/retroshare-gui/src/gui/Settings/settings.ui b/retroshare-gui/src/gui/Settings/settings.ui index 56fc14bd3..2bfc44108 100644 --- a/retroshare-gui/src/gui/Settings/settings.ui +++ b/retroshare-gui/src/gui/Settings/settings.ui @@ -16,26 +16,45 @@ - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + - - 1 - 4 + 0 0 @@ -67,12 +86,21 @@ - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + @@ -174,7 +202,7 @@ 100 - 32 + 16 @@ -193,33 +221,21 @@ General - - :/images/misc.png - Network - - :/images/connect_24x24_shadow.png - Server - - :/images/webcache_24x24.png - Directories - - :/images/directories_24x24.png -