Skip to content

Commit

Permalink
[Qt] Add new colors for proposals
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Warrows committed Apr 26, 2019
1 parent bda0322 commit 89ce7ff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/qt/governancepage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ void GovernancePage::updateProposalList()
std::vector<CBudgetProposal*> proposalsList = budget.GetAllProposals();
std::sort (proposalsList.begin(), proposalsList.end(), sortProposalsByVotes());
int nRow = 0;
CBlockIndex* pindexPrev = chainActive.Tip();
if (!pindexPrev) return;
int nBlockStart = pindexPrev->nHeight - pindexPrev->nHeight % Params().GetBudgetCycleBlocks() + Params().GetBudgetCycleBlocks();
int nBlocksLeft = nBlockStart - pindexPrev->nHeight;
int nBlockEnd = nBlockStart + Params().GetBudgetCycleBlocks() - 1;
int mnCount = mnodeman.CountEnabled(ActiveProtocol());

for (CBudgetProposal* pbudgetProposal : proposalsList) {
if (!pbudgetProposal->fValid) continue;
if (pbudgetProposal->GetRemainingPaymentCount() < 1) continue;
Expand All @@ -96,8 +103,13 @@ void GovernancePage::updateProposalList()
if (std::find(allotedProposals.begin(), allotedProposals.end(), pbudgetProposal) != allotedProposals.end()) {
nTotalAllotted += pbudgetProposal->GetAllotted();
proposalFrame->setObjectName(QStringLiteral("proposalFramePassing"));
} else
} else if (!pbudgetProposal->IsEstablished()) {
proposalFrame->setObjectName(QStringLiteral("proposalFrameNotEstablished"));
} else if (pbudgetProposal->IsPassing(pindexPrev, nBlockStart, nBlockEnd, mnCount)) {
proposalFrame->setObjectName(QStringLiteral("proposalFramePassingUnfunded"));
} else {
proposalFrame->setObjectName(QStringLiteral("proposalFrame"));
}
proposalFrame->setFrameShape(QFrame::StyledPanel);

if (extendedProposal == pbudgetProposal)
Expand All @@ -108,20 +120,9 @@ void GovernancePage::updateProposalList()
++nRow;
}

CBlockIndex* pindexPrev = chainActive.Tip();
int nNext, nLeft;
if (!pindexPrev) {
nNext = 0;
nLeft = 0;
}
else {
nNext = pindexPrev->nHeight - pindexPrev->nHeight % Params().GetBudgetCycleBlocks() + Params().GetBudgetCycleBlocks();
nLeft = nNext - pindexPrev->nHeight;
}

ui->next_superblock_value->setText(QString::number(nNext));
ui->blocks_before_super_value->setText(QString::number(nLeft));
ui->time_before_super_value->setText(QString::number(nLeft/60/24));
ui->next_superblock_value->setText(QString::number(nBlockStart));
ui->blocks_before_super_value->setText(QString::number(nBlocksLeft));
ui->time_before_super_value->setText(QString::number(nBlocksLeft/60/24));
ui->alloted_budget_value->setText(QString::number(nTotalAllotted/COIN));
ui->unallocated_budget_value->setText(QString::number((budget.GetTotalBudget(pindexPrev->nHeight) - nTotalAllotted)/COIN));
ui->masternode_count_value->setText(QString::number(mnodeman.stable_size()));
Expand Down
10 changes: 10 additions & 0 deletions src/qt/res/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,16 @@ QWidget#GovernancePage .ProposalFrame#proposalFramePassing {
border:1px solid #00ef00;
}

QWidget#GovernancePage .ProposalFrame#proposalFrameNotEstablished {
background-color:qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #0080ff, stop: 1 #00a3ff);
border:1px solid #00a3ff;
}

QWidget#GovernancePage .ProposalFrame#proposalFramePassingUnfunded {
background-color:qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #cccc00, stop: 1 #efef00);
border:1px solid #efef00;
}

QWidget#GovernancePage .ProposalFrame > QLabel#strProposalName, QLabel#strMonthlyPayout, QLabel#strRemainingPaymentCount {
font-size:18pt;
}
Expand Down

0 comments on commit 89ce7ff

Please sign in to comment.