From f73e3b358edb2a1eb31ccc4b944d56f057a563f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Sun, 29 Nov 2009 17:15:22 +0000 Subject: [PATCH] * Include bibtex and makeindex logs to log file dialog. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32230 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiLog.cpp | 52 +++++++++++++-- src/frontends/qt4/GuiLog.h | 2 + src/frontends/qt4/ui/LogUi.ui | 118 +++++++++++++++++++++------------- 3 files changed, 119 insertions(+), 53 deletions(-) diff --git a/src/frontends/qt4/GuiLog.cpp b/src/frontends/qt4/GuiLog.cpp index 138aeeff21..320b977316 100644 --- a/src/frontends/qt4/GuiLog.cpp +++ b/src/frontends/qt4/GuiLog.cpp @@ -19,6 +19,7 @@ #include "Lexer.h" #include "support/docstring.h" +#include "support/FileName.h" #include "support/gettext.h" #include @@ -117,6 +118,8 @@ GuiLog::GuiLog(GuiView & lv) connect(findPB, SIGNAL(clicked()), this, SLOT(find())); // FIXME: find via returnPressed() does not work! connect(findLE, SIGNAL(returnPressed()), this, SLOT(find())); + connect(logTypeCO, SIGNAL(activated(int)), + this, SLOT(typeChanged(int))); bc().setPolicy(ButtonPolicy::OkCancelPolicy); @@ -146,6 +149,25 @@ void GuiLog::updateContents() } +void GuiLog::typeChanged(int i) +{ + string const type = + fromqstr(logTypeCO->itemData(i).toString()); + string ext; + if (type == "latex") + ext = "log"; + else if (type == "bibtex") + ext = "blg"; + else if (type == "index") + ext = "ilg"; + + if (!ext.empty()) + logfile_.changeExtension(ext); + + updateContents(); +} + + void GuiLog::find() { logTB->find(findLE->text()); @@ -194,19 +216,35 @@ bool GuiLog::initialiseParams(string const & data) // Parsing of the data failed. return false; - if (logtype == "latex") + logTypeCO->setEnabled(logtype == "latex"); + logTypeCO->clear(); + + FileName log(logfile); + + if (logtype == "latex") { type_ = LatexLog; + logTypeCO->addItem(qt_("LaTeX"), toqstr(logtype)); + FileName tmp = log; + tmp.changeExtension("blg"); + if (tmp.exists()) + logTypeCO->addItem(qt_("BibTeX"), QString("bibtex")); + tmp.changeExtension("ilg"); + if (tmp.exists()) + logTypeCO->addItem(qt_("Index"), QString("index")); // FIXME: not sure "literate" still works. - else if (logtype == "literate") + } else if (logtype == "literate") { type_ = LiterateLog; - else if (logtype == "lyx2lyx") + logTypeCO->addItem(qt_("Literate"), toqstr(logtype)); + } else if (logtype == "lyx2lyx") { type_ = Lyx2lyxLog; - else if (logtype == "vc") + logTypeCO->addItem(qt_("LyX2LyX"), toqstr(logtype)); + } else if (logtype == "vc") { type_ = VCLog; - else + logTypeCO->addItem(qt_("Version Control"), toqstr(logtype)); + } else return false; - logfile_ = FileName(logfile); + logfile_ = log; updateContents(); @@ -256,7 +294,7 @@ void GuiLog::getContents(ostream & ss) const switch (type_) { case LatexLog: - ss << to_utf8(_("No LaTeX log file found.")); + ss << to_utf8(_("Log file not found.")); break; case LiterateLog: ss << to_utf8(_("No literate programming build log file found.")); diff --git a/src/frontends/qt4/GuiLog.h b/src/frontends/qt4/GuiLog.h index e8bdbb901b..2a9ebb6e7a 100644 --- a/src/frontends/qt4/GuiLog.h +++ b/src/frontends/qt4/GuiLog.h @@ -41,6 +41,8 @@ private Q_SLOTS: void on_nextErrorPB_clicked(); /// jump to next warning void on_nextWarningPB_clicked(); + /// Log type changed + void typeChanged(int); private: /// Apply changes diff --git a/src/frontends/qt4/ui/LogUi.ui b/src/frontends/qt4/ui/LogUi.ui index d26abb0080..ddf6ebcd39 100644 --- a/src/frontends/qt4/ui/LogUi.ui +++ b/src/frontends/qt4/ui/LogUi.ui @@ -6,7 +6,7 @@ 0 0 421 - 441 + 474 @@ -22,14 +22,7 @@ 6 - - - - Hit Enter to search, or click Go! - - - - + &Find: @@ -39,57 +32,63 @@ - - - - - + + - Jump to the next error message. - - - Next &Error + Hit Enter to search, or click Go! - - - - Jump to the next warning message. - + + - Next &Warning + Log &Type: + + + logTypeCO - - - - &Go! - - - - + Qt::Horizontal - 201 + 161 20 - - + + + + + + + + + + Update the display + - Copy to Clip&board + &Update + + + true - + + + + &Close + + + + Qt::Horizontal @@ -105,23 +104,50 @@ - - + + - &Close + Copy to Clip&board - - + + + + Qt::Horizontal + + + + 201 + 20 + + + + + + + + &Go! + + + + + - Update the display + Jump to the next warning message. - &Update + Next &Warning - - true + + + + + + Jump to the next error message. + + + Next &Error