KDevelop API Documentation

makeitem.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 1999-2001 by Bernd Gehrmann                             *
00003  *   bernd@kdevelop.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00012 #ifndef MakeItem_h
00013 #define MakeItem_h
00014 
00015 #include <qstring.h>
00016 
00017 enum EOutputLevel
00018 {
00019     // appropriate to the ID's in the button group of settingswidget.ui
00020     eVeryShort = 0
00021     ,eShort
00022     ,eFull
00023 };
00024 
00025 class MakeItem
00026 {
00027 public:
00028     enum Type { Normal, Error, Warning, Diagnostic };
00029     MakeItem();
00030     MakeItem( const QString& text );
00031     virtual ~MakeItem();
00032 
00033   enum DisplayModes
00034   {
00035     DelayedDisplay = 0, // item can be displayed later
00036     ImmDisplay = 1,     // item has to be displayed ASAP
00037     Append = 2          // item's text can be appended (append has been overloaded)
00038   };
00039   virtual int displayMode() const { return ImmDisplay; }
00040     virtual bool append( const QString& ) { return false; }
00041     virtual Type type() { return Diagnostic; }
00042     virtual bool visible( EOutputLevel level ) { return level > eVeryShort; }
00043     virtual QString text( EOutputLevel );
00044     virtual QString formattedText( EOutputLevel, bool bright_bg );
00045     QString icon();
00046     QString color( bool bright_bg );
00047 
00048     static QString br();
00049 
00050     QString m_text;
00051 };
00052 
00053 class CommandItem : public MakeItem
00054 {
00055 public:
00056     CommandItem(const QString command)
00057         : MakeItem( command )
00058     {}
00059 
00060     Type type() { return Diagnostic; }
00061     virtual bool visible( EOutputLevel ) { return true; }
00062 };
00063 
00064 class ExitStatusItem : public MakeItem
00065 {
00066 public:
00067     ExitStatusItem( bool normalExit, int exitStatus );
00068 
00069     Type type() { return m_normalExit && m_exitStatus == 0 ? Diagnostic : Error; }
00070     virtual bool visible( EOutputLevel ) { return true; }
00071     QString text( EOutputLevel level );
00072 
00073 private:
00074     bool m_normalExit;
00075     int m_exitStatus;
00076 };
00077 
00078 class DirectoryItem : public MakeItem
00079 {
00080 public:
00081     DirectoryItem( const QString& dir, const QString& text )
00082         : MakeItem( text )
00083         , directory( dir )
00084     {}
00085 
00086     Type type() { return Diagnostic; }
00087 
00088     static void setShowDirectoryMessages( bool show ) { m_showDirectoryMessages = show; }
00089     static bool getShowDirectoryMessages() { return m_showDirectoryMessages; }
00090 
00091     QString directory;
00092 
00093 protected:
00094     static bool m_showDirectoryMessages;
00095 };
00096 
00097 class EnteringDirectoryItem : public DirectoryItem
00098 {
00099 public:
00100     EnteringDirectoryItem( const QString& dir, const QString& text )
00101         : DirectoryItem( dir, text )
00102     {}
00103     bool visible( EOutputLevel )
00104     {
00105         return m_showDirectoryMessages;
00106     }
00107 
00108     virtual QString text( EOutputLevel );
00109 };
00110 
00111 class ExitingDirectoryItem : public DirectoryItem
00112 {
00113 public:
00114     ExitingDirectoryItem( const QString& dir, const QString& text )
00115         : DirectoryItem( dir, text )
00116     {}
00117     bool visible( EOutputLevel level )
00118     {
00119         return m_showDirectoryMessages && level > eVeryShort;
00120     }
00121 
00122     virtual QString text( EOutputLevel );
00123 };
00124 
00125 namespace KTextEditor { class Cursor; class Document; }
00126 
00127 class ErrorItem : public MakeItem
00128 {
00129 public:
00130     ErrorItem( const QString& fn, int ln, const QString& tx, const QString& line, bool isWarning, const QString& compiler );
00131     virtual ~ErrorItem();
00132 
00133     virtual bool append( const QString& text );
00134   virtual int displayMode() const { return DelayedDisplay | Append; }
00135     Type type() { return m_isWarning ? Warning : Error; }
00136     virtual bool visible( EOutputLevel ) { return true; }
00137 
00138     QString fileName;
00139     int lineNum;
00140     QString m_error;
00141     KTextEditor::Cursor* m_cursor;
00142     KTextEditor::Document* m_doc;
00143     bool m_isWarning;
00144     QString m_compiler;
00145 };
00146 
00147 class ActionItem : public MakeItem
00148 {
00149 public:
00150     ActionItem( const QString& action, const QString& file, const QString& tool, const QString& line )
00151         : MakeItem( line )
00152         , m_action( action )
00153         , m_file( file )
00154         , m_tool( tool )
00155     {}
00156 
00157     virtual bool visible( EOutputLevel ) { return true; }
00158     virtual QString text( EOutputLevel level );
00159 
00160     QString m_action;
00161     QString m_file;
00162     QString m_tool;
00163 };
00164 
00165 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:57 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003