#ifndef UPDATEGUI_H #define UPDATEGUI_H 1 #include #include #ifndef WX_PRECOMP #include #endif #include #include "UpdateFactory.hpp" #include "JobQueue.hpp" enum LogType { RTL_DEFAULT, RTL_GREEN, RTL_RED }; enum { wxID_EDITOR = wxID_HIGHEST + 1, wxID_IP, wxID_PW, wxID_IMG, wxID_UPDATEFILE, wxID_IMPORTCSV, wxID_DOUPDATE }; class UpdateGUI : public wxApp { public: virtual bool OnInit(); }; class UpdateGUIFrame: public wxFrame { public: UpdateGUIFrame(const wxString& title, const wxPoint& pos, const wxSize& size); ~UpdateGUIFrame() {} protected: UpdateFactory uf; private: /* log to GUI */ void tLog(enum LogType type, const char *text, const char *ident=nullptr); void tLog(enum LogType type, std::string& text, const char *ident=nullptr); /* wxWidgets GUI/Thread events */ void OnClose(wxCloseEvent& event); void OnExit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); void OnEditor(wxCommandEvent& event); void OnUpdateFile(wxCommandEvent& event); void OnImportCSV(wxCommandEvent& event); void OnUpdate(wxCommandEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); void OnThread(wxCommandEvent& event); wxDECLARE_EVENT_TABLE(); /* GUI elements */ wxBoxSizer *mainVSizer; wxStaticBoxSizer *ipBox, *pwBox, *imgBox, *subBox, *logBox; wxButton *imgButton, *subButton, *csvButton; wxTextCtrl *ipEntry, *pwEntry, *imgEntry, *logText; /** JobQueue */ Queue *jobs; /** Thread list IDs */ std::list threads; }; #endif