From 407cca7c6b124757008d7e83c2681a9af4c76e46 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 23 May 2018 23:09:31 +0200 Subject: [PATCH] Ref T213, legal info component added in wizard --- .../components/configurationwizard.cpp | 11 +-- src/blackgui/components/configurationwizard.h | 1 + .../components/configurationwizard.ui | 37 ++++++++++ .../components/legalinfocomponent.cpp | 48 +++++++++++++ src/blackgui/components/legalinfocomponent.h | 70 +++++++++++++++++++ src/blackgui/components/legalinfocomponent.ui | 39 +++++++++++ src/blackgui/share/qss/stdwidget.qss | 12 ++-- 7 files changed, 205 insertions(+), 13 deletions(-) create mode 100644 src/blackgui/components/legalinfocomponent.cpp create mode 100644 src/blackgui/components/legalinfocomponent.h create mode 100644 src/blackgui/components/legalinfocomponent.ui diff --git a/src/blackgui/components/configurationwizard.cpp b/src/blackgui/components/configurationwizard.cpp index 2c135e288..dfbb588da 100644 --- a/src/blackgui/components/configurationwizard.cpp +++ b/src/blackgui/components/configurationwizard.cpp @@ -31,6 +31,7 @@ namespace BlackGui ui->wp_XSwiftBus->setConfigComponent(ui->comp_XSwiftBus); ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad); ui->wp_Hotkeys->setConfigComponent(ui->comp_Hotkeys); + ui->wp_Legal->setConfigComponent(ui->comp_LegalInformation); ui->comp_Hotkeys->registerDummyPttEntry(); this->setButtonText(CustomButton1, "skip"); @@ -41,7 +42,7 @@ namespace BlackGui } const QList ids = this->pageIds(); - auto mm = std::minmax_element(ids.begin(), ids.end()); + const auto mm = std::minmax_element(ids.begin(), ids.end()); m_maxId = *mm.second; m_minId = *mm.first; @@ -77,10 +78,10 @@ namespace BlackGui bool CConfigurationWizard::event(QEvent *event) { if (event->type() != QEvent::EnterWhatsThisMode) { return QDialog::event(event); } - const QPointer guard(this); + const QPointer myself(this); QTimer::singleShot(0, this, [ = ] { - if (guard.isNull() || !sGui || sGui->isShuttingDown()) { return; } + if (myself.isNull() || !sGui || sGui->isShuttingDown()) { return; } sGui->showHelp(this); }); return true; @@ -115,12 +116,12 @@ namespace BlackGui { if (which == static_cast(CustomButton1)) { - this->m_skipped = true; + m_skipped = true; this->next(); } else { - this->m_skipped = false; + m_skipped = false; } } diff --git a/src/blackgui/components/configurationwizard.h b/src/blackgui/components/configurationwizard.h index 1a3989b1c..c9ea8a657 100644 --- a/src/blackgui/components/configurationwizard.h +++ b/src/blackgui/components/configurationwizard.h @@ -32,6 +32,7 @@ namespace BlackGui //! Page ids enum Pages { + Legal, CopyModels, CopySettings, CopyCaches, diff --git a/src/blackgui/components/configurationwizard.ui b/src/blackgui/components/configurationwizard.ui index 18e798e5c..2cd628bf1 100644 --- a/src/blackgui/components/configurationwizard.ui +++ b/src/blackgui/components/configurationwizard.ui @@ -28,6 +28,31 @@ QWizard::HaveCustomButton1 + + + Legal + + + Please confirm you know and understand our license and privacy policy + + + + 4 + + + 4 + + + 4 + + + 4 + + + + + + Copy models @@ -376,6 +401,18 @@
blackgui/components/copymodelsfromotherswiftversionscomponent.h
1 + + BlackGui::Components::CLegalInfoComponent + QFrame +
blackgui/components/legalinfocomponent.h
+ 1 +
+ + BlackGui::Components::CLegalInfoWizardPage + QWizardPage +
blackgui/components/legalinfocomponent.h
+ 1 +
diff --git a/src/blackgui/components/legalinfocomponent.cpp b/src/blackgui/components/legalinfocomponent.cpp new file mode 100644 index 000000000..6f90496e4 --- /dev/null +++ b/src/blackgui/components/legalinfocomponent.cpp @@ -0,0 +1,48 @@ +/* Copyright (C) 2018 + * 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. + */ + +#include "blackmisc/statusmessage.h" +#include "legalinfocomponent.h" +#include "ui_legalinfocomponent.h" + +using namespace BlackMisc; + +namespace BlackGui +{ + namespace Components + { + CLegalInfoComponent::CLegalInfoComponent(QWidget *parent) : + COverlayMessagesFrame(parent), + ui(new Ui::CLegalInfoComponent) + { + ui->setupUi(this); + } + + CLegalInfoComponent::~CLegalInfoComponent() + { } + + bool CLegalInfoComponent::isAgreedTo() const + { + return ui->cb_Agree->isChecked(); + } + + bool CLegalInfoComponent::validateAgreement() + { + if (this->isAgreedTo()) { return true; } + static const CStatusMessage m = CStatusMessage(this).validationError("You need to agree with the swift license"); + this->showOverlayMessage(m); + return false; + } + + bool CLegalInfoWizardPage::validatePage() + { + return m_legalInfo && m_legalInfo->validateAgreement(); + } + } // ns +} // ns diff --git a/src/blackgui/components/legalinfocomponent.h b/src/blackgui/components/legalinfocomponent.h new file mode 100644 index 000000000..57b3dc9c5 --- /dev/null +++ b/src/blackgui/components/legalinfocomponent.h @@ -0,0 +1,70 @@ +/* Copyright (C) 2018 + * 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_COMPONENTS_LEGALINFOCOMPONENT_H +#define BLACKGUI_COMPONENTS_LEGALINFOCOMPONENT_H + +#include "blackgui/overlaymessagesframe.h" +#include +#include +#include + +namespace Ui { class CLegalInfoComponent; } +namespace BlackGui +{ + namespace Components + { + /** + * swift legal information + */ + class CLegalInfoComponent : public COverlayMessagesFrame + { + Q_OBJECT + + public: + //! Constructor + explicit CLegalInfoComponent(QWidget *parent = nullptr); + + //! Destructor + virtual ~CLegalInfoComponent(); + + //! Agreed with? + bool isAgreedTo() const; + + //! Validate that the agreement is accepted + bool validateAgreement(); + + private: + QScopedPointer ui; + }; + + /** + * Wizard page for CLegalInfoComponent + */ + class CLegalInfoWizardPage : public QWizardPage + { + public: + //! Constructors + using QWizardPage::QWizardPage; + + //! Set config + void setConfigComponent(CLegalInfoComponent *config) { m_legalInfo = config; } + + //! \copydoc QWizardPage::validatePage + virtual bool validatePage() override; + + private: + CLegalInfoComponent *m_legalInfo = nullptr; + }; + } // ns +} // ns + +#endif // guard diff --git a/src/blackgui/components/legalinfocomponent.ui b/src/blackgui/components/legalinfocomponent.ui new file mode 100644 index 000000000..35431e98f --- /dev/null +++ b/src/blackgui/components/legalinfocomponent.ui @@ -0,0 +1,39 @@ + + + CLegalInfoComponent + + + + 0 + 0 + 640 + 480 + + + + Frame + + + + + + + + + I agree with the swift license and privacy policy + + + + + + + + BlackGui::Components::CAboutHtmlComponent + QFrame +
blackgui/components/abouthtmlcomponent.h
+ 1 +
+
+ + +
diff --git a/src/blackgui/share/qss/stdwidget.qss b/src/blackgui/share/qss/stdwidget.qss index c9568770c..f66b4a402 100644 --- a/src/blackgui/share/qss/stdwidget.qss +++ b/src/blackgui/share/qss/stdwidget.qss @@ -176,14 +176,10 @@ BlackGui--Components--CDownloadDialog, BlackGui--Components--CRawFsdMessagesComponent, BlackGui--Components--CRawFsdMessagesDialog, BlackGui--Components--CDbOwnModelsDialog, -BlackGui--Components--CDbOwnModelSetDialog -{ - background: black; /* background is background color here */ - background-image: url(:/textures/icons/textures/texture-inner.jpg); -} - -BlackGui--Components--CFirstModelSetComponent -BlackGui--Components--CDbDistributorComponent +BlackGui--Components--CDbOwnModelSetDialog, +BlackGui--Components--CFirstModelSetComponent, +BlackGui--Components--CDbDistributorComponent, +BlackGui--Components--CLegalInfoComponent { background: black; /* background is background color here */ background-image: url(:/textures/icons/textures/texture-inner.jpg);