Move desktopservices to settings
This commit is contained in:
@@ -424,14 +424,7 @@ void MainWindow::setupStatusBar() {
|
|||||||
QGuiApplication::clipboard()->setText(txid);
|
QGuiApplication::clipboard()->setText(txid);
|
||||||
});
|
});
|
||||||
menu.addAction("View tx on block explorer", [=]() {
|
menu.addAction("View tx on block explorer", [=]() {
|
||||||
QString url;
|
Settings::openTxInExplorer(txid);
|
||||||
if (Settings::getInstance()->isTestnet()) {
|
|
||||||
url = "https://explorer.testnet.z.cash/tx/" + txid;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
url = "https://explorer.zcha.in/transactions/" + txid;
|
|
||||||
}
|
|
||||||
QDesktopServices::openUrl(QUrl(url));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1109,13 +1102,7 @@ void MainWindow::setupBalancesTab() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
menu.addAction(tr("View on block explorer"), [=] () {
|
menu.addAction(tr("View on block explorer"), [=] () {
|
||||||
QString url;
|
Settings::openAddressInExplorer(addr);
|
||||||
if (Settings::getInstance()->isTestnet()) {
|
|
||||||
url = "https://explorer.testnet.z.cash/address/" + addr;
|
|
||||||
} else {
|
|
||||||
url = "https://explorer.zcha.in/accounts/" + addr;
|
|
||||||
}
|
|
||||||
QDesktopServices::openUrl(QUrl(url));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1175,13 +1162,7 @@ void MainWindow::setupTransactionsTab() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
menu.addAction(tr("View on block explorer"), [=] () {
|
menu.addAction(tr("View on block explorer"), [=] () {
|
||||||
QString url;
|
Settings::openTxInExplorer(txid);
|
||||||
if (Settings::getInstance()->isTestnet()) {
|
|
||||||
url = "https://explorer.testnet.z.cash/tx/" + txid;
|
|
||||||
} else {
|
|
||||||
url = "https://explorer.zcha.in/transactions/" + txid;
|
|
||||||
}
|
|
||||||
QDesktopServices::openUrl(QUrl(url));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Payment Request
|
// Payment Request
|
||||||
|
|||||||
@@ -160,6 +160,27 @@ void Settings::saveRestore(QDialog* d) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::openAddressInExplorer(QString address) {
|
||||||
|
QString url;
|
||||||
|
if (Settings::getInstance()->isTestnet()) {
|
||||||
|
url = "https://explorer.testnet.z.cash/address/" + address;
|
||||||
|
} else {
|
||||||
|
url = "https://explorer.zcha.in/accounts/" + address;
|
||||||
|
}
|
||||||
|
QDesktopServices::openUrl(QUrl(url));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::openTxInExplorer(QString txid) {
|
||||||
|
QString url;
|
||||||
|
if (Settings::getInstance()->isTestnet()) {
|
||||||
|
url = "https://explorer.testnet.z.cash/tx/" + txid;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
url = "https://explorer.zcha.in/transactions/" + txid;
|
||||||
|
}
|
||||||
|
QDesktopServices::openUrl(QUrl(url));
|
||||||
|
}
|
||||||
|
|
||||||
QString Settings::getUSDFormat(double bal) {
|
QString Settings::getUSDFormat(double bal) {
|
||||||
return "$" + QLocale(QLocale::English).toString(bal, 'f', 2);
|
return "$" + QLocale(QLocale::English).toString(bal, 'f', 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ public:
|
|||||||
|
|
||||||
static void saveRestore(QDialog* d);
|
static void saveRestore(QDialog* d);
|
||||||
|
|
||||||
|
static void openAddressInExplorer(QString address);
|
||||||
|
static void openTxInExplorer(QString txid);
|
||||||
|
|
||||||
static PaymentURI parseURI(QString paymentURI);
|
static PaymentURI parseURI(QString paymentURI);
|
||||||
static QString paymentURIPretty(PaymentURI);
|
static QString paymentURIPretty(PaymentURI);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user