From 9937513dfd72cfdd405d820b4881bfaac16a5dd2 Mon Sep 17 00:00:00 2001 From: Phenom Date: Wed, 18 Jan 2017 20:18:12 +0100 Subject: [PATCH] Add StatusBar and its widgets show options. The StatusBar is shown by default. --- retroshare-gui/src/gui/MainWindow.cpp | 65 +++++++- retroshare-gui/src/gui/MainWindow.h | 8 + .../src/gui/settings/AppearancePage.cpp | 62 ++++++-- .../src/gui/settings/AppearancePage.ui | 140 +++++++++++++----- 4 files changed, 217 insertions(+), 58 deletions(-) diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 807b43667..7d821ce3f 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -19,14 +19,15 @@ * Boston, MA 02110-1301, USA. ****************************************************************/ -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include #include +#include #ifdef BLOGS #include "gui/unfinished/blogs/BlogsDialog.h" @@ -223,8 +224,11 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) if (!state.isEmpty()) restoreState(state); /** StatusBar section ********/ + statusBar()->setVisible(Settings->valueFromGroup("StatusBar", "ShowStatusBar", QVariant(true)).toBool()); + /* initialize combobox in status bar */ statusComboBox = new QComboBox(statusBar()); + statusComboBox->setVisible(Settings->valueFromGroup("StatusBar", "ShowStatus", QVariant(true)).toBool()); statusComboBox->setFocusPolicy(Qt::ClickFocus); initializeStatusObject(statusComboBox, true); @@ -237,32 +241,39 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) statusBar()->addWidget(widget); peerstatus = new PeerStatus(); + peerstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowPeer", QVariant(true)).toBool()); statusBar()->addWidget(peerstatus); natstatus = new NATStatus(); + natstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowNAT", QVariant(true)).toBool()); statusBar()->addWidget(natstatus); dhtstatus = new DHTStatus(); + dhtstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowDHT", QVariant(true)).toBool()); statusBar()->addWidget(dhtstatus); hashingstatus = new HashingStatus(); + hashingstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowHashing", QVariant(true)).toBool()); statusBar()->addPermanentWidget(hashingstatus, 1); discstatus = new DiscStatus(); + discstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowDisc", QVariant(true)).toBool()); statusBar()->addPermanentWidget(discstatus); ratesstatus = new RatesStatus(); + ratesstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowRate", QVariant(true)).toBool()); statusBar()->addPermanentWidget(ratesstatus); opModeStatus = new OpModeStatus(); + opModeStatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowOpMode", QVariant(true)).toBool()); statusBar()->addPermanentWidget(opModeStatus); soundStatus = new SoundStatus(); - soundStatus->setHidden(Settings->valueFromGroup("StatusBar", "HideSound", QVariant(false)).toBool()); + soundStatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowSound", QVariant(true)).toBool()); statusBar()->addPermanentWidget(soundStatus); toasterDisable = new ToasterDisable(); - toasterDisable->setHidden(Settings->valueFromGroup("StatusBar", "HideToaster", QVariant(false)).toBool()); + toasterDisable->setVisible(Settings->valueFromGroup("StatusBar", "ShowToaster", QVariant(true)).toBool()); statusBar()->addPermanentWidget(toasterDisable); sysTrayStatus = new SysTrayStatus(); @@ -309,6 +320,7 @@ MainWindow::~MainWindow() Settings->setValueToGroup("MainWindow", "SplitterState", ui->splitter->saveState()); Settings->setValueToGroup("MainWindow", "State", saveState()); + delete statusComboBox; delete peerstatus; delete natstatus; delete dhtstatus; @@ -1477,6 +1489,45 @@ void MainWindow::processLastArgs() //{ // ServicePermissionDialog::showYourself(); //} +QComboBox *MainWindow::statusComboBoxInstance() +{ + return statusComboBox; +} + +PeerStatus *MainWindow::peerstatusInstance() +{ + return peerstatus; +} + +NATStatus *MainWindow::natstatusInstance() +{ + return natstatus; +} + +DHTStatus *MainWindow::dhtstatusInstance() +{ + return dhtstatus; +} + +HashingStatus *MainWindow::hashingstatusInstance() +{ + return hashingstatus; +} + +DiscStatus *MainWindow::discstatusInstance() +{ + return discstatus; +} + +RatesStatus *MainWindow::ratesstatusInstance() +{ + return ratesstatus; +} + +OpModeStatus *MainWindow::opModeStatusInstance() +{ + return opModeStatus; +} SoundStatus *MainWindow::soundStatusInstance() { diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index 51fc4835b..ef65c65ce 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -173,6 +173,14 @@ public: void removeStatusObject(QObject *pObject); void setStatus(QObject *pObject, int nStatus); + QComboBox *statusComboBoxInstance(); + PeerStatus *peerstatusInstance(); + NATStatus *natstatusInstance(); + DHTStatus *dhtstatusInstance(); + HashingStatus *hashingstatusInstance(); + DiscStatus *discstatusInstance(); + RatesStatus *ratesstatusInstance(); + OpModeStatus *opModeStatusInstance(); SoundStatus *soundStatusInstance(); ToasterDisable *toasterDisableInstance(); SysTrayStatus *sysTrayStatusInstance(); diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp index 0d431e996..b860ca2aa 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.cpp +++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp @@ -19,15 +19,25 @@ * Boston, MA 02110-1301, USA. ****************************************************************/ -#include -#include +#include #include +#include +#include +#include +#include #include "lang/languagesupport.h" #include #include "AppearancePage.h" #include "rsharesettings.h" #include "gui/MainWindow.h" +#include "gui/statusbar/peerstatus.h" +#include "gui/statusbar/natstatus.h" +#include "gui/statusbar/dhtstatus.h" +#include "gui/statusbar/hashingstatus.h" +#include "gui/statusbar/discstatus.h" +#include "gui/statusbar/ratesstatus.h" +#include "gui/statusbar/OpModeStatus.h" #include "gui/statusbar/SoundStatus.h" #include "gui/statusbar/ToasterDisable.h" #include "gui/statusbar/SysTrayStatus.h" @@ -41,11 +51,21 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags) MainWindow *pMainWindow = MainWindow::getInstance(); connect(ui.cmboStyleSheet, SIGNAL(activated(int)), this, SLOT(loadStyleSheet(int))); - connect(ui.checkBoxStatusCompactMode, SIGNAL(toggled(bool)), pMainWindow, SLOT(setCompactStatusMode(bool))); - connect(ui.checkBoxHideSoundStatus, SIGNAL(toggled(bool)), pMainWindow->soundStatusInstance(), SLOT(setHidden(bool))); - connect(ui.checkBoxHideToasterDisable, SIGNAL(toggled(bool)), pMainWindow->toasterDisableInstance(), SLOT(setHidden(bool))); - connect(ui.checkBoxShowSystrayOnStatus, SIGNAL(toggled(bool)), pMainWindow->sysTrayStatusInstance(), SLOT(setVisible(bool))); + + connect(ui.grpStatus, SIGNAL(toggled(bool)), pMainWindow->statusBar(), SLOT(setVisible(bool))); + connect(ui.checkBoxStatusCompactMode, SIGNAL(toggled(bool)), pMainWindow, SLOT(setCompactStatusMode(bool))); connect(ui.checkBoxDisableSysTrayToolTip, SIGNAL(toggled(bool)), pMainWindow, SLOT(toggleStatusToolTip(bool))); + connect(ui.checkBoxShowStatusStatus, SIGNAL(toggled(bool)), pMainWindow->statusComboBoxInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxShowPeerStatus, SIGNAL(toggled(bool)), pMainWindow->peerstatusInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxShowNATStatus, SIGNAL(toggled(bool)), pMainWindow->natstatusInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxShowDHTStatus, SIGNAL(toggled(bool)), pMainWindow->dhtstatusInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxShowHashingStatus, SIGNAL(toggled(bool)), pMainWindow->hashingstatusInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxShowDiscStatus, SIGNAL(toggled(bool)), pMainWindow->discstatusInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxShowRateStatus, SIGNAL(toggled(bool)), pMainWindow->ratesstatusInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxShowOpModeStatus, SIGNAL(toggled(bool)), pMainWindow->opModeStatusInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxShowSoundStatus, SIGNAL(toggled(bool)), pMainWindow->soundStatusInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxShowToasterDisable, SIGNAL(toggled(bool)), pMainWindow->toasterDisableInstance(), SLOT(setVisible(bool))); + connect(ui.checkBoxShowSystrayOnStatus, SIGNAL(toggled(bool)), pMainWindow->sysTrayStatusInstance(), SLOT(setVisible(bool))); /* Populate combo boxes */ foreach (QString code, LanguageSupport::languageCodes()) { @@ -139,12 +159,21 @@ bool AppearancePage::save(QString &errmsg) /* Set to new style */ Rshare::setStyle(ui.cmboStyle->currentText()); + Settings->setValueToGroup("StatusBar", "ShowStatusBar", QVariant(ui.grpStatus->isChecked())); Settings->setValueToGroup("StatusBar", "CompactMode", QVariant(ui.checkBoxStatusCompactMode->isChecked())); - Settings->setValueToGroup("StatusBar", "HideSound", QVariant(ui.checkBoxHideSoundStatus->isChecked())); - Settings->setValueToGroup("StatusBar", "HideToaster", QVariant(ui.checkBoxHideToasterDisable->isChecked())); - Settings->setValueToGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(ui.checkBoxShowSystrayOnStatus->isChecked())); Settings->setValueToGroup("StatusBar", "DisableSysTrayToolTip", QVariant(ui.checkBoxDisableSysTrayToolTip->isChecked())); MainWindow::getInstance()->toggleStatusToolTip(ui.checkBoxDisableSysTrayToolTip->isChecked()); + Settings->setValueToGroup("StatusBar", "ShowStatus", QVariant(ui.checkBoxShowStatusStatus->isChecked())); + Settings->setValueToGroup("StatusBar", "ShowPeer", QVariant(ui.checkBoxShowPeerStatus->isChecked())); + Settings->setValueToGroup("StatusBar", "ShowNAT", QVariant(ui.checkBoxShowNATStatus->isChecked())); + Settings->setValueToGroup("StatusBar", "ShowDHT", QVariant(ui.checkBoxShowDHTStatus->isChecked())); + Settings->setValueToGroup("StatusBar", "ShowHashing", QVariant(ui.checkBoxShowHashingStatus->isChecked())); + Settings->setValueToGroup("StatusBar", "ShowDisc", QVariant(ui.checkBoxShowDiscStatus->isChecked())); + Settings->setValueToGroup("StatusBar", "ShowRate", QVariant(ui.checkBoxShowRateStatus->isChecked())); + Settings->setValueToGroup("StatusBar", "ShowOpMode", QVariant(ui.checkBoxShowOpModeStatus->isChecked())); + Settings->setValueToGroup("StatusBar", "ShowSound", QVariant(ui.checkBoxShowSoundStatus->isChecked())); + Settings->setValueToGroup("StatusBar", "ShowToaster", QVariant(ui.checkBoxShowToasterDisable->isChecked())); + Settings->setValueToGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(ui.checkBoxShowSystrayOnStatus->isChecked())); return true; } @@ -227,11 +256,20 @@ void AppearancePage::load() ui.cmboListItemSize->setCurrentIndex(5); } + ui.grpStatus->setChecked(Settings->valueFromGroup("StatusBar", "ShowStatusBar", QVariant(true)).toBool()); ui.checkBoxStatusCompactMode->setChecked(Settings->valueFromGroup("StatusBar", "CompactMode", QVariant(false)).toBool()); - ui.checkBoxHideSoundStatus->setChecked(Settings->valueFromGroup("StatusBar", "HideSound", QVariant(false)).toBool()); - ui.checkBoxHideToasterDisable->setChecked(Settings->valueFromGroup("StatusBar", "HideToaster", QVariant(false)).toBool()); - ui.checkBoxShowSystrayOnStatus->setChecked(Settings->valueFromGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(false)).toBool()); ui.checkBoxDisableSysTrayToolTip->setChecked(Settings->valueFromGroup("StatusBar", "DisableSysTrayToolTip", QVariant(false)).toBool()); + ui.checkBoxShowStatusStatus-> setChecked(Settings->valueFromGroup("StatusBar", "ShowStatus", QVariant(true)).toBool()); + ui.checkBoxShowPeerStatus-> setChecked(Settings->valueFromGroup("StatusBar", "ShowPeer", QVariant(true)).toBool()); + ui.checkBoxShowNATStatus-> setChecked(Settings->valueFromGroup("StatusBar", "ShowNAT", QVariant(true)).toBool()); + ui.checkBoxShowDHTStatus-> setChecked(Settings->valueFromGroup("StatusBar", "ShowDHT", QVariant(true)).toBool()); + ui.checkBoxShowHashingStatus-> setChecked(Settings->valueFromGroup("StatusBar", "ShowHashing", QVariant(true)).toBool()); + ui.checkBoxShowDiscStatus-> setChecked(Settings->valueFromGroup("StatusBar", "Show eDisc", QVariant(true)).toBool()); + ui.checkBoxShowRateStatus-> setChecked(Settings->valueFromGroup("StatusBar", "ShowRate", QVariant(true)).toBool()); + ui.checkBoxShowOpModeStatus-> setChecked(Settings->valueFromGroup("StatusBar", "ShowOpMode", QVariant(true)).toBool()); + ui.checkBoxShowSoundStatus-> setChecked(Settings->valueFromGroup("StatusBar", "ShowSound", QVariant(true)).toBool()); + ui.checkBoxShowToasterDisable->setChecked(Settings->valueFromGroup("StatusBar", "ShowToaster", QVariant(true)).toBool()); + ui.checkBoxShowSystrayOnStatus->setChecked(Settings->valueFromGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(false)).toBool()); } diff --git a/retroshare-gui/src/gui/settings/AppearancePage.ui b/retroshare-gui/src/gui/settings/AppearancePage.ui index 95f3bf297..dface3903 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.ui +++ b/retroshare-gui/src/gui/settings/AppearancePage.ui @@ -7,13 +7,13 @@ 0 0 1160 - 567 + 608 Qt::NoContextMenu - + 6 @@ -43,7 +43,7 @@ Language - + @@ -71,7 +71,7 @@ - + Qt::Horizontal @@ -103,7 +103,7 @@ Style - + @@ -118,7 +118,7 @@ - + Qt::Horizontal @@ -144,7 +144,7 @@ Style Sheet - + @@ -156,7 +156,7 @@ - + Qt::Horizontal @@ -172,7 +172,7 @@ - + Qt::Vertical @@ -198,7 +198,7 @@ Tool Bar - + @@ -207,7 +207,7 @@ QFrame::Plain - + 2 @@ -235,7 +235,7 @@ - + Qt::Horizontal @@ -265,7 +265,7 @@ QFrame::Plain - + 2 @@ -293,7 +293,7 @@ - + Qt::Horizontal @@ -326,7 +326,7 @@ QFrame::NoFrame - + @@ -456,8 +456,91 @@ Status Bar - - + + true + + + true + + + + + + Show SysTray on Status Bar + + + + + + + Show Toaster Disable + + + + + + + Show Sound Status + + + + + + + Show Operating Mode Status + + + + + + + Show Network Rate Status + + + + + + + Show Discovery Status + + + + + + + Show DHT Status + + + + + + + Show Hashing Status + + + + + + + Show NAT Status + + + + + + + Show Peer Status + + + + + + + Show Status ComboBox + + + + Remove surplus text in status bar. @@ -467,28 +550,7 @@ - - - - Hide Sound Status - - - - - - - Hide Toaster Disable - - - - - - - Show SysTray on Status Bar - - - - + Disable SysTray ToolTip