From 31d9f1a7e6d1e35a1a7b359d00d9416bdf3b8043 Mon Sep 17 00:00:00 2001
From: Kittywhiskers Van Gogh <6098974-kittywhiskers@users.noreply.gitlab.com>
Date: Sun, 16 May 2021 22:21:01 +0530
Subject: [PATCH] core: remove unused gui elements
---
src/qt/forms/miningpage.ui | 998 -------------------------------------
src/qt/miningpage.cpp | 440 ----------------
src/qt/miningpage.h | 77 ---
3 files changed, 1515 deletions(-)
delete mode 100644 src/qt/forms/miningpage.ui
delete mode 100644 src/qt/miningpage.cpp
delete mode 100644 src/qt/miningpage.h
diff --git a/src/qt/forms/miningpage.ui b/src/qt/forms/miningpage.ui
deleted file mode 100644
index e9215f887a..0000000000
--- a/src/qt/forms/miningpage.ui
+++ /dev/null
@@ -1,998 +0,0 @@
-
-
- MiningPage
-
-
-
- 0
- 0
- 860
- 474
-
-
-
- Form
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- QTabWidget:tab-bar { alignment: left; }
-QTabBar { alignment: left; }
-
-
-
- 0
-
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- CPU
-
-
-
-
-
-
-
-
-
-
- 250
- 0
-
-
-
- QSlider::groove:horizontal {
- border: 1px solid #bbb;
- background: white;
- height: 10px;
- border-radius: 4px;
- }
-
- QSlider::sub-page:horizontal {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #66e, stop: 1 #bbf);
- background: qlineargradient(x1: 0, y1: 0.2, x2: 1, y2: 1,
- stop: 0 #bbf, stop: 1 #520072);
- border: 1px solid #777;
- height: 10px;
- border-radius: 4px;
- }
-
- QSlider::add-page:horizontal {
- background: #fff;
- border: 1px solid #777;
- height: 10px;
- border-radius: 4px;
- }
-
- QSlider::handle:horizontal {
- background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
- stop:0 #eee, stop:1 #520072);
- border: 1px solid #777;
- width: 13px;
- margin-top: -2px;
- margin-bottom: -2px;
- border-radius: 4px;
- }
-
- QSlider::handle:horizontal:hover {
- background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
- stop:0 #fff, stop:1 #ddd);
- border: 1px solid #444;
- border-radius: 4px;
- }
-
- QSlider::sub-page:horizontal:disabled {
- background: #bbb;
- border-color: #999;
- }
-
- QSlider::add-page:horizontal:disabled {
- background: #eee;
- border-color: #999;
- }
-
- QSlider::handle:horizontal:disabled {
- background: #eee;
- border: 1px solid #aaa;
- border-radius: 4px;
- }
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
-
-
- Qt::Vertical
-
-
-
- 10
- 20
-
-
-
-
-
-
- -
-
-
-
- 75
- true
-
-
-
- 5 m
-
-
-
- -
-
-
- QPushButton { /* Global Button Style */
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #8F5BA3, stop: .1 #771F99, stop: .95 #771F99, stop: 1 #520072);
-border:0;
-border-radius:3px;
-color:#ffffff;
-font-size:12px;
-font-weight:bold;
-padding-left:25px;
-padding-right:25px;
-padding-top:5px;
-padding-bottom:5px;
-}
-
-QPushButton:hover {
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #BA77D4, stop: .1 #9F2DCC, stop: .95 #9F2DCC, stop: 1 #7400A1);
-}
-
-QPushButton:focus {
-border:none;
-outline:none;
-}
-
-QPushButton:pressed {
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #8F5BA3, stop: .1 #771F99, stop: .95 #771F99, stop: 1 #520072);
-border:1px solid #520072;
-}
-
-
- Clear
-
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 10
- 200
-
-
-
-
-
-
- -
-
-
-
-
-
- QPushButton { /* Global Button Style */
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #8F5BA3, stop: .1 #771F99, stop: .95 #771F99, stop: 1 #520072);
-border:0;
-border-radius:3px;
-color:#ffffff;
-font-size:12px;
-font-weight:bold;
-padding-left:25px;
-padding-right:25px;
-padding-top:5px;
-padding-bottom:5px;
-}
-
-QPushButton:hover {
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #BA77D4, stop: .1 #9F2DCC, stop: .95 #9F2DCC, stop: 1 #7400A1);
-}
-
-QPushButton:focus {
-border:none;
-outline:none;
-}
-
-QPushButton:pressed {
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #8F5BA3, stop: .1 #771F99, stop: .95 #771F99, stop: 1 #520072);
-border:1px solid #520072;
-}
-
-
- Start mining
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 100
-
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- Show Hash Meter Graph
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- 4
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
-
- 250
- 0
-
-
-
- QSlider::groove:horizontal {
-border: 1px solid #bbb;
-background: white;
-height: 10px;
-border-radius: 4px;
-}
-
-QSlider::sub-page:horizontal {
-background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #66e, stop: 1 #bbf);
-background: qlineargradient(x1: 0, y1: 0.2, x2: 1, y2: 1,
- stop: 0 #bbf, stop: 1 #520072);
-border: 1px solid #777;
-height: 10px;
-border-radius: 4px;
-}
-
-QSlider::add-page:horizontal {
-background: #fff;
-border: 1px solid #777;
-height: 10px;
-border-radius: 4px;
-}
-
-QSlider::handle:horizontal {
-background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
- stop:0 #eee, stop:1 #520072);
-border: 1px solid #777;
-width: 13px;
-margin-top: -2px;
-margin-bottom: -2px;
-border-radius: 4px;
-}
-
-QSlider::handle:horizontal:hover {
-background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
- stop:0 #fff, stop:1 #ddd);
-border: 1px solid #444;
-border-radius: 4px;
-}
-
-QSlider::sub-page:horizontal:disabled {
-background: #bbb;
-border-color: #999;
-}
-
-QSlider::add-page:horizontal:disabled {
-background: #eee;
-border-color: #999;
-}
-
-QSlider::handle:horizontal:disabled {
-background: #eee;
-border: 1px solid #aaa;
-border-radius: 4px;
-}
-
-
- Qt::Horizontal
-
-
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
-
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- Average spacing between your blocks:
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- Your hashrate (built-in miner):
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- Network hashrate:
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- Number of CPU threads to use:
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- 0
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- ?
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- ∞
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- GPU
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- 4
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
-
- 250
- 0
-
-
-
- QSlider::groove:horizontal {
-border: 1px solid #bbb;
-background: white;
-height: 10px;
-border-radius: 4px;
-}
-
-QSlider::sub-page:horizontal {
-background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #66e, stop: 1 #bbf);
-background: qlineargradient(x1: 0, y1: 0.2, x2: 1, y2: 1,
- stop: 0 #bbf, stop: 1 #520072);
-border: 1px solid #777;
-height: 10px;
-border-radius: 4px;
-}
-
-QSlider::add-page:horizontal {
-background: #fff;
-border: 1px solid #777;
-height: 10px;
-border-radius: 4px;
-}
-
-QSlider::handle:horizontal {
-background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
- stop:0 #eee, stop:1 #520072);
-border: 1px solid #777;
-width: 13px;
-margin-top: -2px;
-margin-bottom: -2px;
-border-radius: 4px;
-}
-
-QSlider::handle:horizontal:hover {
-background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
- stop:0 #fff, stop:1 #ddd);
-border: 1px solid #444;
-border-radius: 4px;
-}
-
-QSlider::sub-page:horizontal:disabled {
-background: #bbb;
-border-color: #999;
-}
-
-QSlider::add-page:horizontal:disabled {
-background: #eee;
-border-color: #999;
-}
-
-QSlider::handle:horizontal:disabled {
-background: #eee;
-border: 1px solid #aaa;
-border-radius: 4px;
-}
-
-
- Qt::Horizontal
-
-
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
-
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- Average spacing between your blocks:
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- Your hashrate (built-in miner):
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- Network hashrate:
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- Number of GPU devices to use:
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- 0
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- ?
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- ∞
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
-
-
-
- QPushButton { /* Global Button Style */
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #8F5BA3, stop: .1 #771F99, stop: .95 #771F99, stop: 1 #520072);
-border:0;
-border-radius:3px;
-color:#ffffff;
-font-size:12px;
-font-weight:bold;
-padding-left:25px;
-padding-right:25px;
-padding-top:5px;
-padding-bottom:5px;
-}
-
-QPushButton:hover {
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #BA77D4, stop: .1 #9F2DCC, stop: .95 #9F2DCC, stop: 1 #7400A1);
-}
-
-QPushButton:focus {
-border:none;
-outline:none;
-}
-
-QPushButton:pressed {
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #8F5BA3, stop: .1 #771F99, stop: .95 #771F99, stop: 1 #520072);
-border:1px solid #520072;
-}
-
-
- Start mining
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 100
-
-
-
-
- -
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
- Show Hash Meter Graph
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- background-color: rgb(0, 0, 0);
-color: rgb(255, 255, 255);
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 10
- 200
-
-
-
-
-
-
- -
-
-
-
-
-
-
- 250
- 0
-
-
-
- QSlider::groove:horizontal {
- border: 1px solid #bbb;
- background: white;
- height: 10px;
- border-radius: 4px;
- }
-
- QSlider::sub-page:horizontal {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #66e, stop: 1 #bbf);
- background: qlineargradient(x1: 0, y1: 0.2, x2: 1, y2: 1,
- stop: 0 #bbf, stop: 1 #520072);
- border: 1px solid #777;
- height: 10px;
- border-radius: 4px;
- }
-
- QSlider::add-page:horizontal {
- background: #fff;
- border: 1px solid #777;
- height: 10px;
- border-radius: 4px;
- }
-
- QSlider::handle:horizontal {
- background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
- stop:0 #eee, stop:1 #520072);
- border: 1px solid #777;
- width: 13px;
- margin-top: -2px;
- margin-bottom: -2px;
- border-radius: 4px;
- }
-
- QSlider::handle:horizontal:hover {
- background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
- stop:0 #fff, stop:1 #ddd);
- border: 1px solid #444;
- border-radius: 4px;
- }
-
- QSlider::sub-page:horizontal:disabled {
- background: #bbb;
- border-color: #999;
- }
-
- QSlider::add-page:horizontal:disabled {
- background: #eee;
- border-color: #999;
- }
-
- QSlider::handle:horizontal:disabled {
- background: #eee;
- border: 1px solid #aaa;
- border-radius: 4px;
- }
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
-
-
- Qt::Vertical
-
-
-
- 10
- 20
-
-
-
-
-
-
- -
-
-
-
- 75
- true
-
-
-
- 5 m
-
-
-
- -
-
-
- QPushButton { /* Global Button Style */
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #8F5BA3, stop: .1 #771F99, stop: .95 #771F99, stop: 1 #520072);
-border:0;
-border-radius:3px;
-color:#ffffff;
-font-size:12px;
-font-weight:bold;
-padding-left:25px;
-padding-right:25px;
-padding-top:5px;
-padding-bottom:5px;
-}
-
-QPushButton:hover {
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #BA77D4, stop: .1 #9F2DCC, stop: .95 #9F2DCC, stop: 1 #7400A1);
-}
-
-QPushButton:focus {
-border:none;
-outline:none;
-}
-
-QPushButton:pressed {
-background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #8F5BA3, stop: .1 #771F99, stop: .95 #771F99, stop: 1 #520072);
-border:1px solid #520072;
-}
-
-
- Clear
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
- HashRateGraphWidget
- QWidget
-
- 1
-
- clear()
-
-
-
-
-
-
diff --git a/src/qt/miningpage.cpp b/src/qt/miningpage.cpp
deleted file mode 100644
index 19ff14226e..0000000000
--- a/src/qt/miningpage.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-#include "miningpage.h"
-#include "ui_miningpage.h"
-
-#include "dynode-sync.h"
-#include "guiutil.h"
-#include "miner/miner.h"
-#include "net.h"
-#include "util.h"
-#include "utiltime.h"
-#include "validation.h"
-#include "walletmodel.h"
-
-#include
-#include
-
-MiningPage::MiningPage(const PlatformStyle* platformStyle, QWidget* parent) : QWidget(parent),
- ui(new Ui::MiningPage),
- hasMiningprivkey(false)
-{
- ui->setupUi(this);
-
- int nCPUMaxUseThreads = GUIUtil::CPUMaxThreads();
-#ifdef ENABLE_GPU
- int nGPUMaxUseThreads = GUIUtil::GPUMaxThreads();
-#endif
- std::string PrivAddress = GetArg("-miningprivkey", "");
- if (!PrivAddress.empty()) {
- CDynamicSecret Secret;
- Secret.SetString(PrivAddress);
- if (Secret.IsValid()) {
- CDynamicAddress Address;
- Address.Set(Secret.GetKey().GetPubKey().GetID());
- ui->labelAddress->setText(QString("All mined coins will go to %1").arg(Address.ToString().c_str()));
- hasMiningprivkey = true;
- }
- }
-
- if (!dynodeSync.IsSynced() || !dynodeSync.IsBlockchainSynced()) {
- ui->sliderCPUCores->setVisible(false);
- ui->labelNCPUCores->setText(tr("Slider will show once Dynamic has finished syncing"));
- } else {
- ui->sliderCPUCores->setVisible(true);
- ui->labelNCPUCores->setText(QString("%1").arg(nCPUMaxUseThreads));
- }
-
- ui->sliderCPUCores->setMinimum(0);
- ui->sliderCPUCores->setMaximum(nCPUMaxUseThreads);
- ui->sliderCPUCores->setValue(nCPUMaxUseThreads);
-
-#ifdef ENABLE_GPU
- if (!dynodeSync.IsSynced() || !dynodeSync.IsBlockchainSynced()) {
- ui->sliderGPUCores->setVisible(false);
- ui->labelNGPUCores->setText(tr("Slider will show once Dynamic has finished syncing"));
- } else {
- ui->sliderGPUCores->setVisible(true);
- ui->labelNGPUCores->setText(QString("%1").arg(nGPUMaxUseThreads));
- }
-
- ui->sliderGPUCores->setMinimum(0);
- ui->sliderGPUCores->setMaximum(nGPUMaxUseThreads);
- ui->sliderGPUCores->setValue(nGPUMaxUseThreads);
- ui->pushSwitchGPUMining->setVisible(true);
- ui->checkBoxShowGPUGraph->setVisible(true);
-#else
- ui->sliderGPUCores->setVisible(false);
- ui->labelNGPUCores->setText(tr("GPU mining is not supported in this version of Dynamic"));
- ui->pushSwitchGPUMining->setVisible(false);
- ui->checkBoxShowGPUGraph->setVisible(false);
-#endif
-
- ui->sliderCPUGraphSampleTime->setMaximum(0);
- ui->sliderCPUGraphSampleTime->setMaximum(6);
-
-#ifdef ENABLE_GPU
- ui->sliderGPUGraphSampleTime->setMaximum(0);
- ui->sliderGPUGraphSampleTime->setMaximum(6);
-#else
- ui->sliderGPUGraphSampleTime->setVisible(false);
-#endif
-
-#ifdef ENABLE_GPU
- ui->labelGPUGraphSampleSize->setVisible(true);
-#else
- ui->labelGPUGraphSampleSize->setVisible(false);
-#endif
-
- ui->sliderCPUCores->setToolTip(tr("Use the slider to select the amount of CPU threads to use"));
-#ifdef ENABLE_GPU
- ui->sliderGPUCores->setToolTip(tr("Use the slider to select the amount of GPU devices to use"));
-#endif
- ui->labelCPUMinerHashRate->setToolTip(tr("This shows the hashrate of your CPU whilst mining"));
-#ifdef ENABLE_GPU
- ui->labelGPUMinerHashRate->setToolTip(tr("This shows the hashrate of your GPU whilst mining"));
-#endif
- ui->labelNetHashRateCPU->setToolTip(tr("This shows the overall hashrate of the Dynamic network"));
- ui->labelNetHashRateGPU->setToolTip(tr("This shows the overall hashrate of the Dynamic network"));
- ui->labelNextCPUBlock->setToolTip(tr("This shows the average time between the blocks you have mined"));
-#ifdef ENABLE_GPU
- ui->labelNextGPUBlock->setToolTip(tr("This shows the average time between the blocks you have mined"));
-#endif
-
- connect(ui->sliderCPUCores, SIGNAL(valueChanged(int)), this, SLOT(changeNumberOfCPUThreads(int)));
-#ifdef ENABLE_GPU
- connect(ui->sliderGPUCores, SIGNAL(valueChanged(int)), this, SLOT(changeNumberOfGPUThreads(int)));
-#endif
- connect(ui->sliderCPUGraphSampleTime, SIGNAL(valueChanged(int)), this, SLOT(changeCPUSampleTime(int)));
-#ifdef ENABLE_GPU
- connect(ui->sliderGPUGraphSampleTime, SIGNAL(valueChanged(int)), this, SLOT(changeGPUSampleTime(int)));
-#endif
- connect(ui->pushSwitchCPUMining, SIGNAL(clicked()), this, SLOT(switchCPUMining()));
-#ifdef ENABLE_GPU
- connect(ui->pushSwitchGPUMining, SIGNAL(clicked()), this, SLOT(switchGPUMining()));
-#endif
- connect(ui->pushButtonClearCPUData, SIGNAL(clicked()), this, SLOT(clearCPUHashRateData()));
-#ifdef ENABLE_GPU
- connect(ui->pushButtonClearGPUData, SIGNAL(clicked()), this, SLOT(clearGPUHashRateData()));
-#else
- ui->pushButtonClearGPUData->setVisible(false);
-#endif
- connect(ui->checkBoxShowCPUGraph, SIGNAL(stateChanged(int)), this, SLOT(showCPUHashRate(int)));
-#ifdef ENABLE_GPU
- connect(ui->checkBoxShowGPUGraph, SIGNAL(stateChanged(int)), this, SLOT(showGPUHashRate(int)));
-#endif
-
- ui->minerCPUHashRateWidget->graphType = HashRateGraphWidget::GraphType::MINER_CPU_HASHRATE;
- ui->minerCPUHashRateWidget->UpdateSampleTime(HashRateGraphWidget::SampleTime::FIVE_MINUTES);
-
-#ifdef ENABLE_GPU
- ui->minerGPUHashRateWidget->graphType = HashRateGraphWidget::GraphType::MINER_GPU_HASHRATE;
- ui->minerGPUHashRateWidget->UpdateSampleTime(HashRateGraphWidget::SampleTime::FIVE_MINUTES);
-#endif
-
- showCPUHashMeterControls(false);
-#ifdef ENABLE_GPU
- showGPUHashMeterControls(false);
-#endif
- fCPUMinerOn = false;
- fGPUMinerOn = false;
- updateUI();
- startTimer(3511);
-}
-
-MiningPage::~MiningPage()
-{
- delete ui;
-}
-
-void MiningPage::setModel(WalletModel* model)
-{
- this->model = model;
-}
-
-void MiningPage::updateUI()
-{
- if (dynodeSync.IsSynced() && dynodeSync.IsBlockchainSynced()) {
-#ifdef ENABLE_GPU
- if (ui->sliderGPUCores->isHidden()) {
- int nThreads = ui->sliderGPUCores->value();
- ui->sliderGPUCores->setVisible(true);
- ui->labelNGPUCores->setText(QString("%1").arg(nThreads));
- }
-#endif
- if (ui->sliderCPUCores->isHidden()) {
- int nThreads = ui->sliderCPUCores->value();
- ui->sliderCPUCores->setVisible(true);
- ui->labelNCPUCores->setText(QString("%1").arg(nThreads));
- }
- }
- qint64 networkHashrate = GUIUtil::GetNetworkHashPS(120, -1);
- qint64 hashrate = GetHashRate();
-
- ui->labelNetHashRateCPU->setText(GUIUtil::FormatHashRate(networkHashrate));
- ui->labelNetHashRateGPU->setText(GUIUtil::FormatHashRate(networkHashrate));
- ui->labelCPUMinerHashRate->setText(GUIUtil::FormatHashRate(GetCPUHashRate()));
-#ifdef ENABLE_GPU
- ui->labelGPUMinerHashRate->setText(GUIUtil::FormatHashRate(GetGPUHashRate()));
-#endif
-
- QString nextBlockTime;
- if (hashrate == 0) {
- nextBlockTime = QChar(L'∞');
- } else {
- arith_uint256 target;
- target.SetCompact(chainActive.Tip()->nBits);
- arith_uint256 expectedTime = (arith_uint256(1) << 256) / (target * hashrate);
- nextBlockTime = GUIUtil::FormatTimeInterval(expectedTime);
- }
-
- ui->labelNextCPUBlock->setText(nextBlockTime);
-#ifdef ENABLE_GPU
- ui->labelNextGPUBlock->setText(nextBlockTime);
- updateGPUPushSwitch();
-#endif
- updateCPUPushSwitch();
-}
-
-void MiningPage::updatePushSwitch(QPushButton* pushSwitch, bool minerOn)
-{
- if (!dynodeSync.IsSynced() || !dynodeSync.IsBlockchainSynced()) {
- pushSwitch->setToolTip(tr("Blockchain/Dynodes are not synced, please wait until fully synced before mining!"));
- pushSwitch->setText(tr("Disabled"));
- pushSwitch->setEnabled(false);
- return;
- }
- if (minerOn) {
- pushSwitch->setToolTip(tr("Click 'Stop mining' to stop mining!"));
- pushSwitch->setText(tr("Stop mining"));
- } else if (!minerOn) {
- pushSwitch->setToolTip(tr("Click 'Start mining' to begin mining!"));
- pushSwitch->setText(tr("Start mining"));
- }
- pushSwitch->setEnabled(true);
-}
-
-void MiningPage::updateCPUPushSwitch()
-{
- updatePushSwitch(ui->pushSwitchCPUMining, fCPUMinerOn);
-}
-
-#ifdef ENABLE_GPU
-void MiningPage::updateGPUPushSwitch()
-{
- updatePushSwitch(ui->pushSwitchGPUMining, fGPUMinerOn);
-}
-#endif
-
-void MiningPage::StartCPUMiner()
-{
- LogPrintf("StartCPUMiner %d (%s)\n", ui->sliderCPUCores->value(), fCPUMinerOn);
- fCPUMinerOn = true;
- InitMiners(Params(), *g_connman);
- changeNumberOfCPUThreads(ui->sliderCPUCores->value());
- updateUI();
-}
-
-#ifdef ENABLE_GPU
-void MiningPage::StartGPUMiner()
-{
- fGPUMinerOn = true;
- InitMiners(Params(), *g_connman);
- changeNumberOfGPUThreads(ui->sliderGPUCores->value());
- updateUI();
-}
-#endif
-
-void MiningPage::StopCPUMiner()
-{
- LogPrintf("StopCPUMiner %d (%s)\n", ui->sliderCPUCores->value(), fCPUMinerOn);
- fCPUMinerOn = false;
- changeNumberOfCPUThreads(0, true);
- ShutdownCPUMiners();
- updateUI();
-}
-
-#ifdef ENABLE_GPU
-void MiningPage::StopGPUMiner()
-{
- fGPUMinerOn = false;
- changeNumberOfGPUThreads(0, true);
- ShutdownGPUMiners();
- updateUI();
-}
-#endif
-
-bool MiningPage::isMinerOn()
-{
-#ifdef ENABLE_GPU
- return fCPUMinerOn || fGPUMinerOn;
-#else
- return fCPUMinerOn;
-#endif
-}
-
-void MiningPage::changeNumberOfCPUThreads(int i, bool shutdown)
-{
- if (!shutdown)
- ui->labelNCPUCores->setText(QString("%1").arg(i));
- ForceSetArg("-gen", isMinerOn() ? "1" : "0");
- ForceSetArg("-genproclimit-cpu", isMinerOn() ? i : 0);
- InitMiners(Params(), *g_connman);
- SetCPUMinerThreads(i);
- if (fCPUMinerOn)
- StartMiners();
-}
-
-#ifdef ENABLE_GPU
-void MiningPage::changeNumberOfGPUThreads(int i, bool shutdown)
-{
- if (!shutdown)
- ui->labelNGPUCores->setText(QString("%1").arg(i));
- ForceSetArg("-gen", isMinerOn() ? "1" : "0");
- ForceSetArg("-genproclimit-gpu", isMinerOn() ? i : 0);
- InitMiners(Params(), *g_connman);
- SetGPUMinerThreads(i);
- if (fGPUMinerOn)
- StartMiners();
-}
-#endif
-
-void MiningPage::switchCPUMining()
-{
- //Check to see if wallet needs upgrading
- if (model->getWallet()->WalletNeedsUpgrading()) {
- QMessageBox::critical(this, QObject::tr("Older wallet version detected"),
- QObject::tr("Your wallet has not been fully upgraded to version 2.4. Please unlock your wallet to continue."));
- return;
- }
-
- fCPUMinerOn = !fCPUMinerOn;
- updateCPUPushSwitch();
- if (fCPUMinerOn) {
- StartCPUMiner();
- } else {
- StopCPUMiner();
- }
-}
-
-#ifdef ENABLE_GPU
-void MiningPage::switchGPUMining()
-{
- fGPUMinerOn = !fGPUMinerOn;
- updateGPUPushSwitch();
- if (fGPUMinerOn) {
- StartGPUMiner();
- } else {
- StopGPUMiner();
- }
-}
-#endif
-
-void MiningPage::timerEvent(QTimerEvent*)
-{
- updateUI();
-}
-
-void MiningPage::showCPUHashRate(int i)
-{
- if (i == 0) {
- ui->minerCPUHashRateWidget->StopHashMeter();
- showCPUHashMeterControls(false);
- } else {
- ui->minerCPUHashRateWidget->StartHashMeter();
- showCPUHashMeterControls(true);
- }
-}
-
-#ifdef ENABLE_GPU
-void MiningPage::showGPUHashRate(int i)
-{
- if (i == 0) {
- ui->minerGPUHashRateWidget->StopHashMeter();
- showGPUHashMeterControls(false);
- } else {
- ui->minerGPUHashRateWidget->StartHashMeter();
- showGPUHashMeterControls(true);
- }
-}
-#endif
-
-void MiningPage::showCPUHashMeterControls(bool show)
-{
- ui->sliderCPUGraphSampleTime->setVisible(show);
- ui->labelCPUGraphSampleSize->setVisible(show);
- ui->pushButtonClearCPUData->setVisible(show);
-}
-
-#ifdef ENABLE_GPU
-void MiningPage::showGPUHashMeterControls(bool show)
-{
- ui->sliderGPUGraphSampleTime->setVisible(show);
- ui->labelGPUGraphSampleSize->setVisible(show);
- ui->pushButtonClearGPUData->setVisible(show);
-}
-#endif
-
-void MiningPage::clearCPUHashRateData()
-{
- ui->minerCPUHashRateWidget->clear();
-}
-
-#ifdef ENABLE_GPU
-void MiningPage::clearGPUHashRateData()
-{
- ui->minerGPUHashRateWidget->clear();
-}
-#endif
-
-void setSampleTimeLabel(QLabel* labelSize, HashRateGraphWidget* hashRate, int i)
-{
- switch (i) {
- case 0:
- hashRate->UpdateSampleTime(HashRateGraphWidget::SampleTime::FIVE_MINUTES);
- labelSize->setText(QString("5 minutes"));
- break;
- case 1:
- hashRate->UpdateSampleTime(HashRateGraphWidget::SampleTime::TEN_MINUTES);
- labelSize->setText(QString("10 minutes"));
- break;
- case 2:
- hashRate->UpdateSampleTime(HashRateGraphWidget::SampleTime::THIRTY_MINUTES);
- labelSize->setText(QString("30 minutes"));
- break;
- case 3:
- hashRate->UpdateSampleTime(HashRateGraphWidget::SampleTime::ONE_HOUR);
- labelSize->setText(QString("1 hour"));
- break;
- case 4:
- hashRate->UpdateSampleTime(HashRateGraphWidget::SampleTime::EIGHT_HOURS);
- labelSize->setText(QString("8 hours"));
- break;
- case 5:
- hashRate->UpdateSampleTime(HashRateGraphWidget::SampleTime::TWELVE_HOURS);
- labelSize->setText(QString("12 hours"));
- break;
- case 6:
- hashRate->UpdateSampleTime(HashRateGraphWidget::SampleTime::ONE_DAY);
- labelSize->setText(QString("1 day"));
- break;
- default:
- hashRate->UpdateSampleTime(HashRateGraphWidget::SampleTime::ONE_DAY);
- labelSize->setText(QString("1 day"));
- break;
- }
-}
-
-void MiningPage::changeCPUSampleTime(int i)
-{
- QLabel* labelSize = ui->labelCPUGraphSampleSize;
- HashRateGraphWidget* hashRate = ui->minerCPUHashRateWidget;
- setSampleTimeLabel(labelSize, hashRate, i);
-}
-
-#ifdef ENABLE_GPU
-void MiningPage::changeGPUSampleTime(int i)
-{
- QLabel* labelSize = ui->labelGPUGraphSampleSize;
- HashRateGraphWidget* hashRate = ui->minerGPUHashRateWidget;
- setSampleTimeLabel(labelSize, hashRate, i);
-}
-#endif
diff --git a/src/qt/miningpage.h b/src/qt/miningpage.h
deleted file mode 100644
index 7d98d64d9e..0000000000
--- a/src/qt/miningpage.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2016-2021 Duality Blockchain Solutions Developers
-// Copyright (c) 2014-2021 The Dash Core Developers
-// Copyright (c) 2009-2021 The Bitcoin Developers
-// Copyright (c) 2009-2021 Satoshi Nakamoto
-// Distributed under the MIT/X11 software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef MININGPAGE_H
-#define MININGPAGE_H
-
-#include "platformstyle.h"
-
-#include "walletmodel.h"
-
-#include
-#include
-
-#include
-
-namespace Ui
-{
-class MiningPage;
-}
-
-class MiningPage : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit MiningPage(const PlatformStyle* platformStyle, QWidget* parent = 0);
- ~MiningPage();
-
- void setModel(WalletModel* model);
-
-private:
- Ui::MiningPage* ui;
- WalletModel* model;
- std::unique_ptr unlockContext;
- bool hasMiningprivkey;
- bool fGPUMinerOn;
- bool fCPUMinerOn;
- void timerEvent(QTimerEvent* event);
- void updateUI();
- void StartCPUMiner();
- void StopCPUMiner();
- void showCPUHashMeterControls(bool show);
- void updateCPUPushSwitch();
-#ifdef ENABLE_GPU
- void StartGPUMiner();
- void StopGPUMiner();
- void showGPUHashMeterControls(bool show);
- void updateGPUPushSwitch();
-#endif
-
- void updatePushSwitch(QPushButton* pushSwitch, bool minerOn);
-
- bool isMinerOn();
-
-private Q_SLOTS:
-
- void changeNumberOfCPUThreads(int i, bool shutdown = false);
- void switchCPUMining();
- void showCPUHashRate(int i);
- void changeCPUSampleTime(int i);
- void clearCPUHashRateData();
-
-
-#ifdef ENABLE_GPU
- void changeNumberOfGPUThreads(int i, bool shutdown = false);
- void switchGPUMining();
- void showGPUHashRate(int i);
- void changeGPUSampleTime(int i);
- void clearGPUHashRateData();
-#endif
-};
-
-#endif // MININGPAGE_H