From 5510195a7f600008bbfabae59ad1b2209d56ae0c Mon Sep 17 00:00:00 2001 From: randymcmillan Date: Mon, 31 Jan 2022 13:27:02 -0500 Subject: [PATCH 1/5] gui: network graph - show/hide panels based on window width/height The debugwindow - network graph hides ui elements btnClearTrafficGraph, lblGraphRange, sldGraphRange when at minimumHeight, it also hides the groupBox at minimumWidth - this maximizes the dimensions of the traffic graph in these small dimensions. --- src/qt/rpcconsole.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index c5e5e69df6a..a8dcbfbc700 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1228,6 +1228,22 @@ void RPCConsole::updateDetailWidget() void RPCConsole::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); + if (width()<=minimumWidth()*2){ + ui->groupBox->hide(); + }else{ + ui->groupBox->show(); + } + if (height()==minimumHeight()){ + ui->sldGraphRange->hide(); + ui->lblGraphRange->hide(); + ui->btnClearTrafficGraph->hide(); + }else{ + ui->sldGraphRange->show(); + ui->lblGraphRange->show(); + ui->btnClearTrafficGraph->show(); + } + + } void RPCConsole::showEvent(QShowEvent *event) From cf6f2324f0f78aac53f47f71540a556d7799603a Mon Sep 17 00:00:00 2001 From: randymcmillan Date: Mon, 14 Feb 2022 03:12:08 -0500 Subject: [PATCH 2/5] gui: network graph - show/hide panels based on click event --- src/qt/rpcconsole.cpp | 25 +++++++++++++++++++++++++ src/qt/rpcconsole.h | 1 + src/qt/trafficgraphwidget.cpp | 9 +++++++++ src/qt/trafficgraphwidget.h | 5 +++++ 4 files changed, 40 insertions(+) diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index a8dcbfbc700..cf562c818c4 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -561,6 +561,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty connect(ui->fontBiggerButton, &QAbstractButton::clicked, this, &RPCConsole::fontBigger); connect(ui->fontSmallerButton, &QAbstractButton::clicked, this, &RPCConsole::fontSmaller); connect(ui->btnClearTrafficGraph, &QPushButton::clicked, ui->trafficGraph, &TrafficGraphWidget::clear); + connect(ui->trafficGraph, &TrafficGraphWidget::trafficGraphClicked, this, &RPCConsole::onTrafficGraphClicked); // disable the wallet selector by default ui->WalletSelector->setVisible(false); @@ -647,6 +648,30 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event) } } return QWidget::eventFilter(obj, event); +} + +void RPCConsole::onTrafficGraphClicked(){ + + LogPrintf("%s panelToggle = %s\n", __func__, ui->trafficGraph->panelToggle); + if (ui->trafficGraph->panelToggle){ + ui->groupBox->hide(); + }else{ + ui->groupBox->show(); + } + if (ui->trafficGraph->panelToggle){ + ui->sldGraphRange->hide(); + ui->lblGraphRange->hide(); + ui->btnClearTrafficGraph->hide(); + }else{ + ui->sldGraphRange->show(); + ui->lblGraphRange->show(); + ui->btnClearTrafficGraph->show(); + } + + + + + } void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_t bestblock_date, double verification_progress) diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 528e2bef7d5..eefdfb85b0e 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -128,6 +128,7 @@ public Q_SLOTS: void unbanSelectedNode(); /** set which tab has the focus (is visible) */ void setTabFocus(enum TabTypes tabType); + void onTrafficGraphClicked(); Q_SIGNALS: // For RPC command executor diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index aebd44d5f7c..d83f8c70c4e 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -160,6 +160,15 @@ void TrafficGraphWidget::setGraphRange(std::chrono::minutes new_range) clear(); } +void TrafficGraphWidget::mouseReleaseEvent(QMouseEvent *event) +{ + QWidget::mousePressEvent(event); + panelToggle = !panelToggle; + Q_EMIT trafficGraphClicked(this, event, panelToggle); + LogPrintf("%s panelToggle = %s\n", __func__, panelToggle); + update(); +} + void TrafficGraphWidget::clear() { timer->stop(); diff --git a/src/qt/trafficgraphwidget.h b/src/qt/trafficgraphwidget.h index a40b7345403..e8b097cfc72 100644 --- a/src/qt/trafficgraphwidget.h +++ b/src/qt/trafficgraphwidget.h @@ -25,6 +25,7 @@ class TrafficGraphWidget : public QWidget explicit TrafficGraphWidget(QWidget *parent = nullptr); void setClientModel(ClientModel *model); std::chrono::minutes getGraphRange() const; + bool panelToggle = false; protected: void paintEvent(QPaintEvent *) override; @@ -32,8 +33,12 @@ class TrafficGraphWidget : public QWidget public Q_SLOTS: void updateRates(); void setGraphRange(std::chrono::minutes new_range); + void mouseReleaseEvent(QMouseEvent *event) override; void clear(); +Q_SIGNALS: + void trafficGraphClicked(QWidget*, QMouseEvent *event, bool panelToggle); + private: void paintPath(QPainterPath &path, QQueue &samples); From dbb007e00e0182ff3286165cac0756a23528eba3 Mon Sep 17 00:00:00 2001 From: randymcmillan Date: Mon, 14 Feb 2022 13:16:45 -0500 Subject: [PATCH 3/5] gui: network graph - show/hide slider based on click event --- src/qt/forms/debugwindow.ui | 295 +++++++++++++----------------------- src/qt/rpcconsole.cpp | 23 +-- 2 files changed, 112 insertions(+), 206 deletions(-) diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index 21968010230..7a91dc6bcb6 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -623,6 +623,115 @@ 0 + + + + + + 160 + 40 + + + + background:rgba(0, 0, 0, 64) + + + + + + + + background:rgba(0, 0, 0, 16);color:rgb(255, 0, 0, 255) + + + Sent + + + + + + + + 50 + 0 + + + + background:rgba(0, 0, 0, 16);color:rgb(255, 255, 255, 255) + + + ### MB + + + Qt::AlignTrailing|Qt::AlignRight|Qt::AlignVCenter + + + + + + + + + + + background:rgba(0, 0, 0, 16);color:rgb(0, 255, 0) + + + Received + + + + + + + + 50 + 0 + + + + background:rgba(0, 0, 0, 16);color:white + + + ### MB + + + Qt::AlignTrailing|Qt::AlignRight|Qt::AlignVCenter + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + 985 + 20 + + + + + @@ -673,192 +782,6 @@ - - - - - - Totals - - - - - - - - - 0 - 0 - - - - - 10 - 0 - - - - - - - - - 0 - 255 - 0 - - - - - - - - - 0 - 255 - 0 - - - - - - - - - 0 - 255 - 0 - - - - - - - - Qt::Horizontal - - - - - - - Received - - - - - - - - 50 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - 0 - 0 - - - - - 10 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - Qt::Horizontal - - - - - - - Sent - - - - - - - - 50 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - Qt::Vertical - - - - 20 - 407 - - - - - - - - - diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index cf562c818c4..541de1ed8e5 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -574,6 +574,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty m_node.rpcSetTimerInterfaceIfUnset(rpcTimerInterface); setTrafficGraphRange(INITIAL_TRAFFIC_GRAPH_MINS); + ui->groupBox->setFrameStyle(QFrame::Panel | QFrame::Raised); updateDetailWidget(); consoleFontSize = settings.value(fontSizeSettingsKey, QFont().pointSize()).toInt(); @@ -650,14 +651,8 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event) return QWidget::eventFilter(obj, event); } -void RPCConsole::onTrafficGraphClicked(){ - - LogPrintf("%s panelToggle = %s\n", __func__, ui->trafficGraph->panelToggle); - if (ui->trafficGraph->panelToggle){ - ui->groupBox->hide(); - }else{ - ui->groupBox->show(); - } +void RPCConsole::onTrafficGraphClicked() +{ if (ui->trafficGraph->panelToggle){ ui->sldGraphRange->hide(); ui->lblGraphRange->hide(); @@ -667,11 +662,6 @@ void RPCConsole::onTrafficGraphClicked(){ ui->lblGraphRange->show(); ui->btnClearTrafficGraph->show(); } - - - - - } void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_t bestblock_date, double verification_progress) @@ -1253,11 +1243,6 @@ void RPCConsole::updateDetailWidget() void RPCConsole::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); - if (width()<=minimumWidth()*2){ - ui->groupBox->hide(); - }else{ - ui->groupBox->show(); - } if (height()==minimumHeight()){ ui->sldGraphRange->hide(); ui->lblGraphRange->hide(); @@ -1267,8 +1252,6 @@ void RPCConsole::resizeEvent(QResizeEvent *event) ui->lblGraphRange->show(); ui->btnClearTrafficGraph->show(); } - - } void RPCConsole::showEvent(QShowEvent *event) From 6577b7bae913234d007b4e5a7ebb06a8a35b29cc Mon Sep 17 00:00:00 2001 From: randymcmillan Date: Mon, 14 Feb 2022 17:10:47 -0500 Subject: [PATCH 4/5] gui: network graph - totals frame - implement original color scheme --- src/qt/forms/debugwindow.ui | 163 +++++++++++++++++++++++++----------- src/qt/rpcconsole.cpp | 5 +- 2 files changed, 117 insertions(+), 51 deletions(-) diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index 7a91dc6bcb6..70083ca3d15 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -6,8 +6,8 @@ 0 0 - 740 - 430 + 777 + 451 @@ -36,7 +36,7 @@ - 0 + 2 @@ -624,24 +624,84 @@ + + + + Qt::Horizontal + + + + 985 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + - - - - 160 - 40 - - + + + + 184 + 70 + + - background:rgba(0, 0, 0, 64) + background:rgba(218, 218, 218, 255) + + + + + 20 + 5 + + + + + 20 + 5 + + + + false + + + background-color:rgba(255,0,0,255) + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 57 + 20 + + - background:rgba(0, 0, 0, 16);color:rgb(255, 0, 0, 255) + background:rgba(0, 0, 0, 0);color:rgb(0, 0, 0, 255) Sent @@ -652,18 +712,18 @@ - 50 - 0 + 57 + 20 - background:rgba(0, 0, 0, 16);color:rgb(255, 255, 255, 255) + background:rgba(0, 0, 0, 0);color:rgb(0, 0, 0) ### MB - Qt::AlignTrailing|Qt::AlignRight|Qt::AlignVCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -671,10 +731,41 @@ + + + + + 20 + 5 + + + + + 12 + 5 + + + + background-color:rgba(0,255,0,255) + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 57 + 20 + + - background:rgba(0, 0, 0, 16);color:rgb(0, 255, 0) + background:rgba(0, 0, 0, 0);color:rgb(0, 0, 0) Received @@ -685,18 +776,18 @@ - 50 - 0 + 57 + 20 - background:rgba(0, 0, 0, 16);color:white + background:rgba(0, 0, 0, 0);color:rgb(0, 0, 0) ### MB - Qt::AlignTrailing|Qt::AlignRight|Qt::AlignVCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -705,32 +796,6 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - 985 - 20 - - - - @@ -953,8 +1018,8 @@ 0 0 - 300 - 426 + 274 + 688 diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 541de1ed8e5..b3dfccfe899 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -574,7 +574,8 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty m_node.rpcSetTimerInterfaceIfUnset(rpcTimerInterface); setTrafficGraphRange(INITIAL_TRAFFIC_GRAPH_MINS); - ui->groupBox->setFrameStyle(QFrame::Panel | QFrame::Raised); + ui->totalsFrame->setFrameStyle(QFrame::Panel | QFrame::Raised); + ui->totalsFrame->setStyleSheet("QFrame#totalsFrame{background:rgba(189,189,189,227);border-top-left-radius: 2px;border-top-right-radius: 2px;border-bottom-right-radius: 2px;border-bottom-left-radius: 2px;}"); updateDetailWidget(); consoleFontSize = settings.value(fontSizeSettingsKey, QFont().pointSize()).toInt(); @@ -1390,4 +1391,4 @@ void RPCConsole::updateAlerts(const QString& warnings) { this->ui->label_alerts->setVisible(!warnings.isEmpty()); this->ui->label_alerts->setText(warnings); -} +} \ No newline at end of file From 1afde286fcd167eb6eed13d7cb4eed7ffe505cca Mon Sep 17 00:00:00 2001 From: randymcmillan Date: Tue, 15 Feb 2022 18:24:40 -0500 Subject: [PATCH 5/5] gui: network graph - totals frame - background color base on acc. audit --- src/qt/forms/debugwindow.ui | 20 +++++++++++++------- src/qt/rpcconsole.cpp | 2 -- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index 70083ca3d15..9363aceced1 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -651,15 +651,18 @@ - + 184 70 + + false + - background:rgba(218, 218, 218, 255) + background-color:rgba(106,106,106);border-radius:5px; @@ -701,7 +704,7 @@ - background:rgba(0, 0, 0, 0);color:rgb(0, 0, 0, 255) + color:white; Sent @@ -717,7 +720,7 @@ - background:rgba(0, 0, 0, 0);color:rgb(0, 0, 0) + color:white; ### MB @@ -732,7 +735,7 @@ - + 20 @@ -764,8 +767,11 @@ 20 + + false + - background:rgba(0, 0, 0, 0);color:rgb(0, 0, 0) + color:white; Received @@ -781,7 +787,7 @@ - background:rgba(0, 0, 0, 0);color:rgb(0, 0, 0) + color:white; ### MB diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index b3dfccfe899..45e1a51ceeb 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -574,8 +574,6 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty m_node.rpcSetTimerInterfaceIfUnset(rpcTimerInterface); setTrafficGraphRange(INITIAL_TRAFFIC_GRAPH_MINS); - ui->totalsFrame->setFrameStyle(QFrame::Panel | QFrame::Raised); - ui->totalsFrame->setStyleSheet("QFrame#totalsFrame{background:rgba(189,189,189,227);border-top-left-radius: 2px;border-top-right-radius: 2px;border-bottom-right-radius: 2px;border-bottom-left-radius: 2px;}"); updateDetailWidget(); consoleFontSize = settings.value(fontSizeSettingsKey, QFont().pointSize()).toInt();