mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 08:55:43 +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_CopySettings->setConfigComponent(ui->comp_CopySettings);
|
||||||
ui->wp_Simulator->setConfigComponent(ui->comp_Simulator);
|
ui->wp_Simulator->setConfigComponent(ui->comp_Simulator);
|
||||||
ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad);
|
ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad);
|
||||||
|
this->setButtonText(CustomButton1, "skip");
|
||||||
|
|
||||||
// no other versions, skip copy pages
|
// no other versions, skip copy pages
|
||||||
if (!ui->comp_CopySettings->hasOtherVersionData())
|
if (!ui->comp_CopySettings->hasOtherVersionData())
|
||||||
{
|
{
|
||||||
this->setStartId(ConfigSimulator);
|
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::currentIdChanged, this, &CConfigurationWizard::wizardCurrentIdChanged);
|
||||||
|
connect(this, &QWizard::customButtonClicked, this, &CConfigurationWizard::clickedCustomButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigurationWizard::~CConfigurationWizard()
|
CConfigurationWizard::~CConfigurationWizard()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
bool CConfigurationWizard::lastStepSkipped() const
|
||||||
|
{
|
||||||
|
return m_skipped;
|
||||||
|
}
|
||||||
|
|
||||||
void CConfigurationWizard::wizardCurrentIdChanged(int id)
|
void CConfigurationWizard::wizardCurrentIdChanged(int id)
|
||||||
{
|
{
|
||||||
const int lastId = m_lastId;
|
const int previousId = m_previousId;
|
||||||
m_lastId = id; // update
|
const bool backward = id < previousId;
|
||||||
const bool backward = id < lastId;
|
const bool skipped = m_skipped;
|
||||||
|
m_previousId = id; // update
|
||||||
|
m_skipped = false; // reset
|
||||||
Q_UNUSED(backward);
|
Q_UNUSED(backward);
|
||||||
|
Q_UNUSED(skipped);
|
||||||
|
|
||||||
const QWizardPage *page = this->currentPage();
|
const QWizardPage *page = this->currentPage();
|
||||||
if (page == ui->wp_CopyCaches)
|
if (page == ui->wp_CopyCaches)
|
||||||
@@ -53,6 +69,21 @@ namespace BlackGui
|
|||||||
ui->comp_CopySettings->setSettingsMode();
|
ui->comp_CopySettings->setSettingsMode();
|
||||||
ui->comp_CopySettings->initCurrentDirectories(true);
|
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
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -43,12 +43,21 @@ namespace BlackGui
|
|||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CConfigurationWizard();
|
virtual ~CConfigurationWizard();
|
||||||
|
|
||||||
|
//! Was the last step skipped?
|
||||||
|
bool lastStepSkipped() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! The current page has changed
|
//! The current page has changed
|
||||||
void wizardCurrentIdChanged(int id);
|
void wizardCurrentIdChanged(int id);
|
||||||
|
|
||||||
|
//! Custom button was clicked
|
||||||
|
void clickedCustomButton(int which);
|
||||||
|
|
||||||
QScopedPointer<Ui::CConfigurationWizard> ui;
|
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
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -25,6 +25,9 @@
|
|||||||
<property name="wizardStyle">
|
<property name="wizardStyle">
|
||||||
<enum>QWizard::ClassicStyle</enum>
|
<enum>QWizard::ClassicStyle</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="options">
|
||||||
|
<set>QWizard::HaveCustomButton1</set>
|
||||||
|
</property>
|
||||||
<widget class="BlackGui::Components::CCopyConfigurationWizardPage" name="wp_CopySettings">
|
<widget class="BlackGui::Components::CCopyConfigurationWizardPage" name="wp_CopySettings">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Copy configuration from another installation</string>
|
<string>Copy configuration from another installation</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user