Skip to content

Commit 89ce7ff

Browse files
committed
[Qt] Add new colors for proposals
Show passing (enough votes and whatnot) but unfunded (lack of funds in the budget) proposals in yellow and unestablished proposals (less than 24 hours since submission) in blue
1 parent bda0322 commit 89ce7ff

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

src/qt/governancepage.cpp

+16-15
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ void GovernancePage::updateProposalList()
8484
std::vector<CBudgetProposal*> proposalsList = budget.GetAllProposals();
8585
std::sort (proposalsList.begin(), proposalsList.end(), sortProposalsByVotes());
8686
int nRow = 0;
87+
CBlockIndex* pindexPrev = chainActive.Tip();
88+
if (!pindexPrev) return;
89+
int nBlockStart = pindexPrev->nHeight - pindexPrev->nHeight % Params().GetBudgetCycleBlocks() + Params().GetBudgetCycleBlocks();
90+
int nBlocksLeft = nBlockStart - pindexPrev->nHeight;
91+
int nBlockEnd = nBlockStart + Params().GetBudgetCycleBlocks() - 1;
92+
int mnCount = mnodeman.CountEnabled(ActiveProtocol());
93+
8794
for (CBudgetProposal* pbudgetProposal : proposalsList) {
8895
if (!pbudgetProposal->fValid) continue;
8996
if (pbudgetProposal->GetRemainingPaymentCount() < 1) continue;
@@ -96,8 +103,13 @@ void GovernancePage::updateProposalList()
96103
if (std::find(allotedProposals.begin(), allotedProposals.end(), pbudgetProposal) != allotedProposals.end()) {
97104
nTotalAllotted += pbudgetProposal->GetAllotted();
98105
proposalFrame->setObjectName(QStringLiteral("proposalFramePassing"));
99-
} else
106+
} else if (!pbudgetProposal->IsEstablished()) {
107+
proposalFrame->setObjectName(QStringLiteral("proposalFrameNotEstablished"));
108+
} else if (pbudgetProposal->IsPassing(pindexPrev, nBlockStart, nBlockEnd, mnCount)) {
109+
proposalFrame->setObjectName(QStringLiteral("proposalFramePassingUnfunded"));
110+
} else {
100111
proposalFrame->setObjectName(QStringLiteral("proposalFrame"));
112+
}
101113
proposalFrame->setFrameShape(QFrame::StyledPanel);
102114

103115
if (extendedProposal == pbudgetProposal)
@@ -108,20 +120,9 @@ void GovernancePage::updateProposalList()
108120
++nRow;
109121
}
110122

111-
CBlockIndex* pindexPrev = chainActive.Tip();
112-
int nNext, nLeft;
113-
if (!pindexPrev) {
114-
nNext = 0;
115-
nLeft = 0;
116-
}
117-
else {
118-
nNext = pindexPrev->nHeight - pindexPrev->nHeight % Params().GetBudgetCycleBlocks() + Params().GetBudgetCycleBlocks();
119-
nLeft = nNext - pindexPrev->nHeight;
120-
}
121-
122-
ui->next_superblock_value->setText(QString::number(nNext));
123-
ui->blocks_before_super_value->setText(QString::number(nLeft));
124-
ui->time_before_super_value->setText(QString::number(nLeft/60/24));
123+
ui->next_superblock_value->setText(QString::number(nBlockStart));
124+
ui->blocks_before_super_value->setText(QString::number(nBlocksLeft));
125+
ui->time_before_super_value->setText(QString::number(nBlocksLeft/60/24));
125126
ui->alloted_budget_value->setText(QString::number(nTotalAllotted/COIN));
126127
ui->unallocated_budget_value->setText(QString::number((budget.GetTotalBudget(pindexPrev->nHeight) - nTotalAllotted)/COIN));
127128
ui->masternode_count_value->setText(QString::number(mnodeman.stable_size()));

src/qt/res/css/default.css

+10
Original file line numberDiff line numberDiff line change
@@ -1722,6 +1722,16 @@ QWidget#GovernancePage .ProposalFrame#proposalFramePassing {
17221722
border:1px solid #00ef00;
17231723
}
17241724

1725+
QWidget#GovernancePage .ProposalFrame#proposalFrameNotEstablished {
1726+
background-color:qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #0080ff, stop: 1 #00a3ff);
1727+
border:1px solid #00a3ff;
1728+
}
1729+
1730+
QWidget#GovernancePage .ProposalFrame#proposalFramePassingUnfunded {
1731+
background-color:qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #cccc00, stop: 1 #efef00);
1732+
border:1px solid #efef00;
1733+
}
1734+
17251735
QWidget#GovernancePage .ProposalFrame > QLabel#strProposalName, QLabel#strMonthlyPayout, QLabel#strRemainingPaymentCount {
17261736
font-size:18pt;
17271737
}

0 commit comments

Comments
 (0)