Merge pull request #10340 from Chocobo1/move

Move helper functions to Utils::Gui namespace
This commit is contained in:
Mike Tzou
2019-03-07 15:11:58 +08:00
committed by GitHub
23 changed files with 201 additions and 201 deletions

View File

@@ -41,6 +41,7 @@
#include <QAtomicInt>
#include <QDebug>
#include <QDir>
#include <QLibraryInfo>
#include <QProcess>
@@ -55,6 +56,7 @@
#endif // Q_OS_MAC
#include "addnewtorrentdialog.h"
#include "gui/guiiconprovider.h"
#include "gui/utils.h"
#include "mainwindow.h"
#include "shutdownconfirmdialog.h"
#else // DISABLE_GUI
@@ -533,7 +535,7 @@ int Application::exec(const QStringList &params)
msgBox.setText(tr("Application failed to start."));
msgBox.setInformativeText(err.message());
msgBox.show(); // Need to be shown or to moveToCenter does not work
msgBox.move(Utils::Misc::screenCenter(&msgBox));
msgBox.move(Utils::Gui::screenCenter(&msgBox));
msgBox.exec();
#endif
return 1;

View File

@@ -45,6 +45,10 @@
#include "base/utils/misc.h"
#include "base/utils/string.h"
#ifndef DISABLE_GUI
#include "gui/utils.h"
#endif
namespace
{
const int USAGE_INDENTATION = 4;
@@ -580,7 +584,7 @@ void displayUsage(const QString &prgName)
#else
QMessageBox msgBox(QMessageBox::Information, QObject::tr("Help"), makeUsage(prgName), QMessageBox::Ok);
msgBox.show(); // Need to be shown or to moveToCenter does not work
msgBox.move(Utils::Misc::screenCenter(&msgBox));
msgBox.move(Utils::Gui::screenCenter(&msgBox));
msgBox.exec();
#endif
}

View File

@@ -76,6 +76,10 @@ Q_IMPORT_PLUGIN(QICOPlugin)
#include "cmdoptions.h"
#include "upgrade.h"
#ifndef DISABLE_GUI
#include "gui/utils.h"
#endif
// Signal handlers
void sigNormalHandler(int signum);
#ifdef STACKTRACE
@@ -328,7 +332,7 @@ void displayBadArgMessage(const QString &message)
QMessageBox msgBox(QMessageBox::Critical, QObject::tr("Bad command line"),
message + QLatin1Char('\n') + help, QMessageBox::Ok);
msgBox.show(); // Need to be shown or to moveToCenter does not work
msgBox.move(Utils::Misc::screenCenter(&msgBox));
msgBox.move(Utils::Gui::screenCenter(&msgBox));
msgBox.exec();
#else
const QString errMsg = QObject::tr("Bad command line: ") + '\n'
@@ -364,7 +368,7 @@ bool userAgreesWithLegalNotice()
msgBox.addButton(QObject::tr("Cancel"), QMessageBox::RejectRole);
const QAbstractButton *agreeButton = msgBox.addButton(QObject::tr("I Agree"), QMessageBox::AcceptRole);
msgBox.show(); // Need to be shown or to moveToCenter does not work
msgBox.move(Utils::Misc::screenCenter(&msgBox));
msgBox.move(Utils::Gui::screenCenter(&msgBox));
msgBox.exec();
if (msgBox.clickedButton() == agreeButton) {
// Save the answer