File indexing completed on 2024-04-21 15:55:34
0001 /*************************************************************************** 0002 Copyright (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net) 0003 2011-2016 by Michel Ludwig (michel.ludwig@kdemail.net) 0004 ***************************************************************************/ 0005 0006 /*************************************************************************** 0007 * * 0008 * This program is free software; you can redistribute it and/or modify * 0009 * it under the terms of the GNU General Public License as published by * 0010 * the Free Software Foundation; either version 2 of the License, or * 0011 * (at your option) any later version. * 0012 * * 0013 ***************************************************************************/ 0014 0015 #ifndef ERRORHANDLER_H 0016 #define ERRORHANDLER_H 0017 0018 #include <QObject> 0019 #include <QPointer> 0020 0021 #include "outputinfo.h" 0022 0023 class QLabel; 0024 class QTabWidget; 0025 class QToolBar; 0026 class QToolButton; 0027 0028 class QAction; 0029 class KActionCollection; 0030 class KileInfo; 0031 class KileProject; 0032 class LaTeXOutputHandler; 0033 class OutputInfo; 0034 0035 namespace KileTool { 0036 class Base; 0037 } 0038 namespace KileWidget { 0039 class LogWidget; 0040 } 0041 0042 class KileErrorHandler : public QObject 0043 { 0044 Q_OBJECT 0045 0046 public: 0047 KileErrorHandler(QObject *parent, KileInfo *info, KActionCollection *ac); 0048 0049 ~KileErrorHandler(); 0050 0051 QLabel* compilationResultLabel(); 0052 0053 QWidget* outputWidget(); 0054 0055 void setErrorHandlerToolBar(QToolBar *toolBar); 0056 0057 void setMostRecentLogInformation(const QString& logFile, const LatexOutputInfoArray& outputInfoList); 0058 0059 0060 enum ProblemType { AllProblems = 0, OnlyErrors, OnlyWarnings, OnlyBadBoxes }; 0061 0062 void displayProblemsInLogWidget(KileWidget::LogWidget *logWidget, const LatexOutputInfoArray& infoList, ProblemType problemType = AllProblems); 0063 0064 bool areMessagesShown() const; 0065 void addEmptyLineToMessages(); 0066 0067 void startToolLogOutput(); 0068 void endToolLogOutput(); 0069 0070 Q_SIGNALS: 0071 void showingErrorMessage(QWidget *w); 0072 void currentLaTeXOutputHandlerChanged(LaTeXOutputHandler *outputHandler); 0073 0074 public Q_SLOTS: 0075 void handleSpawnedChildTool(KileTool::Base *parent, KileTool::Base *child); 0076 void handleLaTeXToolDone(KileTool::Base*, int, bool childToolSpawned); 0077 0078 0079 void printMessage(const QString& message); 0080 void printMessage(int type, const QString& message, const QString &tool = "Kile", 0081 const OutputInfo& outputInfo = OutputInfo(), bool allowSelection = false, 0082 bool scroll = true); 0083 void printProblem(int type, const QString& problem, const OutputInfo& outputInfo = OutputInfo()); 0084 void clearMessages(); 0085 0086 void jumpToFirstError(); 0087 void jumpToProblem(const OutputInfo& info); 0088 0089 int currentOutputTabIndex(); 0090 void setCurrentOutputTab(int i); 0091 0092 void showMessagesOutput(); 0093 void showErrorsOutput(); 0094 void showWarningsOutput(); 0095 void showBadBoxesOutput(); 0096 0097 void clearErrorOutput(); 0098 0099 /* log view, error handling */ 0100 private Q_SLOTS: 0101 void ViewLog(); 0102 void NextError(); 0103 void PreviousError(); 0104 void NextWarning(); 0105 void PreviousWarning(); 0106 void NextBadBox(); 0107 void PreviousBadBox(); 0108 0109 void setOutputActionsEnabled(bool b); 0110 0111 void handleProjectOpened(KileProject *project); 0112 void updateCurrentLaTeXOutputHandler(); 0113 void updateForCompilationResult(); 0114 0115 private: 0116 KileInfo *m_ki; 0117 QToolBar *m_errorHanderToolBar; 0118 int m_currentOutputType; 0119 LaTeXOutputHandler *m_currentLaTeXOutputHandler; 0120 QPointer<QTabWidget> m_outputTabWidget; 0121 QPointer<QLabel> m_compilationResultLabel; 0122 QPointer<KileWidget::LogWidget> m_mainLogWidget; 0123 QPointer<KileWidget::LogWidget> m_errorLogWidget, m_warningLogWidget, m_badBoxLogWidget; 0124 QPointer<QAction> m_viewLogAction; 0125 QPointer<QAction> m_previousErrorAction, m_nextErrorAction; 0126 QPointer<QAction> m_previousWarningAction, m_nextWarningAction; 0127 QPointer<QAction> m_previousBadBoxAction, m_nextBadBoxAction; 0128 0129 void createActions(KActionCollection *ac); 0130 void jumpToProblem(int type, bool); 0131 void displayProblemsInMainLogWidget(const LatexOutputInfoArray& infoList); 0132 void printNoInformationAvailable(); 0133 }; 0134 0135 #endif