mirror of
https://github.com/Snigdha-OS/snigdhaos-blackbox.git
synced 2025-09-21 03:55:05 +02:00
📝 docs: insert inline explanation
This commit is contained in:
@@ -450,50 +450,63 @@ void SnigdhaOSBlackbox::relaunchSelf(QString param) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SnigdhaOSBlackbox::on_textWidget_buttonBox_clicked(QAbstractButton* button) {
|
void SnigdhaOSBlackbox::on_textWidget_buttonBox_clicked(QAbstractButton* button) {
|
||||||
|
// Check the current state of the application.
|
||||||
switch(currentState) {
|
switch(currentState) {
|
||||||
case State::WELCOME:
|
case State::WELCOME:
|
||||||
|
// If the current state is 'WELCOME' and the 'Ok' button is clicked, transition to 'INTERNET' state.
|
||||||
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Ok) {
|
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Ok) {
|
||||||
updateState(State::INTERNET);
|
updateState(State::INTERNET);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case State::UPDATE_RETRY:
|
case State::UPDATE_RETRY:
|
||||||
|
// If the current state is 'UPDATE_RETRY' and the 'Yes' button is clicked, transition to 'INTERNET' state.
|
||||||
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes) {
|
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes) {
|
||||||
updateState(State::INTERNET);
|
updateState(State::INTERNET);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case State::APPLY_RETRY:
|
case State::APPLY_RETRY:
|
||||||
|
// If the current state is 'APPLY_RETRY' and the 'Yes' button is clicked, transition to 'APPLY' state.
|
||||||
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes) {
|
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes) {
|
||||||
updateState(State::APPLY);
|
updateState(State::APPLY);
|
||||||
}
|
}
|
||||||
|
// If the 'Reset' button is clicked, transition to 'SELECT' state.
|
||||||
else if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Reset) {
|
else if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Reset) {
|
||||||
updateState(State::SELECT);
|
updateState(State::SELECT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case State::SUCCESS:
|
case State::SUCCESS:
|
||||||
|
// If the current state is 'SUCCESS' and the 'Ok' button is clicked, quit the application.
|
||||||
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Ok) {
|
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Ok) {
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case State::QUIT:
|
case State::QUIT:
|
||||||
|
// If the current state is 'QUIT' and the 'No' or 'Ok' button is clicked, quit the application.
|
||||||
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::No || ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Ok) {
|
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::No || ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Ok) {
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
}
|
}
|
||||||
|
// If any other button is clicked, transition back to the 'WELCOME' state.
|
||||||
else {
|
else {
|
||||||
updateState(State::WELCOME);
|
updateState(State::WELCOME);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:;
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
// A catch-all for any other states not explicitly handled. Currently does nothing.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the 'No' or 'Cancel' button is clicked at any point, transition to the 'QUIT' state.
|
||||||
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::No || ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Cancel) {
|
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::No || ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Cancel) {
|
||||||
updateState(State::QUIT);
|
updateState(State::QUIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SnigdhaOSBlackbox::on_selectWidget_buttonBox_Clicked(QAbstractButton* button) {
|
void SnigdhaOSBlackbox::on_selectWidget_buttonBox_Clicked(QAbstractButton* button) {
|
||||||
if (ui->selectWidget_buttonBox->standardButton(button) == QDialogButtonBox::Ok) {
|
if (ui->selectWidget_buttonBox->standardButton(button) == QDialogButtonBox::Ok) {
|
||||||
updateState(State::APPLY);
|
updateState(State::APPLY);
|
||||||
|
Reference in New Issue
Block a user