From 9b9f6cbcfaf32311e0c76019b724815f1ccd58c4 Mon Sep 17 00:00:00 2001 From: eshanized Date: Thu, 2 Jan 2025 07:34:25 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20docs:=20insert=20inline=20explan?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qt/snigdhaosblackbox.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/qt/snigdhaosblackbox.cpp b/qt/snigdhaosblackbox.cpp index 8579e6e..ca6042d 100644 --- a/qt/snigdhaosblackbox.cpp +++ b/qt/snigdhaosblackbox.cpp @@ -450,50 +450,63 @@ void SnigdhaOSBlackbox::relaunchSelf(QString param) { } void SnigdhaOSBlackbox::on_textWidget_buttonBox_clicked(QAbstractButton* button) { + // Check the current state of the application. switch(currentState) { 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) { updateState(State::INTERNET); } break; 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) { updateState(State::INTERNET); } break; 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) { updateState(State::APPLY); } + // If the 'Reset' button is clicked, transition to 'SELECT' state. else if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Reset) { updateState(State::SELECT); } break; 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) { QApplication::quit(); } break; 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) { QApplication::quit(); } + // If any other button is clicked, transition back to the 'WELCOME' state. else { updateState(State::WELCOME); } 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) { updateState(State::QUIT); } } + void SnigdhaOSBlackbox::on_selectWidget_buttonBox_Clicked(QAbstractButton* button) { if (ui->selectWidget_buttonBox->standardButton(button) == QDialogButtonBox::Ok) { updateState(State::APPLY);