/* This class maintains info about what's happening in the application. It doesn't only use slots/signals, we also have a global pointer to the one and only instance of this class. The idea is that writes/sets are done via slots/signals, while reads/gets are done via direct function calls. The reason for this to be a widget is that it can be later used as a "hide/show GUI" button, to make other windows disappear or appear. */ #ifndef _STATUS_MONITOR_H_ #define _STATUS_MONITOR_H_ #include #include #include #include #include #include #include #include using namespace std; class status_monitor : public QFrame { Q_OBJECT protected: int n_hubs; // hubs int n_uls; // uploads int n_qgdls; // queued gdls int n_agdls; // active gdls int n_fgdls; // finished gdls typedef pair gdl_t; map gdls; bool b_gui_shown; bool b_showing_popup; bool b_popup_visible; bool b_has_news; QPixmap pIcon; QPixmap pIconFull; QPixmap pOn; QPixmap pDL; QPixmap pUL; QFrame *popup; QVGroupBox *box; QLabel *ln_hubs; QLabel *ln_qgdls; QLabel *ln_agdls; // QLabel *ln_fgdls; QLabel *ln_uls; QTimer *infotip_timer; QTimer *info_ttl_timer; virtual void paintEvent( QPaintEvent * e ); virtual void mouseMoveEvent( QMouseEvent * e ); virtual void mouseDoubleClickEvent( QMouseEvent * e ); virtual void mousePressEvent( QMouseEvent * e ); virtual void leaveEvent( QEvent *e ); // Functions (methods) are used to get read-access to info public: int num_open_hubs() const; int num_uls() const; int num_queued_gdls() const; int num_active_gdls() const; unsigned int get_gdl_id_first(const unsigned long int); unsigned int get_gdl_id_next(const unsigned long int); QString get_gdl_name_by_id(const unsigned int) const; status_monitor(QWidget *parent=0, const char *name=0); virtual ~status_monitor(); // Slots are used to tell the monitor what's happening. public slots: void hub_opened(); void hub_closed(); void ul_added(); void ul_removed(); void gdl_added(const unsigned int, const QString &, const unsigned long); void gdl_removed(const unsigned int); void gdl_queued(); // active gdl stopped and queued void gdl_active(); // queued gdl turned active // slot activated when the stat-mon window (shown in gui-hide mode) is clicked void slot_show_ui(); // slot activated when the minimode-button in main tool bar is clicked void slot_hide_ui(); // activated by timer to show "toop tip"-alike status info void slot_show_popup(); // activated when user wants to turn off status info void slot_hide_popup(); signals: // emitted when we want to hide interface void sig_hide_ui(); // emitted when we want to show interface again void sig_show_ui(); }; // This is the globally-available pointer to the single instance of // the class. extern status_monitor* statMon; #endif