Skip to content

Commit

Permalink
Merge pull request #297 from carsenk/almostmaster
Browse files Browse the repository at this point in the history
Add new Denarius NVS UI
  • Loading branch information
metaspartan authored Jan 26, 2021
2 parents bbe9637 + 0e95d98 commit d5ffe9f
Show file tree
Hide file tree
Showing 16 changed files with 1,771 additions and 8 deletions.
5 changes: 5 additions & 0 deletions denarius-qt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ HEADERS += src/qt/bitcoingui.h \
src/sph_types.h \
src/threadsafety.h \
src/eccryptoverify.h \
src/qt/nametablemodel.h \
src/qt/managenamespage.h \
src/qt/messagepage.h \
src/qt/messagemodel.h \
src/qt/sendmessagesdialog.h \
Expand Down Expand Up @@ -635,6 +637,8 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
src/qt/qtipcserver.cpp \
src/qt/rpcconsole.cpp \
src/qt/trafficgraphwidget.cpp \
src/qt/nametablemodel.cpp \
src/qt/managenamespage.cpp \
src/qt/messagepage.cpp \
src/qt/messagemodel.cpp \
src/qt/qcustomplot.cpp \
Expand Down Expand Up @@ -694,6 +698,7 @@ FORMS += \
src/qt/forms/multisigaddressentry.ui \
src/qt/forms/multisiginputentry.ui \
src/qt/forms/multisigdialog.ui \
src/qt/forms/managenamespage.ui \
src/qt/forms/sendmessagesentry.ui \
src/qt/forms/sendmessagesdialog.ui \
src/qt/plugins/mrichtexteditor/mrichtextedit.ui
Expand Down
7 changes: 5 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3112,8 +3112,11 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck, boo
return error("ConnectBlock() : WriteBlockIndex failed");
}

// add names to denariusnamesindex.dat
hooks->ConnectBlock(txdb, pindex);
// Check Name Release Height to Connect Blocks
if (pindex->nHeight >= RELEASE_HEIGHT) {
// add names to denariusnamesindex.dat
hooks->ConnectBlock(txdb, pindex);
}

// Watch for transactions paying to me
BOOST_FOREACH(CTransaction& tx, vtx)
Expand Down
8 changes: 4 additions & 4 deletions src/namecoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ string SendMoneyWithInputTx(CScript scriptPubKey, int64_t nValue, int64_t nNetFe
return "";
}

