From 48d7c576622a03c857499b8ea318fa5534ef5164 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 30 Jan 2016 23:34:42 +0100 Subject: [PATCH 1/2] Save last state of OpMode status bar droplist and restore it at start. --- retroshare-gui/src/gui/statusbar/OpModeStatus.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/retroshare-gui/src/gui/statusbar/OpModeStatus.cpp b/retroshare-gui/src/gui/statusbar/OpModeStatus.cpp index 96934c5bf..260c1a0c9 100644 --- a/retroshare-gui/src/gui/statusbar/OpModeStatus.cpp +++ b/retroshare-gui/src/gui/statusbar/OpModeStatus.cpp @@ -23,7 +23,10 @@ #include #include "gui/statusbar/OpModeStatus.h" +#include "gui/settings/rsharesettings.h" + #include + #include OpModeStatus::OpModeStatus(QWidget *parent) @@ -37,6 +40,8 @@ OpModeStatus::OpModeStatus(QWidget *parent) connect(this, SIGNAL(activated( int )), this, SLOT(setOpMode())); + setCurrentIndex(Settings->valueFromGroup("StatusBar", "OpMode", QVariant(0)).toInt()); + setOpMode(); setToolTip(tr("Use this DropList to quickly change Retroshare's behaviour\n No Anon D/L: switches off file forwarding\n Gaming Mode: 25% standard traffic and TODO: reduced popups\n Low Traffic: 10% standard traffic and TODO: pauses all file-transfers")); setFocusPolicy(Qt::ClickFocus); @@ -77,6 +82,7 @@ void OpModeStatus::setOpMode() // reload to be safe. getOpMode(); + Settings->setValueToGroup("StatusBar", "OpMode", idx); } From 1843a5460d7fba276378e9e866a5f0228d056b64 Mon Sep 17 00:00:00 2001 From: Phenom Date: Wed, 3 Feb 2016 14:02:19 +0100 Subject: [PATCH 2/2] Add colored style sheet to OpModeStatus ComboBox. --- .../src/gui/qss/stylesheet/Standard.qss | 20 +++++ .../src/gui/statusbar/OpModeStatus.cpp | 83 ++++++++++++++++--- .../src/gui/statusbar/OpModeStatus.h | 23 ++++- retroshare-gui/src/qss/blacknight.qss | 20 +++++ retroshare-gui/src/qss/blue.qss | 20 +++++ retroshare-gui/src/qss/groove.qss | 20 +++++ retroshare-gui/src/qss/orangesurfer.qss | 20 +++++ retroshare-gui/src/qss/qdarkstyle.qss | 22 ++++- retroshare-gui/src/qss/qlive.qss | 19 +++++ retroshare-gui/src/qss/redscorpion.qss | 20 +++++ retroshare-gui/src/qss/silver.qss | 20 +++++ retroshare-gui/src/qss/silvergrey.qss | 20 +++++ retroshare-gui/src/qss/uus.qss | 22 ++++- retroshare-gui/src/qss/wx.qss | 20 +++++ retroshare-gui/src/qss/yaba.qss | 20 +++++ retroshare-gui/src/qss/yeah.qss | 20 +++++ 16 files changed, 376 insertions(+), 13 deletions(-) diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss index 645fb9702..05a9b6e94 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss @@ -661,3 +661,23 @@ IdEditDialog QLabel#info_label background: #FFFFD7; background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2); } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/gui/statusbar/OpModeStatus.cpp b/retroshare-gui/src/gui/statusbar/OpModeStatus.cpp index 260c1a0c9..e7f7eab13 100644 --- a/retroshare-gui/src/gui/statusbar/OpModeStatus.cpp +++ b/retroshare-gui/src/gui/statusbar/OpModeStatus.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. ****************************************************************/ @@ -30,13 +30,18 @@ #include OpModeStatus::OpModeStatus(QWidget *parent) - : QComboBox(parent) + : QComboBox(parent) { + onUpdate = false; /* add the options */ addItem(tr("Normal Mode"), RS_OPMODE_FULL); + setItemData(0, opMode_Full_Color, Qt::BackgroundRole); addItem(tr("No Anon D/L"), RS_OPMODE_NOTURTLE); + setItemData(1, opMode_NoTurtle_Color, Qt::BackgroundRole); addItem(tr("Gaming Mode"), RS_OPMODE_GAMING); + setItemData(2, opMode_Gaming_Color, Qt::BackgroundRole); addItem(tr("Low Traffic"), RS_OPMODE_MINIMAL); + setItemData(3, opMode_Minimal_Color, Qt::BackgroundRole); connect(this, SIGNAL(activated( int )), this, SLOT(setOpMode())); @@ -47,7 +52,6 @@ OpModeStatus::OpModeStatus(QWidget *parent) setFocusPolicy(Qt::ClickFocus); } - void OpModeStatus::getOpMode() { int opMode = rsConfig->getOperatingMode(); @@ -56,17 +60,26 @@ void OpModeStatus::getOpMode() default: case RS_OPMODE_FULL: setCurrentIndex(0); - break; + setProperty("opMode", "Full"); + break; case RS_OPMODE_NOTURTLE: setCurrentIndex(1); - break; + setProperty("opMode", "NoTurtle"); + break; case RS_OPMODE_GAMING: setCurrentIndex(2); - break; + setProperty("opMode", "Gaming"); + break; case RS_OPMODE_MINIMAL: setCurrentIndex(3); - break; + setProperty("opMode", "Minimal"); + break; } + onUpdate = true; + style()->unpolish(this); + style()->polish(this); + update(); + onUpdate = false; } void OpModeStatus::setOpMode() @@ -74,9 +87,9 @@ void OpModeStatus::setOpMode() std::cerr << "OpModeStatus::setOpMode()"; std::cerr << std::endl; - int idx = currentIndex(); - QVariant var = itemData(idx); - uint32_t opMode = var.toUInt(); + int idx = currentIndex(); + QVariant var = itemData(idx); + uint32_t opMode = var.toUInt(); rsConfig->setOperatingMode(opMode); @@ -85,4 +98,54 @@ void OpModeStatus::setOpMode() Settings->setValueToGroup("StatusBar", "OpMode", idx); } +QColor OpModeStatus::getOpMode_Full_Color() const +{ + return opMode_Full_Color; +} +void OpModeStatus::setOpMode_Full_Color( QColor c ) +{ + opMode_Full_Color = c; + setItemData(0, opMode_Full_Color, Qt::BackgroundRole); + if (!onUpdate) + getOpMode(); +} + +QColor OpModeStatus::getOpMode_NoTurtle_Color() const +{ + return opMode_NoTurtle_Color; +} + +void OpModeStatus::setOpMode_NoTurtle_Color( QColor c ) +{ + opMode_NoTurtle_Color = c; + setItemData(1, opMode_NoTurtle_Color, Qt::BackgroundRole); + if (!onUpdate) + getOpMode(); +} + +QColor OpModeStatus::getOpMode_Gaming_Color() const +{ + return opMode_Gaming_Color; +} + +void OpModeStatus::setOpMode_Gaming_Color( QColor c ) +{ + opMode_Gaming_Color = c; + setItemData(2, opMode_Gaming_Color, Qt::BackgroundRole); + if (!onUpdate) + getOpMode(); +} + +QColor OpModeStatus::getOpMode_Minimal_Color() const +{ + return opMode_Minimal_Color; +} + +void OpModeStatus::setOpMode_Minimal_Color( QColor c ) +{ + opMode_Minimal_Color = c; + setItemData(3, opMode_Minimal_Color, Qt::BackgroundRole); + if (!onUpdate) + getOpMode(); +} diff --git a/retroshare-gui/src/gui/statusbar/OpModeStatus.h b/retroshare-gui/src/gui/statusbar/OpModeStatus.h index 6e84aea3a..43156be1f 100644 --- a/retroshare-gui/src/gui/statusbar/OpModeStatus.h +++ b/retroshare-gui/src/gui/statusbar/OpModeStatus.h @@ -26,16 +26,37 @@ class OpModeStatus : public QComboBox { Q_OBJECT + Q_PROPERTY(QColor opMode_Full_Color READ getOpMode_Full_Color WRITE setOpMode_Full_Color DESIGNABLE true) + Q_PROPERTY(QColor opMode_NoTurtle_Color READ getOpMode_NoTurtle_Color WRITE setOpMode_NoTurtle_Color DESIGNABLE true) + Q_PROPERTY(QColor opMode_Gaming_Color READ getOpMode_Gaming_Color WRITE setOpMode_Gaming_Color DESIGNABLE true) + Q_PROPERTY(QColor opMode_Minimal_Color READ getOpMode_Minimal_Color WRITE setOpMode_Minimal_Color DESIGNABLE true) public: OpModeStatus(QWidget *parent = 0); + QColor getOpMode_Full_Color() const; + void setOpMode_Full_Color( QColor c ); + + QColor getOpMode_NoTurtle_Color() const; + void setOpMode_NoTurtle_Color( QColor c ); + + QColor getOpMode_Gaming_Color() const; + void setOpMode_Gaming_Color( QColor c ); + + QColor getOpMode_Minimal_Color() const; + void setOpMode_Minimal_Color( QColor c ); + private slots: - void setOpMode(); + void setOpMode(); private: void getOpMode(); + QColor opMode_Full_Color; + QColor opMode_NoTurtle_Color; + QColor opMode_Gaming_Color; + QColor opMode_Minimal_Color; + bool onUpdate; }; #endif diff --git a/retroshare-gui/src/qss/blacknight.qss b/retroshare-gui/src/qss/blacknight.qss index 23dc205ac..4a454c54e 100644 --- a/retroshare-gui/src/qss/blacknight.qss +++ b/retroshare-gui/src/qss/blacknight.qss @@ -272,3 +272,23 @@ QTextBrowser { QTextEdit { color: white; } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #007000; + qproperty-opMode_NoTurtle_Color: #000070; + qproperty-opMode_Gaming_Color: #707000; + qproperty-opMode_Minimal_Color: #700000; +} +OpModeStatus[opMode="Full"] { + background: #007000; +} +OpModeStatus[opMode="NoTurtle"] { + background: #000070; +} +OpModeStatus[opMode="Gaming"] { + background: #707000; +} +OpModeStatus[opMode="Minimal"] { + background: #700000; +} diff --git a/retroshare-gui/src/qss/blue.qss b/retroshare-gui/src/qss/blue.qss index f337f274d..792a1dc4d 100644 --- a/retroshare-gui/src/qss/blue.qss +++ b/retroshare-gui/src/qss/blue.qss @@ -172,3 +172,23 @@ QSplitter#splitter{ border-image: url(qss/blue/blue.png); } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/qss/groove.qss b/retroshare-gui/src/qss/groove.qss index 28662667b..e4e5a6e97 100644 --- a/retroshare-gui/src/qss/groove.qss +++ b/retroshare-gui/src/qss/groove.qss @@ -66,3 +66,23 @@ QTreeWidget::item:selected { /* when user selects item using mouse or keyboard * } Q + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/qss/orangesurfer.qss b/retroshare-gui/src/qss/orangesurfer.qss index 413fc6e5e..a178238b9 100644 --- a/retroshare-gui/src/qss/orangesurfer.qss +++ b/retroshare-gui/src/qss/orangesurfer.qss @@ -205,3 +205,23 @@ QLabel#fromText{ color: blue; } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/qss/qdarkstyle.qss b/retroshare-gui/src/qss/qdarkstyle.qss index bcb04a28f..74ad6abc8 100644 --- a/retroshare-gui/src/qss/qdarkstyle.qss +++ b/retroshare-gui/src/qss/qdarkstyle.qss @@ -1056,4 +1056,24 @@ QToolBox::tab { QStatusBar::item { border: 1px solid #3A3939; border-radius: 3px; - } \ No newline at end of file + } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #007000; + qproperty-opMode_NoTurtle_Color: #000070; + qproperty-opMode_Gaming_Color: #707000; + qproperty-opMode_Minimal_Color: #700000; +} +OpModeStatus[opMode="Full"] { + background: #007000; +} +OpModeStatus[opMode="NoTurtle"] { + background: #000070; +} +OpModeStatus[opMode="Gaming"] { + background: #707000; +} +OpModeStatus[opMode="Minimal"] { + background: #700000; +} diff --git a/retroshare-gui/src/qss/qlive.qss b/retroshare-gui/src/qss/qlive.qss index b5e7a45a8..ca1cbd0ea 100644 --- a/retroshare-gui/src/qss/qlive.qss +++ b/retroshare-gui/src/qss/qlive.qss @@ -116,3 +116,22 @@ QStatusBar{ border-image: url(qss/qlive/qb.png); } +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/qss/redscorpion.qss b/retroshare-gui/src/qss/redscorpion.qss index 0467650c3..014535305 100644 --- a/retroshare-gui/src/qss/redscorpion.qss +++ b/retroshare-gui/src/qss/redscorpion.qss @@ -287,3 +287,23 @@ QLabel#threadTitle{ background: white; color: black; } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/qss/silver.qss b/retroshare-gui/src/qss/silver.qss index 3acc5dc24..ca061984f 100644 --- a/retroshare-gui/src/qss/silver.qss +++ b/retroshare-gui/src/qss/silver.qss @@ -135,3 +135,23 @@ QLabel#fromText{ color: blue; } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/qss/silvergrey.qss b/retroshare-gui/src/qss/silvergrey.qss index 1004d3ebf..e13908b40 100644 --- a/retroshare-gui/src/qss/silvergrey.qss +++ b/retroshare-gui/src/qss/silvergrey.qss @@ -162,3 +162,23 @@ QLabel#fromText{ color: blue; } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/qss/uus.qss b/retroshare-gui/src/qss/uus.qss index 257c40ee3..b452e65e1 100644 --- a/retroshare-gui/src/qss/uus.qss +++ b/retroshare-gui/src/qss/uus.qss @@ -300,4 +300,24 @@ QStatusBar { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #BDDF7D, stop: 1 #49881F); -} \ No newline at end of file +} + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/qss/wx.qss b/retroshare-gui/src/qss/wx.qss index e115b04dd..c836e61b8 100644 --- a/retroshare-gui/src/qss/wx.qss +++ b/retroshare-gui/src/qss/wx.qss @@ -85,3 +85,23 @@ QLabel#fromText{ color: blue; } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/qss/yaba.qss b/retroshare-gui/src/qss/yaba.qss index 02cabb029..dd8f4877d 100644 --- a/retroshare-gui/src/qss/yaba.qss +++ b/retroshare-gui/src/qss/yaba.qss @@ -205,3 +205,23 @@ QToolBar#chattoolBar{ border-image: url(qss/yaba/yaba.png); } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +} diff --git a/retroshare-gui/src/qss/yeah.qss b/retroshare-gui/src/qss/yeah.qss index 23dd3c839..9c7925660 100644 --- a/retroshare-gui/src/qss/yeah.qss +++ b/retroshare-gui/src/qss/yeah.qss @@ -168,3 +168,23 @@ QLabel#fromText{ color: blue; } + +/* OpModeStatus need to be at end to overload other values*/ +OpModeStatus { + qproperty-opMode_Full_Color: #CCFFCC; + qproperty-opMode_NoTurtle_Color: #CCCCFF; + qproperty-opMode_Gaming_Color: #FFFFCC; + qproperty-opMode_Minimal_Color: #FFCCCC; +} +OpModeStatus[opMode="Full"] { + background: #CCFFCC; +} +OpModeStatus[opMode="NoTurtle"] { + background: #CCCCFF; +} +OpModeStatus[opMode="Gaming"] { + background: #FFFFCC; +} +OpModeStatus[opMode="Minimal"] { + background: #FFCCCC; +}