2020-10-14 20:12:32 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2022-02-10 10:26:41 +00:00
|
|
|
// SPDX-FileCopyrightText: 2020-2022 The Monero Project
|
2020-10-14 20:12:32 +00:00
|
|
|
|
2021-06-27 12:51:15 +00:00
|
|
|
#ifndef FEATHER_XMRIGWIDGET_H
|
|
|
|
#define FEATHER_XMRIGWIDGET_H
|
2020-10-14 20:12:32 +00:00
|
|
|
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QItemSelection>
|
|
|
|
|
2021-06-27 15:00:09 +00:00
|
|
|
#include "appcontext.h"
|
2020-10-14 20:12:32 +00:00
|
|
|
#include "utils/xmrig.h"
|
|
|
|
#include "utils/config.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class XMRigWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
class XMRigWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2021-05-18 15:59:18 +00:00
|
|
|
explicit XMRigWidget(QSharedPointer<AppContext> ctx, QWidget *parent = nullptr);
|
2020-12-11 13:36:08 +00:00
|
|
|
~XMRigWidget() override;
|
2020-10-14 20:12:32 +00:00
|
|
|
QStandardItemModel *model();
|
|
|
|
|
2021-05-23 13:58:28 +00:00
|
|
|
bool isMining();
|
2022-03-15 12:36:20 +00:00
|
|
|
void setDownloadsTabEnabled(bool enabled);
|
2021-05-23 13:58:28 +00:00
|
|
|
|
2020-10-14 20:12:32 +00:00
|
|
|
public slots:
|
2020-10-16 19:01:18 +00:00
|
|
|
void onWalletClosed();
|
2020-10-14 20:12:32 +00:00
|
|
|
void onStartClicked();
|
|
|
|
void onStopClicked();
|
|
|
|
void onClearClicked();
|
2021-10-12 12:45:06 +00:00
|
|
|
void onUsePrimaryAddressClicked();
|
2020-10-14 20:12:32 +00:00
|
|
|
void onDownloads(const QJsonObject &data);
|
|
|
|
void linkClicked();
|
2020-10-17 21:14:56 +00:00
|
|
|
void onProcessError(const QString &msg);
|
|
|
|
void onProcessOutput(const QByteArray &msg);
|
|
|
|
void onHashrate(const QString &hashrate);
|
2021-10-12 12:45:06 +00:00
|
|
|
void onMiningModeChanged(int mode);
|
|
|
|
void onNetworkTLSToggled(bool checked);
|
|
|
|
void onNetworkTorToggled(bool checked);
|
|
|
|
void onXMRigStateChanged(QProcess::ProcessState state);
|
2020-10-14 20:12:32 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onBrowseClicked();
|
|
|
|
void onThreadsValueChanged(int date);
|
2021-07-07 17:11:12 +00:00
|
|
|
void onPoolChanged(const QString &pool);
|
2021-10-12 12:45:06 +00:00
|
|
|
void onXMRigElevationChanged(bool elevated);
|
2020-10-14 20:12:32 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void miningStarted();
|
|
|
|
void miningEnded();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void showContextMenu(const QPoint &pos);
|
2021-07-07 17:11:12 +00:00
|
|
|
void updatePools();
|
2021-10-12 12:45:06 +00:00
|
|
|
void printConsoleInfo();
|
|
|
|
void setMiningStopped();
|
|
|
|
void setMiningStarted();
|
|
|
|
bool checkXMRigPath();
|
2020-10-14 20:12:32 +00:00
|
|
|
|
2021-06-27 12:13:05 +00:00
|
|
|
QScopedPointer<Ui::XMRigWidget> ui;
|
2021-05-18 15:59:18 +00:00
|
|
|
QSharedPointer<AppContext> m_ctx;
|
2021-10-12 12:45:06 +00:00
|
|
|
XmRig *m_XMRig;
|
2020-10-14 20:12:32 +00:00
|
|
|
QStandardItemModel *m_model;
|
|
|
|
QMenu *m_contextMenu;
|
2021-05-02 18:22:38 +00:00
|
|
|
|
2021-05-23 13:58:28 +00:00
|
|
|
bool m_isMining = false;
|
2020-10-14 20:12:32 +00:00
|
|
|
QStringList m_urls;
|
2021-07-07 17:11:12 +00:00
|
|
|
QStringList m_defaultPools{"pool.xmr.pt:9000", "pool.supportxmr.com:9000", "mine.xmrpool.net:443", "xmrpool.eu:9999", "xmr-eu1.nanopool.org:14433", "pool.minexmr.com:6666", "us-west.minexmr.com:6666", "monerohash.com:9999", "cryptonote.social:5555", "cryptonote.social:5556"};
|
2020-10-14 20:12:32 +00:00
|
|
|
};
|
|
|
|
|
2021-06-27 12:51:15 +00:00
|
|
|
#endif // FEATHER_XMRWIDGET_H
|