1 #ifndef __MAINWINDOW_H__
2 #define __MAINWINDOW_H__
5 #include <connection.hpp>
7 class MainWindow : public QPushButton
14 ConnectionChecker *cc = ConnectionChecker::instance ();
16 connect (cc, SIGNAL (connected (bool)), SLOT (connected (bool)));
17 connect (cc, SIGNAL (type_changed (ConnectionChecker::network_type_t)), SLOT (type_changed (ConnectionChecker::network_type_t)));
19 setText (cc->isConnected () ? "Connected" : "Not connected");
20 connect (this, SIGNAL (clicked ()), SLOT (checkConnection ()));
24 void connected (bool active)
27 printf ("Device connected\n");
29 printf ("Device not connected\n");
30 setText (ConnectionChecker::instance ()->isConnected () ? "Connected" : "Not connected");
33 void type_changed (ConnectionChecker::network_type_t type)
36 case ConnectionChecker::Net_None:
37 printf ("Type: none\n");
39 case ConnectionChecker::Net_WLAN:
40 printf ("Type: WLAN\n");
42 case ConnectionChecker::Net_GSM:
43 printf ("Type: GSM\n");
48 void checkConnection ()
50 ConnectionChecker::instance ()->requestState ();
54 #endif // __MAINWINDOW_H__