Add StatusBar and its widgets show options.

The StatusBar is shown by default.
This commit is contained in:
Phenom 2017-01-18 20:18:12 +01:00
parent aa62136f17
commit 9937513dfd
4 changed files with 217 additions and 58 deletions

View File

@ -19,14 +19,15 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QMessageBox>
#include <QString>
#include <QtDebug>
#include <QIcon>
#include <QPixmap>
#include <QColorDialog>
#include <QDesktopServices>
#include <QIcon>
#include <QMessageBox>
#include <QPixmap>
#include <QStatusBar>
#include <QString>
#include <QUrl>
#include <QtDebug>
#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()
{

View File

@ -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();

View File

@ -19,15 +19,25 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QStyleFactory>
#include <QFileInfo>
#include <QCheckBox>
#include <QDir>
#include <QFileInfo>
#include <QGroupBox>
#include <QStatusBar>
#include <QStyleFactory>
#include "lang/languagesupport.h"
#include <rshare.h>
#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());
}

View File

@ -7,13 +7,13 @@
<x>0</x>
<y>0</y>
<width>1160</width>
<height>567</height>
<height>608</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout">
<layout class="QGridLayout" name="AppearancePageGLayout">
<property name="leftMargin">
<number>6</number>
</property>
@ -43,7 +43,7 @@
<property name="title">
<string>Language</string>
</property>
<layout class="QGridLayout" name="gridLayout_Language">
<layout class="QGridLayout" name="grpLanguageGLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="labelLanguage">
<property name="text">
@ -71,7 +71,7 @@
</widget>
</item>
<item row="1" column="1">
<spacer>
<spacer name="grpLanguageHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -103,7 +103,7 @@
<property name="title">
<string>Style</string>
</property>
<layout class="QGridLayout" name="gridLayout_Style">
<layout class="QGridLayout" name="grpStyleGLayout">
<item row="0" column="0">
<widget class="QComboBox" name="cmboStyle">
<property name="minimumSize">
@ -118,7 +118,7 @@
</widget>
</item>
<item row="0" column="1">
<spacer>
<spacer name="grpStyleHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -144,7 +144,7 @@
<property name="title">
<string>Style Sheet</string>
</property>
<layout class="QGridLayout" name="gridLayout_StyleSheet">
<layout class="QGridLayout" name="grpStyleSheetGLayout">
<item row="0" column="0">
<widget class="QComboBox" name="cmboStyleSheet">
<property name="minimumSize">
@ -156,7 +156,7 @@
</widget>
</item>
<item row="0" column="1">
<spacer>
<spacer name="grpStyleSheetHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -172,7 +172,7 @@
</widget>
</item>
<item row="8" column="0">
<spacer>
<spacer name="AppearancePageVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -198,7 +198,7 @@
<property name="title">
<string>Tool Bar</string>
</property>
<layout class="QGridLayout" name="gridLayout_ToolBar">
<layout class="QGridLayout" name="grpToolBarGLayout">
<item row="4" column="0">
<widget class="QFrame" name="frameAction">
<property name="frameShape">
@ -207,7 +207,7 @@
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="frameActionHLayout">
<property name="leftMargin">
<number>2</number>
</property>
@ -235,7 +235,7 @@
</widget>
</item>
<item>
<spacer>
<spacer name="frameActionHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -265,7 +265,7 @@
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="framePageHLayout">
<property name="leftMargin">
<number>2</number>
</property>
@ -293,7 +293,7 @@
</widget>
</item>
<item>
<spacer>
<spacer name="framePageHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -326,7 +326,7 @@
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<layout class="QGridLayout" name="gridLayoutToolListStyle">
<layout class="QGridLayout" name="frameToolListStyleGLayout">
<item row="2" column="0">
<widget class="QComboBox" name="cmboTollButtonsStyle">
<item>
@ -456,8 +456,91 @@
<property name="title">
<string>Status Bar</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="grpStatusGLayout">
<item row="4" column="2">
<widget class="QCheckBox" name="checkBoxShowSystrayOnStatus">
<property name="text">
<string>Show SysTray on Status Bar</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="checkBoxShowToasterDisable">
<property name="text">
<string>Show Toaster Disable</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxShowSoundStatus">
<property name="text">
<string>Show Sound Status</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="checkBoxShowOpModeStatus">
<property name="text">
<string>Show Operating Mode Status</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxShowRateStatus">
<property name="text">
<string>Show Network Rate Status</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxShowDiscStatus">
<property name="text">
<string>Show Discovery Status</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxShowDHTStatus">
<property name="text">
<string>Show DHT Status</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxShowHashingStatus">
<property name="text">
<string>Show Hashing Status</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="checkBoxShowNATStatus">
<property name="text">
<string>Show NAT Status</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBoxShowPeerStatus">
<property name="text">
<string>Show Peer Status</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxShowStatusStatus">
<property name="text">
<string>Show Status ComboBox</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBoxStatusCompactMode">
<property name="toolTip">
<string>Remove surplus text in status bar.</string>
@ -467,28 +550,7 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxHideSoundStatus">
<property name="text">
<string>Hide Sound Status</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxHideToasterDisable">
<property name="text">
<string>Hide Toaster Disable</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxShowSystrayOnStatus">
<property name="text">
<string>Show SysTray on Status Bar</string>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBoxDisableSysTrayToolTip">
<property name="text">
<string>Disable SysTray ToolTip</string>