wpa_gui: Make Status strings visible to linguist
authorStefan Oswald <stefan@homeunix.de>
Sun, 11 Apr 2010 19:42:02 +0000 (22:42 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 11 Apr 2010 19:42:02 +0000 (22:42 +0300)
Linguist cannot see the strings coming from wpa_supplicant, so create
a function that translates these to tr() strings inside wpa_gui
source code.

wpa_supplicant/wpa_gui-qt4/wpagui.cpp
wpa_supplicant/wpa_gui-qt4/wpagui.h

index 6da2500..c3d24cf 100644 (file)
@@ -460,6 +460,31 @@ int WpaGui::ctrlRequest(const char *cmd, char *buf, size_t *buflen)
 }
 
 
+QString WpaGui::wpaStateTranslate(char *state)
+{
+       if (!strcmp(state, "DISCONNECTED"))
+               return tr("Disconnected");
+       else if (!strcmp(state, "INACTIVE"))
+               return tr("Inactive");
+       else if (!strcmp(state, "SCANNING"))
+               return tr("Scanning");
+       else if (!strcmp(state, "AUTHENTICATING"))
+               return tr("Authenticating");
+       else if (!strcmp(state, "ASSOCIATING"))
+               return tr("Associating");
+       else if (!strcmp(state, "ASSOCIATED"))
+               return tr("Associated");
+       else if (!strcmp(state, "4WAY_HANDSHAKE"))
+               return tr("4-Way Handshake");
+       else if (!strcmp(state, "GROUP_HANDSHAKE"))
+               return tr("Group Handshake");
+       else if (!strcmp(state, "COMPLETED"))
+               return tr("Completed");
+       else
+               return tr("Unknown");
+}
+
+
 void WpaGui::updateStatus()
 {
        char buf[2048], *start, *end, *pos;
@@ -528,7 +553,7 @@ void WpaGui::updateStatus()
                                textIpAddress->setText(pos);
                        } else if (strcmp(start, "wpa_state") == 0) {
                                status_updated = true;
-                               textStatus->setText(pos);
+                               textStatus->setText(wpaStateTranslate(pos));
                        } else if (strcmp(start, "key_mgmt") == 0) {
                                auth_updated = true;
                                textAuthentication->setText(pos);
index a9b8cd3..2e1af8e 100644 (file)
@@ -118,6 +118,7 @@ private:
        QAction *quitAction;
        QMenu *tray_menu;
        QSystemTrayIcon *tray_icon;
+       QString wpaStateTranslate(char *state);
        void createTrayIcon(bool);
        bool ackTrayIcon;
        bool startInTray;