Move debug window into designers stuff instead of dynamical building

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32661 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2009-12-28 21:40:14 +00:00
parent 7384d3dd35
commit 85c73e7fcc
4 changed files with 115 additions and 10 deletions

View File

@ -24,14 +24,24 @@ namespace lyx {
namespace frontend { namespace frontend {
ProgressViewWidget::ProgressViewWidget()
{
setupUi(this);
}
GuiProgressView::~GuiProgressView()
{
delete widget_;
}
GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area, GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
Qt::WindowFlags flags) : DockView(parent, "progress", "Progress monitoring", area, flags) Qt::WindowFlags flags) : DockView(parent, "progress", "Debug/Progress window", area, flags)
{ {
setWindowTitle(qt_("Progress monitoring")); widget_ = new ProgressViewWidget();
setWidget(&text_edit); setWidget(widget_);
text_edit.setReadOnly(true);
GuiProgress* progress = dynamic_cast<GuiProgress*>(support::ProgressInterface::instance()); GuiProgress* progress = dynamic_cast<GuiProgress*>(support::ProgressInterface::instance());
@ -47,7 +57,7 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
void GuiProgressView::clearText() void GuiProgressView::clearText()
{ {
text_edit.clear(); widget_->outTE->clear();
} }
@ -56,8 +66,8 @@ void GuiProgressView::appendText(QString const & text)
if (text.isEmpty()) if (text.isEmpty())
return; return;
QString time = QTime::currentTime().toString(); QString time = QTime::currentTime().toString();
text_edit.insertPlainText(time + ": " + text.trimmed() + "\n"); widget_->outTE->insertPlainText(time + ": " + text.trimmed() + "\n");
text_edit.ensureCursorVisible(); widget_->outTE->ensureCursorVisible();
} }

View File

@ -12,19 +12,29 @@
#ifndef GUIPROGRESSVIEW_H #ifndef GUIPROGRESSVIEW_H
#define GUIPROGRESSVIEW_H #define GUIPROGRESSVIEW_H
#include "ui_ProgressViewUi.h"
#include "DockView.h" #include "DockView.h"
#include "GuiProgress.h" #include "GuiProgress.h"
#include <QTextEdit>
#include <string> #include <string>
#include <QDockWidget>
#include "qt_helpers.h"
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class ProgressViewWidget : public QWidget, public Ui::ProgressViewUi
{
Q_OBJECT
public:
ProgressViewWidget();
private:
};
class GuiProgressView : public DockView class GuiProgressView : public DockView
{ {
@ -36,6 +46,7 @@ public:
Qt::DockWidgetArea area, ///< Position of the dock (and also drawer) Qt::DockWidgetArea area, ///< Position of the dock (and also drawer)
Qt::WindowFlags flags = 0); Qt::WindowFlags flags = 0);
~GuiProgressView();
/// Controller inherited method. /// Controller inherited method.
///@{ ///@{
bool initialiseParams(std::string const &) { return true; } bool initialiseParams(std::string const &) { return true; }
@ -45,6 +56,7 @@ public:
bool canApply() const { return true; } bool canApply() const { return true; }
bool canApplyToReadOnly() const { return true; } bool canApplyToReadOnly() const { return true; }
void updateView() {} void updateView() {}
bool wantInitialFocus() const { return false; }
///@} ///@}
private Q_SLOTS: private Q_SLOTS:
@ -52,7 +64,7 @@ private Q_SLOTS:
void clearText(); void clearText();
private: private:
QTextEdit text_edit; ProgressViewWidget * widget_;
}; };

View File

@ -316,6 +316,7 @@ UIFILES = \
PrintUi.ui \ PrintUi.ui \
PrintindexUi.ui \ PrintindexUi.ui \
PrintNomenclUi.ui \ PrintNomenclUi.ui \
ProgressViewUi.ui \
RefUi.ui \ RefUi.ui \
SearchUi.ui \ SearchUi.ui \
SendtoUi.ui \ SendtoUi.ui \

View File

@ -0,0 +1,82 @@
<ui version="4.0" >
<class>ProgressViewUi</class>
<widget class="QWidget" name="ProgressViewUi" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>468</width>
<height>94</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>0</number>
</property>
<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>&amp;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>&amp;Update</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0" >
<widget class="QTextEdit" name="outTE" />
</item>
</layout>
</widget>
<tabstops>
<tabstop>autoClearCB</tabstop>
<tabstop>updatePB</tabstop>
</tabstops>
<includes>
<include location="local" >qt_i18n.h</include>
</includes>
<resources/>
<connections/>
</ui>