feat(qt): add MN type to MN tab (#5201)

## Issue being fixed or feature implemented
Added a "Type" column on the masternode tab so it's easy to distinguish
between regular and HPMN

## What was done?
Added column with type

## How Has This Been Tested?
Built locally and tried on devnet with an HPMN registered

## Breaking Changes
<!--- Please describe any breaking changes your code introduces -->

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation

**For repository code-owners and collaborators only**
- [x] I have assigned this pull request to a milestone

---------

Co-authored-by: Odysseas Gabrielides <odysseas.gabrielides@gmail.com>
This commit is contained in:
thephez 2023-02-15 15:59:54 -05:00 committed by GitHub
parent 50f16bc753
commit 919f6306fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -132,6 +132,11 @@
<string>Service</string> <string>Service</string>
</property> </property>
</column> </column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column> <column>
<property name="text"> <property name="text">
<string>Status</string> <string>Status</string>

View File

@ -58,6 +58,7 @@ MasternodeList::MasternodeList(QWidget* parent) :
GUIUtil::setFont({ui->label_filter_2}, GUIUtil::FontWeight::Normal, 15); GUIUtil::setFont({ui->label_filter_2}, GUIUtil::FontWeight::Normal, 15);
int columnAddressWidth = 200; int columnAddressWidth = 200;
int columnTypeWidth = 160;
int columnStatusWidth = 80; int columnStatusWidth = 80;
int columnPoSeScoreWidth = 80; int columnPoSeScoreWidth = 80;
int columnRegisteredWidth = 80; int columnRegisteredWidth = 80;
@ -70,6 +71,7 @@ MasternodeList::MasternodeList(QWidget* parent) :
int columnVotingWidth = 130; int columnVotingWidth = 130;
ui->tableWidgetMasternodesDIP3->setColumnWidth(COLUMN_SERVICE, columnAddressWidth); ui->tableWidgetMasternodesDIP3->setColumnWidth(COLUMN_SERVICE, columnAddressWidth);
ui->tableWidgetMasternodesDIP3->setColumnWidth(COLUMN_TYPE, columnTypeWidth);
ui->tableWidgetMasternodesDIP3->setColumnWidth(COLUMN_STATUS, columnStatusWidth); ui->tableWidgetMasternodesDIP3->setColumnWidth(COLUMN_STATUS, columnStatusWidth);
ui->tableWidgetMasternodesDIP3->setColumnWidth(COLUMN_POSE, columnPoSeScoreWidth); ui->tableWidgetMasternodesDIP3->setColumnWidth(COLUMN_POSE, columnPoSeScoreWidth);
ui->tableWidgetMasternodesDIP3->setColumnWidth(COLUMN_REGISTERED, columnRegisteredWidth); ui->tableWidgetMasternodesDIP3->setColumnWidth(COLUMN_REGISTERED, columnRegisteredWidth);
@ -230,6 +232,7 @@ void MasternodeList::updateDIP3List()
auto addr_key = dmn.pdmnState->addr.GetKey(); auto addr_key = dmn.pdmnState->addr.GetKey();
QByteArray addr_ba(reinterpret_cast<const char*>(addr_key.data()), addr_key.size()); QByteArray addr_ba(reinterpret_cast<const char*>(addr_key.data()), addr_key.size());
QTableWidgetItem* addressItem = new CMasternodeListWidgetItem<QByteArray>(QString::fromStdString(dmn.pdmnState->addr.ToString()), addr_ba); QTableWidgetItem* addressItem = new CMasternodeListWidgetItem<QByteArray>(QString::fromStdString(dmn.pdmnState->addr.ToString()), addr_ba);
QTableWidgetItem* typeItem = new QTableWidgetItem(QString::fromStdString(std::string(GetMnType(dmn.nType).description)));
QTableWidgetItem* statusItem = new QTableWidgetItem(mnList.IsMNValid(dmn) ? tr("ENABLED") : (mnList.IsMNPoSeBanned(dmn) ? tr("POSE_BANNED") : tr("UNKNOWN"))); QTableWidgetItem* statusItem = new QTableWidgetItem(mnList.IsMNValid(dmn) ? tr("ENABLED") : (mnList.IsMNPoSeBanned(dmn) ? tr("POSE_BANNED") : tr("UNKNOWN")));
QTableWidgetItem* PoSeScoreItem = new CMasternodeListWidgetItem<int>(QString::number(dmn.pdmnState->nPoSePenalty), dmn.pdmnState->nPoSePenalty); QTableWidgetItem* PoSeScoreItem = new CMasternodeListWidgetItem<int>(QString::number(dmn.pdmnState->nPoSePenalty), dmn.pdmnState->nPoSePenalty);
QTableWidgetItem* registeredItem = new CMasternodeListWidgetItem<int>(QString::number(dmn.pdmnState->nRegisteredHeight), dmn.pdmnState->nRegisteredHeight); QTableWidgetItem* registeredItem = new CMasternodeListWidgetItem<int>(QString::number(dmn.pdmnState->nRegisteredHeight), dmn.pdmnState->nRegisteredHeight);
@ -284,6 +287,7 @@ void MasternodeList::updateDIP3List()
if (strCurrentFilterDIP3 != "") { if (strCurrentFilterDIP3 != "") {
strToFilter = addressItem->text() + " " + strToFilter = addressItem->text() + " " +
typeItem->text() + " " +
statusItem->text() + " " + statusItem->text() + " " +
PoSeScoreItem->text() + " " + PoSeScoreItem->text() + " " +
registeredItem->text() + " " + registeredItem->text() + " " +
@ -300,6 +304,7 @@ void MasternodeList::updateDIP3List()
ui->tableWidgetMasternodesDIP3->insertRow(0); ui->tableWidgetMasternodesDIP3->insertRow(0);
ui->tableWidgetMasternodesDIP3->setItem(0, COLUMN_SERVICE, addressItem); ui->tableWidgetMasternodesDIP3->setItem(0, COLUMN_SERVICE, addressItem);
ui->tableWidgetMasternodesDIP3->setItem(0, COLUMN_TYPE, typeItem);
ui->tableWidgetMasternodesDIP3->setItem(0, COLUMN_STATUS, statusItem); ui->tableWidgetMasternodesDIP3->setItem(0, COLUMN_STATUS, statusItem);
ui->tableWidgetMasternodesDIP3->setItem(0, COLUMN_POSE, PoSeScoreItem); ui->tableWidgetMasternodesDIP3->setItem(0, COLUMN_POSE, PoSeScoreItem);
ui->tableWidgetMasternodesDIP3->setItem(0, COLUMN_REGISTERED, registeredItem); ui->tableWidgetMasternodesDIP3->setItem(0, COLUMN_REGISTERED, registeredItem);

View File

@ -42,6 +42,7 @@ public:
enum { enum {
COLUMN_SERVICE, COLUMN_SERVICE,
COLUMN_TYPE,
COLUMN_STATUS, COLUMN_STATUS,
COLUMN_POSE, COLUMN_POSE,
COLUMN_REGISTERED, COLUMN_REGISTERED,