GuiLog: show also log files of additional indices

This commit is contained in:
Juergen Spitzmueller 2024-07-26 18:48:31 +02:00
parent d4f58c96b5
commit b6d3066ad2
2 changed files with 41 additions and 4 deletions

View File

@ -24,6 +24,9 @@
#include "support/Lexer.h" #include "support/Lexer.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "BufferParams.h"
#include "IndicesList.h"
#include <QTextBrowser> #include <QTextBrowser>
#include <QSyntaxHighlighter> #include <QSyntaxHighlighter>
#include <QClipboard> #include <QClipboard>
@ -167,11 +170,16 @@ void GuiLog::typeChanged(int i)
ext = "log"; ext = "log";
else if (type == "bibtex") else if (type == "bibtex")
ext = "blg"; ext = "blg";
else if (type == "index") else if (prefixIs(type, "index"))
ext = "ilg"; ext = "ilg";
if (!ext.empty()) if (ext == "ilg" && type != "index")
logfile_.changeExtension(ext); real_logfile_ = FileName(split(type, ':'));
else {
real_logfile_ = logfile_;
if (!ext.empty())
real_logfile_.changeExtension(ext);
}
updateContents(); updateContents();
} }
@ -250,6 +258,30 @@ bool GuiLog::initialiseParams(string const & sdata)
tmp.changeExtension("ilg"); tmp.changeExtension("ilg");
if (tmp.exists()) if (tmp.exists())
logTypeCO->addItem(qt_("Index"), QString("index")); logTypeCO->addItem(qt_("Index"), QString("index"));
// Generate ebtries for each index with multiple indexes.
string const tmppath = tmp.onlyPath().absFileName();
IndicesList const & indiceslist = buffer().params().indiceslist();
if (!indiceslist.empty()) {
IndicesList::const_iterator it = indiceslist.begin();
IndicesList::const_iterator const end = indiceslist.end();
for (; it != end; ++it) {
docstring const & ci = it->shortcut();
if (ci == "idx")
continue;
// splitidx: <filename>-<shortcut>.ilg
FileName stmp(tmppath + "/" + tmp.onlyFileNameWithoutExt()
+ "-" + to_ascii(ci) + ".ilg");
if (!stmp.exists()) {
// memoir: <shortcut>.ilg
stmp = FileName(tmppath + "/" + to_ascii(ci) + ".ilg");
if (!stmp.exists())
continue;
}
Index const * index = indiceslist.findShortcut(ci);
string const name = to_utf8(index->index());
logTypeCO->addItem(qt_(name), toqstr("index:" + stmp.absFileName()));
}
}
// FIXME: not sure "literate" still works. // FIXME: not sure "literate" still works.
} else if (logtype == "literate") { } else if (logtype == "literate") {
type_ = LiterateLog; type_ = LiterateLog;
@ -264,6 +296,7 @@ bool GuiLog::initialiseParams(string const & sdata)
return false; return false;
logfile_ = log; logfile_ = log;
real_logfile_ = log;
updateContents(); updateContents();
@ -274,6 +307,7 @@ bool GuiLog::initialiseParams(string const & sdata)
void GuiLog::clearParams() void GuiLog::clearParams()
{ {
logfile_.erase(); logfile_.erase();
real_logfile_.erase();
} }
@ -296,7 +330,7 @@ docstring GuiLog::title() const
void GuiLog::getContents(ostream & ss) const void GuiLog::getContents(ostream & ss) const
{ {
ifstream in(logfile_.toFilesystemEncoding().c_str()); ifstream in(real_logfile_.toFilesystemEncoding().c_str());
bool success = false; bool success = false;

View File

@ -81,7 +81,10 @@ private:
}; };
LogType type_; LogType type_;
/// The log as input by params
support::FileName logfile_; support::FileName logfile_;
/// The log file to display
support::FileName real_logfile_;
}; };