// scans nameindex.dat and return names with their last CNameIndex
// scans denariusnamesindex.dat and return names with their last CNameIndex
bool CNameDB::ScanNames(
const vector<unsigned char>& vchName,
unsigned int nMax,
Expand Down Expand Up @@ -1317,7 +1317,7 @@ Value name_scan(const Array& params, bool fHelp)

vector<unsigned char> vchName;
int nMax = 500;
int mMaxShownValue = -1;
int mMaxShownValue = 10; //-1 for unlimited values
if (params.size() > 0)
{
vchName = vchFromValue(params[0]);
Expand Down Expand Up @@ -1356,7 +1356,7 @@ Value name_scan(const Array& params, bool fHelp)
vector<unsigned char> vchValue = txName.vchValue;

string value = stringFromVch(vchValue);
oName.push_back(Pair("value", limitString(value, mMaxShownValue, "\n...(value too large - use name_show to see full value)")));
oName.push_back(Pair("value", limitString(value, mMaxShownValue, "\n...(value redacted - use name_show to see full value)")));
oName.push_back(Pair("expires_in", nExpiresAt - pindexBest->nHeight));
if (nExpiresAt - pindexBest->nHeight <= 0)
oName.push_back(Pair("expired", true));
Expand Down Expand Up @@ -2380,7 +2380,7 @@ bool CNamecoinHooks::DisconnectInputs(const CTransaction& tx)
// be empty, since a reorg cannot go that far back. Be safe anyway and do not try to pop if empty.
if (nameRec.vtxPos.size() > 0)
{
// check if tx matches last tx in nameindex.dat
// check if tx matches last tx in denariusnamesindex.dat
CTransaction lastTx;
lastTx.ReadFromDisk(nameRec.vtxPos.back().txPos);
assert(lastTx.GetHash() == tx.GetHash());
Expand Down
1 change: 1 addition & 0 deletions src/qt/bitcoin.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<file alias="mark">res/icons/mark.png</file>
<file alias="btc">res/icons/btc.png</file>
<file alias="mn">res/icons/mn.png</file>
<file alias="names">res/icons/names.png</file>
<file alias="denominate">res/icons/multi.png</file>
<file alias="connect_0">res/icons/connect0_16.png</file>
<file alias="connect_1">res/icons/connect1_16.png</file>
Expand Down
25 changes: 24 additions & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "termsofuse.h"
#include "proofofimage.h"
#include "jupiter.h"
#include "managenamespage.h"

#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
Expand Down Expand Up @@ -191,6 +192,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
multisigPage = new MultisigDialog(this);
proofOfImagePage = new ProofOfImage(this);
jupiterPage = new Jupiter(this);
manageNamesPage = new ManageNamesPage(this);
//chatWindow = new ChatWindow(this);

transactionsPage = new QWidget(this);
Expand Down Expand Up @@ -220,6 +222,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
centralWidget->addWidget(overviewPage);
centralWidget->addWidget(transactionsPage);
centralWidget->addWidget(mintingPage);
centralWidget->addWidget(manageNamesPage);
centralWidget->addWidget(addressBookPage);
centralWidget->addWidget(receiveCoinsPage);
centralWidget->addWidget(sendCoinsPage);
Expand Down Expand Up @@ -353,6 +356,12 @@ void BitcoinGUI::createActions()
marketAction->setCheckable(true);
tabGroup->addAction(marketAction);

manageNamesAction = new QAction(QIcon(":/icons/names"), tr("&Manage NVS"), this);
manageNamesAction->setToolTip(tr("Manage Denarius NVS"));
manageNamesAction->setCheckable(true);
manageNamesAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
tabGroup->addAction(manageNamesAction);

//chatAction = new QAction(QIcon(":/icons/msg"), tr("&Social"), this);
//chatAction->setToolTip(tr("View chat"));
//chatAction->setCheckable(true);
Expand Down Expand Up @@ -432,6 +441,8 @@ void BitcoinGUI::createActions()
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(manageNamesAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(manageNamesAction, SIGNAL(triggered()), this, SLOT(gotoManageNamesPage()));
connect(mintingAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(mintingAction, SIGNAL(triggered()), this, SLOT(gotoMintingPage()));
connect(fortunastakeManagerAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
Expand Down Expand Up @@ -585,8 +596,9 @@ void BitcoinGUI::createToolBars()
mainToolbar->addAction(addressBookAction);
mainToolbar->addAction(statisticsAction);
mainToolbar->addAction(fortunastakeManagerAction);
mainToolbar->addAction(proofOfImageAction);
mainToolbar->addAction(manageNamesAction);
mainToolbar->addAction(jupiterAction);
mainToolbar->addAction(proofOfImageAction);
mainToolbar->addAction(marketAction);
mainToolbar->addAction(blockAction);
mainToolbar->addAction(messageAction);
Expand Down Expand Up @@ -696,6 +708,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
marketBrowser->setModel(clientModel);
fortunastakeManagerPage->setWalletModel(walletModel);
multisigPage->setModel(walletModel);
manageNamesPage->setModel(walletModel);
//chatWindow->setModel(clientModel);

setEncryptionStatus(walletModel->getEncryptionStatus());
Expand Down Expand Up @@ -1157,6 +1170,16 @@ void BitcoinGUI::gotoMarketBrowser()

}

void BitcoinGUI::gotoManageNamesPage()
{
manageNamesAction->setChecked(true);
centralWidget->setCurrentWidget(manageNamesPage);

exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), manageNamesPage, SLOT(exportClicked()));
}

void BitcoinGUI::gotoProofOfImagePage()
{
proofOfImageAction->setChecked(true);
Expand Down
5 changes: 5 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class WalletModel;
class MessageModel;
class TransactionView;
class MintingView;
class ManageNamesPage;
class FortunastakeManager;
class MultisigDialog;
class OverviewPage;
Expand Down Expand Up @@ -96,6 +97,7 @@ class BitcoinGUI : public QMainWindow
OverviewPage *overviewPage;
StatisticsPage *statisticsPage;
BlockBrowser *blockBrowser;
ManageNamesPage *manageNamesPage;
MarketBrowser *marketBrowser;
QWidget *transactionsPage;
QWidget *mintingPage;
Expand Down Expand Up @@ -131,6 +133,7 @@ class BitcoinGUI : public QMainWindow
QAction *multisigAction;
QAction *proofOfImageAction;
QAction *jupiterAction;
QAction *manageNamesAction;
QAction *fortunastakeManagerAction;
QAction *quitAction;
QAction *sendCoinsAction;
Expand Down Expand Up @@ -222,6 +225,8 @@ private slots:
void gotoBlockBrowser();
/** Switch to market*/
void gotoMarketBrowser();
/** Switch to manage names page */
void gotoManageNamesPage();
/** Switch to minting page */
void gotoMintingPage();
/** Switch to history (transactions) page */
Expand Down
Loading

0 comments on commit d5ffe9f

Please sign in to comment.