Replace showMessageBox with Qt builtin

This commit is contained in:
tobtoht
2020-12-14 03:23:19 +01:00
parent b6459d1b64
commit 85a06007a1
13 changed files with 29 additions and 52 deletions
+2 -22
View File
@@ -276,7 +276,7 @@ bool Utils::testSocks5(const QString &host, quint16 port){
return false;
}
void Utils::externalLinkWarning(const QString &url){
void Utils::externalLinkWarning(QWidget *parent, const QString &url){
if(!config()->get(Config::warnOnExternalLink).toBool()) {
QDesktopServices::openUrl(QUrl(url));
return;
@@ -286,7 +286,7 @@ void Utils::externalLinkWarning(const QString &url){
body += QString("%1\n\n").arg(url);
body += "You will NOT be using Tor.";
switch (Utils::showMessageBox("External link warning", body, true)) {
switch (QMessageBox::warning(parent, "External link warning", body, QMessageBox::Cancel|QMessageBox::Ok)) {
case QMessageBox::Cancel:
break;
default:
@@ -327,26 +327,6 @@ bool Utils::walletExists(QString name, const QString &path) {
return Utils::fileExists(walletPath);
}
int Utils::showMessageBox(const QString &windowTitle, const QString &body, bool warning){
QMessageBox msgBox(QApplication::activeWindow());
msgBox.setWindowTitle(windowTitle);
msgBox.setText(body);
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
if(warning) {
QPixmap iconWarning = QPixmap(":/assets/images/ghost_icon.png");
msgBox.setIconPixmap(iconWarning);
}
else {
QPixmap iconInfo = QPixmap(":/assets/images/info.png")
.scaled(QSize(48,48), Qt::KeepAspectRatio, Qt::SmoothTransformation);
msgBox.setIconPixmap(iconInfo);
}
return msgBox.exec();
}
void Utils::copyToClipboard(const QString &string){
QClipboard * clipboard = QApplication::clipboard();
if (!clipboard) {