🔨 refactor(og): ongoing building

This commit is contained in:
Eshan Roy
2024-11-19 03:15:03 +05:30
parent 5154e9ce96
commit 6629238f76
2 changed files with 30 additions and 2 deletions

View File

@@ -4,3 +4,4 @@
git config --global user.email "m.eshanized@gmail.com" git config --global user.email "m.eshanized@gmail.com"
git config --global user.name "Eshan Roy" git config --global user.name "Eshan Roy"

View File

@@ -9,10 +9,37 @@ SnigdhaOSBlackBox::SnigdhaOSBlackBox(QWidget *parent, Qstring state)
{ {
this->setWindowIcon(QIcon("/usr/share/pixmaps/snigdhaos-blackbox.svg")); this->setWindowIcon(QIcon("/usr/share/pixmaps/snigdhaos-blackbox.svg"));
ui->setupUi(this); ui->setupUi(this);
this->setWindowFlags(this->WindowFlags() & -Qt::WindowCloseButtonHint) this->setWindowFlags(this->WindowFlags() & -Qt::WindowCloseButtonHint);
executable_modify_date = QFileInfo(QCoreApplication::applicationFilePath()).lastModified();
updateState(state);
} }
//destructor for Snigdha OS Blackbox class
SnigdhaOSBlackBox::~SnigdhaOSBlackBox() SnigdhaOSBlackBox::~SnigdhaOSBlackBox()
{ {
delete ui; delete ui;
} }
void SnigdhaOSBlackbox::doInternetUpRequest(){
QNetworkAccessManager* = network_manager = new QNetworkAccessManager();
auto network_reply = network_manager->head(QNetworkRequest(QString(INTERNET_CHECK_URL)));
QTimer* timer = new QTimer(this);
timer->setSingleShot(true);
timer->start(5000); //5 sec
// if the time is out we will try again
connect(timer, QTimer::timeout, this, [this, timer, network_reply, network_manager](){
timer->stop();
timer->deleteLayer();
network_reply->deleteLater();
network_manager->deleteLater();
if (network_reply->error() == network_reply->NoError){
updateState(state::UPDATE);
}
else{
doInternetUpRequest();
}
});
}