summaryrefslogtreecommitdiffstats
path: root/parts/outputviews/makeitem.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /parts/outputviews/makeitem.h
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/outputviews/makeitem.h')
-rw-r--r--parts/outputviews/makeitem.h164
1 files changed, 164 insertions, 0 deletions
diff --git a/parts/outputviews/makeitem.h b/parts/outputviews/makeitem.h
new file mode 100644
index 00000000..e95dd4df
--- /dev/null
+++ b/parts/outputviews/makeitem.h
@@ -0,0 +1,164 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * 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 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef MakeItem_h
+#define MakeItem_h
+
+#include <qstring.h>
+
+enum EOutputLevel
+{
+ // appropriate to the ID's in the button group of settingswidget.ui
+ eVeryShort = 0
+ ,eShort
+ ,eFull
+};
+
+class MakeItem
+{
+public:
+ enum Type { Normal, Error, Warning, Diagnostic };
+ MakeItem();
+ MakeItem( const QString& text );
+ virtual ~MakeItem();
+
+ enum DisplayModes
+ {
+ DelayedDisplay = 0, // item can be displayed later
+ ImmDisplay = 1, // item has to be displayed ASAP
+ Append = 2 // item's text can be appended (append has been overloaded)
+ };
+ virtual int displayMode() const { return ImmDisplay; }
+ virtual bool append( const QString& ) { return false; }
+ virtual Type type() { return Diagnostic; }
+ virtual bool visible( EOutputLevel level ) { return level > eVeryShort; }
+ virtual QString text( EOutputLevel );
+ virtual QString formattedText( EOutputLevel, bool bright_bg );
+ QString icon();
+ QString color( bool bright_bg );
+
+ static QString br();
+
+ QString m_text;
+};
+
+class CommandItem : public MakeItem
+{
+public:
+ CommandItem(const QString command)
+ : MakeItem( command )
+ {}
+
+ Type type() { return Diagnostic; }
+ virtual bool visible( EOutputLevel ) { return true; }
+};
+
+class ExitStatusItem : public MakeItem
+{
+public:
+ ExitStatusItem( bool normalExit, int exitStatus );
+
+ Type type() { return m_normalExit && m_exitStatus == 0 ? Diagnostic : Error; }
+ virtual bool visible( EOutputLevel ) { return true; }
+ QString text( EOutputLevel level );
+
+private:
+ bool m_normalExit;
+ int m_exitStatus;
+};
+
+class DirectoryItem : public MakeItem
+{
+public:
+ DirectoryItem( const QString& dir, const QString& text )
+ : MakeItem( text )
+ , directory( dir )
+ {}
+
+ Type type() { return Diagnostic; }
+
+ static void setShowDirectoryMessages( bool show ) { m_showDirectoryMessages = show; }
+ static bool getShowDirectoryMessages() { return m_showDirectoryMessages; }
+
+ QString directory;
+
+protected:
+ static bool m_showDirectoryMessages;
+};
+
+class EnteringDirectoryItem : public DirectoryItem
+{
+public:
+ EnteringDirectoryItem( const QString& dir, const QString& text )
+ : DirectoryItem( dir, text )
+ {}
+ bool visible( EOutputLevel )
+ {
+ return m_showDirectoryMessages;
+ }
+
+ virtual QString text( EOutputLevel );
+};
+
+class ExitingDirectoryItem : public DirectoryItem
+{
+public:
+ ExitingDirectoryItem( const QString& dir, const QString& text )
+ : DirectoryItem( dir, text )
+ {}
+ bool visible( EOutputLevel level )
+ {
+ return m_showDirectoryMessages && level > eVeryShort;
+ }
+
+ virtual QString text( EOutputLevel );
+};
+
+namespace KTextEditor { class Cursor; class Document; }
+
+class ErrorItem : public MakeItem
+{
+public:
+ ErrorItem( const QString& fn, int ln, const QString& tx, const QString& line, bool isWarning, bool isInstatiationInfo, const QString& compiler );
+ virtual ~ErrorItem();
+
+ virtual bool append( const QString& text );
+ virtual int displayMode() const { return DelayedDisplay | Append; }
+ Type type() { return m_isInstatiationInfo ? Diagnostic : (m_isWarning ? Warning : Error); }
+ virtual bool visible( EOutputLevel ) { return true; }
+
+ QString fileName;
+ int lineNum;
+ QString m_error;
+ bool m_isWarning;
+ bool m_isInstatiationInfo; ///this also implies isWarning
+ QString m_compiler;
+};
+
+class ActionItem : public MakeItem
+{
+public:
+ ActionItem( const QString& action, const QString& file, const QString& tool, const QString& line )
+ : MakeItem( line )
+ , m_action( action )
+ , m_file( file )
+ , m_tool( tool )
+ {}
+
+ virtual bool visible( EOutputLevel ) { return true; }
+ virtual QString text( EOutputLevel level );
+
+ QString m_action;
+ QString m_file;
+ QString m_tool;
+};
+
+#endif