mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
refs #886, added skip button (custom button) in config wizard
This commit is contained in:
committed by
Mathew Sutcliffe
parent
80b127bce8
commit
1b56f498a9
@@ -23,24 +23,40 @@ namespace BlackGui
|
||||
ui->wp_CopySettings->setConfigComponent(ui->comp_CopySettings);
|
||||
ui->wp_Simulator->setConfigComponent(ui->comp_Simulator);
|
||||
ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad);
|
||||
this->setButtonText(CustomButton1, "skip");
|
||||
|
||||
// no other versions, skip copy pages
|
||||
if (!ui->comp_CopySettings->hasOtherVersionData())
|
||||
{
|
||||
this->setStartId(ConfigSimulator);
|
||||
}
|
||||
|
||||
const QList<int> ids = this->pageIds();
|
||||
auto mm = std::minmax_element(ids.begin(), ids.end());
|
||||
m_maxId = *mm.second;
|
||||
m_minId = *mm.first;
|
||||
|
||||
connect(this, &QWizard::currentIdChanged, this, &CConfigurationWizard::wizardCurrentIdChanged);
|
||||
connect(this, &QWizard::customButtonClicked, this, &CConfigurationWizard::clickedCustomButton);
|
||||
}
|
||||
|
||||
CConfigurationWizard::~CConfigurationWizard()
|
||||
{ }
|
||||
|
||||
bool CConfigurationWizard::lastStepSkipped() const
|
||||
{
|
||||
return m_skipped;
|
||||
}
|
||||
|
||||
void CConfigurationWizard::wizardCurrentIdChanged(int id)
|
||||
{
|
||||
const int lastId = m_lastId;
|
||||
m_lastId = id; // update
|
||||
const bool backward = id < lastId;
|
||||
const int previousId = m_previousId;
|
||||
const bool backward = id < previousId;
|
||||
const bool skipped = m_skipped;
|
||||
m_previousId = id; // update
|
||||
m_skipped = false; // reset
|
||||
Q_UNUSED(backward);
|
||||
Q_UNUSED(skipped);
|
||||
|
||||
const QWizardPage *page = this->currentPage();
|
||||
if (page == ui->wp_CopyCaches)
|
||||
@@ -53,6 +69,21 @@ namespace BlackGui
|
||||
ui->comp_CopySettings->setSettingsMode();
|
||||
ui->comp_CopySettings->initCurrentDirectories(true);
|
||||
}
|
||||
|
||||
this->setOption(HaveCustomButton1, id != m_maxId);
|
||||
}
|
||||
|
||||
void CConfigurationWizard::clickedCustomButton(int which)
|
||||
{
|
||||
if (which == static_cast<int>(CustomButton1))
|
||||
{
|
||||
this->m_skipped = true;
|
||||
this->next();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_skipped = false;
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -43,12 +43,21 @@ namespace BlackGui
|
||||
//! Destructor
|
||||
virtual ~CConfigurationWizard();
|
||||
|
||||
//! Was the last step skipped?
|
||||
bool lastStepSkipped() const;
|
||||
|
||||
private:
|
||||
//! The current page has changed
|
||||
void wizardCurrentIdChanged(int id);
|
||||
|
||||
//! Custom button was clicked
|
||||
void clickedCustomButton(int which);
|
||||
|
||||
QScopedPointer<Ui::CConfigurationWizard> ui;
|
||||
int m_lastId = -1;
|
||||
int m_previousId = -1;
|
||||
int m_minId = -1;
|
||||
int m_maxId = -1;
|
||||
bool m_skipped = false;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
<property name="wizardStyle">
|
||||
<enum>QWizard::ClassicStyle</enum>
|
||||
</property>
|
||||
<property name="options">
|
||||
<set>QWizard::HaveCustomButton1</set>
|
||||
</property>
|
||||
<widget class="BlackGui::Components::CCopyConfigurationWizardPage" name="wp_CopySettings">
|
||||
<property name="title">
|
||||
<string>Copy configuration from another installation</string>
|
||||
|
||||
Reference in New Issue
Block a user