right-click to start alias in "My Masternodes" sub-tab

This commit is contained in:
UdjinM6 2016-05-20 16:15:02 +03:00
parent 43cd805282
commit 16c20006ca
2 changed files with 23 additions and 4 deletions

View File

@ -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 += "<center>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;

View File

@ -6,8 +6,9 @@
#include "sync.h"
#include "util.h"
#include <QWidget>
#include <QMenu>
#include <QTimer>
#include <QWidget>
#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();