diff --git a/retroshare-gui/src/config/rsharesettings.cpp b/retroshare-gui/src/config/rsharesettings.cpp index bf30b3e8a..eec7a3d7b 100644 --- a/retroshare-gui/src/config/rsharesettings.cpp +++ b/retroshare-gui/src/config/rsharesettings.cpp @@ -44,7 +44,7 @@ #define SETTING_SHEETNAME "SheetName" #define SETTING_DATA_DIRECTORY "DataDirectory" - +#define SETTING_SHOW_MAINWINDOW_AT_START "ShowMainWindowAtStart" #define SETTING_BWGRAPH_FILTER "StatisticDialog/BWLineFilter" #define SETTING_BWGRAPH_OPACITY "StatisticDialog/Opacity" #define SETTING_BWGRAPH_ALWAYS_ON_TOP "StatisticDialog/AlwaysOnTop" @@ -84,6 +84,7 @@ RshareSettings::RshareSettings() : QSettings(SETTINGS_FILE, QSettings::IniFormat) { setDefault(SETTING_STYLE, DEFAULT_STYLE); + setDefault(SETTING_SHOW_MAINWINDOW_AT_START, true); } /** Sets the default value of key to be val. */ @@ -208,7 +209,20 @@ void RshareSettings::setBWGraphAlwaysOnTop(bool alwaysOnTop) setValue(SETTING_BWGRAPH_ALWAYS_ON_TOP, alwaysOnTop); } +/** Returns true if RetroShare's main window should be visible when the + * application starts. */ +bool +RshareSettings::showMainWindowAtStart() +{ + return value(SETTING_SHOW_MAINWINDOW_AT_START).toBool(); +} +/** Sets whether to show RetroShare's main window when the application starts. */ +void +RshareSettings::setShowMainWindowAtStart(bool show) +{ + setValue(SETTING_SHOW_MAINWINDOW_AT_START, show); +} /** Saving Generic Widget Size / Location */ diff --git a/retroshare-gui/src/config/rsharesettings.h b/retroshare-gui/src/config/rsharesettings.h index 1c7ba5162..48ba7c2a5 100644 --- a/retroshare-gui/src/config/rsharesettings.h +++ b/retroshare-gui/src/config/rsharesettings.h @@ -81,7 +81,13 @@ public: /** Sets the stylesheet */ void setSheetName(QString sheet); /** Gets the stylesheet */ - QString getSheetName(); + QString getSheetName(); + + /** Returns true if RetroShare's main window should be visible when the + * application starts. */ + bool showMainWindowAtStart(); + /** Sets whether to show Vidalia's main window when the application starts. */ + void setShowMainWindowAtStart(bool show); /* Get the destination log file. */ diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index ad0f83b4d..990106c48 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -63,7 +63,7 @@ #define IMAGE_SEARCH ":/images/filefind.png" #define IMAGE_TRANSFERS ":/images/ktorrent32.png" #define IMAGE_LINKS ":/images/knewsticker24.png" -#define IMAGE_FILES ":/images/folder_green.png" +#define IMAGE_FILES ":/images/fileshare24.png" #define IMAGE_CHANNELS ":/images/channels.png" #define IMAGE_PREFERENCES ":/images/settings16.png" #define IMAGE_CHAT ":/images/groupchat.png" diff --git a/retroshare-gui/src/gui/Preferences/GeneralDialog.cpp b/retroshare-gui/src/gui/Preferences/GeneralDialog.cpp index 2da0e2ecb..2802018f7 100644 --- a/retroshare-gui/src/gui/Preferences/GeneralDialog.cpp +++ b/retroshare-gui/src/gui/Preferences/GeneralDialog.cpp @@ -22,7 +22,7 @@ #include "rshare.h" #include "GeneralDialog.h" - +#include /** Constructor */ GeneralDialog::GeneralDialog(QWidget *parent) @@ -49,7 +49,19 @@ GeneralDialog::GeneralDialog(QWidget *parent) ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText("Default")); //loadStyleSheet("Default"); loadqss(); + + 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(); + } + } /** Destructor */ @@ -69,6 +81,9 @@ GeneralDialog::save(QString &errmsg) _settings->setLanguageCode(languageCode); _settings->setInterfaceStyle(ui.cmboStyle->currentText()); _settings->setSheetName(ui.styleSheetCombo->currentText()); + + _settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized()); + /* Set to new style */ Rshare::setStyle(ui.cmboStyle->currentText()); @@ -85,6 +100,8 @@ GeneralDialog::load() index = ui.cmboStyle->findData(Rshare::style().toLower()); ui.cmboStyle->setCurrentIndex(index); + ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool()); + ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText(_settings->getSheetName())); @@ -132,3 +149,8 @@ void GeneralDialog::loadqss() } } + +bool GeneralDialog::startMinimized() const { + if(ui.checkStartMinimized->isChecked()) return true; + return ui.checkStartMinimized->isChecked(); +} diff --git a/retroshare-gui/src/gui/Preferences/GeneralDialog.h b/retroshare-gui/src/gui/Preferences/GeneralDialog.h index a17ca59f5..3a68cc1c1 100644 --- a/retroshare-gui/src/gui/Preferences/GeneralDialog.h +++ b/retroshare-gui/src/gui/Preferences/GeneralDialog.h @@ -33,6 +33,7 @@ #include "configpage.h" #include "ui_GeneralDialog.h" + class GeneralDialog : public ConfigPage { Q_OBJECT @@ -46,7 +47,7 @@ public: bool save(QString &errmsg); /** Loads the settings for this page */ void load(); - + bool startMinimized() const; private slots: diff --git a/retroshare-gui/src/gui/Preferences/GeneralDialog.ui b/retroshare-gui/src/gui/Preferences/GeneralDialog.ui index 534b7ef73..4d6843cb6 100644 --- a/retroshare-gui/src/gui/Preferences/GeneralDialog.ui +++ b/retroshare-gui/src/gui/Preferences/GeneralDialog.ui @@ -553,7 +553,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 40 20 @@ -600,7 +600,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 300 16 @@ -688,7 +688,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 181 20 @@ -735,6 +735,51 @@ p, li { white-space: pre-wrap; } + + + + 0 + 280 + 441 + 80 + + + + System tray + + + + + 10 + 20 + 401 + 20 + + + + Show MainWindow at Startup + + + false + + + + + + 10 + 50 + 401 + 20 + + + + Start minimized + + + true + + + cmboLanguage diff --git a/retroshare-gui/src/gui/Preferences/PreferencesWindow.cpp b/retroshare-gui/src/gui/Preferences/PreferencesWindow.cpp index 1118cdce7..233f862a7 100644 --- a/retroshare-gui/src/gui/Preferences/PreferencesWindow.cpp +++ b/retroshare-gui/src/gui/Preferences/PreferencesWindow.cpp @@ -61,8 +61,8 @@ PreferencesWindow::PreferencesWindow(QWidget *parent, Qt::WFlags flags) //ui.stackPages->add(new CryptographyDialog(ui.stackPages), // createPageAction(QIcon(IMAGE_CRYPTOGRAPHY), tr("Cryptography"), grp)); - ui.stackPages->add(new LogDialog(ui.stackPages), - createPageAction(QIcon(IMAGE_ABOUT), tr("About"), grp)); + //ui.stackPages->add(new LogDialog(ui.stackPages), + // createPageAction(QIcon(IMAGE_ABOUT), tr("About"), grp)); /* Create the toolbar */ diff --git a/retroshare-gui/src/gui/SharedFilesDialog.cpp b/retroshare-gui/src/gui/SharedFilesDialog.cpp index 41d26a7e6..d97deb387 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/SharedFilesDialog.cpp @@ -47,7 +47,7 @@ /* Images for context menu icons */ #define IMAGE_DOWNLOAD ":/images/start.png" #define IMAGE_HASH_BUSY ":/images/settings.png" -#define IMAGE_HASH_DONE ":/images/folder_green.png" +#define IMAGE_HASH_DONE ":/images/friendsfolder24.png" #define IMAGE_MSG ":/images/message-mail.png" #define IMAGE_ATTACHMENT ":/images/attachment.png" #define IMAGE_FRIEND ":/images/peers_16x16.png" diff --git a/retroshare-gui/src/gui/SharedFilesDialog.ui b/retroshare-gui/src/gui/SharedFilesDialog.ui index 63612c96d..c185eb81d 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.ui +++ b/retroshare-gui/src/gui/SharedFilesDialog.ui @@ -538,7 +538,7 @@ - :/images/folder_green16.png + :/images/fileshare16.png diff --git a/retroshare-gui/src/gui/bwgraph/bwgraph.cpp b/retroshare-gui/src/gui/bwgraph/bwgraph.cpp index 657bcbbfe..8b012d2c5 100644 --- a/retroshare-gui/src/gui/bwgraph/bwgraph.cpp +++ b/retroshare-gui/src/gui/bwgraph/bwgraph.cpp @@ -24,6 +24,8 @@ #include #include #include "bwgraph.h" +#include "rsiface/rsiface.h" + #define BWGRAPH_LINE_SEND (1u<<0) #define BWGRAPH_LINE_RECV (1u<<1) @@ -95,6 +97,18 @@ BandwidthGraph::customEvent(QEvent *event) } } +void +BandwidthGraph::timerEvent( QTimerEvent * ) +{ + /* set users/friends/network */ + float downKb = 0; + float upKb = 0; + rsicontrol -> ConfigGetDataRates(downKb, upKb); + + updateGraph(downKb,upKb); + +} + /** Binds events to actions. */ void BandwidthGraph::createActions() diff --git a/retroshare-gui/src/gui/bwgraph/bwgraph.h b/retroshare-gui/src/gui/bwgraph/bwgraph.h index 9179771d4..081d35321 100644 --- a/retroshare-gui/src/gui/bwgraph/bwgraph.h +++ b/retroshare-gui/src/gui/bwgraph/bwgraph.h @@ -52,6 +52,7 @@ public slots: protected: /** Called to deliver a bandwidth update event from Tor. */ void customEvent(QEvent *event); + void timerEvent(QTimerEvent*); private slots: /** Adds new data to the graph */ diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index ad41e911b..248ef5d9c 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -92,7 +92,9 @@ images/filerating2.png images/filerating3.png images/filerating4.png - images/filerating5.png + images/filerating5.png + images/fileshare16.png + images/fileshare24.png images/find.png images/emoticons/kopete/kopete020.png images/flags/af.png @@ -125,6 +127,7 @@ images/folder_doments.png images/folder_green.png images/folder_green16.png + images/friendsfolder24.png images/kgames.png images/graph-area.png images/graph-line.png