mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-14 01:22:33 +00:00
* GuiLog.{cpp,h}:
* LogUi.ui: - add some basic navigation facilities. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@30426 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cfeab7476f
commit
28988d22bc
@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
* \author John Levon
|
* \author John Levon
|
||||||
* \author Angus Leeming
|
* \author Angus Leeming
|
||||||
|
* \author Jürgen Spitzmüller
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
@ -33,6 +34,16 @@ using namespace lyx::support;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
|
|
||||||
|
// Regular expressions needed at several places
|
||||||
|
// Information
|
||||||
|
QRegExp exprInfo("^(Document Class:|LaTeX Font Info:|File:|Package:|Language:|Underfull|Overfull|\\(|\\\\).*$");
|
||||||
|
// Warnings
|
||||||
|
QRegExp exprWarning("^LaTeX Warning.*$");
|
||||||
|
// Errors
|
||||||
|
QRegExp exprError("^!.*$");
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// LogHighlighter
|
// LogHighlighter
|
||||||
@ -67,7 +78,6 @@ LogHighlighter::LogHighlighter(QTextDocument * parent)
|
|||||||
void LogHighlighter::highlightBlock(QString const & text)
|
void LogHighlighter::highlightBlock(QString const & text)
|
||||||
{
|
{
|
||||||
// Info
|
// Info
|
||||||
QRegExp exprInfo("^(Document Class:|LaTeX Font Info:|File:|Package:|Language:|Underfull|Overfull|\\(|\\\\).*$");
|
|
||||||
int index = exprInfo.indexIn(text);
|
int index = exprInfo.indexIn(text);
|
||||||
while (index >= 0) {
|
while (index >= 0) {
|
||||||
int length = exprInfo.matchedLength();
|
int length = exprInfo.matchedLength();
|
||||||
@ -75,7 +85,6 @@ void LogHighlighter::highlightBlock(QString const & text)
|
|||||||
index = exprInfo.indexIn(text, index + length);
|
index = exprInfo.indexIn(text, index + length);
|
||||||
}
|
}
|
||||||
// LaTeX Warning:
|
// LaTeX Warning:
|
||||||
QRegExp exprWarning("^LaTeX Warning.*$");
|
|
||||||
index = exprWarning.indexIn(text);
|
index = exprWarning.indexIn(text);
|
||||||
while (index >= 0) {
|
while (index >= 0) {
|
||||||
int length = exprWarning.matchedLength();
|
int length = exprWarning.matchedLength();
|
||||||
@ -83,7 +92,6 @@ void LogHighlighter::highlightBlock(QString const & text)
|
|||||||
index = exprWarning.indexIn(text, index + length);
|
index = exprWarning.indexIn(text, index + length);
|
||||||
}
|
}
|
||||||
// ! error
|
// ! error
|
||||||
QRegExp exprError("^!.*$");
|
|
||||||
index = exprError.indexIn(text);
|
index = exprError.indexIn(text);
|
||||||
while (index >= 0) {
|
while (index >= 0) {
|
||||||
int length = exprError.matchedLength();
|
int length = exprError.matchedLength();
|
||||||
@ -106,6 +114,9 @@ GuiLog::GuiLog(GuiView & lv)
|
|||||||
|
|
||||||
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
||||||
connect(updatePB, SIGNAL(clicked()), this, SLOT(updateContents()));
|
connect(updatePB, SIGNAL(clicked()), this, SLOT(updateContents()));
|
||||||
|
connect(findPB, SIGNAL(clicked()), this, SLOT(find()));
|
||||||
|
// FIXME: find via returnPressed() does not work!
|
||||||
|
connect(findLE, SIGNAL(returnPressed()), this, SLOT(find()));
|
||||||
|
|
||||||
bc().setPolicy(ButtonPolicy::OkCancelPolicy);
|
bc().setPolicy(ButtonPolicy::OkCancelPolicy);
|
||||||
|
|
||||||
@ -129,6 +140,41 @@ void GuiLog::updateContents()
|
|||||||
getContents(ss);
|
getContents(ss);
|
||||||
|
|
||||||
logTB->setPlainText(toqstr(ss.str()));
|
logTB->setPlainText(toqstr(ss.str()));
|
||||||
|
|
||||||
|
nextErrorPB->setEnabled(contains(exprError));
|
||||||
|
nextWarningPB->setEnabled(contains(exprWarning));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiLog::find()
|
||||||
|
{
|
||||||
|
logTB->find(findLE->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiLog::on_nextErrorPB_clicked()
|
||||||
|
{
|
||||||
|
goTo(exprError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiLog::on_nextWarningPB_clicked()
|
||||||
|
{
|
||||||
|
goTo(exprWarning);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiLog::goTo(QRegExp const & exp) const
|
||||||
|
{
|
||||||
|
QTextCursor const newc =
|
||||||
|
logTB->document()->find(exp, logTB->textCursor());
|
||||||
|
logTB->setTextCursor(newc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GuiLog::contains(QRegExp const & exp) const
|
||||||
|
{
|
||||||
|
return !logTB->document()->find(exp, logTB->textCursor()).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,8 +33,14 @@ public:
|
|||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void updateContents();
|
void updateContents();
|
||||||
// copy log to clipboard
|
/// copy log to clipboard
|
||||||
void on_copyPB_clicked();
|
void on_copyPB_clicked();
|
||||||
|
/// find content
|
||||||
|
void find();
|
||||||
|
/// jump to next error message
|
||||||
|
void on_nextErrorPB_clicked();
|
||||||
|
/// jump to next warning
|
||||||
|
void on_nextWarningPB_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Apply changes
|
/// Apply changes
|
||||||
@ -58,6 +64,10 @@ private:
|
|||||||
docstring title() const;
|
docstring title() const;
|
||||||
/// put the log file into the ostream
|
/// put the log file into the ostream
|
||||||
void getContents(std::ostream & ss) const;
|
void getContents(std::ostream & ss) const;
|
||||||
|
/// go to the next occurence of the RegExp
|
||||||
|
void goTo(QRegExp const & exp) const;
|
||||||
|
/// does the document after cursor position contain the RegExp?
|
||||||
|
bool contains(QRegExp const & exp) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Recognized log file-types
|
/// Recognized log file-types
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
<ui version="4.0" >
|
<ui version="4.0" >
|
||||||
<author></author>
|
|
||||||
<comment></comment>
|
|
||||||
<exportmacro></exportmacro>
|
|
||||||
<class>LogUi</class>
|
<class>LogUi</class>
|
||||||
<widget class="QDialog" name="LogUi" >
|
<widget class="QDialog" name="LogUi" >
|
||||||
<property name="geometry" >
|
<property name="geometry" >
|
||||||
@ -9,7 +6,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>421</width>
|
<width>421</width>
|
||||||
<height>359</height>
|
<height>441</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
@ -25,14 +22,27 @@
|
|||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0" >
|
<item row="3" column="3" colspan="2" >
|
||||||
<widget class="QPushButton" name="copyPB" >
|
<widget class="QPushButton" name="updatePB" >
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Update the display</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Copy to Clip&board</string>
|
<string>&Update</string>
|
||||||
|
</property>
|
||||||
|
<property name="default" >
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="3" column="5" >
|
||||||
|
<widget class="QPushButton" name="closePB" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Close</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" colspan="2" >
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -48,32 +58,75 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3" >
|
<item row="3" column="0" >
|
||||||
<widget class="QPushButton" name="closePB" >
|
<widget class="QPushButton" name="copyPB" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>&Close</string>
|
<string>Copy to Clip&board</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" >
|
<item row="1" column="0" colspan="2" >
|
||||||
<widget class="QPushButton" name="updatePB" >
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>201</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="5" >
|
||||||
|
<widget class="QPushButton" name="findPB" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Go!</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="4" >
|
||||||
|
<widget class="QLineEdit" name="findLE" >
|
||||||
<property name="toolTip" >
|
<property name="toolTip" >
|
||||||
<string>Update the display</string>
|
<string>Enter search string, hit return or thr "Go!" button.</string>
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>&Update</string>
|
|
||||||
</property>
|
|
||||||
<property name="default" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" colspan="4" >
|
<item row="2" column="0" >
|
||||||
|
<widget class="QLabel" name="findLA" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Find:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy" >
|
||||||
|
<cstring>findLE</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4" colspan="2" >
|
||||||
|
<widget class="QPushButton" name="nextWarningPB" >
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Jump to the next warning message.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Next &Warning</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" colspan="2" >
|
||||||
|
<widget class="QPushButton" name="nextErrorPB" >
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Jump to the next error message.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Next &Error</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="6" >
|
||||||
<widget class="QTextBrowser" name="logTB" />
|
<widget class="QTextBrowser" name="logTB" />
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<pixmapfunction></pixmapfunction>
|
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>logTB</tabstop>
|
<tabstop>logTB</tabstop>
|
||||||
<tabstop>copyPB</tabstop>
|
<tabstop>copyPB</tabstop>
|
||||||
|
@ -52,6 +52,8 @@ What's new
|
|||||||
to begin/end of insets (and outside of the inset if the cursor is already
|
to begin/end of insets (and outside of the inset if the cursor is already
|
||||||
in place). There are also versions that select text.
|
in place). There are also versions that select text.
|
||||||
|
|
||||||
|
- The LaTeX Log File dialog has a search facility.
|
||||||
|
|
||||||
- Notes context menu has a new item for toggling all notes.
|
- Notes context menu has a new item for toggling all notes.
|
||||||
|
|
||||||
- Math context menu has a new item for numbering a single line in a formula.
|
- Math context menu has a new item for numbering a single line in a formula.
|
||||||
|
Loading…
Reference in New Issue
Block a user