makewidget.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 _MAKEWIDGET_H_ 00013 #define _MAKEWIDGET_H_ 00014 00015 #include <qptrstack.h> 00016 #include <qregexp.h> 00017 #include <qtextedit.h> 00018 #include <qvaluevector.h> 00019 #include <qintdict.h> 00020 00021 #include "outputfilter.h" 00022 #include "directorystatusmessagefilter.h" 00023 #include "compileerrorfilter.h" 00024 #include "commandcontinuationfilter.h" 00025 #include "makeactionfilter.h" 00026 #include "otherfilter.h" 00027 #include "makeitem.h" 00028 00029 class MakeViewPart; 00030 class MakeItem; 00031 class KProcess; 00032 class ProcessLineMaker; 00033 class KURL; 00034 00035 namespace KTextEditor { class Document; } 00036 00037 class MakeWidget : public QTextEdit 00038 { 00039 Q_OBJECT 00040 00041 public: 00042 MakeWidget(MakeViewPart *part); 00043 ~MakeWidget(); 00044 00045 void queueJob(const QString &dir, const QString &command); 00046 bool isRunning(); 00047 void updateSettingsFromConfig(); 00048 void processLine( const QString& line ); 00049 00050 public slots: 00051 void startNextJob(); 00052 void killJob(); 00053 void nextError(); 00054 void prevError(); 00055 void copy(); 00056 00057 protected: 00058 virtual QPopupMenu *createPopupMenu( const QPoint& pos ); 00059 virtual void contentsMouseReleaseEvent( QMouseEvent* e ); 00060 00061 private slots: 00062 void insertStdoutLine(const QString& line); 00063 void insertStderrLine(const QString& line); 00064 void slotProcessExited(KProcess *); 00065 void verticScrollingOn() { m_vertScrolling = true; } 00066 void verticScrollingOff() { m_vertScrolling = false; } 00067 void horizScrollingOn() { m_horizScrolling = true; } 00068 void horizScrollingOff() { m_horizScrolling = false; } 00069 void toggleLineWrapping(); 00070 void slotVeryShortCompilerOutput(); 00071 void slotShortCompilerOutput(); 00072 void slotFullCompilerOutput(); 00073 void toggleShowDirNavigMessages(); 00074 void slotEnteredDirectory( EnteringDirectoryItem* ); 00075 void slotExitedDirectory( ExitingDirectoryItem* ); 00076 void insertItem( MakeItem* ); 00077 void slotDocumentOpened(const KURL& filename); 00078 void slotDocumentClosed(QObject* doc); 00079 00080 private: 00081 virtual void keyPressEvent(QKeyEvent *e); 00082 void searchItem(int parag); 00083 QString guessFileName( const QString& fName, int parag ) const; 00084 QString directory(int parag) const; 00085 bool brightBg(); 00086 void refill(); 00087 void createCursor(ErrorItem* e, KTextEditor::Document* doc); 00088 00089 bool scanErrorForward(int parag); 00090 bool scanErrorBackward(int parag); 00091 00092 DirectoryStatusMessageFilter m_directoryStatusFilter; 00093 CompileErrorFilter m_errorFilter; 00094 CommandContinuationFilter m_continuationFilter; 00095 MakeActionFilter m_actionFilter; 00096 OtherFilter m_otherFilter; 00097 00098 void setPendingItem(MakeItem* new_item); 00099 void displayPendingItem(); 00100 bool appendToLastLine( const QString& text ); 00101 void setCompilerOutputLevel(EOutputLevel level); 00102 00103 QStringList commandList; 00104 QStringList dirList; 00105 QString currentCommand; 00106 KProcess *childproc; 00107 ProcessLineMaker* procLineMaker; 00108 QPtrStack<QString> dirstack; 00109 MakeItem* m_pendingItem; 00110 QValueVector<MakeItem*> m_items; 00111 QIntDict<MakeItem> m_paragraphToItem; 00112 long m_paragraphs; 00113 int m_lastErrorSelected; 00114 00115 MakeViewPart *m_part; 00116 00117 bool m_vertScrolling, m_horizScrolling; 00118 bool m_bCompiling; 00119 00120 bool m_bLineWrapping; 00121 EOutputLevel m_compilerOutputLevel; 00122 }; 00123 00124 #endif