mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 23:35:40 +08:00
Ref T213, legal info component added in wizard
This commit is contained in:
@@ -31,6 +31,7 @@ namespace BlackGui
|
|||||||
ui->wp_XSwiftBus->setConfigComponent(ui->comp_XSwiftBus);
|
ui->wp_XSwiftBus->setConfigComponent(ui->comp_XSwiftBus);
|
||||||
ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad);
|
ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad);
|
||||||
ui->wp_Hotkeys->setConfigComponent(ui->comp_Hotkeys);
|
ui->wp_Hotkeys->setConfigComponent(ui->comp_Hotkeys);
|
||||||
|
ui->wp_Legal->setConfigComponent(ui->comp_LegalInformation);
|
||||||
ui->comp_Hotkeys->registerDummyPttEntry();
|
ui->comp_Hotkeys->registerDummyPttEntry();
|
||||||
this->setButtonText(CustomButton1, "skip");
|
this->setButtonText(CustomButton1, "skip");
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QList<int> ids = this->pageIds();
|
const QList<int> 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_maxId = *mm.second;
|
||||||
m_minId = *mm.first;
|
m_minId = *mm.first;
|
||||||
|
|
||||||
@@ -77,10 +78,10 @@ namespace BlackGui
|
|||||||
bool CConfigurationWizard::event(QEvent *event)
|
bool CConfigurationWizard::event(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() != QEvent::EnterWhatsThisMode) { return QDialog::event(event); }
|
if (event->type() != QEvent::EnterWhatsThisMode) { return QDialog::event(event); }
|
||||||
const QPointer<CConfigurationWizard> guard(this);
|
const QPointer<CConfigurationWizard> myself(this);
|
||||||
QTimer::singleShot(0, this, [ = ]
|
QTimer::singleShot(0, this, [ = ]
|
||||||
{
|
{
|
||||||
if (guard.isNull() || !sGui || sGui->isShuttingDown()) { return; }
|
if (myself.isNull() || !sGui || sGui->isShuttingDown()) { return; }
|
||||||
sGui->showHelp(this);
|
sGui->showHelp(this);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
@@ -115,12 +116,12 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (which == static_cast<int>(CustomButton1))
|
if (which == static_cast<int>(CustomButton1))
|
||||||
{
|
{
|
||||||
this->m_skipped = true;
|
m_skipped = true;
|
||||||
this->next();
|
this->next();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->m_skipped = false;
|
m_skipped = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace BlackGui
|
|||||||
//! Page ids
|
//! Page ids
|
||||||
enum Pages
|
enum Pages
|
||||||
{
|
{
|
||||||
|
Legal,
|
||||||
CopyModels,
|
CopyModels,
|
||||||
CopySettings,
|
CopySettings,
|
||||||
CopyCaches,
|
CopyCaches,
|
||||||
|
|||||||
@@ -28,6 +28,31 @@
|
|||||||
<property name="options">
|
<property name="options">
|
||||||
<set>QWizard::HaveCustomButton1</set>
|
<set>QWizard::HaveCustomButton1</set>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="BlackGui::Components::CLegalInfoWizardPage" name="wp_Legal">
|
||||||
|
<property name="title">
|
||||||
|
<string>Legal</string>
|
||||||
|
</property>
|
||||||
|
<property name="subTitle">
|
||||||
|
<string>Please confirm you know and understand our license and privacy policy</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vl_Legal">
|
||||||
|
<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::CLegalInfoComponent" name="comp_LegalInformation"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
<widget class="BlackGui::Components::CCopyModelsFromOtherSwiftVersionsWizardPage" name="wp_CopyModels">
|
<widget class="BlackGui::Components::CCopyModelsFromOtherSwiftVersionsWizardPage" name="wp_CopyModels">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Copy models</string>
|
<string>Copy models</string>
|
||||||
@@ -376,6 +401,18 @@
|
|||||||
<header>blackgui/components/copymodelsfromotherswiftversionscomponent.h</header>
|
<header>blackgui/components/copymodelsfromotherswiftversionscomponent.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CLegalInfoComponent</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>blackgui/components/legalinfocomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CLegalInfoWizardPage</class>
|
||||||
|
<extends>QWizardPage</extends>
|
||||||
|
<header>blackgui/components/legalinfocomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
|||||||
48
src/blackgui/components/legalinfocomponent.cpp
Normal file
48
src/blackgui/components/legalinfocomponent.cpp
Normal file
@@ -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
|
||||||
70
src/blackgui/components/legalinfocomponent.h
Normal file
70
src/blackgui/components/legalinfocomponent.h
Normal file
@@ -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 <QFrame>
|
||||||
|
#include <QScopedPointer>
|
||||||
|
#include <QWizardPage>
|
||||||
|
|
||||||
|
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::CLegalInfoComponent> 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
|
||||||
39
src/blackgui/components/legalinfocomponent.ui
Normal file
39
src/blackgui/components/legalinfocomponent.ui
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CLegalInfoComponent</class>
|
||||||
|
<widget class="QFrame" name="CLegalInfoComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>640</width>
|
||||||
|
<height>480</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Frame</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::Components::CAboutHtmlComponent" name="comp_AboutHTML"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cb_Agree">
|
||||||
|
<property name="text">
|
||||||
|
<string>I agree with the swift license and privacy policy</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CAboutHtmlComponent</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>blackgui/components/abouthtmlcomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -176,14 +176,10 @@ BlackGui--Components--CDownloadDialog,
|
|||||||
BlackGui--Components--CRawFsdMessagesComponent,
|
BlackGui--Components--CRawFsdMessagesComponent,
|
||||||
BlackGui--Components--CRawFsdMessagesDialog,
|
BlackGui--Components--CRawFsdMessagesDialog,
|
||||||
BlackGui--Components--CDbOwnModelsDialog,
|
BlackGui--Components--CDbOwnModelsDialog,
|
||||||
BlackGui--Components--CDbOwnModelSetDialog
|
BlackGui--Components--CDbOwnModelSetDialog,
|
||||||
{
|
BlackGui--Components--CFirstModelSetComponent,
|
||||||
background: black; /* background is background color here */
|
BlackGui--Components--CDbDistributorComponent,
|
||||||
background-image: url(:/textures/icons/textures/texture-inner.jpg);
|
BlackGui--Components--CLegalInfoComponent
|
||||||
}
|
|
||||||
|
|
||||||
BlackGui--Components--CFirstModelSetComponent
|
|
||||||
BlackGui--Components--CDbDistributorComponent
|
|
||||||
{
|
{
|
||||||
background: black; /* background is background color here */
|
background: black; /* background is background color here */
|
||||||
background-image: url(:/textures/icons/textures/texture-inner.jpg);
|
background-image: url(:/textures/icons/textures/texture-inner.jpg);
|
||||||
|
|||||||
Reference in New Issue
Block a user