mainwindow.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include <QMainWindow>
  4. #include <QEvent>
  5. #include <QString>
  6. #include "../node/Node.hpp"
  7. #include "../node/Utils.hpp"
  8. namespace Ui {
  9. class MainWindow;
  10. }
  11. // Globally visible instance of local client for communicating with ZT1
  12. // Can be null if not connected, or will point to current
  13. extern ZeroTier::Node::LocalClient *zeroTierClient;
  14. class MainWindow : public QMainWindow
  15. {
  16. Q_OBJECT
  17. public:
  18. // Event used to pass messages from the Node::LocalClient thread to the
  19. // main window to update network lists and stats.
  20. class ZTMessageEvent : public QEvent
  21. {
  22. public:
  23. ZTMessageEvent(const std::vector<std::string> &m) :
  24. QEvent(QEvent::User),
  25. ztMessage(m)
  26. {
  27. }
  28. std::vector<std::string> ztMessage;
  29. };
  30. explicit MainWindow(QWidget *parent = 0);
  31. virtual ~MainWindow();
  32. protected:
  33. virtual void timerEvent(QTimerEvent *event);
  34. virtual void customEvent(QEvent *event);
  35. private slots:
  36. void on_joinNetworkButton_clicked();
  37. void on_actionAbout_triggered();
  38. void on_networkIdLineEdit_textChanged(const QString &text);
  39. void on_addressButton_clicked();
  40. private:
  41. Ui::MainWindow *ui;
  42. QString myAddress;
  43. QString myStatus;
  44. QString myVersion;
  45. unsigned int numPeers;
  46. unsigned int cyclesSinceResponseFromService;
  47. };
  48. #endif // MAINWINDOW_H