/*************************************************************************** * LogTab.h * * Mon Aug 13 12:41:51 2007 * Copyright 2007 Fernando TarĂ­n Morales * icemanf@gmail.com ****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA */ #ifndef _LOGTAB_H #define _LOGTAB_H #include #include #include #include "../config.h" #include "BaseTab.h" class LogTab : public BaseTab { private: Gtk::Frame logFrame; Gtk::ScrolledWindow logScrolledWindow; Gtk::TextView logTextView; Glib::RefPtr refTagTable; Glib::RefPtr logTextBuffer; boost::int64_t maxLogSize; int logLevel; bool saveToFile, useColoredOutput, autoScroll, isActive; Glib::ustring fileName; boost::filesystem::basic_ofstream fileStream; struct message{ Glib::ustring time, message; int level; }; std::queue messages; void appendText(const Glib::ustring &); void appendBoldText(const Glib::ustring &); void appendGrayBoldText(const Glib::ustring &); void appendRedText(const Glib::ustring &); void appendGreenText(const Glib::ustring &); void appendBlueText(const Glib::ustring &); void appendOrangeText(const Glib::ustring &); void cleanLogTab(void); void saveCurrentBufferToFile(); Glib::ustring getTime(void); void appendMessage(std::string, int); void logMessage(struct message&); public: LogTab(); ~LogTab(); virtual Gtk::Widget * getTabChild(void) { return & logFrame; }; void setLogTabActive(bool value) { isActive = value; }; void setLogLevel(int value) { logLevel = value; }; void setMaxLogSize(boost::int64_t value) { maxLogSize = value; }; void setSaveToFile(bool value); void setColoredOutput(bool value) { useColoredOutput = value; }; void setAutoScroll(bool value) { autoScroll = value; }; void setFileName(const Glib::ustring & fname) { fileName = fname; }; void flushMessages(void); }; #endif /* _LOGTAB_H */