mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Ref T41, download dialog available for all swift UI applications
This commit is contained in:
committed by
Mathew Sutcliffe
parent
5aa9cb1dca
commit
b2d95f471e
@@ -11,6 +11,7 @@
|
||||
#include "blackcore/context/contextnetwork.h"
|
||||
#include "blackcore/data/globalsetup.h"
|
||||
#include "blackgui/components/applicationclosedialog.h"
|
||||
#include "blackgui/components/downloadandinstalldialog.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackgui/registermetadata.h"
|
||||
@@ -386,6 +387,10 @@ namespace BlackGui
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||
}
|
||||
});
|
||||
|
||||
a = menu.addAction(CIcons::swift24(), "Check for updates");
|
||||
c = connect(a, &QAction::triggered, this, &CGuiApplication::checkNewVersion);
|
||||
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||
Q_UNUSED(c);
|
||||
}
|
||||
@@ -622,6 +627,28 @@ namespace BlackGui
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGuiApplication::checkNewVersion()
|
||||
{
|
||||
if (!m_installDialog)
|
||||
{
|
||||
// without parent stylesheet is not inherited
|
||||
m_installDialog = new CDownloadAndInstallDialog(this->mainApplicationWindow());
|
||||
}
|
||||
|
||||
if (!m_installDialog->isNewVersionAvailable()) return;
|
||||
const int result = m_installDialog->exec();
|
||||
if (result != QDialog::Accepted) { return; }
|
||||
}
|
||||
|
||||
void CGuiApplication::triggerNewVersionCheck(int delayedMs)
|
||||
{
|
||||
QTimer::singleShot(delayedMs, this, [ = ]
|
||||
{
|
||||
if (this->m_installDialog) { return; }
|
||||
this->checkNewVersion();
|
||||
});
|
||||
}
|
||||
|
||||
void CGuiApplication::settingsChanged()
|
||||
{
|
||||
// changing widget style is slow, so I try to prevent setting it when nothing changed
|
||||
|
||||
Reference in New Issue
Block a user