8 #include "ui_configurationwizard.h"
16 using namespace swift::misc::math;
20 CConfigurationWizard::CConfigurationWizard(QWidget *parent) : QWizard(parent), ui(new Ui::
CConfigurationWizard)
23 this->setWindowFlags(windowFlags() | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint |
24 Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
26 ui->wp_CopyModels->setConfigComponent(ui->comp_CopyModels);
27 ui->wp_CopySettingsAndCaches->setConfigComponent(ui->comp_CopySettingsAndCachesComponent);
28 ui->wp_Simulator->setConfigComponent(ui->comp_Simulator);
29 ui->wp_SimulatorSpecific->setConfigComponent(ui->comp_InstallXSwiftBus, ui->comp_InstallFsxTerrainProbe);
30 ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad);
31 ui->wp_Hotkeys->setConfigComponent(ui->comp_Hotkeys);
32 ui->wp_Legal->setConfigComponent(ui->comp_LegalInformation);
33 ui->comp_Hotkeys->registerDummyPttEntry();
34 this->setButtonText(CustomButton1,
"skip");
40 ui->tb_SimulatorSpecific->setCurrentWidget(ui->comp_InstallXSwiftBus);
42 const QList<int> ids = this->pageIds();
43 const auto mm = std::minmax_element(ids.begin(), ids.end());
47 connect(
this, &QWizard::currentIdChanged,
this, &CConfigurationWizard::wizardCurrentIdChanged);
48 connect(
this, &QWizard::customButtonClicked,
this, &CConfigurationWizard::clickedCustomButton);
49 connect(
this, &QWizard::rejected,
this, &CConfigurationWizard::ended);
50 connect(
this, &QWizard::accepted,
this, &CConfigurationWizard::ended);
52 Q_ASSERT_X(
sGui, Q_FUNC_INFO,
"missing sGui");
53 const QPointer<CConfigurationWizard> myself(
this);
54 connect(
this, &QWizard::helpRequested,
sGui, [=] {
55 if (!myself) {
return; }
60 this->setScreenGeometry();
77 return QDialog::event(
event);
80 void CConfigurationWizard::wizardCurrentIdChanged(
int id)
82 const int previousId = m_previousId;
83 const bool backward =
id < previousId;
84 const bool skipped = m_skipped;
90 this->setParentOpacity(0.5);
91 const QWizardPage *page = this->currentPage();
94 this->setOption(HaveCustomButton1,
id != m_maxId);
97 void CConfigurationWizard::clickedCustomButton(
int which)
99 if (which ==
static_cast<int>(CustomButton1))
104 else { m_skipped =
false; }
107 void CConfigurationWizard::ended() { this->setParentOpacity(1.0); }
109 void CConfigurationWizard::setParentOpacity(qreal opacity)
111 QWidget *parent = this->parentWidget();
112 if (!parent) {
return; }
113 if (CMathUtils::epsilonEqual(parent->windowOpacity(), opacity)) {
return; }
114 parent->setWindowOpacity(opacity);
117 void CConfigurationWizard::setScreenGeometry()
119 if (!
sGui) {
return; }
124 const int gw = g.width();
125 const int gh = g.height();
126 const int calcW = qRound(gw * 0.8);
127 const int calcH = qRound(gh * 0.9);
130 const int w = qMin(900, calcW);
131 const int h = qMin(750, calcH);
bool isShuttingDown() const
Is application shutting down?
static QRect currentScreenGeometry()
Current screen resolution.
static bool triggerShowHelp(const QWidget *widget, QEvent *event)
Static version used with dialogs.
void showHelp(const QString &context={}) const
Show help page (online help)
static void setWizardButtonWidths(QWizard *wizard)
Set button widths for a wizard.
Configure the most important settings.
static bool lastWizardStepSkipped(const QWizard *standardWizard)
Static version of CConfigurationWizard::lastStepSkipped.
virtual bool event(QEvent *event)
virtual ~CConfigurationWizard()
Destructor.
bool lastStepSkipped() const
Was the last step skipped?
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
High level reusable GUI components.
Free functions in swift::misc.