mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T78, setting and dialog "do not show again"
Applies to automatic update info check
This commit is contained in:
@@ -26,8 +26,10 @@ namespace BlackGui
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->bb_DownloadInstallDialog->button(QDialogButtonBox::Ok)->setText(" Download and install ");
|
||||
ui->cb_DontShowAgain->setChecked(!m_setting.get());
|
||||
this->selectionChanged();
|
||||
connect(ui->comp_DistributionInfo, &CDistributionInfoComponent::selectionChanged, this, &CDownloadAndInstallDialog::selectionChanged);
|
||||
connect(ui->cb_DontShowAgain, &QCheckBox::toggled, this, &CDownloadAndInstallDialog::onDontShowAgain);
|
||||
}
|
||||
|
||||
CDownloadAndInstallDialog::~CDownloadAndInstallDialog()
|
||||
@@ -53,6 +55,11 @@ namespace BlackGui
|
||||
return QDialog::Rejected;
|
||||
}
|
||||
|
||||
void CDownloadAndInstallDialog::onDontShowAgain(bool dontShowAgain)
|
||||
{
|
||||
m_setting.setAndSave(!dontShowAgain);
|
||||
}
|
||||
|
||||
void CDownloadAndInstallDialog::selectionChanged()
|
||||
{
|
||||
const bool nv = ui->comp_DistributionInfo->isNewVersionAvailable();
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DOWNLOADANDINSTALLDIALOG_H
|
||||
#define BLACKGUI_COMPONENTS_DOWNLOADANDINSTALLDIALOG_H
|
||||
|
||||
#include "blackgui/settings/updatenotification.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include <QDialog>
|
||||
|
||||
@@ -42,6 +43,10 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDownloadAndInstallDialog> ui;
|
||||
BlackMisc::CSetting<BlackGui::Settings::TUpdateNotificationSettings> m_setting { this }; //!< show again?
|
||||
|
||||
//! Toggled checkbox
|
||||
void onDontShowAgain(bool dontShowAgain);
|
||||
|
||||
//! Selection in distribution component changed
|
||||
void selectionChanged();
|
||||
|
||||
@@ -7,26 +7,63 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>125</height>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>130</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Update checker</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_DownloadAndInstall">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CDistributionInfoComponent" name="comp_DistributionInfo">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="wi_Bottom" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_Bottom">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_DontShowAgain">
|
||||
<property name="text">
|
||||
<string>Don't show again</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -42,6 +79,9 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CDistributionInfoComponent</class>
|
||||
|
||||
@@ -630,6 +630,7 @@ namespace BlackGui
|
||||
|
||||
void CGuiApplication::triggerNewVersionCheck(int delayedMs)
|
||||
{
|
||||
if (!m_updateSetting.get()) { return; }
|
||||
QTimer::singleShot(delayedMs, this, [ = ]
|
||||
{
|
||||
if (this->m_installDialog) { return; }
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "blackgui/enableforframelesswindow.h"
|
||||
#include "blackgui/mainwindowaccess.h"
|
||||
#include "blackgui/settings/guisettings.h"
|
||||
#include "blackgui/settings/updatenotification.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
@@ -218,6 +219,7 @@ namespace BlackGui
|
||||
QScopedPointer<QSplashScreen> m_splashScreen; //!< splash screen
|
||||
BlackGui::Components::CApplicationCloseDialog *m_closeDialog = nullptr; //!< close dialog (no QScopedPointer because I need to set parent)
|
||||
BlackMisc::CSettingReadOnly<BlackGui::Settings::TGeneralGui> m_guiSettings{ this, &CGuiApplication::settingsChanged };
|
||||
BlackMisc::CSettingReadOnly<BlackGui::Settings::TUpdateNotificationSettings> m_updateSetting { this }; //!< update notification settings
|
||||
|
||||
//! Qt help message to formatted HTML
|
||||
static QString beautifyHelpMessage(const QString &helpText);
|
||||
|
||||
34
src/blackgui/settings/updatenotification.h
Normal file
34
src/blackgui/settings/updatenotification.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/* Copyright (C) 2017
|
||||
* swift project community / contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_SETTINGS_UPDATENOTIFICATIONSETTINGS_H
|
||||
#define BLACKGUI_SETTINGS_UPDATENOTIFICATIONSETTINGS_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
//! Trait for directory settings
|
||||
struct TUpdateNotificationSettings : public BlackMisc::TSettingTrait<bool>
|
||||
{
|
||||
//! Key in data cache
|
||||
static const char *key() { return "guiupdatenotification/%Application%"; }
|
||||
|
||||
//! Default, not consolidating
|
||||
static const bool &defaultValue() { static const bool d = true; return d; }
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user