Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef LOGWINDOW_H
00028 #define LOGWINDOW_H
00029
00030 #if defined WIN32
00031 # if defined LOGWINDOW_EXPORTS || defined LogWindow_EXPORTS
00032 # define LOGWINDOW_EXPORT __declspec( dllexport )
00033 # else
00034 # define LOGWINDOW_EXPORT __declspec( dllimport )
00035 # endif
00036 #else
00037 # define LOGWINDOW_EXPORT
00038 #endif
00039
00040 #include <SUIT_PopupClient.h>
00041
00042 #include <QWidget>
00043 #include <QMap>
00044 #include <QStringList>
00045
00046 #ifdef WIN32
00047 #pragma warning( disable:4251 )
00048 #endif
00049
00050 class QAction;
00051 class QTextEdit;
00052
00053 class LOGWINDOW_EXPORT LogWindow : public QWidget, public SUIT_PopupClient
00054 {
00055 Q_OBJECT
00056
00057 public:
00059 enum
00060 {
00061 CopyId = 0x01,
00062 ClearId = 0x02,
00063 SelectAllId = 0x04,
00064 SaveToFileId = 0x08,
00065 All = CopyId | ClearId | SelectAllId | SaveToFileId
00066 };
00067
00069 enum
00070 {
00071 DisplayNormal = 0x00,
00072 DisplayDate = 0x01,
00073 DisplayTime = 0x02,
00074 DisplaySeparator = 0x04,
00075 DisplayNoColor = 0x08,
00076 DisplayDateTime = DisplayDate | DisplayTime
00077 };
00078
00079 public:
00080 LogWindow( QWidget* theParent );
00081 virtual ~LogWindow();
00082
00083 virtual QString popupClientType() const { return QString( "LogWindow" ); }
00084 virtual void contextMenuPopup( QMenu* );
00085
00086 virtual bool eventFilter( QObject*, QEvent* );
00087
00088 QString banner() const;
00089 QString separator() const;
00090
00091 void setBanner( const QString& );
00092 void setSeparator( const QString& );
00093
00094 void putMessage( const QString&, const int = DisplayNormal );
00095 virtual void putMessage( const QString&, const QColor&, const int = DisplayNormal );
00096 void clear( const bool = false );
00097
00098 bool saveLog( const QString& );
00099
00100 void setMenuActions( const int );
00101 int menuActions() const;
00102
00103 protected slots:
00104 void onSaveToFile();
00105 void onSelectAll();
00106 void onClear();
00107 void onCopy();
00108
00109 private:
00110 void createActions();
00111 void updateActions();
00112
00113 private:
00114 QTextEdit* myView;
00115 QString myBanner;
00116 QStringList myHistory;
00117 QString mySeparator;
00118 int myBannerSize;
00119 QMap<int, QAction*> myActions;
00120 };
00121
00122 #ifdef WIN32
00123 #pragma warning( default:4251 )
00124 #endif
00125
00126 #endif // LOGWINDOW_H