mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
Add Pavel's lyxerr extension, add ui for debug levels.
Still needs some fiddling with line endings. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32670 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
248f47f06a
commit
12efe108db
@ -5,6 +5,7 @@
|
|||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
* \author Peter Kümmel
|
* \author Peter Kümmel
|
||||||
|
* \author Pavel Sanda
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
@ -47,6 +48,7 @@ GuiProgress::GuiProgress(GuiView * view) : view_(view)
|
|||||||
connect(this, SIGNAL(appendMessage(QString const &)), SLOT(doAppendMessage(QString const &)));
|
connect(this, SIGNAL(appendMessage(QString const &)), SLOT(doAppendMessage(QString const &)));
|
||||||
connect(this, SIGNAL(appendError(QString const &)), SLOT(doAppendError(QString const &)));
|
connect(this, SIGNAL(appendError(QString const &)), SLOT(doAppendError(QString const &)));
|
||||||
connect(this, SIGNAL(clearMessages()), SLOT(doClearMessages()));
|
connect(this, SIGNAL(clearMessages()), SLOT(doClearMessages()));
|
||||||
|
connect(this, SIGNAL(lyxerrFlush()), SLOT(dolyxerrFlush()));
|
||||||
|
|
||||||
// Alert interface
|
// Alert interface
|
||||||
connect(this, SIGNAL(warning(QString const &, QString const &)),
|
connect(this, SIGNAL(warning(QString const &, QString const &)),
|
||||||
@ -78,14 +80,13 @@ void GuiProgress::doProcessFinished(QString const & cmd)
|
|||||||
|
|
||||||
void GuiProgress::doAppendMessage(QString const & msg)
|
void GuiProgress::doAppendMessage(QString const & msg)
|
||||||
{
|
{
|
||||||
appendText(msg);
|
appendText(msg + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiProgress::doAppendError(QString const & msg)
|
void GuiProgress::doAppendError(QString const & msg)
|
||||||
{
|
{
|
||||||
QString time = QTime::currentTime().toString();
|
appendText(msg);
|
||||||
appendText(time + " : " + msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -95,6 +96,31 @@ void GuiProgress::doClearMessages()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiProgress::dolyxerrFlush()
|
||||||
|
{
|
||||||
|
appendError(toqstr(lyxerr_stream_.str()));
|
||||||
|
lyxerr_stream_.str("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiProgress::lyxerrConnect()
|
||||||
|
{
|
||||||
|
lyxerr.setSecond(&lyxerr_stream_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiProgress::lyxerrDisconnect()
|
||||||
|
{
|
||||||
|
lyxerr.setSecond(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GuiProgress::~GuiProgress()
|
||||||
|
{
|
||||||
|
lyxerrDisconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiProgress::appendText(QString const & text)
|
void GuiProgress::appendText(QString const & text)
|
||||||
{
|
{
|
||||||
if (!text.isEmpty())
|
if (!text.isEmpty())
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
* \author Peter Kümmel
|
* \author Peter Kümmel
|
||||||
|
* \author Pavel Sanda
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
@ -20,7 +21,7 @@
|
|||||||
#include <QSplashScreen>
|
#include <QSplashScreen>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include <string>
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
@ -35,7 +36,10 @@ class GuiProgress :
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
GuiProgress(GuiView * view);
|
GuiProgress(GuiView * view);
|
||||||
|
~GuiProgress();
|
||||||
|
|
||||||
|
void lyxerrConnect();
|
||||||
|
void lyxerrDisconnect();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void processStarted(QString const &);
|
void processStarted(QString const &);
|
||||||
@ -43,6 +47,7 @@ Q_SIGNALS:
|
|||||||
void appendMessage(QString const &);
|
void appendMessage(QString const &);
|
||||||
void appendError(QString const &);
|
void appendError(QString const &);
|
||||||
void clearMessages();
|
void clearMessages();
|
||||||
|
void lyxerrFlush();
|
||||||
|
|
||||||
// Alert interface
|
// Alert interface
|
||||||
void warning(QString const & title, QString const & message);
|
void warning(QString const & title, QString const & message);
|
||||||
@ -56,6 +61,7 @@ private Q_SLOTS:
|
|||||||
void doAppendMessage(QString const &);
|
void doAppendMessage(QString const &);
|
||||||
void doAppendError(QString const &);
|
void doAppendError(QString const &);
|
||||||
void doClearMessages();
|
void doClearMessages();
|
||||||
|
void dolyxerrFlush();
|
||||||
|
|
||||||
|
|
||||||
void doWarning(QString const &, QString const &);
|
void doWarning(QString const &, QString const &);
|
||||||
@ -67,6 +73,7 @@ private Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
GuiView* view_;
|
GuiView* view_;
|
||||||
void appendText(QString const &);
|
void appendText(QString const &);
|
||||||
|
std::ostringstream lyxerr_stream_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
* \author Peter Kümmel
|
* \author Peter Kümmel
|
||||||
|
* \author Pavel Sanda
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
@ -20,12 +21,21 @@
|
|||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QRadioButton>
|
||||||
|
#include <QButtonGroup>
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
|
|
||||||
|
struct LevelButton : QRadioButton
|
||||||
|
{
|
||||||
|
LevelButton(const QString& name) : QRadioButton(name) {}
|
||||||
|
Debug::Type level;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
ProgressViewWidget::ProgressViewWidget()
|
ProgressViewWidget::ProgressViewWidget()
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -51,6 +61,18 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
|
|||||||
font.setStyleHint(QFont::TypeWriter);
|
font.setStyleHint(QFont::TypeWriter);
|
||||||
widget_->outTE->setFont(font);
|
widget_->outTE->setFont(font);
|
||||||
|
|
||||||
|
QButtonGroup* button_group = new QButtonGroup(this);
|
||||||
|
const std::vector<Debug::Type> levels = Debug::levels();
|
||||||
|
for (unsigned int i = 0; i < levels.size(); i++) {
|
||||||
|
LevelButton * box = new LevelButton(toqstr(Debug::description(levels[i])));
|
||||||
|
box->level = levels[i];
|
||||||
|
widget_->settingsLayout->addWidget(box);
|
||||||
|
button_group->addButton(box);
|
||||||
|
}
|
||||||
|
connect(button_group, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(levelChanged(QAbstractButton*)));
|
||||||
|
// TODO settings
|
||||||
|
button_group->buttons().front()->setChecked(true);
|
||||||
|
|
||||||
GuiProgress* progress = dynamic_cast<GuiProgress*>(support::ProgressInterface::instance());
|
GuiProgress* progress = dynamic_cast<GuiProgress*>(support::ProgressInterface::instance());
|
||||||
|
|
||||||
if (progress) {
|
if (progress) {
|
||||||
@ -59,10 +81,19 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
|
|||||||
connect(progress, SIGNAL(appendMessage(QString const &)), this, SLOT(appendText(QString const &)));
|
connect(progress, SIGNAL(appendMessage(QString const &)), this, SLOT(appendText(QString const &)));
|
||||||
connect(progress, SIGNAL(appendError(QString const &)), this, SLOT(appendText(QString const &)));
|
connect(progress, SIGNAL(appendError(QString const &)), this, SLOT(appendText(QString const &)));
|
||||||
connect(progress, SIGNAL(clearMessages()), this, SLOT(clearText()));
|
connect(progress, SIGNAL(clearMessages()), this, SLOT(clearText()));
|
||||||
|
progress->lyxerrConnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiProgressView::levelChanged(QAbstractButton* b)
|
||||||
|
{
|
||||||
|
LevelButton* lb = dynamic_cast<LevelButton*>(b);
|
||||||
|
if (lb)
|
||||||
|
lyxerr.level(lb->level);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiProgressView::clearText()
|
void GuiProgressView::clearText()
|
||||||
{
|
{
|
||||||
if (widget_->autoClearCB->isChecked())
|
if (widget_->autoClearCB->isChecked())
|
||||||
@ -75,10 +106,15 @@ void GuiProgressView::appendText(QString const & text)
|
|||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
return;
|
return;
|
||||||
QString time = QTime::currentTime().toString();
|
QString time = QTime::currentTime().toString();
|
||||||
widget_->outTE->insertPlainText(time + ": " + text.trimmed() + "\n");
|
if (text.endsWith("\n"))
|
||||||
|
widget_->outTE->insertPlainText(time + ": " + text);
|
||||||
|
else
|
||||||
|
widget_->outTE->insertPlainText(text);
|
||||||
|
|
||||||
widget_->outTE->ensureCursorVisible();
|
widget_->outTE->ensureCursorVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiProgressView::saveSession() const
|
void GuiProgressView::saveSession() const
|
||||||
{
|
{
|
||||||
Dialog::saveSession();
|
Dialog::saveSession();
|
||||||
@ -87,6 +123,7 @@ void GuiProgressView::saveSession() const
|
|||||||
sessionKey() + "/autoclear", widget_->autoClearCB->isChecked());
|
sessionKey() + "/autoclear", widget_->autoClearCB->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiProgressView::restoreSession()
|
void GuiProgressView::restoreSession()
|
||||||
{
|
{
|
||||||
DockView::restoreSession();
|
DockView::restoreSession();
|
||||||
@ -96,6 +133,20 @@ void GuiProgressView::restoreSession()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiProgressView::showEvent(QShowEvent*)
|
||||||
|
{
|
||||||
|
support::ProgressInterface::instance()->lyxerrConnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiProgressView::hideEvent(QHideEvent*)
|
||||||
|
{
|
||||||
|
support::ProgressInterface::instance()->lyxerrDisconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dialog * createGuiProgressView(GuiView & guiview)
|
Dialog * createGuiProgressView(GuiView & guiview)
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_MACX
|
#ifdef Q_WS_MACX
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
* \author Peter Kümmel
|
* \author Peter Kümmel
|
||||||
|
* \author Pavel Sanda
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
@ -20,9 +21,15 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
class QAbstractButton;
|
||||||
|
class QHideEvent;
|
||||||
|
class QShowEvent;
|
||||||
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
|
|
||||||
class ProgressViewWidget : public QWidget, public Ui::ProgressViewUi
|
class ProgressViewWidget : public QWidget, public Ui::ProgressViewUi
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -62,8 +69,13 @@ private Q_SLOTS:
|
|||||||
void appendText(QString const & text);
|
void appendText(QString const & text);
|
||||||
void clearText();
|
void clearText();
|
||||||
|
|
||||||
|
void levelChanged(QAbstractButton*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProgressViewWidget * widget_;
|
ProgressViewWidget * widget_;
|
||||||
|
|
||||||
|
void showEvent(QShowEvent*);
|
||||||
|
void hideEvent(QHideEvent*);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,159 +1,157 @@
|
|||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>ProgressViewUi</class>
|
<class>ProgressViewUi</class>
|
||||||
<widget class="QWidget" name="ProgressViewUi" >
|
<widget class="QWidget" name="ProgressViewUi">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>826</width>
|
<width>544</width>
|
||||||
<height>252</height>
|
<height>518</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="margin" >
|
<item>
|
||||||
<number>0</number>
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
</property>
|
<property name="enabled">
|
||||||
<property name="spacing" >
|
<bool>true</bool>
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item row="1" column="1" >
|
|
||||||
<layout class="QVBoxLayout" >
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="margin" >
|
<property name="sizePolicy">
|
||||||
<number>0</number>
|
<sizepolicy hsizetype="Expanding" vsizetype="Ignored">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<property name="baseSize">
|
||||||
<widget class="QTabWidget" name="tabWidget" >
|
<size>
|
||||||
<property name="enabled" >
|
<width>0</width>
|
||||||
<bool>true</bool>
|
<height>0</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="sizePolicy" >
|
</property>
|
||||||
<sizepolicy vsizetype="Ignored" hsizetype="Expanding" >
|
<property name="acceptDrops">
|
||||||
<horstretch>0</horstretch>
|
<bool>false</bool>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
<property name="layoutDirection">
|
||||||
</property>
|
<enum>Qt::LeftToRight</enum>
|
||||||
<property name="baseSize" >
|
</property>
|
||||||
<size>
|
<property name="autoFillBackground">
|
||||||
<width>0</width>
|
<bool>false</bool>
|
||||||
<height>0</height>
|
</property>
|
||||||
</size>
|
<property name="tabPosition">
|
||||||
</property>
|
<enum>QTabWidget::East</enum>
|
||||||
<property name="acceptDrops" >
|
</property>
|
||||||
<bool>false</bool>
|
<property name="tabShape">
|
||||||
</property>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
<property name="layoutDirection" >
|
</property>
|
||||||
<enum>Qt::LeftToRight</enum>
|
<property name="currentIndex">
|
||||||
</property>
|
<number>1</number>
|
||||||
<property name="autoFillBackground" >
|
</property>
|
||||||
<bool>false</bool>
|
<property name="iconSize">
|
||||||
</property>
|
<size>
|
||||||
<property name="tabPosition" >
|
<width>16</width>
|
||||||
<enum>QTabWidget::East</enum>
|
<height>16</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="tabShape" >
|
</property>
|
||||||
<enum>QTabWidget::Rounded</enum>
|
<property name="usesScrollButtons">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
<property name="currentIndex" >
|
</property>
|
||||||
<number>0</number>
|
<widget class="QWidget" name="tab">
|
||||||
</property>
|
<attribute name="title">
|
||||||
<property name="iconSize" >
|
<string>Output</string>
|
||||||
<size>
|
</attribute>
|
||||||
<width>16</width>
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<height>16</height>
|
<item row="0" column="0">
|
||||||
</size>
|
<widget class="QTextEdit" name="outTE">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<property name="usesScrollButtons" >
|
<sizepolicy hsizetype="Expanding" vsizetype="Ignored">
|
||||||
<bool>true</bool>
|
<horstretch>1</horstretch>
|
||||||
</property>
|
<verstretch>0</verstretch>
|
||||||
<widget class="QWidget" name="tab" >
|
</sizepolicy>
|
||||||
<attribute name="title" >
|
|
||||||
<string>Output</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout9" >
|
|
||||||
<item row="0" column="0" >
|
|
||||||
<widget class="QTextEdit" name="outTE" >
|
|
||||||
<property name="sizePolicy" >
|
|
||||||
<sizepolicy vsizetype="Ignored" hsizetype="Expanding" >
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize" >
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape" >
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow" >
|
|
||||||
<enum>QFrame::Sunken</enum>
|
|
||||||
</property>
|
|
||||||
<property name="lineWidth" >
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_2" >
|
|
||||||
<attribute name="title" >
|
|
||||||
<string>Settings</string>
|
|
||||||
</attribute>
|
|
||||||
<widget class="QCheckBox" name="autoClearCB" >
|
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>22</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>144</width>
|
|
||||||
<height>19</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip" >
|
<property name="maximumSize">
|
||||||
<string>Automatic cleanup of the window before LaTeX compilation proceeds</string>
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="frameShape">
|
||||||
<string>&Automatic clear</string>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked" >
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="updatePB" >
|
</item>
|
||||||
<property name="enabled" >
|
</layout>
|
||||||
<bool>false</bool>
|
</widget>
|
||||||
</property>
|
<widget class="QWidget" name="tab_2">
|
||||||
<property name="geometry" >
|
<attribute name="title">
|
||||||
<rect>
|
<string>Settings</string>
|
||||||
<x>16</x>
|
</attribute>
|
||||||
<y>35</y>
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<width>75</width>
|
<item>
|
||||||
<height>24</height>
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
</rect>
|
<property name="widgetResizable">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
<property name="text" >
|
|
||||||
<string>&Update</string>
|
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>482</width>
|
||||||
|
<height>474</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="settingsLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="autoClearCB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Automatic cleanup of the window before LaTeX compilation proceeds</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Automatic clear</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="updatePB">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Update</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
</widget>
|
</layout>
|
||||||
</item>
|
</widget>
|
||||||
</layout>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<includes>
|
<includes>
|
||||||
<include location="local" >qt_i18n.h</include>
|
<include location="local">qt_i18n.h</include>
|
||||||
</includes>
|
</includes>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -23,18 +23,22 @@ class ProgressInterface
|
|||||||
public:
|
public:
|
||||||
virtual ~ProgressInterface() {}
|
virtual ~ProgressInterface() {}
|
||||||
|
|
||||||
|
/// will be Signals in Qt classes
|
||||||
virtual void processStarted(QString const &) = 0;
|
virtual void processStarted(QString const &) = 0;
|
||||||
virtual void processFinished(QString const &) = 0;
|
virtual void processFinished(QString const &) = 0;
|
||||||
virtual void appendMessage(QString const &) = 0;
|
virtual void appendMessage(QString const &) = 0;
|
||||||
virtual void appendError(QString const &) = 0;
|
virtual void appendError(QString const &) = 0;
|
||||||
virtual void clearMessages() = 0;
|
virtual void clearMessages() = 0;
|
||||||
|
virtual void lyxerrFlush() = 0;
|
||||||
|
|
||||||
// Alert interface
|
/// Alert interface
|
||||||
virtual void warning(QString const & title, QString const & message) = 0;
|
virtual void warning(QString const & title, QString const & message) = 0;
|
||||||
virtual void toggleWarning(QString const & title, QString const & msg, QString const & formatted) = 0;
|
virtual void toggleWarning(QString const & title, QString const & msg, QString const & formatted) = 0;
|
||||||
virtual void error(QString const & title, QString const & message) = 0;
|
virtual void error(QString const & title, QString const & message) = 0;
|
||||||
virtual void information(QString const & title, QString const & message) = 0;
|
virtual void information(QString const & title, QString const & message) = 0;
|
||||||
|
|
||||||
|
virtual void lyxerrConnect() = 0;
|
||||||
|
virtual void lyxerrDisconnect() = 0;
|
||||||
|
|
||||||
static void setInstance(ProgressInterface*);
|
static void setInstance(ProgressInterface*);
|
||||||
static ProgressInterface* instance();
|
static ProgressInterface* instance();
|
||||||
|
@ -61,6 +61,10 @@ public:
|
|||||||
void appendMessage(QString const &) {}
|
void appendMessage(QString const &) {}
|
||||||
void appendError(QString const &) {}
|
void appendError(QString const &) {}
|
||||||
void clearMessages() {}
|
void clearMessages() {}
|
||||||
|
void lyxerrFlush() {}
|
||||||
|
|
||||||
|
void lyxerrConnect() {}
|
||||||
|
void lyxerrDisconnect() {}
|
||||||
|
|
||||||
void warning(QString const &, QString const &) {}
|
void warning(QString const &, QString const &) {}
|
||||||
void toggleWarning(QString const &, QString const &, QString const &) {}
|
void toggleWarning(QString const &, QString const &, QString const &) {}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
* \author Lars Gullik Bjønnes
|
* \author Lars Gullik Bjønnes
|
||||||
* \author Jean-Marc Lasgouttes
|
* \author Jean-Marc Lasgouttes
|
||||||
|
* \author Pavel Sanda
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
@ -16,6 +17,7 @@
|
|||||||
#include "support/gettext.h"
|
#include "support/gettext.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "support/FileName.h"
|
#include "support/FileName.h"
|
||||||
|
#include "support/ProgressInterface.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@ -77,6 +79,35 @@ int const numErrorTags = sizeof(errorTags)/sizeof(errorTags[0]);
|
|||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector<Debug::Type> Debug::levels()
|
||||||
|
{
|
||||||
|
std::vector<Debug::Type> vec;
|
||||||
|
for (int i = 0 ; i < numErrorTags ; ++i) {
|
||||||
|
vec.push_back(errorTags[i].level);
|
||||||
|
}
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
string const Debug::description(Debug::Type val)
|
||||||
|
{
|
||||||
|
for (int i = 0 ; i < numErrorTags ; ++i) {
|
||||||
|
if (errorTags[i].level == val)
|
||||||
|
return errorTags[i].desc;
|
||||||
|
}
|
||||||
|
return "unknown level";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string const Debug::name(Debug::Type val)
|
||||||
|
{
|
||||||
|
for (int i = 0 ; i < numErrorTags ; ++i) {
|
||||||
|
if (errorTags[i].level == val)
|
||||||
|
return errorTags[i].name;
|
||||||
|
}
|
||||||
|
return "unknown level";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Debug::Type Debug::value(string const & val)
|
Debug::Type Debug::value(string const & val)
|
||||||
{
|
{
|
||||||
Type l = Debug::NONE;
|
Type l = Debug::NONE;
|
||||||
@ -152,37 +183,54 @@ bool LyXErr::debugging(Debug::Type t) const
|
|||||||
|
|
||||||
void LyXErr::endl()
|
void LyXErr::endl()
|
||||||
{
|
{
|
||||||
if (enabled_)
|
if (enabled_) {
|
||||||
stream() << std::endl;
|
stream() << std::endl;
|
||||||
|
if (second_used_)
|
||||||
|
second() << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// It seems not possible to instantiate operator template out of class body
|
||||||
|
#define STREAM_OPERATOR(t) \
|
||||||
|
{\
|
||||||
|
if (l.enabled()){\
|
||||||
|
l.stream() << t;\
|
||||||
|
if (l.second_used()){\
|
||||||
|
l.second() << t;\
|
||||||
|
ProgressInterface::instance()->lyxerrFlush();\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
return l;\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LyXErr & operator<<(LyXErr & l, void const * t)
|
LyXErr & operator<<(LyXErr & l, void const * t)
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, char const * t)
|
LyXErr & operator<<(LyXErr & l, char const * t)
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, char t)
|
LyXErr & operator<<(LyXErr & l, char t)
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, int t)
|
LyXErr & operator<<(LyXErr & l, int t)
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, unsigned int t)
|
LyXErr & operator<<(LyXErr & l, unsigned int t)
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, long t)
|
LyXErr & operator<<(LyXErr & l, long t)
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, unsigned long t)
|
LyXErr & operator<<(LyXErr & l, unsigned long t)
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, double t)
|
LyXErr & operator<<(LyXErr & l, double t)
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, string const & t)
|
LyXErr & operator<<(LyXErr & l, string const & t)
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, docstring const & t)
|
LyXErr & operator<<(LyXErr & l, docstring const & t)
|
||||||
{ if (l.enabled()) l.stream() << to_utf8(t); return l; }
|
STREAM_OPERATOR(to_utf8(t));
|
||||||
LyXErr & operator<<(LyXErr & l, FileName const & t)
|
LyXErr & operator<<(LyXErr & l, FileName const & t)
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, ostream &(*t)(ostream &))
|
LyXErr & operator<<(LyXErr & l, ostream &(*t)(ostream &))
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
LyXErr & operator<<(LyXErr & l, ios_base &(*t)(ios_base &))
|
LyXErr & operator<<(LyXErr & l, ios_base &(*t)(ios_base &))
|
||||||
{ if (l.enabled()) l.stream() << t; return l; }
|
STREAM_OPERATOR(t)
|
||||||
|
|
||||||
|
|
||||||
// The global instance
|
// The global instance
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
*
|
*
|
||||||
* \author Lars Gullik Bjønnes
|
* \author Lars Gullik Bjønnes
|
||||||
* \author Jean-Marc Lasgouttes
|
* \author Jean-Marc Lasgouttes
|
||||||
|
* \author Pavel Sanda
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
@ -19,7 +20,7 @@
|
|||||||
#define LYXDEBUG_H
|
#define LYXDEBUG_H
|
||||||
|
|
||||||
#include "support/strfwd.h"
|
#include "support/strfwd.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
||||||
@ -107,11 +108,20 @@ namespace Debug {
|
|||||||
ANY = 0xffffffff
|
ANY = 0xffffffff
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const std::vector<Type> levels();
|
||||||
|
|
||||||
/** A function to convert symbolic string names on debug levels
|
/** A function to convert symbolic string names on debug levels
|
||||||
to their numerical value.
|
to their numerical value.
|
||||||
*/
|
*/
|
||||||
Type value(std::string const & val);
|
Type value(std::string const & val);
|
||||||
|
|
||||||
|
/// Return description of level
|
||||||
|
std::string const description(Type val);
|
||||||
|
|
||||||
|
/// Return name of level
|
||||||
|
std::string const name(Type val);
|
||||||
|
|
||||||
|
|
||||||
/** Display the tags and descriptions of the current debug level
|
/** Display the tags and descriptions of the current debug level
|
||||||
of ds
|
of ds
|
||||||
*/
|
*/
|
||||||
@ -132,7 +142,7 @@ inline void operator|=(Debug::Type & d1, Debug::Type d2)
|
|||||||
class LyXErr
|
class LyXErr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LyXErr(): enabled_(true) {}
|
LyXErr(): enabled_(true), second_used_(false) {}
|
||||||
/// Disable the stream completely
|
/// Disable the stream completely
|
||||||
void disable();
|
void disable();
|
||||||
/// Enable the stream after a possible call of disable()
|
/// Enable the stream after a possible call of disable()
|
||||||
@ -153,6 +163,13 @@ public:
|
|||||||
Debug::Type level() const { return dt; }
|
Debug::Type level() const { return dt; }
|
||||||
/// Returns stream
|
/// Returns stream
|
||||||
operator std::ostream &() { return *stream_; }
|
operator std::ostream &() { return *stream_; }
|
||||||
|
/// Returns second_used_
|
||||||
|
bool second_used() { return second_used_; }
|
||||||
|
// Returns second stream
|
||||||
|
std::ostream & second() { return *second_; };
|
||||||
|
/// Sets the second stream
|
||||||
|
void setSecond(std::ostream * os) { second_used_ = (second_ = os); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The current debug level
|
/// The current debug level
|
||||||
Debug::Type dt;
|
Debug::Type dt;
|
||||||
@ -160,6 +177,10 @@ private:
|
|||||||
bool enabled_;
|
bool enabled_;
|
||||||
/// The real stream
|
/// The real stream
|
||||||
std::ostream * stream_;
|
std::ostream * stream_;
|
||||||
|
/// Next stream for output duplication
|
||||||
|
std::ostream * second_;
|
||||||
|
/// Is the second stream enabled?
|
||||||
|
bool second_used_;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace support { class FileName; }
|
namespace support { class FileName; }
|
||||||
|
Loading…
Reference in New Issue
Block a user