diff --git a/src/installerprompt.cpp b/src/installerprompt.cpp index 07fa1af..e5d6bf6 100644 --- a/src/installerprompt.cpp +++ b/src/installerprompt.cpp @@ -57,12 +57,29 @@ InstallerPrompt::InstallerPrompt(QWidget *parent) connect(nm, &NetworkManager::Notifier::primaryConnectionChanged, this, &InstallerPrompt::updateConnectionStatus); } -bool InstallerPrompt::checkInternetConnection() { - return NetworkManager::status() == NetworkManager::Status::Connected; -} - void InstallerPrompt::updateConnectionStatus() { - bool online = checkInternetConnection(); + auto status = NetworkManager::status(); + bool online = false; + QString statusIndicator; + + switch (status) { + case NetworkManager::Status::Disconnected: + statusIndicator = "❌ Not Connected"; + break; + case NetworkManager::Status::Connected: + online = true; + statusIndicator = "🟢 Connected"; + break; + case NetworkManager::Status::Connecting: + statusIndicator = "🟡 Connecting..."; + break; + case NetworkManager::Status::Disconnecting: + statusIndicator = "🟡 Disconnecting..."; + break; + default: + statusIndicator = "⚪ Unknown Status"; + } + ui->connectionStatusLabel->setText(statusIndicator); const auto devices = NetworkManager::networkInterfaces(); bool wifiEnabled = false; @@ -75,7 +92,6 @@ void InstallerPrompt::updateConnectionStatus() { bool connectable = !online && wifiEnabled; if (connectable) refreshNetworkList(); - ui->connectionStatusLabel->setText(online ? tr("Connected to the internet") : tr("Not connected to the internet")); ui->connectWiFiButton->setVisible(connectable); ui->WiFiLabel->setVisible(connectable); ui->networkComboBox->setVisible(connectable); diff --git a/src/installerprompt.h b/src/installerprompt.h index 7a3c833..479afd2 100644 --- a/src/installerprompt.h +++ b/src/installerprompt.h @@ -37,7 +37,6 @@ private: void initLanguageComboBox(); QStringList getAvailableLanguages() const; - bool checkInternetConnection(); void showWifiOptions(); void updateConnectionStatus(); };