X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FLogWindow%2FLogWindow.h;h=90ee566874e9a4d16f3666b2b90f5fb36fcdb89d;hb=389efae83b99d654509671e60af3eecf11b8278e;hp=44001e068246217534a9539234c213328a851f07;hpb=2e750f9ded92337bc3c44e9d7388180974cc4a43;p=modules%2Fgui.git diff --git a/src/LogWindow/LogWindow.h b/src/LogWindow/LogWindow.h index 44001e068..90ee56687 100755 --- a/src/LogWindow/LogWindow.h +++ b/src/LogWindow/LogWindow.h @@ -1,79 +1,104 @@ -// KERNEL SALOME_Event : Define event posting mechanism +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : LogWindow.h -// Author : -// Module : KERNEL -#ifndef LogWindow_HeaderFile -#define LogWindow_HeaderFile +// KERNEL SALOME_Event : Define event posting mechanism +// File : LogWindow.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +#ifndef LOGWINDOW_H +#define LOGWINDOW_H -#if defined LOGWINDOW_EXPORTS -#if defined WIN32 -#define LOGWINDOW_EXPORT __declspec( dllexport ) -#else -#define LOGWINDOW_EXPORT -#endif -#else #if defined WIN32 -#define LOGWINDOW_EXPORT __declspec( dllimport ) +# if defined LOGWINDOW_EXPORTS || defined LogWindow_EXPORTS +# define LOGWINDOW_EXPORT __declspec( dllexport ) +# else +# define LOGWINDOW_EXPORT __declspec( dllimport ) +# endif #else -#define LOGWINDOW_EXPORT -#endif +# define LOGWINDOW_EXPORT #endif #include -#include -#include +#include +#include +#include #ifdef WIN32 #pragma warning( disable:4251 ) #endif class QAction; -class QTextBrowser; +class QTextEdit; -class LOGWINDOW_EXPORT LogWindow : public QFrame, public SUIT_PopupClient +class LOGWINDOW_EXPORT LogWindow : public QWidget, public SUIT_PopupClient { Q_OBJECT - enum { CopyId, ClearId, SelectAllId, SaveToFileId }; +public: + //! Context popup menu actions flags + enum + { + CopyId = 0x01, //!< "Copy" menu action + ClearId = 0x02, //!< "Clear" menu action + SelectAllId = 0x04, //!< "Select All" menu action + SaveToFileId = 0x08, //!< "Save To File" menu action + All = CopyId | ClearId | SelectAllId | SaveToFileId //!< all menu actions + }; + + //! Display messages flags + enum + { + DisplayNormal = 0x00, //!< do not display extra data + DisplayDate = 0x01, //!< display message date + DisplayTime = 0x02, //!< display message time + DisplaySeparator = 0x04, //!< display separator between messages + DisplayNoColor = 0x08, //!< display non-colored message + DisplayDateTime = DisplayDate | DisplayTime //!< display date & time + }; public: - LogWindow( QWidget* theParent ); - virtual ~LogWindow(); + LogWindow( QWidget* theParent ); + virtual ~LogWindow(); virtual QString popupClientType() const { return QString( "LogWindow" ); } - virtual void contextMenuPopup( QPopupMenu* ); + virtual void contextMenuPopup( QMenu* ); + + virtual bool eventFilter( QObject*, QEvent* ); - bool eventFilter( QObject* o, QEvent* e ); + QString banner() const; + QString separator() const; - void setBanner( const QString& banner ); - void setSeparator( const QString& separator ); + void setBanner( const QString& ); + void setSeparator( const QString& ); - virtual void putMessage( const QString& message, bool addSeparator = true ); - void clear( bool clearHistory = false ); + void putMessage( const QString&, const int = DisplayNormal ); + virtual void putMessage( const QString&, const QColor&, const int = DisplayNormal ); + void clear( const bool = false ); - bool saveLog( const QString& fileName ); + bool saveLog( const QString& ); + + void setMenuActions( const int ); + int menuActions() const; protected slots: void onSaveToFile(); @@ -86,16 +111,16 @@ private: void updateActions(); private: - QTextBrowser* myView; - QString myBanner; - QString mySeparator; - QStringList myHistory; - int myBannerSize; - QMap myActions; + QTextEdit* myView; //!< internal view window + QString myBanner; //!< current banner + QStringList myHistory; //!< messages history + QString mySeparator; //!< current separator + int myBannerSize; //!< current banner's size + QMap myActions; //!< popup menu actions }; #ifdef WIN32 #pragma warning( default:4251 ) #endif -#endif +#endif // LOGWINDOW_H