fix(updater): add parent to dialog to fix issues in tilling WMs
QProgressDialog without parents in Qt tend to cause graphical issues on some systems, so we add the main window as a parent here! Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
a6c8a37a5d
commit
494483fd2b
@ -857,17 +857,6 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
qDebug() << "<> Translations loaded.";
|
qDebug() << "<> Translations loaded.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize the updater
|
|
||||||
if (updaterEnabled()) {
|
|
||||||
qDebug() << "Initializing updater";
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
m_updater.reset(new MacSparkleUpdater());
|
|
||||||
#else
|
|
||||||
m_updater.reset(new PrismExternalUpdater(applicationDirPath(), m_dataPath));
|
|
||||||
#endif
|
|
||||||
qDebug() << "<> Updater started.";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Instance icons
|
// Instance icons
|
||||||
{
|
{
|
||||||
auto setting = APPLICATION->settings()->getSetting("IconsDir");
|
auto setting = APPLICATION->settings()->getSetting("IconsDir");
|
||||||
@ -968,6 +957,25 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
|
|
||||||
applyCurrentlySelectedTheme(true);
|
applyCurrentlySelectedTheme(true);
|
||||||
|
|
||||||
|
updateCapabilities();
|
||||||
|
|
||||||
|
if (createSetupWizard()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
performMainStartupAction();
|
||||||
|
|
||||||
|
// initialize the updater
|
||||||
|
if (updaterEnabled()) {
|
||||||
|
qDebug() << "Initializing updater";
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
m_updater.reset(new MacSparkleUpdater());
|
||||||
|
#else
|
||||||
|
m_updater.reset(new PrismExternalUpdater(m_mainWindow, applicationDirPath(), m_dataPath));
|
||||||
|
#endif
|
||||||
|
qDebug() << "<> Updater started.";
|
||||||
|
}
|
||||||
|
|
||||||
// check update locks
|
// check update locks
|
||||||
{
|
{
|
||||||
auto update_log_path = FS::PathCombine(m_dataPath, "logs", "prism_launcher_update.log");
|
auto update_log_path = FS::PathCombine(m_dataPath, "logs", "prism_launcher_update.log");
|
||||||
@ -1063,14 +1071,6 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
FS::deletePath(update_success_marker.absoluteFilePath());
|
FS::deletePath(update_success_marker.absoluteFilePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCapabilities();
|
|
||||||
|
|
||||||
if (createSetupWizard()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
performMainStartupAction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Application::createSetupWizard()
|
bool Application::createSetupWizard()
|
||||||
|
@ -48,9 +48,11 @@ class PrismExternalUpdater::Private {
|
|||||||
double updateInterval;
|
double updateInterval;
|
||||||
QDateTime lastCheck;
|
QDateTime lastCheck;
|
||||||
std::unique_ptr<QSettings> settings;
|
std::unique_ptr<QSettings> settings;
|
||||||
|
|
||||||
|
QWidget* parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
PrismExternalUpdater::PrismExternalUpdater(const QString& binDir, const QString& dataDir)
|
PrismExternalUpdater::PrismExternalUpdater(QWidget* parent, const QString& binDir, const QString& dataDir)
|
||||||
{
|
{
|
||||||
priv = new PrismExternalUpdater::Private();
|
priv = new PrismExternalUpdater::Private();
|
||||||
priv->binDir = QDir(binDir);
|
priv->binDir = QDir(binDir);
|
||||||
@ -68,6 +70,7 @@ PrismExternalUpdater::PrismExternalUpdater(const QString& binDir, const QString&
|
|||||||
if (!last_check.isNull() && last_check.isValid()) {
|
if (!last_check.isNull() && last_check.isValid()) {
|
||||||
priv->lastCheck = QDateTime::fromString(last_check.toString(), Qt::ISODate);
|
priv->lastCheck = QDateTime::fromString(last_check.toString(), Qt::ISODate);
|
||||||
}
|
}
|
||||||
|
priv->parent = parent;
|
||||||
connectTimer();
|
connectTimer();
|
||||||
resetAutoCheckTimer();
|
resetAutoCheckTimer();
|
||||||
}
|
}
|
||||||
@ -83,7 +86,7 @@ PrismExternalUpdater::~PrismExternalUpdater()
|
|||||||
|
|
||||||
void PrismExternalUpdater::checkForUpdates()
|
void PrismExternalUpdater::checkForUpdates()
|
||||||
{
|
{
|
||||||
QProgressDialog progress(tr("Checking for updates..."), "", 0, 0);
|
QProgressDialog progress(tr("Checking for updates..."), "", 0, 0, priv->parent);
|
||||||
progress.setCancelButton(nullptr);
|
progress.setCancelButton(nullptr);
|
||||||
progress.show();
|
progress.show();
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
|
@ -34,7 +34,7 @@ class PrismExternalUpdater : public ExternalUpdater {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PrismExternalUpdater(const QString& appDir, const QString& dataDir);
|
PrismExternalUpdater(QWidget* parent, const QString& appDir, const QString& dataDir);
|
||||||
~PrismExternalUpdater() override;
|
~PrismExternalUpdater() override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user