diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index 396e9ac7ac..bf208217a9 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -48,6 +48,14 @@ MasternodeList::MasternodeList(const PlatformStyle *platformStyle, QWidget *pare ui->tableWidgetMasternodes->setColumnWidth(3, columnActiveWidth); ui->tableWidgetMasternodes->setColumnWidth(4, columnLastSeenWidth); + ui->tableWidgetMyMasternodes->setContextMenuPolicy(Qt::CustomContextMenu); + + QAction *startAliasAction = new QAction(tr("Start alias"), this); + contextMenu = new QMenu(); + contextMenu->addAction(startAliasAction); + connect(ui->tableWidgetMyMasternodes, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint&))); + connect(startAliasAction, SIGNAL(triggered()), this, SLOT(on_startButton_clicked())); + timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateNodeList())); connect(timer, SIGNAL(timeout()), this, SLOT(updateMyNodeList())); @@ -76,8 +84,14 @@ void MasternodeList::setWalletModel(WalletModel *model) this->walletModel = model; } -void MasternodeList::StartAlias(std::string strAlias) { +void MasternodeList::showContextMenu(const QPoint &point) +{ + QTableWidgetItem *item = ui->tableWidgetMyMasternodes->itemAt(point); + if(item) contextMenu->exec(QCursor::pos()); +} +void MasternodeList::StartAlias(std::string strAlias) +{ std::string statusObj; statusObj += "
Alias: " + strAlias; @@ -106,8 +120,8 @@ void MasternodeList::StartAlias(std::string strAlias) { msg.exec(); } -void MasternodeList::StartAll(std::string strCommand) { - +void MasternodeList::StartAll(std::string strCommand) +{ int total = 0; int successful = 0; int fail = 0; diff --git a/src/qt/masternodelist.h b/src/qt/masternodelist.h index fceade4987..90e48fc321 100644 --- a/src/qt/masternodelist.h +++ b/src/qt/masternodelist.h @@ -6,8 +6,9 @@ #include "sync.h" #include "util.h" -#include +#include #include +#include #define MASTERNODELIST_UPDATE_SECONDS 5 #define MY_MASTERNODELIST_UPDATE_SECONDS 60 @@ -37,6 +38,9 @@ public: void StartAlias(std::string strAlias); void StartAll(std::string strCommand = "start-all"); +private: + QMenu *contextMenu; + public Q_SLOTS: void updateMyMasternodeInfo(QString alias, QString addr, QString privkey, QString txHash, QString txIndex, CMasternode *pmn); void updateMyNodeList(bool reset = false); @@ -53,6 +57,7 @@ private: QString strCurrentFilter; private Q_SLOTS: + void showContextMenu(const QPoint &); void on_filterLineEdit_textChanged(const QString &filterString); void on_startButton_clicked(); void on_startAllButton_clicked();