Ref T203, renamed to CUpdateInfoDialog

This commit is contained in:
Klaus Basan
2017-12-12 19:43:36 +01:00
parent f0cf15a572
commit 18fe389303
5 changed files with 38 additions and 38 deletions

View File

@@ -7,8 +7,8 @@
* contained in the LICENSE file.
*/
#include "downloadandinstalldialog.h"
#include "ui_downloadandinstalldialog.h"
#include "updateinfodialog.h"
#include "ui_updateinfodialog.h"
#include "blackgui/guiapplication.h"
#include <QPushButton>
#include <QDesktopServices>
@@ -19,28 +19,28 @@ namespace BlackGui
{
namespace Components
{
CDownloadAndInstallDialog::CDownloadAndInstallDialog(QWidget *parent) :
CUpdateInfoDialog::CUpdateInfoDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::CDownloadAndInstallDialog)
ui(new Ui::CUpdateInfoDialog)
{
ui->setupUi(this);
ui->bb_DownloadInstallDialog->button(QDialogButtonBox::Ok)->setText(" Download and install ");
ui->bb_UpdateInfolDialog->button(QDialogButtonBox::Ok)->setText(" Download and install ");
ui->cb_DontShowAgain->setChecked(!m_setting.get());
this->selectionChanged();
connect(ui->comp_UpdateInfo, &CUpdateInfoComponent::selectionChanged, this, &CDownloadAndInstallDialog::selectionChanged);
connect(ui->cb_DontShowAgain, &QCheckBox::toggled, this, &CDownloadAndInstallDialog::onDontShowAgain);
connect(ui->comp_UpdateInfo, &CUpdateInfoComponent::selectionChanged, this, &CUpdateInfoDialog::selectionChanged);
connect(ui->cb_DontShowAgain, &QCheckBox::toggled, this, &CUpdateInfoDialog::onDontShowAgain);
}
CDownloadAndInstallDialog::~CDownloadAndInstallDialog()
CUpdateInfoDialog::~CUpdateInfoDialog()
{ }
bool CDownloadAndInstallDialog::isNewVersionAvailable() const
bool CUpdateInfoDialog::isNewVersionAvailable() const
{
const bool newVersion = ui->comp_UpdateInfo->isNewPilotClientVersionAvailable();
return newVersion;
}
int CDownloadAndInstallDialog::exec()
int CUpdateInfoDialog::exec()
{
const int r = QDialog::exec();
if (r != QDialog::Accepted) { return r; }
@@ -54,25 +54,25 @@ namespace BlackGui
return QDialog::Rejected;
}
bool CDownloadAndInstallDialog::event(QEvent *event)
bool CUpdateInfoDialog::event(QEvent *event)
{
if (event->type() != QEvent::EnterWhatsThisMode) { return QDialog::event(event); }
QTimer::singleShot(0, this, &CDownloadAndInstallDialog::requestHelp);
QTimer::singleShot(0, this, &CUpdateInfoDialog::requestHelp);
return true;
}
void CDownloadAndInstallDialog::onDontShowAgain(bool dontShowAgain)
void CUpdateInfoDialog::onDontShowAgain(bool dontShowAgain)
{
m_setting.setAndSave(!dontShowAgain);
}
void CDownloadAndInstallDialog::selectionChanged()
void CUpdateInfoDialog::selectionChanged()
{
const bool nv = ui->comp_UpdateInfo->isNewPilotClientVersionAvailable();
ui->bb_DownloadInstallDialog->button(QDialogButtonBox::Ok)->setEnabled(nv);
ui->bb_UpdateInfolDialog->button(QDialogButtonBox::Ok)->setVisible(nv);
}
void CDownloadAndInstallDialog::requestHelp()
void CUpdateInfoDialog::requestHelp()
{
if (sGui) { sGui->showHelp(this); }
}

View File

@@ -9,14 +9,14 @@
//! \file
#ifndef BLACKGUI_COMPONENTS_DOWNLOADANDINSTALLDIALOG_H
#define BLACKGUI_COMPONENTS_DOWNLOADANDINSTALLDIALOG_H
#ifndef BLACKGUI_COMPONENTS_UPDATEINFODIALOG_H
#define BLACKGUI_COMPONENTS_UPDATEINFODIALOG_H
#include "blackgui/settings/updatenotification.h"
#include "blackgui/blackguiexport.h"
#include <QDialog>
namespace Ui { class CDownloadAndInstallDialog; }
namespace Ui { class CUpdateInfoDialog; }
namespace BlackGui
{
namespace Components
@@ -24,16 +24,16 @@ namespace BlackGui
/**
* Download and install swift
*/
class BLACKGUI_EXPORT CDownloadAndInstallDialog : public QDialog
class BLACKGUI_EXPORT CUpdateInfoDialog : public QDialog
{
Q_OBJECT
public:
//! Constructor
explicit CDownloadAndInstallDialog(QWidget *parent = nullptr);
explicit CUpdateInfoDialog(QWidget *parent = nullptr);
//! Destructor
virtual ~CDownloadAndInstallDialog();
virtual ~CUpdateInfoDialog();
//! A new version existing?
bool isNewVersionAvailable() const;
@@ -45,7 +45,7 @@ namespace BlackGui
virtual bool event(QEvent *event) override;
private:
QScopedPointer<Ui::CDownloadAndInstallDialog> ui;
QScopedPointer<Ui::CUpdateInfoDialog> ui;
BlackMisc::CSetting<BlackGui::Settings::TUpdateNotificationSettings> m_setting { this }; //!< show again?
//! Toggled checkbox

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CDownloadAndInstallDialog</class>
<widget class="QDialog" name="CDownloadAndInstallDialog">
<class>CUpdateInfoDialog</class>
<widget class="QDialog" name="CUpdateInfoDialog">
<property name="geometry">
<rect>
<x>0</x>
@@ -68,7 +68,7 @@
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="bb_DownloadInstallDialog">
<widget class="QDialogButtonBox" name="bb_UpdateInfolDialog">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -93,9 +93,9 @@
<resources/>
<connections>
<connection>
<sender>bb_DownloadInstallDialog</sender>
<sender>bb_UpdateInfolDialog</sender>
<signal>accepted()</signal>
<receiver>CDownloadAndInstallDialog</receiver>
<receiver>CUpdateInfoDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@@ -109,9 +109,9 @@
</hints>
</connection>
<connection>
<sender>bb_DownloadInstallDialog</sender>
<sender>bb_UpdateInfolDialog</sender>
<signal>rejected()</signal>
<receiver>CDownloadAndInstallDialog</receiver>
<receiver>CUpdateInfoDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

View File

@@ -13,7 +13,7 @@
#include "blackcore/data/globalsetup.h"
#include "blackcore/webdataservices.h"
#include "blackgui/components/applicationclosedialog.h"
#include "blackgui/components/downloadandinstalldialog.h"
#include "blackgui/components/updateinfodialog.h"
#include "blackgui/components/aboutdialog.h"
#include "blackgui/components/setuploadingdialog.h"
#include "blackgui/guiapplication.h"
@@ -746,14 +746,14 @@ namespace BlackGui
void CGuiApplication::checkNewVersion(bool onlyIfNew)
{
if (!m_installDialog)
if (!m_updateDialog)
{
// without parent stylesheet is not inherited
m_installDialog = new CDownloadAndInstallDialog(this->mainApplicationWindow());
m_updateDialog = new CUpdateInfoDialog(this->mainApplicationWindow());
}
if (onlyIfNew && !m_installDialog->isNewVersionAvailable()) return;
const int result = m_installDialog->exec();
if (onlyIfNew && !m_updateDialog->isNewVersionAvailable()) return;
const int result = m_updateDialog->exec();
if (result != QDialog::Accepted) { return; }
}
@@ -762,7 +762,7 @@ namespace BlackGui
if (!m_updateSetting.get()) { return; }
QTimer::singleShot(delayedMs, this, [ = ]
{
if (m_installDialog) { return; }
if (m_updateDialog) { return; }
this->checkNewVersion(true);
});
}

View File

@@ -42,7 +42,7 @@ namespace BlackGui
namespace Components
{
class CApplicationCloseDialog;
class CDownloadAndInstallDialog;
class CUpdateInfoDialog;
}
}
namespace BlackGui
@@ -240,7 +240,7 @@ namespace BlackGui
CStyleSheetUtility m_styleSheetUtility {{}, this}; //!< style sheet utility
bool m_uiSetupCompleted = false; //!< ui setup completed
QScopedPointer<QSplashScreen> m_splashScreen; //!< splash screen
Components::CDownloadAndInstallDialog *m_installDialog = nullptr; //!< software installation dialog
Components::CUpdateInfoDialog *m_updateDialog = nullptr; //!< software installation dialog
Components::CApplicationCloseDialog *m_closeDialog = nullptr; //!< close dialog (no QScopedPointer because I need to set parent)
BlackMisc::CSettingReadOnly<Settings::TGeneralGui> m_guiSettings { this, &CGuiApplication::settingsChanged };
BlackMisc::CSettingReadOnly<Settings::TUpdateNotificationSettings> m_updateSetting { this }; //!< update notification settings