logview.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __LIBS_GUI_UTILS_LOGVIEW_H_
00025 #define __LIBS_GUI_UTILS_LOGVIEW_H_
00026
00027 #include <gtkmm.h>
00028 #include <libglademm/xml.h>
00029
00030 #include <utils/logging/logger.h>
00031
00032 namespace fawkes {
00033 #if 0
00034 }
00035 #endif
00036
00037 class FawkesNetworkClient;
00038 class FawkesNetworkMessage;
00039 class ConnectionDispatcher;
00040
00041 class LogView
00042 : public Gtk::TreeView
00043 {
00044 public:
00045 LogView();
00046 LogView(const char *hostname, unsigned short int port);
00047 LogView(BaseObjectType* cobject,
00048 const Glib::RefPtr<Gnome::Glade::Xml>& ref_glade);
00049 ~LogView();
00050
00051 void set_client(FawkesNetworkClient *client);
00052 FawkesNetworkClient * get_client();
00053
00054 void append_message(Logger::LogLevel log_level, struct timeval t,
00055 const char *component, bool is_exception,
00056 const char *message);
00057
00058 void clear();
00059
00060 ConnectionDispatcher * get_connection_dispatcher() const;
00061
00062 private:
00063 virtual void on_row_inserted(const Gtk::TreeModel::Path& path,
00064 const Gtk::TreeModel::iterator& iter);
00065 virtual void on_message_received(FawkesNetworkMessage *msg);
00066 virtual void on_client_connected();
00067 virtual void on_client_disconnected();
00068 virtual void on_expose_notify(GdkEventExpose *event);
00069
00070 void ctor(const char *hostname = NULL, unsigned short int port = 0);
00071
00072 private:
00073 class LogRecord : public Gtk::TreeModelColumnRecord
00074 {
00075 public:
00076 LogRecord();
00077 Gtk::TreeModelColumn<Glib::ustring> loglevel;
00078 Gtk::TreeModelColumn<Glib::ustring> time;
00079 Gtk::TreeModelColumn<Glib::ustring> component;
00080 Gtk::TreeModelColumn<Glib::ustring> message;
00081 Gtk::TreeModelColumn<Gdk::Color> foreground;
00082 Gtk::TreeModelColumn<Gdk::Color> background;
00083 };
00084
00085 LogRecord __record;
00086
00087 Glib::RefPtr<Gtk::ListStore> __list;
00088
00089 ConnectionDispatcher *__connection_dispatcher;
00090 FawkesNetworkClient *__client;
00091
00092 bool __have_recently_added_path;
00093 Gtk::TreeModel::Path __recently_added_path;
00094 };
00095
00096 }
00097
00098
00099 #endif