Files
thehub/hub-qt/rpcconsole.h
T

154 lines
4.6 KiB
C++
Raw Permalink Normal View History

2017-11-09 19:34:51 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2011-2015 The Bitcoin Core developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2013-11-04 16:20:43 +01:00
2018-01-16 10:47:52 +00:00
#ifndef FLOWEE_QT_RPCCONSOLE_H
#define FLOWEE_QT_RPCCONSOLE_H
2012-04-09 21:07:25 +02:00
2014-05-23 12:09:59 -05:00
#include "guiutil.h"
#include "peertablemodel.h"
#include "net.h"
#include <QWidget>
2012-04-09 21:07:25 +02:00
2013-04-13 00:13:08 -05:00
class ClientModel;
2015-07-28 15:20:14 +02:00
class PlatformStyle;
class RPCTimerInterface;
2014-05-23 12:09:59 -05:00
2012-04-09 21:07:25 +02:00
namespace Ui {
class RPCConsole;
}
2014-09-05 13:18:35 +02:00
QT_BEGIN_NAMESPACE
class QMenu;
2014-09-05 13:18:35 +02:00
class QItemSelection;
QT_END_NAMESPACE
/** Local Bitcoin RPC console. */
class RPCConsole: public QWidget
2012-04-09 21:07:25 +02:00
{
Q_OBJECT
public:
2015-07-28 15:20:14 +02:00
explicit RPCConsole(const PlatformStyle *platformStyle, QWidget *parent);
2012-04-09 21:07:25 +02:00
~RPCConsole();
void setClientModel(ClientModel *model);
enum MessageClass {
MC_ERROR,
MC_DEBUG,
CMD_REQUEST,
CMD_REPLY,
CMD_ERROR
};
enum TabTypes {
TAB_INFO = 0,
TAB_CONSOLE = 1,
TAB_GRAPH = 2,
TAB_PEERS = 3
};
2012-04-09 21:07:25 +02:00
protected:
virtual bool eventFilter(QObject* obj, QEvent *event);
void keyPressEvent(QKeyEvent *);
2012-04-09 21:07:25 +02:00
2015-07-14 13:59:05 +02:00
private Q_SLOTS:
2012-04-09 21:07:25 +02:00
void on_lineEdit_returnPressed();
void on_tabWidget_currentChanged(int index);
2018-11-21 12:18:32 +01:00
/** open the hub.log from the current datadir */
void on_openDebugLogfileButton_clicked();
2013-08-23 02:09:32 +10:00
/** change the time range of the network traffic graph */
void on_sldGraphRange_valueChanged(int value);
/** update traffic statistics */
void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut);
2014-05-23 12:09:59 -05:00
void resizeEvent(QResizeEvent *event);
void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event);
/** Show custom context menu on Peers tab */
void showPeersTableContextMenu(const QPoint& point);
/** Show custom context menu on Bans tab */
void showBanTableContextMenu(const QPoint& point);
/** Hides ban table if no bans are present */
void showOrHideBanTableIfRequired();
2015-06-26 10:23:51 +02:00
/** clear the selected node */
void clearSelectedNode();
2015-07-14 13:59:05 +02:00
public Q_SLOTS:
2012-04-09 21:07:25 +02:00
void clear();
/** Append the message to the message widget */
void message(int category, const QString &message, bool html = false);
2012-04-09 21:07:25 +02:00
/** Set number of connections shown in the UI */
void setNumConnections(int count);
/** Set number of blocks and last block date shown in the UI */
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress);
2015-11-09 11:45:07 +01:00
/** Set size (number of transactions and memory usage) of the mempool in the UI */
void setMempoolSize(long numberOfTxs, size_t dynUsage);
2012-04-09 21:07:25 +02:00
/** Go forward or back in history */
void browseHistory(int offset);
/** Scroll console view to end */
void scrollToEnd();
2014-05-23 12:09:59 -05:00
/** Handle selection of peer in peers list */
void peerSelected(const QItemSelection &selected, const QItemSelection &deselected);
/** Handle updated peer information */
void peerLayoutChanged();
/** Disconnect a selected node on the Peers tab */
void disconnectSelectedNode();
2015-06-19 13:24:34 +02:00
/** Ban a selected node on the Peers tab */
void banSelectedNode(int bantime);
/** Unban a selected node on the Bans tab */
void unbanSelectedNode();
/** set which tab has the focus (is visible) */
void setTabFocus(enum TabTypes tabType);
2013-11-08 08:13:08 +01:00
2015-07-14 13:59:05 +02:00
Q_SIGNALS:
2012-04-09 21:07:25 +02:00
// For RPC command executor
void stopExecutor();
void cmdRequest(const QString &command);
private:
2013-08-23 02:09:32 +10:00
static QString FormatBytes(quint64 bytes);
2014-06-04 12:06:18 +02:00
void startExecutor();
2013-08-23 02:09:32 +10:00
void setTrafficGraphRange(int mins);
2014-06-04 12:06:18 +02:00
/** show detailed information on ui about selected node */
void updateNodeDetail(const CNodeCombinedStats *stats);
enum ColumnWidths
{
ADDRESS_COLUMN_WIDTH = 200,
SUBVERSION_COLUMN_WIDTH = 150,
PING_COLUMN_WIDTH = 80,
2015-06-26 14:55:52 +02:00
BANSUBNET_COLUMN_WIDTH = 200,
BANTIME_COLUMN_WIDTH = 250
2014-06-04 12:06:18 +02:00
};
2013-08-23 02:09:32 +10:00
2012-04-09 21:07:25 +02:00
Ui::RPCConsole *ui;
ClientModel *clientModel;
QStringList history;
int historyPtr;
2014-06-04 12:06:18 +02:00
NodeId cachedNodeid;
2015-07-28 15:20:14 +02:00
const PlatformStyle *platformStyle;
RPCTimerInterface *rpcTimerInterface;
QMenu *peersTableContextMenu;
QMenu *banTableContextMenu;
2012-04-09 21:07:25 +02:00
};
2018-01-16 10:47:52 +00:00
#endif