Commit d796755e authored by Ashot Khachatryan's avatar Ashot Khachatryan
Browse files

Adding masternode/systemnode related headers

parent 2e4c7897
......@@ -111,7 +111,9 @@ QT_FORMS_UI = \
qt/forms/sendcoinsdialog.ui \
qt/forms/sendcoinsentry.ui \
qt/forms/signverifymessagedialog.ui \
qt/forms/transactiondescdialog.ui
qt/forms/transactiondescdialog.ui \
qt/forms/masternodelist.ui \
qt/forms/systemnodelist.ui
QT_MOC_CPP = \
qt/moc_addressbookpage.cpp \
......@@ -159,7 +161,9 @@ QT_MOC_CPP = \
qt/moc_utilitydialog.cpp \
qt/moc_walletframe.cpp \
qt/moc_walletmodel.cpp \
qt/moc_walletview.cpp
qt/moc_walletview.cpp \
qt/moc_masternodelist.cpp \
qt/moc_systemnodelist.cpp
BITCOIN_MM = \
qt/macdockiconhandler.mm \
......@@ -235,7 +239,9 @@ BITCOIN_QT_H = \
qt/walletmodel.h \
qt/walletmodeltransaction.h \
qt/walletview.h \
qt/winshutdownmonitor.h
qt/winshutdownmonitor.h \
qt/masternodelist.h \
qt/systemnodelist.h
RES_ICONS = \
qt/res/icons/add.png \
......@@ -347,7 +353,9 @@ BITCOIN_QT_WALLET_CPP = \
qt/walletframe.cpp \
qt/walletmodel.cpp \
qt/walletmodeltransaction.cpp \
qt/walletview.cpp
qt/walletview.cpp \
qt/masternodelist.cpp \
qt/systemnodelist.cpp
BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP)
if TARGET_WINDOWS
......
......@@ -9,8 +9,8 @@
#include "net.h"
#include "key.h"
#include "init.h"
#include "wallet.h"
#include "legacysigner.h"
#include "wallet/wallet.h"
//#include "legacysigner.h"
#include "masternode.h"
#define ACTIVE_MASTERNODE_INITIAL 0 // initial state
......
......@@ -9,7 +9,7 @@
#include "net.h"
#include "key.h"
#include "init.h"
#include "wallet.h"
#include "wallet/wallet.h"
#include "systemnode-sync.h"
#include "legacysigner.h"
#include "systemnode.h"
......
......@@ -180,6 +180,7 @@ public:
/* disable fallback fee on mainnet */
m_fallback_fee_enabled = false;
strLegacySignerDummyAddress = "18WTcWvwrNnfqeQAn6th9QQ2EpnXMq5Th8";
}
};
......
......@@ -86,7 +86,9 @@ public:
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
const CCheckpointData& Checkpoints() const { return checkpointData; }
const ChainTxData& TxData() const { return chainTxData; }
const std::string NetworkID() const { return strNetworkID; }
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout);
std::string LegacySignerDummyAddress() const { return strLegacySignerDummyAddress; }
// TODO old values
// const uint256& HashGenesisBlock() const { return hashGenesisBlock; }
......@@ -175,6 +177,7 @@ protected:
CCheckpointData checkpointData;
ChainTxData chainTxData;
bool m_fallback_fee_enabled;
std::string strLegacySignerDummyAddress;
//TODO old values
// uint256 hashGenesisBlock;
......
......@@ -34,6 +34,7 @@ public:
//! whether containing transaction was a coinbase
unsigned int fCoinBase : 1;
unsigned int fCoinStake : 1;
//! at which height this containing transaction was included in the active block chain
uint32_t nHeight : 31;
......@@ -49,12 +50,16 @@ public:
}
//! empty constructor
Coin() : fCoinBase(false), nHeight(0) { }
Coin() : fCoinBase(false), fCoinStake(false), nHeight(0) { }
bool IsCoinBase() const {
return fCoinBase;
}
bool IsCoinStake() const {
return fCoinStake;
}
template<typename Stream>
void Serialize(Stream &s) const {
assert(!IsSpent());
......
......@@ -5,7 +5,7 @@
#ifndef LEGACYSIGNER_H
#define LEGACYSIGNER_H
#include "main.h"
#include "validation.h"
#include "sync.h"
#include "activemasternode.h"
#include "masternodeman.h"
......
......@@ -6,7 +6,7 @@
#ifndef MASTERNODE_BUDGET_H
#define MASTERNODE_BUDGET_H
#include "main.h"
#include "validation.h"
#include "sync.h"
#include "net.h"
#include "key.h"
......
......@@ -7,7 +7,7 @@
#define MASTERNODE_PAYMENTS_H
#include "key.h"
#include "main.h"
#include "validation.h"
#include "masternode.h"
#include <boost/lexical_cast.hpp>
......@@ -78,7 +78,7 @@ public:
void AddPayee(CScript payeeIn, int nIncrement){
LOCK(cs_vecPayments);
BOOST_FOREACH(CMasternodePayee& payee, vecPayments){
for (auto& payee : vecPayments) {
if(payee.scriptPubKey == payeeIn) {
payee.nVotes += nIncrement;
return;
......@@ -94,7 +94,7 @@ public:
LOCK(cs_vecPayments);
int nVotes = -1;
BOOST_FOREACH(CMasternodePayee& p, vecPayments){
for (auto& p : vecPayments) {
if(p.nVotes > nVotes){
payee = p.scriptPubKey;
nVotes = p.nVotes;
......@@ -108,7 +108,7 @@ public:
{
LOCK(cs_vecPayments);
BOOST_FOREACH(CMasternodePayee& p, vecPayments){
for (auto& p : vecPayments) {
if(p.nVotes >= nVotesReq && p.scriptPubKey == payee) return true;
}
......
......@@ -6,12 +6,13 @@
#ifndef MASTERNODE_H
#define MASTERNODE_H
#include <arith_uint256.h>
#include "validation.h"
#include "sync.h"
#include "net.h"
#include "key.h"
#include "util.h"
#include "base58.h"
#include "main.h"
#include "timedata.h"
#define MASTERNODE_MIN_CONFIRMATIONS 15
......
......@@ -11,7 +11,7 @@
#include "key.h"
#include "util.h"
#include "base58.h"
#include "main.h"
#include "validation.h"
#include "masternode.h"
#define MASTERNODES_DUMP_SECONDS (15*60)
......
......@@ -110,6 +110,11 @@ public:
READWRITE(nSequence);
}
bool IsFinal() const
{
return (nSequence == std::numeric_limits<uint32_t>::max());
}
friend bool operator==(const CTxIn& a, const CTxIn& b)
{
return (a.prevout == b.prevout &&
......
......@@ -24,7 +24,7 @@ class AmountSpinBox: public QAbstractSpinBox
public:
explicit AmountSpinBox(QWidget *parent):
QAbstractSpinBox(parent),
currentUnit(BitcoinUnits::BTC),
currentUnit(BitcoinUnits::CRW),
singleStep(100000) // satoshis
{
setAlignment(Qt::AlignRight);
......@@ -99,7 +99,7 @@ public:
const QFontMetrics fm(fontMetrics());
int h = lineEdit()->minimumSizeHint().height();
int w = fm.width(BitcoinUnits::format(BitcoinUnits::BTC, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways));
int w = fm.width(BitcoinUnits::format(BitcoinUnits::CRW, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways));
w += 2; // cursor blinking space
QStyleOptionSpinBox opt;
......
......@@ -224,7 +224,7 @@ BitcoinGUI::~BitcoinGUI()
void BitcoinGUI::createActions()
{
QActionGroup *tabGroup = new QActionGroup(this);
tabGroup = new QActionGroup(this);
overviewAction = new QAction(platformStyle->SingleColorIcon(":/icons/overview"), tr("&Overview"), this);
overviewAction->setStatusTip(tr("Show general overview of wallet"));
......@@ -403,10 +403,13 @@ void BitcoinGUI::createToolBars()
{
if(walletFrame)
{
QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
toolbar = new QToolBar(tr("Tabs toolbar"));
//toolbar->setOrientation(Qt::Vertical);
appToolBar = toolbar;
toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
addToolBar(Qt::LeftToolBarArea, toolbar);
toolbar->setMovable(false);
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->addAction(overviewAction);
toolbar->addAction(sendCoinsAction);
......@@ -414,6 +417,12 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(historyAction);
overviewAction->setChecked(true);
QLayout* lay = toolbar->layout();
for (int i = 0; i < lay->count(); ++i)
{
lay->itemAt(i)->setAlignment(Qt::AlignLeft);
}
#ifdef ENABLE_WALLET
QWidget *spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
......@@ -505,6 +514,14 @@ bool BitcoinGUI::addWallet(WalletModel *walletModel)
{
if(!walletFrame)
return false;
if (walletModel->getOptionsModel()->getSystemnodesEnabled())
{
enableSystemnodes();
}
if (walletModel->getOptionsModel()->getMasternodesEnabled())
{
enableMasternodes();
}
const QString name = walletModel->getWalletName();
QString display_name = name.isEmpty() ? "["+tr("default wallet")+"]" : name;
setWalletActionsEnabled(true);
......@@ -1236,6 +1253,68 @@ void BitcoinGUI::toggleNetworkActive()
m_node.setNetworkActive(!m_node.getNetworkActive());
}
void BitcoinGUI::enableSystemnodes()
{
if (systemnodeAction == NULL)
{
systemnodeAction = new QAction(QIcon(":/icons/systemnode"), tr("&Systemnodes"), this);
systemnodeAction->setStatusTip(tr("Browse systemnodes"));
systemnodeAction->setToolTip(systemnodeAction->statusTip());
systemnodeAction->setCheckable(true);
#ifdef Q_OS_MAC
systemnodeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_6));
#else
systemnodeAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
#endif
tabGroup->addAction(systemnodeAction);
connect(systemnodeAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(systemnodeAction, SIGNAL(triggered()), this, SLOT(gotoSystemnodePage()));
}
toolbar->addAction(systemnodeAction);
}
void BitcoinGUI::disableSystemnodes()
{
toolbar->removeAction(systemnodeAction);
gotoOverviewPage();
}
void BitcoinGUI::enableMasternodes()
{
if (masternodeAction == NULL)
{
masternodeAction = new QAction(QIcon(":/icons/masternode"), tr("&Masternodes"), this);
masternodeAction->setStatusTip(tr("Browse masternodes"));
masternodeAction->setToolTip(masternodeAction->statusTip());
masternodeAction->setCheckable(true);
#ifdef Q_OS_MAC
masternodeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_6));
#else
masternodeAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
#endif
tabGroup->addAction(masternodeAction);
connect(masternodeAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(masternodeAction, SIGNAL(triggered()), this, SLOT(gotoMasternodePage()));
}
toolbar->addAction(masternodeAction);
}
void BitcoinGUI::disableMasternodes()
{
toolbar->removeAction(masternodeAction);
gotoOverviewPage();
}
void BitcoinGUI::guiEnableSystemnodesChanged(bool enabled)
{
enabled ? enableSystemnodes() : disableSystemnodes();
}
void BitcoinGUI::guiEnableMasternodesChanged(bool enabled)
{
enabled ? enableMasternodes() : disableMasternodes();
}
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) :
optionsModel(0),
menu(0)
......
......@@ -102,8 +102,12 @@ private:
QMenuBar* appMenuBar = nullptr;
QToolBar* appToolBar = nullptr;
QToolBar *toolbar = nullptr;
QActionGroup *tabGroup = nullptr;
QAction* overviewAction = nullptr;
QAction* historyAction = nullptr;
QAction *masternodeAction = nullptr;
QAction *systemnodeAction = nullptr;
QAction* quitAction = nullptr;
QAction* sendCoinsAction = nullptr;
QAction* sendCoinsMenuAction = nullptr;
......@@ -186,6 +190,8 @@ public Q_SLOTS:
@param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only)
*/
void message(const QString &title, const QString &message, unsigned int style, bool *ret = nullptr);
void guiEnableSystemnodesChanged(bool);
void guiEnableMasternodesChanged(bool);
#ifdef ENABLE_WALLET
bool setCurrentWallet(const QString& name);
......@@ -270,6 +276,13 @@ private Q_SLOTS:
void toggleNetworkActive();
void showModalOverlay();
private:
void enableSystemnodes();
void disableSystemnodes();
void enableMasternodes();
void disableMasternodes();
};
class UnitDisplayStatusBarControl : public QLabel
......
......@@ -17,10 +17,10 @@ BitcoinUnits::BitcoinUnits(QObject *parent):
QList<BitcoinUnits::Unit> BitcoinUnits::availableUnits()
{
QList<BitcoinUnits::Unit> unitlist;
unitlist.append(BTC);
unitlist.append(mBTC);
unitlist.append(uBTC);
unitlist.append(SAT);
unitlist.append(CRW);
unitlist.append(mCRW);
unitlist.append(uCRW);
unitlist.append(cSats);
return unitlist;
}
......@@ -28,10 +28,10 @@ bool BitcoinUnits::valid(int unit)
{
switch(unit)
{
case BTC:
case mBTC:
case uBTC:
case SAT:
case CRW:
case mCRW:
case uCRW:
case cSats:
return true;
default:
return false;
......@@ -42,10 +42,10 @@ QString BitcoinUnits::longName(int unit)
{
switch(unit)
{
case BTC: return QString("BTC");
case mBTC: return QString("mBTC");
case uBTC: return QString::fromUtf8(BTC (bits)");
case SAT: return QString("Satoshi (sat)");
case CRW: return QString("CRW");
case mCRW: return QString("mCRW");
case uCRW: return QString::fromUtf8(CRW (bits)");
case cSats: return QString("Satoshi (sat)");
default: return QString("???");
}
}
......@@ -54,8 +54,8 @@ QString BitcoinUnits::shortName(int unit)
{
switch(unit)
{
case uBTC: return QString::fromUtf8("bits");
case SAT: return QString("sat");
case uCRW: return QString::fromUtf8("bits");
case cSats: return QString("sat");
default: return longName(unit);
}
}
......@@ -64,10 +64,10 @@ QString BitcoinUnits::description(int unit)
{
switch(unit)
{
case BTC: return QString("Bitcoins");
case mBTC: return QString("Milli-Bitcoins (1 / 1" THIN_SP_UTF8 "000)");
case uBTC: return QString("Micro-Bitcoins (bits) (1 / 1" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)");
case SAT: return QString("Satoshi (sat) (1 / 100" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)");
case CRW: return QString("Bitcoins");
case mCRW: return QString("Milli-Bitcoins (1 / 1" THIN_SP_UTF8 "000)");
case uCRW: return QString("Micro-Bitcoins (bits) (1 / 1" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)");
case cSats: return QString("Satoshi (sat) (1 / 100" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)");
default: return QString("???");
}
}
......@@ -76,10 +76,10 @@ qint64 BitcoinUnits::factor(int unit)
{
switch(unit)
{
case BTC: return 100000000;
case mBTC: return 100000;
case uBTC: return 100;
case SAT: return 1;
case CRW: return 100000000;
case mCRW: return 100000;
case uCRW: return 100;
case cSats: return 1;
default: return 100000000;
}
}
......@@ -88,10 +88,10 @@ int BitcoinUnits::decimals(int unit)
{
switch(unit)
{
case BTC: return 8;
case mBTC: return 5;
case uBTC: return 2;
case SAT: return 0;
case CRW: return 8;
case mCRW: return 5;
case uCRW: return 2;
case cSats: return 0;
default: return 0;
}
}
......
......@@ -56,10 +56,10 @@ public:
*/
enum Unit
{
BTC,
mBTC,
uBTC,
SAT
CRW,
mCRW,
uCRW,
cSats
};
enum SeparatorStyle
......
......@@ -529,7 +529,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
}
// actually update labels
int nDisplayUnit = BitcoinUnits::BTC;
int nDisplayUnit = BitcoinUnits::CRW;
if (model && model->getOptionsModel())
nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
......
......@@ -24,7 +24,7 @@ public:
void setNoteLabel(QString text);
void setEditMode();
protected slots:
protected Q_SLOTS:
void accept();
private:
......
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/icons">
<file alias="bitcoin">res/icons/bitcoin.png</file>
<file alias="address-book">res/icons/address-book.png</file>
<file alias="quit">res/icons/quit.png</file>
<file alias="send">res/icons/send.png</file>
<file alias="connect_0">res/icons/connect0_16.png</file>
<file alias="connect_1">res/icons/connect1_16.png</file>
<file alias="connect_2">res/icons/connect2_16.png</file>
<file alias="connect_3">res/icons/connect3_16.png</file>
<file alias="connect_4">res/icons/connect4_16.png</file>
<file alias="transaction_0">res/icons/transaction0.png</file>
<file alias="transaction_confirmed">res/icons/transaction2.png</file>
<file alias="transaction_conflicted">res/icons/transaction_conflicted.png</file>
<file alias="transaction_1">res/icons/clock1.png</file>
<file alias="transaction_2">res/icons/clock2.png</file>
<file alias="transaction_3">res/icons/clock3.png</file>
<file alias="transaction_4">res/icons/clock4.png</file>
<file alias="transaction_5">res/icons/clock5.png</file>
<file alias="eye">res/icons/eye.png</file>
<file alias="eye_minus">res/icons/eye_minus.png</file>
<file alias="eye_plus">res/icons/eye_plus.png</file>
<file alias="options">res/icons/configure.png</file>
<file alias="receiving_addresses">res/icons/receive.png</file>
<file alias="editpaste">res/icons/editpaste.png</file>
<file alias="editcopy">res/icons/editcopy.png</file>
<file alias="add">res/icons/add.png</file>
<file alias="bitcoin_testnet">res/icons/bitcoin_testnet.png</file>
<file alias="edit">res/icons/edit.png</file>
<file alias="history">res/icons/history.png</file>
<file alias="overview">res/icons/overview.png</file>
<file alias="export">res/icons/export.png</file>
<file alias="synced">res/icons/synced.png</file>
<file alias="remove">res/icons/remove.png</file>
<file alias="tx_mined">res/icons/tx_mined.png</file>
<file alias="tx_input">res/icons/tx_input.png</file>
<file alias="tx_output">res/icons/tx_output.png</file>
<file alias="tx_inout">res/icons/tx_inout.png</file>
<file alias="unit_crown">res/icons/unit_crown.png</file>
<file alias="unit_mcrown">res/icons/unit_mcrown.png</file>
<file alias="unit_ucrown">res/icons/unit_ucrown.png</file>
<file alias="unit_csats">res/icons/unit_csats.png</file>
<file alias="unit_tcrown">res/icons/unit_tcrown.png</file>
<file alias="unit_tmcrown">res/icons/unit_tmcrown.png</file>
<file alias="unit_tucrown">res/icons/unit_tucrown.png</file>
<file alias="unit_tcsats">res/icons/unit_tcsats.png</file>
<file alias="lock_closed">res/icons/lock_closed.png</file>
<file alias="notsynced">res/icons/notsynced.png</file>
<file alias="lock_open">res/icons/lock_open.png</file>
<file alias="key">res/icons/key.png</file>
<file alias="filesave">res/icons/filesave.png</file>
<file alias="qrcode">res/icons/qrcode.png</file>
<file alias="debugwindow">res/icons/debugwindow.png</file>
<file alias="drkblue_editpaste">res/icons/drkblue_editpaste.png</file>
<file alias="drkblue_address-book">res/icons/drkblue_address-book.png</file>
<file alias="drkblue_editcopy">res/icons/drkblue_editcopy.png</file>
<file alias="drkblue_remove">res/icons/drkblue_remove.png</file>
<file alias="masternode">res/icons/masternode.png</file>
<file alias="systemnode">res/icons/systemnode.png</file>
<file alias="show">res/icons/show.png</file>
<file alias="hide">res/icons/hide.png</file>
<file alias="copy">res/icons/copy.png</file>
<file alias="browse">res/icons/browse.png</file>
<file alias="toolbar">res/icons/toolbar.png</file>
</qresource>
<qresource prefix="/css">
<file alias="crown">res/css/crown.css</file>
<file alias="down_arrow">res/css/down_arrow.png</file>
<file alias="upArrow_small">res/css/upArrow_small.png</file>
<file alias="downArrow_small">res/css/downArrow_small.png</file>
<file alias="logo">res/css/logo.png</file>
</qresource>
<qresource prefix="/images">
<file alias="about">res/images/about.png</file>
<file alias="crown_logo_horizontal">res/images/crown_logo_horizontal.png</file>
<file alias="drkblue_downArrow">res/images/drkblue_downArrow.png</file>
<file alias="drkblue_downArrow_small">res/images/drkblue_downArrow_small.png</file>
<file alias="drkblue_upArrow_small">res/images/drkblue_upArrow_small.png</file>
<file alias="drkblue_leftArrow_small">res/images/drkblue_leftArrow_small.png</file>
<file alias="drkblue_rightArrow_small">res/images/drkblue_rightArrow_small.png</file>
<file alias="drkblue_qtreeview_selected">res/images/drkblue_qtreeview_selected.png</file>
<file alias="drkblue_walletFrame_bg">res/images/drkblue_walletFrame_bg.png</file>
<file alias="drkblue_walletFrame">res/images/drkblue_walletFrame.png</file>
<file alias="splash">res/images/splash.png</file>
<file alias="splash_testnet">res/images/splash_testnet.png</file>
</qresource>
<qresource prefix="/movies">
<file alias="spinner-000">res/movies/spinner-000.png</file>