[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kile] src: Associate the (LaTeX) compilation output with the document/projects it originates from.
From: Michel Ludwig <michel.ludwig () kdemail ! net>
Date: 2012-08-31 18:09:47
Message-ID: 20120831180947.7A541A60DC () git ! kde ! org
[Download RAW message or body]
Git commit fd092562ed5cd5cdeb3b8b4df32174fa8dcae353 by Michel Ludwig.
Committed on 31/08/2012 at 20:06.
Pushed by mludwig into branch 'master'.
Associate the (LaTeX) compilation output with the document/projects it originates \
from.
In that way the correct output can be restored when switching between documents.
Also, add a tab widget to the output pane which allows to choose between displaying
error, warning or badbox messages, and add a label to the status bar which
informs about the number of errors, warnings or badboxes.
M +1 -1 src/CMakeLists.txt
M +2 -1 src/dialogs/configurationdialog.cpp
M +4 -6 src/dialogs/includegraphicsdialog.cpp
M +11 -10 src/dialogs/pdf-wizard/pdfdialog.cpp
M +4 -3 src/dialogs/pdf-wizard/pdfdialog.h
M +10 -12 src/dialogs/postscriptdialog.cpp
M +7 -9 src/dialogs/postscriptdialog.h
M +2 -1 src/documentinfo.h
M +11 -11 src/editorextension.cpp
A +561 -0 src/errorhandler.cpp [License: GPL (v2+)]
A +127 -0 src/errorhandler.h [License: GPL (v2+)]
M +29 -49 src/kile.cpp
M +1 -1 src/kile.h
M +21 -21 src/kiledocmanager.cpp
D +0 -251 src/kileerrorhandler.cpp
D +0 -63 src/kileerrorhandler.h
M +4 -4 src/kilehelp.cpp
M +12 -2 src/kileinfo.cpp
M +1 -3 src/kileinfo.h
M +5 -4 src/kileproject.h
M +45 -1 src/kilestdtools.cpp
M +9 -0 src/kilestdtools.h
M +18 -16 src/kiletool.cpp
M +8 -3 src/kiletool.h
M +23 -13 src/kiletoolmanager.cpp
M +2 -3 src/kiletoolmanager.h
M +17 -12 src/livepreview.cpp
M +2 -1 src/livepreview.h
M +54 -3 src/outputinfo.cpp
M +25 -3 src/outputinfo.h
M +5 -4 src/parser/parsermanager.cpp
M +6 -6 src/quickpreview.cpp
M +4 -4 src/widgets/codecompletionconfigwidget.cpp
M +3 -6 src/widgets/codecompletionconfigwidget.h
M +18 -17 src/widgets/logwidget.cpp
M +7 -6 src/widgets/logwidget.h
M +4 -4 src/widgets/previewwidget.cpp
M +7 -8 src/widgets/structurewidget.cpp
http://commits.kde.org/kile/fd092562ed5cd5cdeb3b8b4df32174fa8dcae353
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1284f84..d9a8758 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -89,7 +89,7 @@ SET(kile_SRCS
kiledocmanager.cpp
kileviewmanager.cpp
eventfilter.cpp
- kileerrorhandler.cpp
+ errorhandler.cpp
dialogs/configcheckerdialog.cpp
configtester.cpp
widgets/sidebar.cpp
diff --git a/src/dialogs/configurationdialog.cpp \
b/src/dialogs/configurationdialog.cpp index c5cee67..cfcf8ff 100644
--- a/src/dialogs/configurationdialog.cpp
+++ b/src/dialogs/configurationdialog.cpp
@@ -39,6 +39,7 @@
#include <KTextEditor/ConfigPage>
#include <KTextEditor/EditorChooser>
+#include "errorhandler.h"
#include "kiledocmanager.h"
#include "kiletoolmanager.h"
#include "kileviewmanager.h"
@@ -206,7 +207,7 @@ namespace KileDialog
void Config::setupCodeCompletion(KPageWidgetItem* parent)
{
- completePage = new CodeCompletionConfigWidget(m_config, m_ki->logWidget());
+ completePage = new CodeCompletionConfigWidget(m_config, m_ki->errorHandler());
completePage->readConfig();
addConfigPage(parent, completePage, i18n("Complete"), "text-x-tex", i18n("Code \
Completion"));
diff --git a/src/dialogs/includegraphicsdialog.cpp \
b/src/dialogs/includegraphicsdialog.cpp index a6ee4a4..c1d0abb 100644
--- a/src/dialogs/includegraphicsdialog.cpp
+++ b/src/dialogs/includegraphicsdialog.cpp
@@ -1,8 +1,6 @@
/**************************************************************************************************
- date : Dec 06 2005
- version : 0.24
- copyright : (C) 2004-2005 by Holger Danielsson \
(holger.danielsson@t-online.de)
- 2004 by Jeroen Wijnhout
+ Copyright (C) 2004-2005 by Holger Danielsson (holger.danielsson@t-online.de)
+ 2004 by Jeroen Wijnhout
**************************************************************************************************/
/***************************************************************************
@@ -28,13 +26,13 @@
#include <KProcess>
#include <KPushButton>
+#include "errorhandler.h"
#include "kiledebug.h"
#include "kileconfig.h"
#include "kileinfo.h"
#include "editorextension.h"
#include "kileactions.h"
#include "kiletool_enums.h"
-#include "widgets/logwidget.h"
namespace KileDialog
{
@@ -593,7 +591,7 @@ void IncludeGraphics::slotWrapFigureSelected(bool state) {
// Adds warning to log if wrapfig isn't in the preamble
QStringList packagelist = m_ki->allPackages();
if (!packagelist.contains("wrapfig")) {
- m_ki->logWidget()->printMessage(KileTool::Error, i18n("You must include the \
wrapfig package to use the text wrapping options"), i18n("Missing Package")); \
+ m_ki->errorHandler()->printMessage(KileTool::Error, i18n("You must include the \
wrapfig package to use the text wrapping options"), i18n("Missing Package")); }
}
diff --git a/src/dialogs/pdf-wizard/pdfdialog.cpp \
b/src/dialogs/pdf-wizard/pdfdialog.cpp index 2154301..12a88ef 100755
--- a/src/dialogs/pdf-wizard/pdfdialog.cpp
+++ b/src/dialogs/pdf-wizard/pdfdialog.cpp
@@ -39,6 +39,7 @@
#include <KUrlRequester>
#include <KInputDialog>
+#include "errorhandler.h"
#include "kdatetime.h"
#include "kileconfig.h"
#include "kiledebug.h"
@@ -51,11 +52,11 @@ PdfDialog::PdfDialog(QWidget *parent,
const QString &texfilename,const QString &startdir,
const QString &latexextensions,
KileTool::Manager *manager,
- KileWidget::LogWidget *log, KileWidget::OutputView *output) :
+ KileErrorHandler *errorHandler, KileWidget::OutputView *output) \
: KDialog(parent),
m_startdir(startdir),
m_manager(manager),
- m_log(log),
+ m_errorHandler(errorHandler),
m_output(output),
m_proc(NULL)
{
@@ -903,7 +904,7 @@ void PdfDialog::executeAction()
return;
}
- m_log->clear();
+ m_errorHandler->clearMessages();
QFileInfo from(m_inputfile);
QFileInfo to(m_outputfile);
@@ -912,7 +913,7 @@ void PdfDialog::executeAction()
QString msg = i18n("Rearranging PDF file: ") + from.fileName();
if (!to.fileName().isEmpty())
msg += " ---> " + to.fileName();
- m_log->printMessage(KileTool::Info, msg, program);
+ m_errorHandler->printMessage(KileTool::Info, msg, program);
// some output logs
m_output->clear();
@@ -1023,8 +1024,8 @@ void PdfDialog::executePermissions()
void PdfDialog::showLogs(const QString &title, const QString &inputfile, const \
QString ¶m) {
// some info for log widget
- m_log->clear();
- m_log->printMessage(KileTool::Info, title, "pdftk" );
+ m_errorHandler->clearMessages();
+ m_errorHandler->printMessage(KileTool::Info, title, "pdftk" );
// some info for output widget
QFileInfo input(inputfile);
@@ -1113,7 +1114,7 @@ void PdfDialog::finishPdfAction(bool state)
QString program = (m_scriptmode==PDF_SCRIPTMODE_ACTION && m_execLatex) ? "LaTeX \
with 'pdfpages' package" : "pdftk";
if ( state ) {
- m_log->printMessage(KileTool::Info, "finished", program);
+ m_errorHandler->printMessage(KileTool::Info, "finished", program);
// should we move the temporary pdf file
if ( ! m_move_filelist.isEmpty() ) {
@@ -1141,19 +1142,19 @@ void PdfDialog::finishPdfAction(bool state)
else {
msg = i18n("Finished with an error");
}
- m_log->printMessage(KileTool::Error, msg, program);
+ m_errorHandler->printMessage(KileTool::Error, msg, program);
}
}
void PdfDialog::runViewer()
{
- m_log->printMessage(KileTool::Info, "Running viewer", "ViewPDF");
+ m_errorHandler->printMessage(KileTool::Info, "Running viewer", "ViewPDF");
// call ViewPDF
QString cfg = KileTool::configName("ViewPDF", m_manager->config());
KileTool::View *tool = \
dynamic_cast<KileTool::View*>(m_manager->createTool("ViewPDF", cfg, false)); \
if(!tool) {
- m_log->printMessage(KileTool::Error, i18n("Could not create the ViewPDF tool"), \
i18n("ViewPDF")); + m_errorHandler->printMessage(KileTool::Error, i18n("Could not \
create the ViewPDF tool"), i18n("ViewPDF")); return;
}
tool->setFlags(0);
diff --git a/src/dialogs/pdf-wizard/pdfdialog.h b/src/dialogs/pdf-wizard/pdfdialog.h
index 10b3374..7a9caec 100644
--- a/src/dialogs/pdf-wizard/pdfdialog.h
+++ b/src/dialogs/pdf-wizard/pdfdialog.h
@@ -32,7 +32,6 @@
#include <QLineEdit>
#include <QBitArray>
-#include "widgets/logwidget.h"
#include "widgets/outputview.h"
#include "widgets/categorycombobox.h"
@@ -44,6 +43,8 @@
class KProcess;
+class KileErrorHandler;
+
namespace KileDialog
{
@@ -56,7 +57,7 @@ class PdfDialog : public KDialog
const QString &texfilename, const QString &startdir,
const QString &latexextensions,
KileTool::Manager *manager,
- KileWidget::LogWidget *log, KileWidget::OutputView *output);
+ KileErrorHandler *errorHandler, KileWidget::OutputView *output);
~PdfDialog();
Q_SIGNALS:
@@ -158,7 +159,7 @@ class PdfDialog : public KDialog
QString m_startdir;
KileTool::Manager *m_manager;
- KileWidget::LogWidget *m_log;
+ KileErrorHandler *m_errorHandler;
KileWidget::OutputView *m_output;
KileWidget::CategoryComboBox *m_cbTask;
diff --git a/src/dialogs/postscriptdialog.cpp b/src/dialogs/postscriptdialog.cpp
index 9c1974b..2a0c9d1 100644
--- a/src/dialogs/postscriptdialog.cpp
+++ b/src/dialogs/postscriptdialog.cpp
@@ -1,9 +1,6 @@
-/***************************************************************************
- date : Mar 12 2007
- version : 0.20
- copyright : (C) 2005-2007 by Holger Danielsson
- email : holger.danielsson@versanet.de
- ***************************************************************************/
+/**********************************************************************************
+ Ccopyright (C) 2005-2007 by Holger Danielsson (holger.danielsson@versanet.de)
+ **********************************************************************************/
/***************************************************************************
* *
@@ -39,6 +36,7 @@
#include <KTemporaryFile>
#include <KUrlRequester>
+#include "errorhandler.h"
#include "kiledebug.h"
#include "kiletool_enums.h"
@@ -48,12 +46,12 @@ namespace KileDialog
PostscriptDialog::PostscriptDialog(QWidget *parent,
const QString &texfilename,const QString \
&startdir, const QString &latexextensions,
- KileWidget::LogWidget *log,KileWidget::OutputView \
*output) : + KileErrorHandler *errorHandler, \
KileWidget::OutputView *output) : KDialog(parent),
m_startdir(startdir),
- m_log(log),
+ m_errorHandler(errorHandler),
m_output(output),
- m_proc(0)
+ m_proc(NULL)
{
setCaption(i18n("Rearrange Postscript File"));
setModal(true);
@@ -176,11 +174,11 @@ void PostscriptDialog::execute()
m_tempfile = buildTempfile();
if(m_tempfile.isEmpty()) {
- m_log->printMessage(KileTool::Error, i18n("Could not create a temporary file."));
+ m_errorHandler->printMessage(KileTool::Error, i18n("Could not create a temporary \
file.")); return;
}
else {
- m_log->clear();
+ m_errorHandler->clearMessages();
QFileInfo from(m_PostscriptDialog.m_edInfile->lineEdit()->text());
QFileInfo to(m_PostscriptDialog.m_edOutfile->lineEdit()->text());
@@ -188,7 +186,7 @@ void PostscriptDialog::execute()
QString msg = i18n("rearrange ps file: ") + from.fileName();
if (!to.fileName().isEmpty())
msg += " ---> " + to.fileName();
- m_log->printMessage(KileTool::Info, msg, m_program);
+ m_errorHandler->printMessage(KileTool::Info, msg, m_program);
// some output logs
m_output->clear();
diff --git a/src/dialogs/postscriptdialog.h b/src/dialogs/postscriptdialog.h
index 6269511..27c61d5 100644
--- a/src/dialogs/postscriptdialog.h
+++ b/src/dialogs/postscriptdialog.h
@@ -1,9 +1,6 @@
-/***************************************************************************
- date : Mar 12 2007
- version : 0.20
- copyright : (C) 2005-2007 by Holger Danielsson
- email : holger.danielsson@versanet.de
- ***************************************************************************/
+/**********************************************************************************
+ Copyright (C) 2005-2007 by Holger Danielsson (holger.danielsson@versanet.de)
+ **********************************************************************************/
/***************************************************************************
* *
@@ -21,7 +18,6 @@
#include <QProcess>
-#include "widgets/logwidget.h"
#include "widgets/outputview.h"
#include "ui_postscriptdialog_base.h"
@@ -47,6 +43,8 @@
class KProcess;
+class KileErrorHandler;
+
namespace KileDialog
{
@@ -58,7 +56,7 @@ class PostscriptDialog : public KDialog
PostscriptDialog(QWidget *parent,
const QString &texfilename, const QString &startdir,
const QString &latexextensions,
- KileWidget::LogWidget *log, KileWidget::OutputView *output);
+ KileErrorHandler *errorHandler, KileWidget::OutputView *output);
~PostscriptDialog();
Q_SIGNALS:
@@ -78,7 +76,7 @@ class PostscriptDialog : public KDialog
void execute();
QString m_startdir;
- KileWidget::LogWidget *m_log;
+ KileErrorHandler *m_errorHandler;
KileWidget::OutputView *m_output;
QString m_tempfile;
diff --git a/src/documentinfo.h b/src/documentinfo.h
index ceae658..27ad09f 100644
--- a/src/documentinfo.h
+++ b/src/documentinfo.h
@@ -28,6 +28,7 @@
#include "kileconstants.h"
#include "kileextensions.h"
#include "livepreview_utils.h"
+#include "outputinfo.h"
#define TEX_CAT0 '\\'
#define TEX_CAT1 '{'
@@ -409,7 +410,7 @@ protected:
-class LaTeXInfo : public TextInfo, public KileTool::LivePreviewUserStatusHandler
+class LaTeXInfo : public TextInfo, public KileTool::LivePreviewUserStatusHandler, \
public LaTeXOutputHandler {
Q_OBJECT
diff --git a/src/editorextension.cpp b/src/editorextension.cpp
index 3692d08..3ce74a3 100644
--- a/src/editorextension.cpp
+++ b/src/editorextension.cpp
@@ -27,18 +27,18 @@
#include <KLocale>
#include <KStandardDirs>
-#include "widgets/konsolewidget.h"
+#include "errorhandler.h"
#include "codecompletion.h"
-#include "kileinfo.h"
-#include "kileviewmanager.h"
-#include "kileconfig.h"
-#include "kileactions.h"
+#include "errorhandler.h"
#include "kile.h"
-
-#include "kiletool_enums.h"
-#include "widgets/logwidget.h"
+#include "kileactions.h"
+#include "kileconfig.h"
#include "kileextensions.h"
+#include "kileinfo.h"
+#include "kiletool_enums.h"
+#include "kileviewmanager.h"
#include "quickpreview.h"
+#include "widgets/konsolewidget.h"
/*
* FIXME: The code in this file should be reworked completely. Once we've got a \
better parser @@ -3022,7 +3022,7 @@ bool \
EditorExtension::insertSpecialCharacter(const QString& texString, KTextEdit if \
(!dep.isEmpty()) { QStringList packagelist = m_ki->allPackages();
if(!packagelist.contains(dep)) {
- m_ki->logWidget()->printMessage(KileTool::Error, i18n("You have to include the \
package %1 to use %2.", dep, texString), i18n("Missing Package")); \
+ m_ki->errorHandler()->printMessage(KileTool::Error, i18n("You have to include the \
package %1 to use %2.", dep, texString), i18n("Missing Package")); KILE_DEBUG() << \
"Need package "<< dep; }
}
@@ -3271,8 +3271,8 @@ void \
EditorExtension::sectioningCommand(KileWidget::StructureViewItem *item, int QRegExp \
reg( "\\\\(part|chapter|section|subsection|subsubsection|paragraph|subparagraph)\\*?\\s*(\\{|\\[)" \
); QString textline = getTextLineReal(doc,row1);
if(reg.indexIn(textline, col1) != col1) {
- m_ki->logWidget()->clear();
- m_ki->logWidget()->printMessage(KileTool::Error,
+ m_ki->errorHandler()->clearMessages();
+ m_ki->errorHandler()->printMessage(KileTool::Error,
i18n("The document was modified and the structure view should be updated, \
before starting such an operation."), i18n("Structure View Error") );
return;
diff --git a/src/errorhandler.cpp b/src/errorhandler.cpp
new file mode 100644
index 0000000..8821de3
--- /dev/null
+++ b/src/errorhandler.cpp
@@ -0,0 +1,561 @@
+/*************************************************************************
+ Copyright (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)
+ 2008-2012 by Michel Ludwig (michel.ludwig@kdemail.net)
+ *************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "errorhandler.h"
+
+#include <QFileInfo>
+#include <QHash>
+#include <QLabel>
+#include <QMenu>
+#include <QRegExp>
+#include <QTabWidget>
+#include <QToolBar>
+#include <QToolButton>
+
+#include <KActionCollection>
+#include <KLocale>
+#include <KUrl>
+#include <KTabWidget>
+#include <KTextEditor/Document>
+#include <KTextEditor/View>
+#include <KSelectAction>
+#include "kiledocmanager.h"
+#include "kileinfo.h"
+#include "kileproject.h"
+#include "kiletool_enums.h"
+#include "kileviewmanager.h"
+#include "outputinfo.h"
+#include "utilities.h"
+#include "widgets/logwidget.h"
+#include "widgets/outputview.h"
+#include "widgets/sidebar.h"
+
+KileErrorHandler::KileErrorHandler(QObject *parent, KileInfo *info, \
KActionCollection *ac) + : QObject(parent), m_ki(info), m_errorHanderToolBar(NULL), \
m_currentLaTeXOutputHandler(NULL) +{
+ setObjectName("ErrorHandler");
+
+ createActions(ac);
+ setOutputActionsEnabled(false);
+
+ m_compilationResultLabel = new QLabel();
+
+ m_mainLogWidget = new KileWidget::LogWidget();
+ m_mainLogWidget->setFocusPolicy(Qt::ClickFocus);
+ m_mainLogWidget->setMinimumHeight(40);
+
+ connect(m_mainLogWidget, SIGNAL(outputInfoSelected(const OutputInfo&)),
+ this, SLOT(jumpToProblem(const OutputInfo&)));
+ connect(m_mainLogWidget, SIGNAL(showingErrorMessage(QWidget*)),
+ this, SIGNAL(showingErrorMessage(QWidget*)));
+ connect(m_mainLogWidget, SIGNAL(showingErrorMessage(QWidget*)),
+ this, SLOT(showMessagesOutput()));
+ m_errorLogWidget = new KileWidget::LogWidget(KileWidget::LogWidget::NoHideActions);
+ connect(m_errorLogWidget, SIGNAL(outputInfoSelected(const OutputInfo&)),
+ this, SLOT(jumpToProblem(const OutputInfo&)));
+ m_warningLogWidget = new \
KileWidget::LogWidget(KileWidget::LogWidget::NoHideActions); \
+ connect(m_warningLogWidget, SIGNAL(outputInfoSelected(const OutputInfo&)), + \
this, SLOT(jumpToProblem(const OutputInfo&))); + m_badBoxLogWidget = new \
KileWidget::LogWidget(KileWidget::LogWidget::NoHideActions); \
+ connect(m_badBoxLogWidget, SIGNAL(outputInfoSelected(const OutputInfo&)), + \
this, SLOT(jumpToProblem(const OutputInfo&))); +
+ // FIXME: suggestions for icons: utilities-log-viewer, script-error, dialog-warning
+ m_outputTabWidget = new QTabWidget();
+ m_outputTabWidget->setTabPosition(QTabWidget::South);
+ m_outputTabWidget->setTabsClosable(false);
+ m_outputTabWidget->addTab(m_mainLogWidget, i18n("Messages"));
+ m_outputTabWidget->addTab(m_errorLogWidget, i18n("Errors"));
+ m_outputTabWidget->addTab(m_warningLogWidget, i18n("Warnings"));
+ m_outputTabWidget->addTab(m_badBoxLogWidget, i18n("BadBoxes"));
+
+ connect(m_ki->viewManager(), SIGNAL(textViewActivated(KTextEditor::View*)),
+ this, SLOT(updateCurrentLaTeXOutputHandler()));
+ connect(m_ki->viewManager(), SIGNAL(textViewClosed(KTextEditor::View*,bool)),
+ this, SLOT(updateCurrentLaTeXOutputHandler()));
+ connect(m_ki->docManager(), SIGNAL(documentOpened(KileDocument::TextInfo*)),
+ this, SLOT(updateCurrentLaTeXOutputHandler()));
+ connect(m_ki->docManager(), SIGNAL(projectOpened(KileProject*)),
+ this, SLOT(handleProjectOpened(KileProject*)));
+
+ showMessagesOutput();
+}
+
+KileErrorHandler::~KileErrorHandler()
+{
+}
+
+void KileErrorHandler::createActions(KActionCollection *ac)
+{
+ m_viewLogAction = ac->addAction("ViewLog", this, SLOT(ViewLog()));
+ m_viewLogAction->setText(i18n("View Log File"));
+ m_viewLogAction->setShortcut(KShortcut(Qt::ALT + Qt::Key_0));
+ m_viewLogAction->setIcon(KIcon("viewlog"));
+
+ m_previousErrorAction = ac->addAction("PreviousError", this, \
SLOT(PreviousError())); + m_previousErrorAction->setText(i18n("Previous LaTeX \
Error")); + m_previousErrorAction->setIcon(KIcon("errorprev"));
+
+ m_nextErrorAction = ac->addAction("NextError", this, SLOT(NextError()));
+ m_nextErrorAction->setText(i18n("Next LaTeX Error"));
+ m_nextErrorAction->setIcon(KIcon("errornext"));
+
+ m_previousWarningAction = ac->addAction("PreviousWarning", this, \
SLOT(PreviousWarning())); + m_previousWarningAction->setText(i18n("Previous LaTeX \
Warning")); + m_previousWarningAction->setIcon(KIcon("warnprev"));
+
+ m_nextWarningAction = ac->addAction("NextWarning", this, SLOT(NextWarning()));
+ m_nextWarningAction->setText(i18n("Next LaTeX Warnings"));
+ m_nextWarningAction->setIcon(KIcon("warnnext"));
+
+ m_previousBadBoxAction = ac->addAction("PreviousBadBox", this, \
SLOT(PreviousBadBox())); + m_previousBadBoxAction->setText(i18n("Previous LaTeX \
BadBox")); + m_previousBadBoxAction->setIcon(KIcon("bboxprev"));
+
+ m_nextBadBoxAction = ac->addAction("NextBadBox", this, SLOT(NextBadBox()));
+ m_nextBadBoxAction->setText(i18n("Next LaTeX BadBox"));
+ m_nextBadBoxAction->setIcon(KIcon("bboxnext"));
+}
+
+void KileErrorHandler::setErrorHandlerToolBar(QToolBar *toolBar)
+{
+ m_errorHanderToolBar = toolBar;
+ toolBar->addAction(m_viewLogAction);
+ toolBar->addAction(m_previousErrorAction);
+ toolBar->addAction(m_nextErrorAction);
+ toolBar->addAction(m_previousWarningAction);
+ toolBar->addAction(m_nextWarningAction);
+ toolBar->addAction(m_previousBadBoxAction);
+ toolBar->addAction(m_nextBadBoxAction);
+
+}
+
+void KileErrorHandler::setOutputActionsEnabled(bool b)
+{
+ m_viewLogAction->setEnabled(b);
+ m_previousErrorAction->setEnabled(b);
+ m_nextErrorAction->setEnabled(b);
+ m_previousWarningAction->setEnabled(b);
+ m_nextWarningAction->setEnabled(b);
+ m_previousBadBoxAction->setEnabled(b);
+ m_nextBadBoxAction->setEnabled(b);
+}
+
+QLabel* KileErrorHandler::compilationResultLabel()
+{
+ return m_compilationResultLabel;
+}
+
+QWidget* KileErrorHandler::outputWidget()
+{
+ return m_outputTabWidget;
+}
+
+bool KileErrorHandler::areMessagesShown() const
+{
+ return m_mainLogWidget->isShowingOutput();
+}
+
+void KileErrorHandler::addEmptyLineToMessages()
+{
+ m_mainLogWidget->addEmptyLine();
+}
+
+void KileErrorHandler::startToolLogOutput()
+{
+ m_mainLogWidget->startToolLogOutput();
+}
+
+void KileErrorHandler::endToolLogOutput()
+{
+ m_mainLogWidget->endToolLogOutput();
+}
+
+void KileErrorHandler::printMessage(const QString& message)
+{
+ m_mainLogWidget->printMessage(message);
+}
+
+void KileErrorHandler::printMessage(int type, const QString& message, const QString \
&tool, + const OutputInfo& outputInfo, bool \
allowSelection, + bool scroll)
+{
+ m_mainLogWidget->printMessage(type, message, tool, outputInfo, allowSelection, \
scroll); +}
+
+void KileErrorHandler::printProblem(int type, const QString& problem, const \
OutputInfo& outputInfo) +{
+ m_mainLogWidget->printProblem(type, problem, outputInfo);
+}
+
+void KileErrorHandler::clearMessages()
+{
+ m_mainLogWidget->clear();
+}
+
+void KileErrorHandler::showMessagesOutput()
+{
+ m_outputTabWidget->setCurrentWidget(m_mainLogWidget);
+}
+
+void KileErrorHandler::showErrorsOutput()
+{
+ m_outputTabWidget->setCurrentWidget(m_errorLogWidget);
+}
+
+void KileErrorHandler::showWarningsOutput()
+{
+ m_outputTabWidget->setCurrentWidget(m_warningLogWidget);
+}
+
+void KileErrorHandler::showBadBoxesOutput()
+{
+ m_outputTabWidget->setCurrentWidget(m_badBoxLogWidget);
+}
+
+void KileErrorHandler::handleProjectOpened(KileProject *project)
+{
+ connect(project, SIGNAL(aboutToBeDestroyed(KileProject*)),
+ this, SLOT(updateCurrentLaTeXOutputHandler()),
+ Qt::UniqueConnection);
+ connect(project, SIGNAL(projectItemAdded(KileProject*,KileProjectItem*)),
+ this, SLOT(updateCurrentLaTeXOutputHandler()),
+ Qt::UniqueConnection);
+ connect(project, SIGNAL(projectItemRemoved(KileProject*,KileProjectItem*)),
+ this, SLOT(updateCurrentLaTeXOutputHandler()),
+ Qt::UniqueConnection);
+}
+
+void KileErrorHandler::handleLaTeXToolDone(KileTool::Base *tool, int i, bool \
childToolSpawned) +{
+ Q_UNUSED(i);
+
+ KileTool::LaTeX *latex = dynamic_cast<KileTool::LaTeX*>(tool);
+ if(!latex) {
+ return;
+ }
+ if(childToolSpawned) {
+ return;
+ }
+ if(latex->latexOutputHandler() == m_currentLaTeXOutputHandler) {
+ updateForCompilationResult();
+ }
+}
+
+void KileErrorHandler::handleSpawnedChildTool(KileTool::Base *parent, KileTool::Base \
*child) +{
+ if(!dynamic_cast<KileTool::LaTeX*>(parent) || \
!dynamic_cast<KileTool::LaTeX*>(child)) { + return;
+ }
+
+ connect(child, SIGNAL(done(KileTool::Base*, int, bool)),
+ this, SLOT(handleLaTeXToolDone(KileTool::Base*, int, bool)));
+}
+
+void KileErrorHandler::updateCurrentLaTeXOutputHandler()
+{
+ LaTeXOutputHandler *h = NULL;
+ m_ki->getCompileName(false, &h);
+ if(h == m_currentLaTeXOutputHandler) {
+ return;
+ }
+ m_currentLaTeXOutputHandler = h;
+
+ if(!m_currentLaTeXOutputHandler) {
+ setOutputActionsEnabled(false);
+ clearErrorOutput();
+ }
+ else {
+ setOutputActionsEnabled(true);
+ updateForCompilationResult();
+ }
+}
+
+void KileErrorHandler::updateForCompilationResult()
+{
+ if(!m_currentLaTeXOutputHandler) {
+ return;
+ }
+ m_errorLogWidget->clear();
+ displayProblemsInLogWidget(m_errorLogWidget, \
m_currentLaTeXOutputHandler->outputList(), KileErrorHandler::OnlyErrors); \
+ m_warningLogWidget->clear(); + displayProblemsInLogWidget(m_warningLogWidget, \
m_currentLaTeXOutputHandler->outputList(), KileErrorHandler::OnlyWarnings); \
+ m_badBoxLogWidget->clear(); + displayProblemsInLogWidget(m_badBoxLogWidget, \
m_currentLaTeXOutputHandler->outputList(), KileErrorHandler::OnlyBadBoxes); +
+ const int nErrors = m_currentLaTeXOutputHandler->numberOfErrors();
+ const int nWarnings = m_currentLaTeXOutputHandler->numberOfWarnings();
+ const int nBadBoxes = m_currentLaTeXOutputHandler->numberOfBadBoxes();
+ QString errorString, warningString, badBoxString;
+
+ if(nErrors >= 0) {
+ errorString = i18n("Errors: %1").arg(nErrors);
+ }
+ if(nWarnings >= 0) {
+ warningString = i18n("Warnings: %1").arg(nWarnings);
+ }
+ if(nBadBoxes >= 0) {
+ badBoxString = i18n("BadBoxes: %1").arg(nBadBoxes);
+ }
+
+ m_compilationResultLabel->setText(i18nc("Result of the compilation w.r.t. number of \
errors/warnings/badboxes", + "%1 %2 \
%3").arg(errorString).arg(warningString).arg(badBoxString)); +}
+
+void KileErrorHandler::clearErrorOutput()
+{
+ m_compilationResultLabel->clear();
+ m_errorLogWidget->clear();
+ m_warningLogWidget->clear();
+ m_badBoxLogWidget->clear();
+}
+
+void KileErrorHandler::setMostRecentLogInformation(const QString& logFile, const \
LatexOutputInfoArray& outputInfoList) +{
+ Q_UNUSED(logFile);
+
+ // add them to the log widget
+ displayProblemsInMainLogWidget(outputInfoList);
+}
+
+void KileErrorHandler::displayProblemsInMainLogWidget(const LatexOutputInfoArray& \
infoList) +{
+ displayProblemsInLogWidget(m_mainLogWidget, infoList);
+}
+
+void KileErrorHandler::displayProblemsInLogWidget(KileWidget::LogWidget *logWidget, \
const LatexOutputInfoArray& infoList, ProblemType problemType) +{
+ QString message;
+ int type = KileTool::Info;
+
+ //print detailed error info
+ logWidget->setUpdatesEnabled(false);
+
+ for(QList<LatexOutputInfo>::const_iterator i = infoList.begin();
+ i != infoList.end(); ++i) {
+
+ const LatexOutputInfo& info = *i;
+ message = info.source() + ':' + QString::number(info.sourceLine()) + ':' + \
info.message(); + switch(info.type()) {
+ case LatexOutputInfo::itmBadBox:
+ if(problemType == AllProblems || problemType == OnlyBadBoxes) {
+ type = KileTool::ProblemBadBox;
+ }
+ else {
+ continue;
+ }
+ break;
+ case LatexOutputInfo::itmError:
+ if(problemType == AllProblems || problemType == OnlyErrors) {
+ type = KileTool::ProblemError;
+ }
+ else {
+ continue;
+ }
+ break;
+ case LatexOutputInfo::itmWarning:
+ if(problemType == AllProblems || problemType == OnlyWarnings) {
+ type = KileTool::ProblemWarning;
+ }
+ else {
+ continue;
+ }
+ break;
+ default:
+ type = KileTool::Info;
+ break;
+ }
+ KileWidget::LogWidget::ProblemInformation problem;
+ problem.type = type;
+ problem.message = message;
+ problem.outputInfo = info;
+ logWidget->printMessage(type, message, QString(), info, false, false);
+ }
+
+ logWidget->setUpdatesEnabled(true);
+ logWidget->scrollToBottom();
+}
+
+void KileErrorHandler::printNoInformationAvailable()
+{
+ m_mainLogWidget->printMessage(i18n("No information about warnings or errors is \
available.")); +}
+
+void KileErrorHandler::ViewLog()
+{
+ if(!m_currentLaTeXOutputHandler) {
+ printNoInformationAvailable();
+ return;
+ }
+
+ const LatexOutputInfoArray& outputInfoList = \
m_currentLaTeXOutputHandler->outputList(); +
+ KileWidget::LogWidget *logWidget = m_mainLogWidget;
+ m_ki->focusLog();
+
+ QFile logFile(m_currentLaTeXOutputHandler->logFile());
+ if(!m_currentLaTeXOutputHandler->logFile().isEmpty() && \
logFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + QHash<int, OutputInfo> \
hash; +
+ for(QList<LatexOutputInfo>::const_iterator i = outputInfoList.begin();
+ i != outputInfoList.end(); ++i) {
+ LatexOutputInfo info = *i;
+ hash[info.outputLine()] = info;
+ }
+
+ QTextStream textStream(&logFile);
+
+ for(int lineNumber = 0; !textStream.atEnd(); ++lineNumber) {
+ int type = -1;
+ const QString line = textStream.readLine();
+ if(hash.find(lineNumber) != hash.end()) {
+ switch(hash[lineNumber].type()) {
+ case LatexOutputInfo::itmError:
+ type = KileTool::Error;
+ break;
+ case LatexOutputInfo::itmWarning:
+ type = KileTool::Warning;
+ break;
+ case LatexOutputInfo::itmBadBox:
+ type = KileTool::ProblemBadBox;
+ break;
+ }
+ }
+ // don't scroll to the item as this will lead to severely degraded performance
+ logWidget->printMessage(type, line, QString(), hash[lineNumber], true, false);
+ }
+
+ logWidget->scrollToBottom();
+ }
+ else {
+ logWidget->printProblem(KileTool::Error, i18n("Cannot open log file; did you run \
LaTeX?")); + }
+}
+
+void KileErrorHandler::jumpToFirstError()
+{
+ if(!m_currentLaTeXOutputHandler) {
+ printNoInformationAvailable();
+ return;
+ }
+
+ const LatexOutputInfoArray& outputInfoList = \
m_currentLaTeXOutputHandler->outputList(); +
+ int sz = outputInfoList.size();
+ for(int i = 0; i < sz; ++i) {
+ if(outputInfoList[i].type() == LatexOutputInfo::itmError) {
+ jumpToProblem(outputInfoList[i]);
+ m_currentLaTeXOutputHandler->setCurrentError(i);
+ break;
+ }
+ }
+}
+
+void KileErrorHandler::jumpToProblem(const OutputInfo& info)
+{
+ QString file = m_ki->getFullFromPrettyName(info, info.source());
+
+ if(!file.isEmpty()) {
+ m_ki->docManager()->fileOpen(KUrl(file));
+ int line = (info.sourceLine() > 0) ? (info.sourceLine() - 1) : 0;
+
+ KTextEditor::Document *doc = m_ki->docManager()->docFor(KUrl(file));
+ if(doc) {
+ KTextEditor::View* view = doc->views().first();
+ if(view) {
+ view->setCursorPosition(KTextEditor::Cursor(line, 0));
+ }
+ }
+ }
+}
+
+void KileErrorHandler::jumpToProblem(int type, bool forward)
+{
+ if(!m_currentLaTeXOutputHandler) {
+ printNoInformationAvailable();
+ return;
+ }
+
+ const LatexOutputInfoArray& outputInfoList = \
m_currentLaTeXOutputHandler->outputList(); +
+ if (!outputInfoList.isEmpty()) {
+ int sz = outputInfoList.size();
+ int pl = forward ? 1 : -1;
+ bool found = false;
+
+ //look for next problem of requested type
+ for(int i = 0; i < sz; ++i) {
+ //always look at the whole outputInfo array, but start
+ //at the problem adjacent to the current error
+ //if we go beyond the bounds of the array we use
+ //a simple "modulo" calculation to get within bounds again
+ int index = (m_currentLaTeXOutputHandler->currentError() + (i + 1) *pl) % sz;
+ while(index < 0) {
+ index += sz;
+ }
+
+ if(outputInfoList[index].type() == type) {
+ m_currentLaTeXOutputHandler->setCurrentError(index);
+ found = true;
+ break;
+ }
+ }
+
+ if(!found) {
+ return;
+ }
+
+ //If the log file is being viewed, use this to jump to the errors,
+ //otherwise, use the error summary display
+ m_mainLogWidget->highlight(outputInfoList[m_currentLaTeXOutputHandler->currentError()]);
+
+ jumpToProblem(outputInfoList[m_currentLaTeXOutputHandler->currentError()]);
+ }
+
+ if(outputInfoList.isEmpty()) {
+ m_mainLogWidget->printMessage(i18n("No LaTeX warnings/errors detected."));
+ }
+}
+
+void KileErrorHandler::NextError()
+{
+ jumpToProblem(LatexOutputInfo::itmError, true);
+}
+
+void KileErrorHandler::PreviousError()
+{
+ jumpToProblem(LatexOutputInfo::itmError, false);
+}
+
+void KileErrorHandler::NextWarning()
+{
+ jumpToProblem(LatexOutputInfo::itmWarning, true);
+}
+
+void KileErrorHandler::PreviousWarning()
+{
+ jumpToProblem(LatexOutputInfo::itmWarning, false);
+}
+
+void KileErrorHandler::NextBadBox()
+{
+ jumpToProblem(LatexOutputInfo::itmBadBox, true);
+}
+
+void KileErrorHandler::PreviousBadBox()
+{
+ jumpToProblem(LatexOutputInfo::itmBadBox, false);
+}
+
+#include "errorhandler.moc"
diff --git a/src/errorhandler.h b/src/errorhandler.h
new file mode 100644
index 0000000..972bb80
--- /dev/null
+++ b/src/errorhandler.h
@@ -0,0 +1,127 @@
+/***************************************************************************
+ Copyright (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)
+ 2011-2012 by Michel Ludwig (michel.ludwig@kdemail.net)
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 ERRORHANDLER_H
+#define ERRORHANDLER_H
+
+#include <QObject>
+#include <QPointer>
+
+#include "outputinfo.h"
+
+class QLabel;
+class QTabWidget;
+class QToolBar;
+class QToolButton;
+
+class KAction;
+class KActionCollection;
+class KileInfo;
+class KileProject;
+class LaTeXOutputHandler;
+class OutputInfo;
+
+namespace KileTool { class Base; }
+namespace KileWidget { class LogWidget; }
+
+class KileErrorHandler : public QObject
+{
+ Q_OBJECT
+
+public:
+ KileErrorHandler(QObject *parent, KileInfo *info, KActionCollection *ac);
+
+ ~KileErrorHandler();
+
+ QLabel* compilationResultLabel();
+
+ QWidget* outputWidget();
+
+ void setErrorHandlerToolBar(QToolBar *toolBar);
+
+ void setMostRecentLogInformation(const QString& logFile, const \
LatexOutputInfoArray& outputInfoList); +
+
+ enum ProblemType { AllProblems = 0, OnlyErrors, OnlyWarnings, OnlyBadBoxes };
+
+ void displayProblemsInLogWidget(KileWidget::LogWidget *logWidget, const \
LatexOutputInfoArray& infoList, ProblemType problemType = AllProblems); +
+ bool areMessagesShown() const;
+ void addEmptyLineToMessages();
+
+ void startToolLogOutput();
+ void endToolLogOutput();
+
+Q_SIGNALS:
+ void showingErrorMessage(QWidget *w);
+
+public Q_SLOTS:
+ void handleSpawnedChildTool(KileTool::Base *parent, KileTool::Base *child);
+ void handleLaTeXToolDone(KileTool::Base*, int, bool childToolSpawned);
+
+
+ void printMessage(const QString& message);
+ void printMessage(int type, const QString& message, const QString &tool = "Kile",
+ const OutputInfo& outputInfo = OutputInfo(), bool allowSelection \
= false, + bool scroll = true);
+ void printProblem(int type, const QString& problem, const OutputInfo& outputInfo = \
OutputInfo()); + void clearMessages();
+
+ void jumpToFirstError();
+ void jumpToProblem(const OutputInfo& info);
+
+ void showMessagesOutput();
+ void showErrorsOutput();
+ void showWarningsOutput();
+ void showBadBoxesOutput();
+
+ void clearErrorOutput();
+
+/* log view, error handling */
+private Q_SLOTS:
+ void ViewLog();
+ void NextError();
+ void PreviousError();
+ void NextWarning();
+ void PreviousWarning();
+ void NextBadBox();
+ void PreviousBadBox();
+
+ void setOutputActionsEnabled(bool b);
+
+ void handleProjectOpened(KileProject *project);
+ void updateCurrentLaTeXOutputHandler();
+ void updateForCompilationResult();
+
+private:
+ KileInfo *m_ki;
+ QToolBar *m_errorHanderToolBar;
+ int m_currentOutputType;
+ LaTeXOutputHandler *m_currentLaTeXOutputHandler;
+ QPointer<QTabWidget> m_outputTabWidget;
+ QPointer<QLabel> m_compilationResultLabel;
+ QPointer<KileWidget::LogWidget> m_mainLogWidget;
+ QPointer<KileWidget::LogWidget> m_errorLogWidget, m_warningLogWidget, \
m_badBoxLogWidget; + QPointer<KAction> m_viewLogAction;
+ QPointer<KAction> m_previousErrorAction, m_nextErrorAction;
+ QPointer<KAction> m_previousWarningAction, m_nextWarningAction;
+ QPointer<KAction> m_previousBadBoxAction, m_nextBadBoxAction;
+
+ void createActions(KActionCollection *ac);
+ void jumpToProblem(int type, bool);
+ void displayProblemsInMainLogWidget(const LatexOutputInfoArray& infoList);
+ void printNoInformationAvailable();
+};
+
+#endif
diff --git a/src/kile.cpp b/src/kile.cpp
index 8374267..8061b54 100644
--- a/src/kile.cpp
+++ b/src/kile.cpp
@@ -1,9 +1,8 @@
/****************************************************************************************
- begin : sam jui 13 09:50:06 CEST 2002
- copyright : (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)
- (C) 2007-2012 by Michel Ludwig \
(michel.ludwig@kdemail.net)
- (C) 2007 Holger Danielsson \
(holger.danielsson@versanet.de)
- (C) 2009 Thomas Braun (thomas.braun@virtuell-zuhause.de)
+ Copyright (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)
+ (C) 2007-2012 by Michel Ludwig (michel.ludwig@kdemail.net)
+ (C) 2007 Holger Danielsson (holger.danielsson@versanet.de)
+ (C) 2009 Thomas Braun (thomas.braun@virtuell-zuhause.de)
****************************************************************************************/
/***************************************************************************
@@ -57,6 +56,7 @@
#include "abbreviationmanager.h"
#include "configurationmanager.h"
#include "documentinfo.h"
+#include "errorhandler.h"
#include "kileactions.h"
#include "kiledebug.h"
#include "kilestdactions.h"
@@ -71,7 +71,6 @@
#include "kiletool.h"
#include "kiletoolmanager.h"
#include "kilestdtools.h"
-#include "widgets/logwidget.h"
#include "widgets/outputview.h"
#include "widgets/konsolewidget.h"
#include "dialogs/quickdocumentdialog.h"
@@ -83,7 +82,6 @@
#include "kileversion.h"
#include "kileviewmanager.h"
#include "kileconfig.h"
-#include "kileerrorhandler.h"
#include "dialogs/configcheckerdialog.h"
#include "widgets/sidebar.h"
#include "dialogs/floatdialog.h"
@@ -114,12 +112,12 @@
* Class Kile.
*/
-Kile::Kile(bool allowRestore, QWidget *parent, const char *name)
+Kile::Kile(bool allowRestore, QWidget *parent)
: KParts::MainWindow(),
KileInfo(this),
m_paPrint(NULL)
{
- setObjectName(name);
+ setObjectName("Kile");
// publish the D-Bus interfaces
new MainAdaptor(this);
QDBusConnection dbus = QDBusConnection::sessionBus();
@@ -153,7 +151,7 @@ Kile::Kile(bool allowRestore, QWidget *parent, const char *name)
m_edit = new KileDocument::EditorExtension(this);
m_help = new KileHelp::Help(m_edit, this);
m_partManager = new KParts::PartManager(this);
- m_errorHandler = new KileErrorHandler(this, this);
+ m_errorHandler = new KileErrorHandler(this, this, actionCollection());
m_quickPreview = new KileTool::QuickPreview(this);
m_extensions = new KileDocument::Extensions();
m_jScriptManager = new KileScript::Manager(this, m_config.data(), \
actionCollection(), parent, "KileScript::Manager"); @@ -222,11 +220,10 @@ \
Kile::Kile(bool allowRestore, QWidget *parent, const char *name) \
setupPreviewTools(); setupActions(); // sets up m_paStop
- // Parser manager must be created before the tool manager!
- m_manager = new KileTool::Manager(this, m_config.data(), m_logWidget, \
m_outputWidget, m_partManager, m_topWidgetStack, m_paStop, 10000); //FIXME make \
timeout configurable + // Parser manager and view manager must be created before the \
tool manager! + m_manager = new KileTool::Manager(this, m_config.data(), \
m_outputWidget, m_partManager, m_topWidgetStack, m_paStop, 10000); //FIXME make \
timeout configurable connect(m_manager, SIGNAL(requestGUIState(const QString &)), \
this, SLOT(prepareForPart(const QString &))); connect(m_manager, \
SIGNAL(jumpToFirstError()), m_errorHandler, \
SLOT(jumpToFirstError()));
- connect(m_manager, SIGNAL(toolStarted()), m_errorHandler, SLOT(reset()));
connect(m_manager, SIGNAL(previewDone()), this, SLOT(focusPreview()));
#ifdef LIVEPREVIEW_POSSIBLE
@@ -436,6 +433,7 @@ void Kile::setupStatusBar()
statusBar()->insertItem(i18n("Normal Mode"), ID_HINTTEXT, 10);
statusBar()->setItemAlignment(ID_HINTTEXT, Qt::AlignLeft | Qt::AlignVCenter);
+ statusBar()->addPermanentWidget(errorHandler()->compilationResultLabel());
statusBar()->insertPermanentItem(QString(), ID_PARSER_STATUS, 0);
statusBar()->setItemAlignment(ID_PARSER_STATUS, Qt::AlignLeft | Qt::AlignVCenter);
statusBar()->insertPermanentItem(QString(), ID_LINE_COLUMN, 0);
@@ -625,12 +623,7 @@ void Kile::setupBottomBar()
m_bottomBar = new KileWidget::BottomBar(this);
m_bottomBar->setFocusPolicy(Qt::ClickFocus);
- m_logWidget = new KileWidget::LogWidget(this, this);
- connect(m_logWidget, SIGNAL(showingErrorMessage(QWidget* )), this, \
SLOT(focusLog()));
- connect(m_logWidget, SIGNAL(outputInfoSelected(const OutputInfo&)), m_errorHandler, \
SLOT(jumpToProblem(const OutputInfo&)));
-
- m_logWidget->setFocusPolicy(Qt::ClickFocus);
- m_logWidget->setMinimumHeight(40);
+ connect(errorHandler(), SIGNAL(showingErrorMessage(QWidget* )), this, \
SLOT(focusLog()));
QWidget *widget = new QWidget(this);
QHBoxLayout *layout = new QHBoxLayout(widget);
@@ -642,7 +635,7 @@ void Kile::setupBottomBar()
m_latexOutputErrorToolBar->setIconDimensions(KIconLoader::SizeSmall);
m_latexOutputErrorToolBar->setOrientation(Qt::Vertical);
- layout->addWidget(m_logWidget);
+ layout->addWidget(errorHandler()->outputWidget());
layout->addWidget(m_latexOutputErrorToolBar);
m_bottomBar->addPage(widget, SmallIcon("utilities-log-viewer"), i18n("Log and \
Messages"));
@@ -795,20 +788,8 @@ void Kile::setupActions()
m_paStop = createAction(i18n("&Stop"),"Stop", "process-stop", \
KShortcut(Qt::Key_Escape)); m_paStop->setEnabled(false);
m_latexOutputErrorToolBar->addAction(m_paStop);
- act = createAction(i18n("View Log File"), "ViewLog", "viewlog", KShortcut(Qt::ALT + \
Qt::Key_0), m_errorHandler, SLOT(ViewLog()));
- m_latexOutputErrorToolBar->addAction(act);
- act = createAction(i18n("Previous LaTeX Error"), "PreviousError", "errorprev", \
m_errorHandler, SLOT(PreviousError()));
- m_latexOutputErrorToolBar->addAction(act);
- act = createAction(i18n("Next LaTeX Error"), "NextError", "errornext", \
m_errorHandler, SLOT(NextError()));
- m_latexOutputErrorToolBar->addAction(act);
- act = createAction(i18n("Previous LaTeX Warning"), "PreviousWarning", "warnprev", \
m_errorHandler, SLOT(PreviousWarning()));
- m_latexOutputErrorToolBar->addAction(act);
- act = createAction(i18n("Next LaTeX Warning"), "NextWarning", "warnnext", \
m_errorHandler, SLOT(NextWarning()));
- m_latexOutputErrorToolBar->addAction(act);
- act = createAction(i18n("Previous LaTeX BadBox"), "PreviousBadBox", "bboxprev", \
m_errorHandler, SLOT(PreviousBadBox()));
- m_latexOutputErrorToolBar->addAction(act);
- act = createAction(i18n("Next LaTeX BadBox"), "NextBadBox", "bboxnext", \
m_errorHandler, SLOT(NextBadBox()));
- m_latexOutputErrorToolBar->addAction(act);
+
+ errorHandler()->setErrorHandlerToolBar(m_latexOutputErrorToolBar);
createAction(i18n("Return to Editor"), "return_to_editor", "document-edit", \
KShortcut("CTRL+E"), this, SLOT(showEditorWidget())); createAction(i18n("Next \
Document"), "gotoNextDocument", "go-next-view-page", KShortcut(Qt::ALT + \
Qt::Key_Right), viewManager(), SLOT(gotoNextView())); @@ -1931,8 +1912,7 @@ void \
Kile::initMenu() // build
<< "quickpreview_selection" << "quickpreview_environment"
<< "quickpreview_subdocument" << "quickpreview_math"
- << "WatchFile" << "ViewLog" << "PreviousError" << "NextError" << \
"PreviousWarning"
- << "NextWarning" << "PreviousBadBox" << "NextBadBox" << "CleanAll"
+ << "WatchFile" << "CleanAll"
// latex
<< "tag_documentclass" << "tag_usepackage" << "tag_amspackages" << \
"tag_env_document"
<< "tag_author" << "tag_title" << "tag_maketitle" << "tag_titlepage" << \
"tag_env_abstract" @@ -2146,7 +2126,7 @@ void Kile::cleanAll(KileDocument::TextInfo \
*docinfo) docinfo = docManager()->textInfoFor(doc);
}
else {
- m_logWidget->printMessage(KileTool::Error, noactivedoc, i18n("Clean"));
+ errorHandler()->printMessage(KileTool::Error, noactivedoc, i18n("Clean"));
return;
}
}
@@ -2163,11 +2143,11 @@ void Kile::refreshStructure()
void Kile::insertTag(const KileAction::TagData& data)
{
- logWidget()->clear();
+ errorHandler()->clearMessages();
if(data.description.length() > 0) {
focusLog();
- logWidget()->printMessage(data.description);
+ errorHandler()->printMessage(data.description);
}
KTextEditor::View *view = viewManager()->currentTextView();
@@ -2226,10 +2206,10 @@ void Kile::insertTag(const KileAction::TagData& data,const \
QStringList &pkgs)
if(warnPkgs.count() > 0) {
if(warnPkgs.count() == 1) {
- m_logWidget->printMessage(KileTool::Error, i18n("You have to include the \
package %1.", warnPkgs.join(",")), i18n("Insert text")); + \
errorHandler()->printMessage(KileTool::Error, i18n("You have to include the package \
%1.", warnPkgs.join(",")), i18n("Insert text")); }
else {
- m_logWidget->printMessage(KileTool::Error, i18n("You have to include the \
packages %1.", warnPkgs.join(",")), i18n("Insert text")); \
+ errorHandler()->printMessage(KileTool::Error, i18n("You have to include the \
packages %1.", warnPkgs.join(",")), i18n("Insert text")); }
}
}
@@ -2351,7 +2331,7 @@ void Kile::quickPostscript()
texfilename = getCompileName();
}
- KileDialog::PostscriptDialog *dlg = new KileDialog::PostscriptDialog(this, \
texfilename, startdir, m_extensions->latexDocuments(), m_logWidget, m_outputWidget); \
+ KileDialog::PostscriptDialog *dlg = new KileDialog::PostscriptDialog(this, \
texfilename, startdir, m_extensions->latexDocuments(), errorHandler(), \
m_outputWidget); dlg->exec();
delete dlg;
}
@@ -2367,7 +2347,7 @@ void Kile::quickPdf()
texFileName = getCompileName();
}
- KileDialog::PdfDialog *dlg = new KileDialog::PdfDialog(m_mainWindow, texFileName, \
startDir, m_extensions->latexDocuments(), m_manager, m_logWidget, m_outputWidget); \
+ KileDialog::PdfDialog *dlg = new KileDialog::PdfDialog(m_mainWindow, texFileName, \
startDir, m_extensions->latexDocuments(), m_manager, errorHandler(), m_outputWidget); \
dlg->exec(); delete dlg;
}
@@ -2410,7 +2390,7 @@ void Kile::helpLaTex()
QString loc = KGlobal::dirs()->findResource("appdata","help/latexhelp.html");
KileTool::Base *tool = toolManager()->createTool("ViewHTML", QString(), false);
if(!tool) {
- m_logWidget->printMessage(KileTool::Error, i18n("Could not create the \"ViewHTML\" \
tool. Please reset the tools.")); + errorHandler()->printMessage(KileTool::Error, \
i18n("Could not create the \"ViewHTML\" tool. Please reset the tools.")); return;
}
tool->setFlags(KileTool::NeedSourceExists | KileTool::NeedSourceRead);
@@ -2936,12 +2916,12 @@ void Kile::citeViewBib()
remoteApps = client->registeredApplications();
if( !remoteApps.contains(viewBibApp) )
{
- m_logWidget->printMessage(KileTool::Warning,
+ errorHandler()->printMessage(KileTool::Warning,
i18n("No ViewBib tool running, trying to start it now"),
i18n("ViewBib Citation"));
uint ret = runWith("ViewBib","KBib");
if( ret == 0 )
- m_logWidget->printMessage(KileTool::Info,
+ errorHandler()->printMessage(KileTool::Info,
i18n("Please select the desired bibliographies and re-execute this command"),
i18n("ViewBib Citation"));
return;
@@ -2950,7 +2930,7 @@ void Kile::citeViewBib()
remoteObjs = client->remoteObjects(viewBibApp);
if( !remoteObjs.contains(viewBibObj) )
{
- m_logWidget->printMessage(KileTool::Warning,
+ errorHandler()->printMessage(KileTool::Warning,
i18n("The ViewBib tool does not have the correct interface"),
i18n("ViewBib Citation"));
return;
@@ -2959,7 +2939,7 @@ void Kile::citeViewBib()
functions = client->remoteFunctions(viewBibApp,viewBibObj);
if( !functions.contains(viewBibFncDef) )
{
- m_logWidget->printMessage(KileTool::Warning,
+ errorHandler()->printMessage(KileTool::Warning,
i18n("The ViewBib tool does not have the correct definition of the cite \
function"), i18n("ViewBib Citation"));
return;
@@ -2980,7 +2960,7 @@ void Kile::citeViewBib()
if (result.isEmpty())
{
- m_logWidget->printMessage(KileTool::Warning,
+ errorHandler()->printMessage(KileTool::Warning,
i18n("No reference selected.\nPlease select a reference first!"),
i18n("ViewBib Citation"));
}
diff --git a/src/kile.h b/src/kile.h
index 3d2d208..dc6ed97 100644
--- a/src/kile.h
+++ b/src/kile.h
@@ -97,7 +97,7 @@ class Kile : public KParts::MainWindow, public KileInfo
Q_OBJECT
public:
- explicit Kile(bool allowRestore = true, QWidget *parent = 0, const char *name = 0);
+ explicit Kile(bool allowRestore = true, QWidget *parent = NULL);
~Kile();
int lineNumber();
diff --git a/src/kiledocmanager.cpp b/src/kiledocmanager.cpp
index 01091f4..bc9aaaa 100644
--- a/src/kiledocmanager.cpp
+++ b/src/kiledocmanager.cpp
@@ -47,6 +47,7 @@
#include <kurl.h>
#include <kfileitem.h>
+#include "errorhandler.h"
#include "templates.h"
#include "dialogs/newfilewizard.h"
#include "dialogs/managetemplatesdialog.h"
@@ -66,7 +67,6 @@
#include "kiletoolmanager.h"
#include "widgets/konsolewidget.h"
#include "kileconfig.h"
-#include "widgets/logwidget.h"
#include "widgets/progressdialog.h"
#include "dialogs/cleandialog.h"
#include "livepreview.h"
@@ -924,9 +924,9 @@ bool Manager::fileSaveAll(bool amAutoSaving, bool disUntitled)
}
else {
KILE_DEBUG() << "backing up failed (" << url.prettyUrl() << " -> " << \
backupUrl.prettyUrl() << ")";
- m_ki->logWidget()->printMessage(KileTool::Error,
- i18n("The file %1 could not be saved, check \
the permissions and free disk space.", backupUrl.prettyUrl()),
- i18n("Autosave"));
+ m_ki->errorHandler()->printMessage(KileTool::Error,
+ i18n("The file %1 could not be saved, check \
the permissions and free disk space.", backupUrl.prettyUrl()), + \
i18n("Autosave")); }
}
@@ -936,9 +936,9 @@ bool Manager::fileSaveAll(bool amAutoSaving, bool disUntitled)
if(!saveResult) {
oneSaveFailed = true;
- m_ki->logWidget()->printMessage(KileTool::Error,
- i18n("Kile encountered problems while saving \
the file %1. Do you have enough free disk space left?", \
url.prettyUrl()),
- i18n("Saving"));
+ m_ki->errorHandler()->printMessage(KileTool::Error,
+ i18n("Kile encountered problems while saving \
the file %1. Do you have enough free disk space left?", url.prettyUrl()), + \
i18n("Saving")); }
}
}
@@ -1448,16 +1448,16 @@ void Manager::addToProject(KileProject* project, const KUrl & \
url) QFileInfo fi(realurl.toLocalFile());
if (project->contains(realurl)) {
- m_ki->logWidget()->printMessage(KileTool::Info,
- i18n("The file %1 is already member of the project \
%2", realurl.fileName(), project->name()),
- i18n("Add to Project"));
+ m_ki->errorHandler()->printMessage(KileTool::Info,
+ i18n("The file %1 is already member of the \
project %2", realurl.fileName(), project->name()), + \
i18n("Add to Project")); return;
}
else if(!fi.exists() || !fi.isReadable())
{
- m_ki->logWidget()->printMessage(KileTool::Info,
- i18n("The file %1 can not be added because it does \
not exist or is not readable", realurl.fileName()),
- i18n("Add to Project"));
+ m_ki->errorHandler()->printMessage(KileTool::Info,
+ i18n("The file %1 can not be added because it \
does not exist or is not readable", realurl.fileName()), + \
i18n("Add to Project")); return;
}
@@ -1955,8 +1955,8 @@ void Manager::cleanUpTempFiles(const KUrl &url, bool silent)
}
if(extlist.count() == 0) {
- m_ki->logWidget()->printMessage(KileTool::Warning, i18n("Nothing to clean for %1", \
fileName),
- i18n("Clean"));
+ m_ki->errorHandler()->printMessage(KileTool::Warning, i18n("Nothing to clean for \
%1", fileName), + \
i18n("Clean")); }
else {
for(int i = 0; i < extlist.count(); ++i) {
@@ -1964,9 +1964,9 @@ void Manager::cleanUpTempFiles(const KUrl &url, bool silent)
KILE_DEBUG() << "About to remove file = " << file.fileName();
file.remove();
}
- m_ki->logWidget()->printMessage(KileTool::Info,
- i18n("Cleaning %1: %2", fileName, extlist.join(" \
")),
- i18n("Clean"));
+ m_ki->errorHandler()->printMessage(KileTool::Info,
+ i18n("Cleaning %1: %2", fileName, \
extlist.join(" ")), + i18n("Clean"));
}
}
@@ -2194,9 +2194,9 @@ QStringList Manager::getProjectFiles()
void Manager::dontOpenWarning(KileProjectItem *item, const QString &action, const \
QString &filetype) {
- m_ki->logWidget()->printMessage(KileTool::Info,
- i18n("not opened: %1 (%2)", \
item->url().toLocalFile(), filetype),
- action);
+ m_ki->errorHandler()->printMessage(KileTool::Info,
+ i18n("not opened: %1 (%2)", \
item->url().toLocalFile(), filetype), + action);
}
KileProjectItem* Manager::selectProjectFileItem(const QString &label)
diff --git a/src/kileerrorhandler.cpp b/src/kileerrorhandler.cpp
deleted file mode 100644
index bd8713c..0000000
--- a/src/kileerrorhandler.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/*************************************************************************
- begin : Tue May 25 2004
- Copyright (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)
- 2008-2011 by Michel Ludwig (michel.ludwig@kdemail.net)
- *************************************************************************/
-
-/***************************************************************************
- * *
- * 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. *
- * *
- ***************************************************************************/
-
-#include "kileerrorhandler.h"
-
-#include <QFileInfo>
-#include <QHash>
-#include <QRegExp>
-
-#include <KLocale>
-#include <KUrl>
-#include <KTabWidget>
-#include <KTextEditor/Document>
-#include <KTextEditor/View>
-
-#include "kiletool_enums.h"
-#include "widgets/logwidget.h"
-#include "widgets/outputview.h"
-#include "kileinfo.h"
-#include "outputinfo.h"
-#include "kiledocmanager.h"
-#include "widgets/sidebar.h"
-
-KileErrorHandler::KileErrorHandler(QObject *parent, KileInfo *info, const char \
*name)
- : QObject(parent), m_ki(info), m_nCurrentError(-1)
-{
- setObjectName(name);
-}
-
-
-KileErrorHandler::~KileErrorHandler()
-{
-}
-
-
-void KileErrorHandler::reset()
-{
- m_nCurrentError = -1;
- m_mostRecentLogFile.clear();
- m_mostRecentLaTeXOutputInfoList.clear();
-}
-
-void KileErrorHandler::setMostRecentLogInformation(const QString& logFile, const \
LatexOutputInfoArray& outputInfoList)
-{
- m_mostRecentLogFile = logFile;
- m_mostRecentLaTeXOutputInfoList = outputInfoList;
- // and add them to the log widget
- displayProblemsInLogWidget(outputInfoList);
-}
-
-void KileErrorHandler::displayProblemsInLogWidget(const LatexOutputInfoArray& \
infoList)
-{
- QString message;
- int type;
-
- //print detailed error info
- m_ki->logWidget()->setUpdatesEnabled(false);
-
- for(QList<LatexOutputInfo>::const_iterator i = infoList.begin();
- i != infoList.end(); ++i) {
-
- const LatexOutputInfo& info = *i;
- message = info.source() + ':' + QString::number(info.sourceLine()) + ':' + \
info.message();
- switch(info.type()) {
- case LatexOutputInfo::itmBadBox:
- type = KileTool::ProblemBadBox;
- break;
- case LatexOutputInfo::itmError:
- type = KileTool::ProblemError;
- break;
- case LatexOutputInfo::itmWarning:
- type = KileTool::ProblemWarning;
- break;
- default:
- type = KileTool::Info;
- break;
- }
- KileWidget::LogWidget::ProblemInformation problem;
- problem.type = type;
- problem.message = message;
- problem.outputInfo = info;
- m_ki->logWidget()->printMessage(type, message, QString(), info, false, false);
- }
-
- m_ki->logWidget()->setUpdatesEnabled(true);
- m_ki->logWidget()->scrollToBottom();
-
-}
-
-void KileErrorHandler::ViewLog()
-{
- KileWidget::LogWidget *logWidget = m_ki->logWidget();
- m_ki->focusLog();
-
- QFile logFile(m_mostRecentLogFile);
- if(!m_mostRecentLogFile.isEmpty() && logFile.open(QIODevice::ReadOnly | \
QIODevice::Text)) {
- QHash<int, OutputInfo> hash;
-
- for(QList<LatexOutputInfo>::iterator i = m_mostRecentLaTeXOutputInfoList.begin();
- i != m_mostRecentLaTeXOutputInfoList.end(); \
++i) {
- LatexOutputInfo info = *i;
- hash[info.outputLine()] = info;
- }
-
- QTextStream textStream(&logFile);
-
- for(int lineNumber = 0; !textStream.atEnd(); ++lineNumber) {
- int type = -1;
- const QString line = textStream.readLine();
- if(hash.find(lineNumber) != hash.end()) {
- switch(hash[lineNumber].type()) {
- case LatexOutputInfo::itmError:
- type = KileTool::Error;
- break;
- case LatexOutputInfo::itmWarning:
- type = KileTool::Warning;
- break;
- case LatexOutputInfo::itmBadBox:
- type = KileTool::ProblemBadBox;
- break;
- }
- }
- // don't scroll to the item as this will lead to severely degraded performance
- logWidget->printMessage(type, line, QString(), hash[lineNumber], true, false);
- }
-
- logWidget->scrollToBottom();
- }
- else {
- logWidget->printProblem(KileTool::Error, i18n("Cannot open log file; did you run \
LaTeX?"));
- }
-}
-
-void KileErrorHandler::jumpToFirstError()
-{
- int sz = m_mostRecentLaTeXOutputInfoList.size();
- for(int i = 0; i < sz; ++i) {
- if(m_mostRecentLaTeXOutputInfoList[i].type() == LatexOutputInfo::itmError) {
- jumpToProblem(m_mostRecentLaTeXOutputInfoList[i]);
- m_nCurrentError = i;
- break;
- }
- }
-}
-
-void KileErrorHandler::jumpToProblem(const OutputInfo& info)
-{
- QString file = m_ki->getFullFromPrettyName(info, info.source());
-
- if(!file.isEmpty()) {
- m_ki->docManager()->fileOpen(KUrl(file));
- int line = (info.sourceLine() > 0) ? (info.sourceLine() - 1) : 0;
-
- KTextEditor::Document *doc = m_ki->docManager()->docFor(KUrl(file));
- if(doc) {
- KTextEditor::View* view = doc->views().first();
- if(view) {
- view->setCursorPosition(KTextEditor::Cursor(line, 0));
- }
- }
- }
-}
-
-void KileErrorHandler::jumpToProblem(int type, bool forward)
-{
- // 'm_mostRecentLogFile' is only nonempty when output information has been
- // provided
- const bool outputInformationPresent = !m_mostRecentLogFile.isEmpty();
-
- if (!m_mostRecentLaTeXOutputInfoList.isEmpty()) {
- int sz = m_mostRecentLaTeXOutputInfoList.size();
- int pl = forward ? 1 : -1;
- bool found = false;
-
- //look for next problem of requested type
- for(int i = 0; i < sz; ++i) {
- //always look at the whole outputInfo array, but start
- //at the problem adjacent to the current error
- //if we go beyond the bounds of the array we use
- //a simple "modulo" calculation to get within bounds again
- int index = (m_nCurrentError + (i + 1) *pl) % sz;
- while(index < 0) {
- index += sz;
- }
-
- if(m_mostRecentLaTeXOutputInfoList[index].type() == type) {
- m_nCurrentError = index;
- found = true;
- break;
- }
- }
-
- if(!found) {
- return;
- }
-
- //If the log file is being viewed, use this to jump to the errors,
- //otherwise, use the error summary display
- m_ki->logWidget()->highlight(m_mostRecentLaTeXOutputInfoList[m_nCurrentError]);
-
- jumpToProblem(m_mostRecentLaTeXOutputInfoList[m_nCurrentError]);
- }
-
- if(m_mostRecentLaTeXOutputInfoList.isEmpty() && outputInformationPresent) {
- m_ki->logWidget()->printMessage(i18n("No LaTeX warnings/errors detected."));
- }
-}
-
-void KileErrorHandler::NextError()
-{
- jumpToProblem(LatexOutputInfo::itmError, true);
-}
-
-void KileErrorHandler::PreviousError()
-{
- jumpToProblem(LatexOutputInfo::itmError, false);
-}
-
-void KileErrorHandler::NextWarning()
-{
- jumpToProblem(LatexOutputInfo::itmWarning, true);
-}
-
-void KileErrorHandler::PreviousWarning()
-{
- jumpToProblem(LatexOutputInfo::itmWarning, false);
-}
-
-void KileErrorHandler::NextBadBox()
-{
- jumpToProblem(LatexOutputInfo::itmBadBox, true);
-}
-
-void KileErrorHandler::PreviousBadBox()
-{
- jumpToProblem(LatexOutputInfo::itmBadBox, false);
-}
-
-#include "kileerrorhandler.moc"
diff --git a/src/kileerrorhandler.h b/src/kileerrorhandler.h
deleted file mode 100644
index ec97132..0000000
--- a/src/kileerrorhandler.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************
- begin : Tue May 25 2004
- Copyright (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)
- 2011 by Michel Ludwig (michel.ludwig@kdemail.net)
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * 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 KILEERRORHANDLER_H
-#define KILEERRORHANDLER_H
-
-#include <QObject>
-
-#include "outputinfo.h"
-
-class KileInfo;
-class OutputInfo;
-
-class KileErrorHandler : public QObject
-{
- Q_OBJECT
-public:
- KileErrorHandler(QObject *parent, KileInfo *info, const char *name = NULL);
-
- ~KileErrorHandler();
-
- void setMostRecentLogInformation(const QString& logFile, const \
LatexOutputInfoArray& outputInfoList);
-
-/* log view, error handling */
-private Q_SLOTS:
- void ViewLog();
- void NextError();
- void PreviousError();
- void NextWarning();
- void PreviousWarning();
- void NextBadBox();
- void PreviousBadBox();
-
-private:
- void jumpToProblem(int type, bool);
-
-public Q_SLOTS:
- void jumpToFirstError();
- void jumpToProblem(const OutputInfo& info);
- void reset();
-
-private:
- KileInfo *m_ki;
- int m_nCurrentError;
- QString m_mostRecentLogFile;
- LatexOutputInfoArray m_mostRecentLaTeXOutputInfoList;
-
- void displayProblemsInLogWidget(const LatexOutputInfoArray& infoList);
-};
-
-#endif
diff --git a/src/kilehelp.cpp b/src/kilehelp.cpp
index 34c79c0..734de57 100644
--- a/src/kilehelp.cpp
+++ b/src/kilehelp.cpp
@@ -1,6 +1,5 @@
/**********************************************************************************************
- begin : 2004
- copyright : (C) 2004-2012 by Holger Danielsson (holger.danielsson@versanet.de)
+ Copyright (C) 2004-2012 by Holger Danielsson (holger.danielsson@versanet.de)
**********************************************************************************************/
/***************************************************************************
@@ -19,13 +18,14 @@
#include <KGlobal>
#include <KStandardDirs>
+#include "editorextension.h"
+#include "errorhandler.h"
#include "kilehelp.h"
#include "kiledebug.h"
#include "kiletool_enums.h"
#include "kiletoolmanager.h"
#include "kileviewmanager.h"
#include "kileinfo.h"
-#include "widgets/logwidget.h"
#include "dialogs/texdocumentationdialog.h"
#include "kileconfig.h"
@@ -322,7 +322,7 @@ namespace KileHelp
void Help::noHelpAvailableFor(const QString &word)
{
- m_manager->info()->logWidget()->printMessage(KileTool::Error, i18n("No help \
available for %1.", word), i18n("Help")); \
+ m_manager->info()->errorHandler()->printMessage(KileTool::Error, i18n("No help \
available for %1.", word), i18n("Help")); }
QString Help::getKeyword(KTextEditor::View *view)
diff --git a/src/kileinfo.cpp b/src/kileinfo.cpp
index e13321e..4da02ad 100644
--- a/src/kileinfo.cpp
+++ b/src/kileinfo.cpp
@@ -95,20 +95,30 @@ QString KileInfo::getName(KTextEditor::Document *doc, bool shrt)
return title;
}
-QString KileInfo::getCompileName(bool shrt /* = false */)
+QString KileInfo::getCompileName(bool shrt /* = false */, LaTeXOutputHandler** h /* \
= NULL */) {
KileProject *project = docManager()->activeProject();
if (m_singlemode) {
if (project) {
+ if(h) {
+ *h = project;
+ }
return getCompileNameForProject(project, shrt);
}
else {
- return getName(activeTextDocument(), shrt);
+ KTextEditor::Document *doc = activeTextDocument();
+ if(h) {
+ *h = dynamic_cast<KileDocument::LaTeXInfo*>(m_docManager->textInfoFor(doc));
+ }
+ return getName(doc, shrt);
}
}
else {
QFileInfo fi(m_masterDocumentFileName);
+ if(h) {
+ *h = dynamic_cast<KileDocument::LaTeXInfo*>(m_docManager->textInfoFor(m_masterDocumentFileName));
+ }
if(shrt) {
return fi.fileName();
}
diff --git a/src/kileinfo.h b/src/kileinfo.h
index b182b4d..3656749 100644
--- a/src/kileinfo.h
+++ b/src/kileinfo.h
@@ -73,7 +73,7 @@ public:
QString getName(KTextEditor::Document *doc = NULL, bool shrt = false);
QString getShortName(KTextEditor::Document *doc = NULL) { return getName(doc, \
true); } QString getCompileNameForProject(KileProject *project, bool shrt = false);
- QString getCompileName(bool shrt = false);
+ QString getCompileName(bool shrt = false, LaTeXOutputHandler** h = NULL);
QString getFullFromPrettyName(const OutputInfo& info, const QString& name);
KUrl::List getParentsFor(KileDocument::Info *);
bool getSinglemode() { return m_singlemode; }
@@ -124,7 +124,6 @@ public:
KileWidget::Konsole *texKonsole() { return m_texKonsole; }
KileWidget::OutputView *outputWidget() { return m_outputWidget; }
KileWidget::BottomBar *outputView() { return m_bottomBar; }
- KileWidget::LogWidget *logWidget() { return m_logWidget; }
KileWidget::PreviewWidget *previewWidget () { return m_previewWidget; }
KileConfiguration::Manager* configurationManager() const { return \
m_configurationManager; } @@ -172,7 +171,6 @@ protected:
KileTool::Factory *m_toolFactory;
KileWidget::Konsole *m_texKonsole;
KileWidget::OutputView *m_outputWidget;
- KileWidget::LogWidget *m_logWidget;
KileWidget::ScriptsManagement *m_scriptsManagementWidget;
KileWidget::BottomBar *m_bottomBar;
KileWidget::PreviewWidget *m_previewWidget;
diff --git a/src/kileproject.h b/src/kileproject.h
index 38dd4dc..e77035a 100644
--- a/src/kileproject.h
+++ b/src/kileproject.h
@@ -19,13 +19,14 @@
#include <QList>
#include <QRegExp>
-#include "kiledebug.h"
-#include "livepreview_utils.h"
-
#include <KConfig>
#include <KUrl>
#include <KTextEditor/View>
+#include "kiledebug.h"
+#include "livepreview_utils.h"
+#include "outputinfo.h"
+
class QString;
class QStringList;
namespace KileDocument { class Info; class TextInfo; class Extensions; }
@@ -147,7 +148,7 @@ private:
/**
* KileProject
**/
-class KileProject : public QObject, public KileTool::LivePreviewUserStatusHandler
+class KileProject : public QObject, public KileTool::LivePreviewUserStatusHandler, \
public LaTeXOutputHandler {
Q_OBJECT
friend class KileProjectItem;
diff --git a/src/kilestdtools.cpp b/src/kilestdtools.cpp
index f814362..0c6e5f0 100644
--- a/src/kilestdtools.cpp
+++ b/src/kilestdtools.cpp
@@ -131,7 +131,8 @@ namespace KileTool
/////////////// LaTeX ////////////////
- LaTeX::LaTeX(const QString& tool, Manager *mngr, bool prepare) : Compile(tool, \
mngr, prepare) + LaTeX::LaTeX(const QString& tool, Manager *mngr, bool prepare)
+ : Compile(tool, mngr, prepare), m_latexOutputHandler(NULL)
{
}
@@ -139,6 +140,44 @@ namespace KileTool
{
}
+ void LaTeX::setupAsChildTool(KileTool::Base *child)
+ {
+ KileTool::LaTeX *latexChild = dynamic_cast<KileTool::LaTeX*>(child);
+ if(latexChild) {
+ latexChild->setLaTeXOutputHandler(latexOutputHandler());
+ }
+ }
+
+ LaTeXOutputHandler* LaTeX::latexOutputHandler()
+ {
+ return m_latexOutputHandler;
+ }
+
+ void LaTeX::setLaTeXOutputHandler(LaTeXOutputHandler *h)
+ {
+ m_latexOutputHandler = h;
+ }
+
+ bool LaTeX::determineSource()
+ {
+ QString src = source();
+
+ // check whether the source has been set already
+ if(!src.isEmpty()) {
+ return true;
+ }
+
+ //the basedir is determined from the current compile target
+ //determined by getCompileName()
+ LaTeXOutputHandler *h = NULL;
+ src = m_ki->getCompileName(false, &h);
+
+ setSource(src);
+ setLaTeXOutputHandler(h);
+
+ return true;
+ }
+
int LaTeX::m_reRun = 0;
// FIXME don't hardcode bbl and ind suffix here.
@@ -199,6 +238,11 @@ namespace KileTool
{
KILE_DEBUG();
+ if(m_latexOutputHandler) {
+ m_latexOutputHandler->storeLaTeXOutputParserResult(m_nErrors, m_nWarnings, \
m_nBadBoxes, m_latexOutputInfoList, + \
m_logFile); + }
+
checkErrors();
if(readEntry("autoRun") == "yes") {
diff --git a/src/kilestdtools.h b/src/kilestdtools.h
index 3e9b9a5..769e8ca 100644
--- a/src/kilestdtools.h
+++ b/src/kilestdtools.h
@@ -59,6 +59,11 @@ namespace KileTool
public:
virtual ~LaTeX();
+ void setupAsChildTool(KileTool::Base *child);
+
+ LaTeXOutputHandler* latexOutputHandler();
+ void setLaTeXOutputHandler(LaTeXOutputHandler *h);
+
Q_SIGNALS:
void jumpToFirstError();
@@ -66,6 +71,10 @@ namespace KileTool
bool finish(int);
protected:
+ LaTeXOutputHandler *m_latexOutputHandler;
+
+ virtual bool determineSource();
+
void checkErrors();
void checkAutoRun();
void latexOutputParserResultInstalled();
diff --git a/src/kiletool.cpp b/src/kiletool.cpp
index 5dcca50..4e2fe8d 100644
--- a/src/kiletool.cpp
+++ b/src/kiletool.cpp
@@ -487,12 +487,14 @@ namespace KileTool
}
}
- void Base::installLaTeXOutputParserResult(int nErrors, int nWarnings, int \
nBadBoxes, const LatexOutputInfoArray& outputList) + void \
Base::installLaTeXOutputParserResult(int nErrors, int nWarnings, int nBadBoxes, const \
LatexOutputInfoArray& outputList, + \
const QString& logFile) {
m_nErrors = nErrors;
m_nWarnings = nWarnings;
m_nBadBoxes = nBadBoxes;
m_latexOutputInfoList = outputList;
+ m_logFile = logFile;
latexOutputParserResultInstalled();
}
@@ -518,42 +520,42 @@ namespace KileTool
bool Base::installLauncher()
{
- if (m_launcher)
+ if (m_launcher) {
return true;
+ }
QString type = readEntry("type");
KILE_DEBUG() << "installing launcher of type " << type;
- Launcher *lr = 0;
+ Launcher *lr = NULL;
- if ( type == "Process" )
- {
+ if ( type == "Process" ) {
lr = new ProcessLauncher();
}
- else if ( type == "Konsole" )
- {
+ else if ( type == "Konsole" ) {
lr = new KonsoleLauncher();
}
- else if ( type == "Part" )
- {
+ else if ( type == "Part" ) {
lr = new PartLauncher();
}
- else if ( type == "DocPart" )
- {
+ else if ( type == "DocPart" ) {
lr = new DocPartLauncher();
}
- if (lr)
- {
+ if (lr) {
installLauncher(lr);
return true;
}
- else
- {
- m_launcher = 0;
+ else {
+ m_launcher = NULL;
return false;
}
}
+ void Base::setupAsChildTool(KileTool::Base *child)
+ {
+ Q_UNUSED(child);
+ }
+
void Base::sendMessage(int type, const QString &msg)
{
emit(message(type, msg, name()));
diff --git a/src/kiletool.h b/src/kiletool.h
index b682547..2b6c035 100644
--- a/src/kiletool.h
+++ b/src/kiletool.h
@@ -192,6 +192,8 @@ namespace KileTool
void setMsg(long n, const KLocalizedString& msg);
KLocalizedString msg(long n) const { return m_messages[n]; }
+ virtual void setupAsChildTool(KileTool::Base *child);
+
public Q_SLOTS:
void sendMessage(int, const QString &);
virtual void filterOutput(const QString &);
@@ -214,7 +216,8 @@ namespace KileTool
**/
virtual bool finish(int);
- void installLaTeXOutputParserResult(int nErrors, int nWarnings, int nBadBoxes, \
const LatexOutputInfoArray& outputList); + void installLaTeXOutputParserResult(int \
nErrors, int nWarnings, int nBadBoxes, const LatexOutputInfoArray& outputList, + \
const QString& logFile);
Q_SIGNALS:
void message(int, const QString &, const QString &);
@@ -272,11 +275,12 @@ namespace KileTool
virtual void latexOutputParserResultInstalled();
- private:
+ protected:
Manager *m_manager;
KileInfo *m_ki;
KConfig *m_config;
+ private:
QString m_name;
QString m_target, m_basedir, m_relativedir, m_targetdir, m_source, m_S, \
m_workingDir; QString m_options;
@@ -301,9 +305,10 @@ namespace KileTool
QMap<long, KLocalizedString> m_messages;
protected:
- bool m_childToolSpawned;
int m_nErrors, m_nWarnings, m_nBadBoxes;
LatexOutputInfoArray m_latexOutputInfoList;
+ QString m_logFile;
+ bool m_childToolSpawned;
int m_toolResult;
};
diff --git a/src/kiletoolmanager.cpp b/src/kiletoolmanager.cpp
index 7cec268..d06e36f 100644
--- a/src/kiletoolmanager.cpp
+++ b/src/kiletoolmanager.cpp
@@ -24,6 +24,7 @@
#include <KMessageBox>
#include <KParts/PartManager>
+#include "errorhandler.h"
#include "kileconfig.h"
#include "kiledebug.h"
#include "kiledocmanager.h"
@@ -87,10 +88,9 @@ namespace KileTool
}
}
- Manager::Manager(KileInfo *ki, KConfig *config, KileWidget::LogWidget *log, \
KileWidget::OutputView *output, KParts::PartManager *manager, QStackedWidget *stack, \
KAction *stop, uint to) : + Manager::Manager(KileInfo *ki, KConfig *config, \
KileWidget::OutputView *output, KParts::PartManager *manager, QStackedWidget *stack, \
KAction *stop, uint to) : m_ki(ki),
m_config(config),
- m_log(log),
m_output(output),
m_pm(manager),
m_stack(stack),
@@ -101,6 +101,9 @@ namespace KileTool
{
connect(m_ki->parserManager(), SIGNAL(parsingComplete()), this, \
SLOT(handleParsingComplete()));
+ connect(this, SIGNAL(childToolSpawned(KileTool::Base*,KileTool::Base*)),
+ m_ki->errorHandler(), SLOT(handleSpawnedChildTool(KileTool::Base*, \
KileTool::Base*))); +
m_timer = new QTimer(this);
connect(m_timer, SIGNAL(timeout()), this, SLOT(enableClear()));
connect(stop, SIGNAL(triggered()), this, SLOT(stop()));
@@ -179,10 +182,15 @@ namespace KileTool
{
KILE_DEBUG() << "==KileTool::Manager::runImmediately(Base *)============" << endl;
if(m_bClear && (m_queue.count() == 0)) {
- m_log->clear();
+ m_ki->errorHandler()->clearMessages();
m_output->clear();
}
+ if(dynamic_cast<KileTool::LaTeX*>(tool)) {
+ connect(tool, SIGNAL(done(KileTool::Base*, int, bool)),
+ m_ki->errorHandler(), SLOT(handleLaTeXToolDone(KileTool::Base*, int, \
bool))); + }
+
if(tool->needsToBePrepared()) {
tool->prepareToRun();
}
@@ -217,6 +225,8 @@ namespace KileTool
int Manager::runChildNext(Base *parent, Base *tool, bool block /*= false*/)
{
+ parent->setupAsChildTool(tool);
+
return runImmediately(tool, true, block, parent);
}
@@ -224,8 +234,8 @@ namespace KileTool
{
Base *head = m_queue.tool();
if(head) {
- if (m_log->isShowingOutput()) {
- m_log->addEmptyLine();
+ if (m_ki->errorHandler()->areMessagesShown()) {
+ m_ki->errorHandler()->addEmptyLineToMessages();
}
if(!head->isPrepared()) {
@@ -243,7 +253,7 @@ namespace KileTool
return status;
}
- m_log->startToolLogOutput();
+ m_ki->errorHandler()->startToolLogOutput();
emit(toolStarted());
return Running;
@@ -254,14 +264,14 @@ namespace KileTool
Base* Manager::createTool(const QString& name, const QString &cfg, bool prepare)
{
- if (!m_factory) {
- m_log->printMessage(Error, i18n("No factory installed, contact the author of \
Kile.")); + if(!m_factory) {
+ m_ki->errorHandler()->printMessage(Error, i18n("No factory installed, contact the \
author of Kile.")); return NULL;
}
Base* pTool = m_factory->create(name, cfg, prepare);
- if (!pTool) {
- m_log->printMessage(Error, i18n("Unknown tool %1.", name));
+ if(!pTool) {
+ m_ki->errorHandler()->printMessage(Error, i18n("Unknown tool %1.", name));
return NULL;
}
initTool(pTool);
@@ -273,7 +283,7 @@ namespace KileTool
tool->setInfo(m_ki);
tool->setConfig(m_config);
- connect(tool, SIGNAL(message(int, const QString &, const QString &)), m_log, \
SLOT(printMessage(int, const QString &, const QString &))); + connect(tool, \
SIGNAL(message(int, const QString &, const QString &)), m_ki->errorHandler(), \
SLOT(printMessage(int, const QString &, const QString &))); connect(tool, \
SIGNAL(output(const QString &)), m_output, SLOT(receive(const QString &))); \
connect(tool, SIGNAL(done(KileTool::Base*,int,bool)), this, \
SLOT(done(KileTool::Base*, int))); connect(tool, SIGNAL(start(KileTool::Base*)), \
this, SLOT(started(KileTool::Base*))); @@ -326,7 +336,7 @@ namespace KileTool
setEnabledStopButton(false);
m_nLastResult = result;
- m_log->endToolLogOutput();
+ m_ki->errorHandler()->endToolLogOutput();
if(tool != m_queue.tool()) { //oops, tool finished async, could happen with view \
tools tool->deleteLater();
@@ -462,7 +472,7 @@ namespace KileTool
if(!retrieveEntryMap(tool->name(), map, true, true, cfg)) {
QString group = (cfg.isEmpty()) ? currentGroup(tool->name(), true, true) : \
groupFor(tool->name(), cfg);
- m_log->printMessage(Error, i18n("Cannot find the tool \"%1\" in the configuration \
database.", group)); + m_ki->errorHandler()->printMessage(Error, i18n("Cannot find \
the tool \"%1\" in the configuration database.", group)); return false;
}
diff --git a/src/kiletoolmanager.h b/src/kiletoolmanager.h
index d27ca60..86e2258 100644
--- a/src/kiletoolmanager.h
+++ b/src/kiletoolmanager.h
@@ -46,7 +46,7 @@ namespace KParts { class PartManager; }
class KileInfo;
namespace KileParser { class Manager; }
namespace KileView { class Manager; }
-namespace KileWidget { class LogWidget; class OutputView; }
+namespace KileWidget { class OutputView; }
typedef QPair<QString, QString> ToolConfigPair;
@@ -86,7 +86,7 @@ namespace KileTool
Q_OBJECT
public:
- Manager(KileInfo *ki, KConfig *config, KileWidget::LogWidget *log, \
KileWidget::OutputView *output, KParts::PartManager *, QStackedWidget* stack, KAction \
*, uint to); + Manager(KileInfo *ki, KConfig *config, KileWidget::OutputView \
*output, KParts::PartManager *, QStackedWidget* stack, KAction *, uint to); \
~Manager();
public:
@@ -155,7 +155,6 @@ namespace KileTool
private:
KileInfo *m_ki;
KConfig *m_config;
- KileWidget::LogWidget *m_log;
KileWidget::OutputView *m_output;
KParts::PartManager *m_pm;
QStackedWidget *m_stack;
diff --git a/src/livepreview.cpp b/src/livepreview.cpp
index 0c4f181..8ee928f 100644
--- a/src/livepreview.cpp
+++ b/src/livepreview.cpp
@@ -40,11 +40,11 @@
#include <okular/interfaces/viewerinterface.h>
#endif
+#include "errorhandler.h"
#include "kiledebug.h"
#include "kiletool_enums.h"
#include "kiledocmanager.h"
#include "kileviewmanager.h"
-#include "widgets/logwidget.h"
//TODO: it still has to be checked whether it is necessary to use LaTeXInfo objects
@@ -629,7 +629,8 @@ void LivePreviewManager::showPreviewOutOfDate()
// If a LaTeXInfo* pointer is passed as first argument, it is guaranteed that \
'*userStatusHandler' won't be NULL. LivePreviewManager::PreviewInformation* \
LivePreviewManager::findPreviewInformation(KileDocument::TextInfo \
*textInfo,
\
KileProject* *locatedProject,
- \
LivePreviewUserStatusHandler* *userStatusHandler) + \
LivePreviewUserStatusHandler* *userStatusHandler, + \
LaTeXOutputHandler* *latexOutputHandler) {
const QString masterDocumentFileName = m_ki->getMasterDocumentFileName();
if(locatedProject) {
@@ -637,12 +638,10 @@ LivePreviewManager::PreviewInformation* \
LivePreviewManager::findPreviewInformati }
KileDocument::LaTeXInfo *latexInfo = \
dynamic_cast<KileDocument::LaTeXInfo*>(textInfo); if(userStatusHandler) {
- if(latexInfo) {
- *userStatusHandler = latexInfo;
- }
- else {
- *userStatusHandler = NULL;
- }
+ *userStatusHandler = latexInfo;
+ }
+ if(latexOutputHandler) {
+ *latexOutputHandler = latexInfo;
}
if(!masterDocumentFileName.isEmpty()) {
KILE_DEBUG() << "master document defined";
@@ -657,6 +656,9 @@ LivePreviewManager::PreviewInformation* \
LivePreviewManager::findPreviewInformati if(userStatusHandler) {
*userStatusHandler = project;
}
+ if(latexOutputHandler) {
+ *latexOutputHandler = project;
+ }
if(m_projectToPreviewInformationHash.contains(project)) {
KILE_DEBUG() << "project found";
return m_projectToPreviewInformationHash[project];
@@ -891,8 +893,10 @@ void LivePreviewManager::compilePreview(KileDocument::LaTeXInfo \
*latexInfo, KTex
KileProject *project = NULL;
LivePreviewUserStatusHandler *userStatusHandler;
- PreviewInformation *previewInformation = findPreviewInformation(latexInfo, \
&project, &userStatusHandler); + LaTeXOutputHandler *latexOutputHandler;
+ PreviewInformation *previewInformation = findPreviewInformation(latexInfo, \
&project, &userStatusHandler, &latexOutputHandler); Q_ASSERT(userStatusHandler);
+ Q_ASSERT(latexOutputHandler);
if(!previewInformation) {
previewInformation = new PreviewInformation();
if(!m_ki->getMasterDocumentFileName().isEmpty()) {
@@ -995,7 +999,8 @@ void LivePreviewManager::compilePreview(KileDocument::LaTeXInfo \
*latexInfo, KTex
latex->setTargetDir(previewInformation->getTempDir());
latex->setSource(fileInfo.absoluteFilePath(), fileInfo.absolutePath());
-// latex->setTargetDir(previewInformation->getTempDir());
+ latex->setLaTeXOutputHandler(latexOutputHandler);
+
latex->prepareToRun();
// latex->launcher()->setWorkingDirectory(previewInformation->getTempDir());
KILE_DEBUG() << "dir:" << previewInformation->getTempDir();
@@ -1331,9 +1336,9 @@ void \
LivePreviewManager::updatePreviewInformationAfterCompilationFinished() void \
LivePreviewManager::displayErrorMessage(const QString &text, bool clearFirst) {
if(clearFirst) {
- m_ki->logWidget()->clear();
+ m_ki->errorHandler()->clearMessages();
}
- m_ki->logWidget()->printMessage(KileTool::Error, text, i18n("LivePreview"));
+ m_ki->errorHandler()->printMessage(KileTool::Error, text, i18n("LivePreview"));
}
}
diff --git a/src/livepreview.h b/src/livepreview.h
index 597648c..03662da 100644
--- a/src/livepreview.h
+++ b/src/livepreview.h
@@ -141,7 +141,8 @@ private:
QLinkedList<KAction*> m_livePreviewToolActionList;
PreviewInformation* findPreviewInformation(KileDocument::TextInfo *textInfo, \
KileProject* *locatedProject = NULL,
- \
LivePreviewUserStatusHandler* *userStatusHandler = NULL); + \
LivePreviewUserStatusHandler* *userStatusHandler = NULL, + \
LaTeXOutputHandler* *latexOutputHandler = NULL); bool \
isCurrentDocumentOrProject(KTextEditor::Document *doc);
void updatePreviewInformationAfterCompilationFinished();
diff --git a/src/outputinfo.cpp b/src/outputinfo.cpp
index 69a9027..8d18adc 100644
--- a/src/outputinfo.cpp
+++ b/src/outputinfo.cpp
@@ -1,7 +1,6 @@
/************************************************************************************
- begin : Die Sep 16 2003
- copyright : (C) 2003 by Jeroen Wijnhout (wijnhout@science.uva.nl)
- 2008-2011 by Michel Ludwig \
(michel.ludwig@kdemail.net) + Copyright (C) 2003 by Jeroen Wijnhout \
(wijnhout@science.uva.nl) + 2008-2012 by Michel Ludwig \
(michel.ludwig@kdemail.net)
************************************************************************************/
/***************************************************************************
@@ -68,3 +67,55 @@ LatexOutputInfo::LatexOutputInfo(const QString& mainSourceFile, \
const QString& s : OutputInfo(mainSourceFile, strSrcFile, nSrcLine, nOutputLine, \
strError, nErrorID) {
}
+
+LaTeXOutputHandler::LaTeXOutputHandler()
+: m_nErrors(-1), m_nWarnings(-1), m_nBadBoxes(-1), m_currentError(-1)
+{
+}
+
+void LaTeXOutputHandler::storeLaTeXOutputParserResult(int nErrors, int nWarnings, \
int nBadBoxes, + \
const LatexOutputInfoArray& outputList, + \
const QString& logFile) +{
+ m_nErrors = nErrors;
+ m_nWarnings = nWarnings;
+ m_nBadBoxes = nBadBoxes;
+ m_latexOutputInfoList = outputList;
+ m_logFile = logFile;
+ m_currentError = -1;
+}
+
+int LaTeXOutputHandler::numberOfWarnings() const
+{
+ return m_nWarnings;
+}
+
+int LaTeXOutputHandler::numberOfErrors() const
+{
+ return m_nErrors;
+}
+
+int LaTeXOutputHandler::numberOfBadBoxes() const
+{
+ return m_nBadBoxes;
+}
+
+LatexOutputInfoArray LaTeXOutputHandler::outputList() const
+{
+ return m_latexOutputInfoList;
+}
+
+QString LaTeXOutputHandler::logFile() const
+{
+ return m_logFile;
+}
+
+int LaTeXOutputHandler::currentError() const
+{
+ return m_currentError;
+}
+
+void LaTeXOutputHandler::setCurrentError(int i)
+{
+ m_currentError = i;
+}
diff --git a/src/outputinfo.h b/src/outputinfo.h
index c1dc531..096c708 100644
--- a/src/outputinfo.h
+++ b/src/outputinfo.h
@@ -1,7 +1,6 @@
/**************************************************************************************
- begin : Die Sep 16 2003
- copyright : (C) 2003 by Jeroen Wijnhout (wijnhout@science.uva.nl)
- 2008-2011 by Michel Ludwig \
(michel.ludwig@kdemail.net) + Copyright (C) 2003 by Jeroen Wijnhout \
(wijnhout@science.uva.nl) + 2008-2012 by Michel Ludwig \
(michel.ludwig@kdemail.net)
**************************************************************************************/
/***************************************************************************
@@ -127,4 +126,27 @@ class LatexOutputInfo : public OutputInfo
**/
typedef QList<LatexOutputInfo> LatexOutputInfoArray;
+class LaTeXOutputHandler
+{
+ public:
+ LaTeXOutputHandler();
+
+ void storeLaTeXOutputParserResult(int nErrors, int nWarnings, int nBadBoxes,
+ const \
LatexOutputInfoArray& outputList, + \
const QString& logFile); +
+ int numberOfWarnings() const;
+ int numberOfErrors() const;
+ int numberOfBadBoxes() const;
+ LatexOutputInfoArray outputList() const;
+ QString logFile() const;
+ int currentError() const;
+ void setCurrentError(int i);
+
+ protected:
+ int m_nErrors, m_nWarnings, m_nBadBoxes, m_currentError;
+ LatexOutputInfoArray m_latexOutputInfoList;
+ QString m_logFile;
+};
+
#endif
diff --git a/src/parser/parsermanager.cpp b/src/parser/parsermanager.cpp
index 92c8671..e421e49 100644
--- a/src/parser/parsermanager.cpp
+++ b/src/parser/parsermanager.cpp
@@ -1,5 +1,5 @@
/**************************************************************************
-* Copyright (C) 2011 by Michel Ludwig (michel.ludwig@kdemail.net) *
+* Copyright (C) 2011-2012 by Michel Ludwig (michel.ludwig@kdemail.net) *
***************************************************************************/
/***************************************************************************
@@ -14,8 +14,8 @@
#include "parsermanager.h"
#include "documentinfo.h"
+#include "errorhandler.h"
#include "kiledocmanager.h"
-#include "kileerrorhandler.h"
#include "kileinfo.h"
#include "kiletool_enums.h"
#include "latexoutputparser.h"
@@ -95,7 +95,7 @@ void Manager::handleOutputParsingComplete(const KUrl& url, \
KileParser::ParserOut return; // have been killed and we do nothing
}
if(!latexOutput->problem.isEmpty()) {
- m_ki->logWidget()->printProblem(KileTool::Warning, latexOutput->problem);
+ m_ki->errorHandler()->printProblem(KileTool::Warning, latexOutput->problem);
return;
}
// use the returned list as the new global error information list
@@ -104,7 +104,8 @@ void Manager::handleOutputParsingComplete(const KUrl& url, \
KileParser::ParserOut Q_FOREACH(KileTool::Base *tool, toolList) {
tool->installLaTeXOutputParserResult(latexOutput->nErrors, latexOutput->nWarnings,
latexOutput->nBadBoxes,
- latexOutput->infoList);
+ latexOutput->infoList,
+ latexOutput->logFile);
}
}
diff --git a/src/quickpreview.cpp b/src/quickpreview.cpp
index 83822ee..47b2345 100644
--- a/src/quickpreview.cpp
+++ b/src/quickpreview.cpp
@@ -1,8 +1,6 @@
/**************************************************************************************************
- date : Feb 15 2007
- version : 0.34
- copyright : (C) 2005-2007 by Holger Danielsson \
(holger.danielsson@versanet.de)
- 2007-2009 by Michel Ludwig \
(michel.ludwig@kdemail.net) + Copyright (C) 2005-2007 by Holger Danielsson \
(holger.danielsson@versanet.de) + 2007-2009 by Michel Ludwig \
(michel.ludwig@kdemail.net)
**************************************************************************************************/
/***************************************************************************
@@ -31,8 +29,10 @@
#include <KTextEditor/Document>
#include <KTextEditor/View>
+#include "errorhandler.h"
#include "kiledebug.h"
+
namespace KileTool
{
@@ -189,7 +189,7 @@ bool QuickPreview::run(const QString &text,const QString \
&textfilename,int start bool QuickPreview::run(const QString &text,const QString \
&textfilename,int startrow,const QString &spreviewlist) {
KILE_DEBUG() << "==QuickPreview::run()==========================" << endl;
- m_ki->logWidget()->clear();
+ m_ki->errorHandler()->clearMessages();
if(m_running > 0) {
showError( i18n("There is already a preview running that has to be finished to run \
this one.") ); return false;
@@ -376,7 +376,7 @@ int QuickPreview::createTempfile(const QString &text)
void QuickPreview::showError(const QString &text)
{
- m_ki->logWidget()->printMessage(KileTool::Error, text, i18n("QuickPreview"));
+ m_ki->errorHandler()->printMessage(KileTool::Error, text, i18n("QuickPreview"));
}
}
diff --git a/src/widgets/codecompletionconfigwidget.cpp \
b/src/widgets/codecompletionconfigwidget.cpp index 4904dfc..22c54fe 100644
--- a/src/widgets/codecompletionconfigwidget.cpp
+++ b/src/widgets/codecompletionconfigwidget.cpp
@@ -38,14 +38,14 @@
#include <KTabWidget>
#include "codecompletion.h"
+#include "errorhandler.h"
#include "kilelistselector.h"
#include "kileconfig.h"
#include "kiledebug.h"
-#include "widgets/logwidget.h"
#include "kiletool_enums.h"
-CodeCompletionConfigWidget::CodeCompletionConfigWidget(KConfig *config, \
KileWidget::LogWidget *logwidget, QWidget *parent, const char *name)
- : QWidget(parent), m_config(config), m_logwidget(logwidget), \
m_configChanged(false) \
+CodeCompletionConfigWidget::CodeCompletionConfigWidget(KConfig *config, \
KileErrorHandler *errorHandler, QWidget *parent, const char *name) + : \
QWidget(parent), m_config(config), m_errorHandler(errorHandler), \
m_configChanged(false) {
setObjectName(name);
setupUi(this);
@@ -279,7 +279,7 @@ QTreeWidgetItem* \
CodeCompletionConfigWidget::getListviewEntry(QTreeWidget *listv }
else {
if (items.count() > 1) {
- m_logwidget->printMessage(KileTool::Info, i18n("Wordlist '%1' contains duplicate \
entries.", filename), i18n("Completion")); \
+ m_errorHandler->printMessage(KileTool::Info, i18n("Wordlist '%1' contains \
duplicate entries.", filename), i18n("Completion")); }
return items.first();
}
diff --git a/src/widgets/codecompletionconfigwidget.h \
b/src/widgets/codecompletionconfigwidget.h index 8f68647..ad40167 100644
--- a/src/widgets/codecompletionconfigwidget.h
+++ b/src/widgets/codecompletionconfigwidget.h
@@ -31,16 +31,13 @@ class KPushButton;
class KTabWidget;
class KDirWatch;
-
-namespace KileWidget {
-class LogWidget;
-}
+class KileErrorHandler;
class CodeCompletionConfigWidget : public QWidget, public \
Ui::KileWidgetCodeCompletionConfig {
Q_OBJECT
public:
- CodeCompletionConfigWidget(KConfig *config, KileWidget::LogWidget *logwidget, \
QWidget *parent = NULL, const char *name = NULL); \
+ CodeCompletionConfigWidget(KConfig *config, KileErrorHandler *errorHandler, \
QWidget *parent = NULL, const char *name = NULL); ~CodeCompletionConfigWidget();
void readConfig(void);
@@ -50,7 +47,7 @@ class CodeCompletionConfigWidget : public QWidget, public \
Ui::KileWidgetCodeComp enum CompletionPage { TexPage = 0, DictionaryPage = 1, \
AbbreviationPage = 2, NumPages = 3 };
KConfig *m_config;
- KileWidget::LogWidget *m_logwidget;
+ KileErrorHandler *m_errorHandler;
// tabs, views, pages, wordlists
QTreeWidget *m_listview[NumPages];
diff --git a/src/widgets/logwidget.cpp b/src/widgets/logwidget.cpp
index 63a6806..ccc2b2f 100644
--- a/src/widgets/logwidget.cpp
+++ b/src/widgets/logwidget.cpp
@@ -1,7 +1,6 @@
/**************************************************************************************
- begin : Sat Dec 20 2003
- copyright : (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)
- 2008-2010 by Michel Ludwig \
(michel.ludwig@kdemail.net) + Copyright (C) 2003 by Jeroen Wijnhout \
(Jeroen.Wijnhout@kdemail.net) + 2008-2012 by Michel Ludwig \
(michel.ludwig@kdemail.net)
**************************************************************************************/
/***************************************************************************
@@ -97,9 +96,8 @@ namespace KileWidget
return textDocument;
}
- LogWidget::LogWidget(KileInfo *info, QWidget *parent, const char *name) :
- KListWidget(parent),
- m_info(info)
+ LogWidget::LogWidget(PopupType popupType, QWidget *parent, const char *name) :
+ KListWidget(parent), m_popupType(popupType)
{
setObjectName(name);
connect(this, SIGNAL(itemClicked(QListWidgetItem*)),
@@ -360,19 +358,22 @@ namespace KileWidget
}
popup.addAction(action);
- popup.addSeparator();
- action = new QAction(i18n("Hide &Bad Boxes"), &popup);
- action->setCheckable(true);
- action->setChecked(KileConfig::hideProblemBadBox());
- connect(action, SIGNAL(triggered()), this, SLOT(toggleBadBoxHiding()));
- popup.addAction(action);
+ if(!(m_popupType & NoHideActions)) {
+ popup.addSeparator();
- action = new QAction(i18n("Hide (La)TeX &Warnings"), &popup);
- action->setCheckable(true);
- action->setChecked(KileConfig::hideProblemWarning());
- connect(action, SIGNAL(triggered()), this, SLOT(toggleWarningsHiding()));
- popup.addAction(action);
+ action = new QAction(i18n("Hide &Bad Boxes"), &popup);
+ action->setCheckable(true);
+ action->setChecked(KileConfig::hideProblemBadBox());
+ connect(action, SIGNAL(triggered()), this, SLOT(toggleBadBoxHiding()));
+ popup.addAction(action);
+
+ action = new QAction(i18n("Hide (La)TeX &Warnings"), &popup);
+ action->setCheckable(true);
+ action->setChecked(KileConfig::hideProblemWarning());
+ connect(action, SIGNAL(triggered()), this, SLOT(toggleWarningsHiding()));
+ popup.addAction(action);
+ }
popup.exec(event->globalPos());
}
diff --git a/src/widgets/logwidget.h b/src/widgets/logwidget.h
index d437167..36cc57c 100644
--- a/src/widgets/logwidget.h
+++ b/src/widgets/logwidget.h
@@ -1,7 +1,6 @@
/*************************************************************************************
- begin : Sat Dec 20 2003
- copyright : (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)
- 2008-2010 by Michel Ludwig \
(michel.ludwig@kdemail.net) + Copyright (C) 2003 by Jeroen Wijnhout \
(Jeroen.Wijnhout@kdemail.net) + 2008-2012 by Michel Ludwig \
(michel.ludwig@kdemail.net)
*************************************************************************************/
/***************************************************************************
@@ -58,8 +57,10 @@ namespace KileWidget {
QString message;
OutputInfo outputInfo;
};
-
- LogWidget(KileInfo *info, QWidget *parent, const char *name = NULL);
+
+ enum PopupType { AllPopupActions = 0, NoHideActions = 1};
+
+ LogWidget(PopupType popupType = AllPopupActions, QWidget *parent = NULL, const \
char *name = NULL); ~LogWidget();
bool isShowingOutput() const;
@@ -107,7 +108,7 @@ namespace KileWidget {
void toggleWarningsHiding();
private:
- KileInfo *m_info;
+ int m_popupType;
int m_idWarning, m_idBadBox;
LogWidgetItemDelegate *m_itemDelegate;
OutputInfo m_firstErrorMessgeInToolLog;
diff --git a/src/widgets/previewwidget.cpp b/src/widgets/previewwidget.cpp
index 3ee1d65..385d586 100644
--- a/src/widgets/previewwidget.cpp
+++ b/src/widgets/previewwidget.cpp
@@ -32,11 +32,11 @@
#include <KLocale>
-#include "kileconfig.h"
#include "editorextension.h"
+#include "errorhandler.h"
+#include "kileconfig.h"
#include "kileinfo.h"
#include "kileviewmanager.h"
-#include "widgets/logwidget.h"
#include "kiletool.h"
#include "kiletool_enums.h"
#include "quickpreview.h"
@@ -124,7 +124,7 @@ PreviewWidget::~PreviewWidget()
void PreviewWidget::showActivePreview(const QString &text,const QString \
&textfilename,int startrow,int previewtype) {
KILE_DEBUG() << "==PreviewWidget::showActivePreview()==========================";
- m_info->logWidget()->clear();
+ m_info->errorHandler()->clearMessages();
if(m_running || m_info->quickPreview()->isRunning()) {
showError( i18n("There is already a preview running that has to be finished to run \
this one.") ); return;
@@ -235,7 +235,7 @@ void PreviewWidget::toolDestroyed()
void PreviewWidget::showError(const QString &text)
{
- m_info->logWidget()->printMessage(KileTool::Error, text, i18n("QuickPreview"));
+ m_info->errorHandler()->printMessage(KileTool::Error, text, i18n("QuickPreview"));
}
}
diff --git a/src/widgets/structurewidget.cpp b/src/widgets/structurewidget.cpp
index 637b629..8cbb61b 100644
--- a/src/widgets/structurewidget.cpp
+++ b/src/widgets/structurewidget.cpp
@@ -1,8 +1,7 @@
/*************************************************************************************************
- begin : Sun Dec 28 2003
- copyright : (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net
- 2005-2007 by Holger Danielsson \
(holger.danielsson@versanet.de)
- 2008-2011 by Michel Ludwig \
(michel.ludwig@kdemail.net) + Copyright (C) 2003 by Jeroen Wijnhout \
(Jeroen.Wijnhout@kdemail.net + 2005-2007 by Holger Danielsson \
(holger.danielsson@versanet.de) + 2008-2012 by Michel Ludwig \
(michel.ludwig@kdemail.net)
*************************************************************************************************/
/***************************************************************************
@@ -72,15 +71,15 @@
#include <KRun>
#include <KUrl>
-#include "parser/parsermanager.h"
-
+#include "documentinfo.h"
+#include "errorhandler.h"
#include "kileconfig.h"
#include "kiledebug.h"
#include "kiledocmanager.h"
#include "kileinfo.h"
-#include "documentinfo.h"
#include "kileproject.h"
#include "kiletool_enums.h"
+#include "parser/parsermanager.h"
#include "widgets/logwidget.h"
namespace KileWidget
@@ -681,7 +680,7 @@ void StructureViewItem::setLabel(const QString &label)
fromProject = false;
}
- m_ki->logWidget()->printMessage(KileTool::Info,
+ m_ki->errorHandler()->printMessage(KileTool::Info,
(fromProject ?
i18n("No extension specified for graphic file. Using .%1 from Project \
settings.", extToAdd) :
i18n("No extension specified for graphic file. Using .%1 from global \
Structure View settings.", extToAdd)),
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic