]> git.lyx.org Git - features.git/commitdiff
re-add view for progress, cleanup follows
authorPeter Kümmel <syntheticpp@gmx.net>
Tue, 22 Dec 2009 10:04:30 +0000 (10:04 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Tue, 22 Dec 2009 10:04:30 +0000 (10:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32610 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ui/stdmenus.inc
src/frontends/qt4/GuiProgressView.cpp [new file with mode: 0644]
src/frontends/qt4/GuiProgressView.h [new file with mode: 0644]
src/frontends/qt4/GuiView.cpp

index 436a0ca316c2b3594a280a6abba3fd9be21a74dc..79a32021707de94a0cd0016818dd6c55cd0e5501 100644 (file)
@@ -309,6 +309,7 @@ Menuset
                Item "Unfold Math Macro|n" "math-macro-unfold"
                Item "Fold Math Macro|d" "math-macro-fold"
                Separator
+               Item "Show progress messages" "dialog-toggle progress"
                Item "View Source|S" "dialog-toggle view-source"
                ViewFormats
                UpdateFormats
diff --git a/src/frontends/qt4/GuiProgressView.cpp b/src/frontends/qt4/GuiProgressView.cpp
new file mode 100644 (file)
index 0000000..377a3c5
--- /dev/null
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+/**
+ * \file GuiProgressView.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Peter Kümmel
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "GuiProgressView.h"
+
+#include "qt_helpers.h"
+
+
+
+namespace lyx {
+namespace frontend {
+
+
+
+
+GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area, 
+       Qt::WindowFlags flags) : DockView(parent, "progress", "Progress monitoring", area, flags)
+{
+       setWindowTitle(qt_("Progress monitoring"));
+       setWidget(&text_edit);
+       text_edit.setReadOnly(true);
+
+       GuiProgress* progress = dynamic_cast<GuiProgress*>(support::ProgressInterface::instance());
+
+       if (progress) {
+               connect(progress, SIGNAL(processStarted(QString const &)), this, SLOT(appendText(QString const &)));
+               connect(progress, SIGNAL(processFinished(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(clearMessages()), this, SLOT(clearText(QString const &)));
+       }
+}
+
+
+void GuiProgressView::clearText()
+{
+       text_edit.clear();
+}
+
+
+void GuiProgressView::appendText(QString const & text)
+{
+       text_edit.insertPlainText(text);
+       text_edit.ensureCursorVisible();
+}
+
+
+
+
+
+Dialog * createGuiProgressView(GuiView & guiview)
+{
+#ifdef Q_WS_MACX
+       return new GuiProgressView(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
+#else
+       return new GuiProgressView(guiview, Qt::BottomDockWidgetArea);
+#endif
+}
+
+
+
+} // namespace frontend
+} // namespace lyx
+
+#include "moc_GuiProgressView.cpp"
\ No newline at end of file
diff --git a/src/frontends/qt4/GuiProgressView.h b/src/frontends/qt4/GuiProgressView.h
new file mode 100644 (file)
index 0000000..8ca57eb
--- /dev/null
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+/**
+ * \file GuiProgressView.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Peter Kümmel
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GUIPROGRESSVIEW_H
+#define GUIPROGRESSVIEW_H
+
+
+#include "DockView.h"
+
+#include "GuiProgress.h"
+
+#include <QTextEdit>
+
+#include <string>
+
+
+namespace lyx {
+namespace frontend {
+
+
+class GuiProgressView : public DockView
+{
+       Q_OBJECT
+
+public:
+       GuiProgressView(
+               GuiView & parent, ///< the main window where to dock.
+               Qt::DockWidgetArea area, ///< Position of the dock (and also drawer)
+               Qt::WindowFlags flags = 0);
+
+       /// Controller inherited method.
+       ///@{
+       bool initialiseParams(std::string const &) { return true; }
+       void clearParams() {}
+       void dispatchParams() {}
+       bool isBufferDependent() const { return false; }
+       bool canApply() const { return true; }
+       bool canApplyToReadOnly() const { return true; }
+       void updateView() {}
+       ///@}
+
+private Q_SLOTS:
+       void appendText(QString const & text);
+       void clearText();
+
+private:
+       QTextEdit text_edit;
+};
+
+
+} // namespace frontend
+} // namespace lyx
+
+#endif
+
index 2f41919dc0292b05009a9b20edc4d6e035d2f5ae..4818722443297fba7f8121d692d926f238f20106 100644 (file)
@@ -364,6 +364,14 @@ GuiView::GuiView(int id)
 
        statusBar()->setSizeGripEnabled(true);
 
+#if (QT_VERSION >= 0x040400)
+       connect(&d.autosave_watcher_, SIGNAL(finished()), this,
+               SLOT(threadFinished()));
+#endif
+
+       connect(this, SIGNAL(triggerShowDialog(QString const &, QString const &, Inset *)),
+               SLOT(doShowDialog(QString const &, QString const &, Inset *)));
+
        // Forbid too small unresizable window because it can happen
        // with some window manager under X11.
        setMinimumSize(300, 200);
@@ -381,14 +389,6 @@ GuiView::GuiView(int id)
        // clear session data if any.
        QSettings settings;
        settings.remove("views");
-
-#if (QT_VERSION >= 0x040400)
-       connect(&d.autosave_watcher_, SIGNAL(finished()), this,
-               SLOT(threadFinished()));
-#endif
-
- connect(this, SIGNAL(triggerShowDialog(QString const &, QString const &, Inset *)),
-               SLOT(doShowDialog(QString const &, QString const &, Inset *)));
 }
 
 
@@ -1435,6 +1435,7 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                                || name == "file" //FIXME: should be removed.
                                || name == "prefs"
                                || name == "texinfo"
+                               || name == "progress"
                                || name == "compare";
                else if (name == "print")
                        enable = doc_buffer->isExportable("dvi")
@@ -3195,7 +3196,7 @@ char const * const dialognames[] = {
 "mathmatrix", "mathspace", "nomenclature", "nomencl_print", "note",
 "paragraph", "phantom", "prefs", "print", "ref", "sendto", "space",
 "spellchecker", "symbols", "tabular", "tabularcreate", "thesaurus", "texinfo",
-"toc", "view-source", "vspace", "wrap"};
+"toc", "view-source", "vspace", "wrap", "progress"};
 
 char const * const * const end_dialognames =
        dialognames + (sizeof(dialognames) / sizeof(char *));
@@ -3403,6 +3404,7 @@ Dialog * createGuiHyperlink(GuiView & lv);
 Dialog * createGuiVSpace(GuiView & lv);
 Dialog * createGuiViewSource(GuiView & lv);
 Dialog * createGuiWrap(GuiView & lv);
+Dialog * createGuiProgressView(GuiView & lv);
 
 
 
@@ -3508,6 +3510,8 @@ Dialog * GuiView::build(string const & name)
                return createGuiVSpace(*this);
        if (name == "wrap")
                return createGuiWrap(*this);
+       if (name == "progress")
+               return createGuiProgressView(*this);
 
        return 0;
 }