mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-10 05:55:33 +08:00
Ref T203, renamed to CUpdateInfoDialog
This commit is contained in:
@@ -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); }
|
||||
}
|
||||
@@ -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
|
||||
@@ -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">
|
||||
Reference in New Issue
Block a user