MainWindow: add account id to title

This commit is contained in:
tobtoht 2021-05-23 15:58:28 +02:00
parent d3227ce054
commit 184d866614
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
4 changed files with 22 additions and 8 deletions

View file

@ -199,8 +199,8 @@ void MainWindow::initWidgets() {
m_xmrig = new XMRigWidget(m_ctx, this);
ui->xmrRigLayout->addWidget(m_xmrig);
connect(m_xmrig, &XMRigWidget::miningStarted, [this]{ this->setTitle(true); });
connect(m_xmrig, &XMRigWidget::miningEnded, [this]{ this->setTitle(false); });
connect(m_xmrig, &XMRigWidget::miningStarted, [this]{ this->updateTitle(); });
connect(m_xmrig, &XMRigWidget::miningEnded, [this]{ this->updateTitle(); });
#else
ui->tabWidget->setTabVisible(Tabs::XMRIG, false);
#endif
@ -361,6 +361,7 @@ void MainWindow::initWalletContext() {
// Wallet
connect(m_ctx->wallet.get(), &Wallet::connectionStatusChanged, this, &MainWindow::onConnectionStatusChanged);
connect(m_ctx->wallet.get(), &Wallet::currentSubaddressAccountChanged, [this]{this->updateTitle();});
}
void MainWindow::startupWarning() {
@ -461,7 +462,7 @@ void MainWindow::onWalletOpened() {
m_coinsWidget->setModel(m_ctx->wallet->coinsModel(), m_ctx->wallet->coins());
this->updatePasswordIcon();
this->setTitle(false);
this->updateTitle();
m_ctx->nodes->connectToNode();
m_updateBytes.start(250);
@ -1354,13 +1355,16 @@ QString MainWindow::getHardwareDevice() {
return "Unknown";
}
void MainWindow::setTitle(bool mining) {
auto title = QString("Feather - [%1]").arg(this->walletName());
if (m_ctx->wallet && m_ctx->wallet->viewOnly())
void MainWindow::updateTitle() {
QString title = QString("%1 (#%2)").arg(this->walletName(), QString::number(m_ctx->wallet->currentSubaddressAccount()));
if (m_ctx->wallet->viewOnly())
title += " [view-only]";
if (mining)
if (m_xmrig->isMining())
title += " [mining]";
title += " - Feather";
this->setWindowTitle(title);
}

View file

@ -200,7 +200,7 @@ private:
QString getPlatformTag();
void displayWalletErrorMsg(const QString &err);
QString getHardwareDevice();
void setTitle(bool mining);
void updateTitle();
void donationNag();
void updateRecentlyOpened(const QString &filename);

View file

@ -115,6 +115,10 @@ XMRigWidget::XMRigWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
}
}
bool XMRigWidget::isMining() {
return m_isMining;
}
void XMRigWidget::onWalletClosed() {
this->onStopClicked();
this->onClearClicked();
@ -173,6 +177,7 @@ void XMRigWidget::onStartClicked() {
m_XMRig->start(xmrigPath, m_threads, address, username, password, ui->relayTor->isChecked(), ui->check_tls->isChecked());
ui->btn_start->setEnabled(false);
ui->btn_stop->setEnabled(true);
m_isMining = true;
emit miningStarted();
}
@ -181,6 +186,7 @@ void XMRigWidget::onStopClicked() {
ui->btn_start->setEnabled(true);
ui->btn_stop->setEnabled(false);
ui->label_status->hide();
m_isMining = false;
emit miningEnded();
}
@ -200,6 +206,7 @@ void XMRigWidget::onProcessError(const QString &msg) {
ui->btn_start->setEnabled(true);
ui->btn_stop->setEnabled(false);
ui->label_status->hide();
m_isMining = false;
emit miningEnded();
}

View file

@ -25,6 +25,8 @@ public:
~XMRigWidget() override;
QStandardItemModel *model();
bool isMining();
public slots:
void onWalletClosed();
void onStartClicked();
@ -55,6 +57,7 @@ private:
QStandardItemModel *m_model;
QMenu *m_contextMenu;
bool m_isMining = false;
int m_threads;
QStringList m_urls;
QStringList m_pools{"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"};