Here the updated patch, it only needs an menu entry for hideing/showing the dock widget.
Peter
Index: development/cmake/src/support/CMakeLists.txt =================================================================== --- development/cmake/src/support/CMakeLists.txt (revision 21106) +++ development/cmake/src/support/CMakeLists.txt (working copy) @@ -24,6 +24,8 @@ ${TOP_SRC_DIR}/src/support/minizip/iowin32.c) lyx_add_msvc_pch(support) + +lyx_automoc(${support_sources}) include_directories(${TOP_SRC_DIR}/src/support ${TOP_SRC_DIR}/src/support/minizip @@ -37,12 +39,17 @@ add_library(support ${library_type} ${support_sources} ${support_headers}) else() lyx_const_touched_files(_allinone support_sources) + set(depends_moc ${support_headers}) + set_source_files_properties(_allinone_const.C + PROPERTIES OBJECT_DEPENDS "${depends_moc}") + set_source_files_properties(_allinone_touched.C + PROPERTIES OBJECT_DEPENDS "${depends_moc}") add_library(support ${library_type} ${_allinone_files} - ${support_minizip_sources} ${support_minizip_cpp_sources}) + ${support_minizip_sources} ${support_minizip_cpp_sources} ${support_headers}) endif() -target_link_libraries(support boost_signals) +target_link_libraries(support boost_signals ${QT_QTCORE_LIBRARY} ) if(WIN32) target_link_libraries(support shlwapi) Index: src/LaTeX.cpp =================================================================== --- src/LaTeX.cpp (revision 21106) +++ src/LaTeX.cpp (working copy) @@ -427,11 +427,10 @@ int LaTeX::startscript() { // onlyFilename() is needed for cygwin - string tmp = cmd + ' ' - + quoteName(onlyFilename(file.toFilesystemEncoding())) - + " > " + os::nulldev(); - Systemcall one; - return one.startscript(Systemcall::Wait, tmp); + string tmp = cmd + ' ' + + "-max-print-line=200 " + + quoteName((file.toFilesystemEncoding())); + return Systemcall().startscript(Systemcall::Wait, tmp); } Index: src/frontends/qt4/GuiProgress.cpp =================================================================== --- src/frontends/qt4/GuiProgress.cpp (revision 0) +++ src/frontends/qt4/GuiProgress.cpp (revision 0) @@ -0,0 +1,49 @@ +// -*- C++ -*- +/** + * \file GuiProgress.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 "GuiProgress.h" + +#include <QApplication> +#include <QVBoxLayout> + +namespace lyx { +namespace frontend { + +// TODO translate +GuiProgress::GuiProgress() : QDockWidget(tr("Progress")) +{ + QVBoxLayout* vl = new QVBoxLayout; + vl->addWidget(&text_edit); + QWidget* content = new QWidget; + content->setLayout(vl); + vl->setMargin(0); + setWidget(content); +} + + +void GuiProgress::appendMessage(QString const & msg) +{ + text_edit.append(msg); + QApplication::processEvents(); +} + + +void GuiProgress::clearMessages() +{ + text_edit.clear(); +} + + +} // namespace frontend +} // namespace lyx + + Property changes on: src/frontends/qt4/GuiProgress.cpp ___________________________________________________________________ Name: svn:eol-style + native Index: src/frontends/qt4/GuiView.cpp =================================================================== --- src/frontends/qt4/GuiView.cpp (revision 21106) +++ src/frontends/qt4/GuiView.cpp (working copy) @@ -22,6 +22,7 @@ #include "GuiToolbar.h" #include "GuiToolbars.h" #include "qt_helpers.h" +#include "GuiProgress.h" #include "frontends/Application.h" #include "frontends/Dialogs.h" @@ -32,6 +33,7 @@ #include "support/convert.h" #include "support/lstrings.h" #include "support/os.h" +#include "support/SystemProcess.h" #include "Buffer.h" #include "BufferParams.h" @@ -66,6 +68,7 @@ #include <QToolBar> #include <QUrl> + #include <boost/current_function.hpp> using std::endl; @@ -134,6 +137,7 @@ TabWorkArea * tab_widget_; QStackedWidget * stack_widget_; BackgroundWidget * bg_widget_; + GuiProgress* progress_widget; /// view's menubar GuiMenubar * menubar_; /// view's toolbars @@ -141,7 +145,7 @@ /// docstring current_layout; - GuiViewPrivate() : posx_offset(0), posy_offset(0) {} + GuiViewPrivate() : posx_offset(0), posy_offset(0), progress_widget(0) {} unsigned int smallIconSize; unsigned int normalIconSize; @@ -244,6 +248,11 @@ // For Drag&Drop. setAcceptDrops(true); + + // add progress widget + d.progress_widget = new GuiProgress(); + addDockWidget(Qt::BottomDockWidgetArea, d.progress_widget); + lyx::support::SystemProcess::registerProgressInterface(d.progress_widget); } Index: src/frontends/qt4/GuiProgress.h =================================================================== --- src/frontends/qt4/GuiProgress.h (revision 0) +++ src/frontends/qt4/GuiProgress.h (revision 0) @@ -0,0 +1,44 @@ +// -*- C++ -*- +/** + * \file GuiProgress.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 GUIPROGRESS_H +#define GUIPROGRESS_H + +#include "support/ProgressInterface.h" + +#include <QTextEdit> +#include <QDockWidget> + +#include <string> + + +namespace lyx { +namespace frontend { + + +class GuiProgress : public QDockWidget, public lyx::support::ProgressInterface +{ +public: + GuiProgress(); + + void appendMessage(QString const &); + void clearMessages(); + +private: + QTextEdit text_edit; +}; + + +} // namespace frontend +} // namespace lyx + +#endif + Property changes on: src/frontends/qt4/GuiProgress.h ___________________________________________________________________ Name: svn:eol-style + native Index: src/support/Systemcall.cpp =================================================================== --- src/support/Systemcall.cpp (revision 21106) +++ src/support/Systemcall.cpp (working copy) @@ -14,6 +14,7 @@ #include <config.h> #include "support/Systemcall.h" +#include "support/SystemProcess.h" #include "support/os.h" #include <cstdlib> @@ -32,19 +33,14 @@ { string command = what; - if (how == DontWait) { - switch (os::shell()) { - case os::UNIX: - command += " &"; - break; - case os::CMD_EXE: - command = "start /min " + command; - break; - } - } + SystemProcess* process = new SystemProcess; + + if (how == Wait) + return process->start(command, true); - return ::system(command.c_str()); + return process->start(command, false); } + } // namespace support } // namespace lyx Index: src/support/SystemProcess.h =================================================================== --- src/support/SystemProcess.h (revision 0) +++ src/support/SystemProcess.h (revision 0) @@ -0,0 +1,52 @@ +// -*- C++ -*- +/** + * \file SystemProcess.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 LYX_SUPPORT_SYSTEMPROCESS_H +#define LYX_SUPPORT_SYSTEMPROCESS_H + +#include <string> +#include <QObject> +#include <QProcess> + +namespace lyx { +namespace support { + +class ProgressInterface; + +class SystemProcess : public QObject +{ + Q_OBJECT + +public: + SystemProcess(); + + // waitForFinished == true: returns the exit code of the process + // waitForFinished == false: returns 0 if the process could bestarted + int start(const std::string& cmd, bool waitForFinished); + + static void registerProgressInterface(ProgressInterface*); + +public Q_SLOTS: + void newProcessOutput(); + void processStarted(); + void processError(QProcess::ProcessError); + void processFinished(int, QProcess::ExitStatus); + +private: + QProcess process; + static ProgressInterface* progress; +}; + + +} // namespace support +} // namespace lyx + +#endif // LYX_SUPPORT_PROCESS_H Property changes on: src/support/SystemProcess.h ___________________________________________________________________ Name: svn:eol-style + native Index: src/support/SystemProcess.cpp =================================================================== --- src/support/SystemProcess.cpp (revision 0) +++ src/support/SystemProcess.cpp (revision 0) @@ -0,0 +1,108 @@ +// -*- C++ -*- +/** + * \file SystemProcess.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 "SystemProcess.h" +#include "ProgressInterface.h" + + +namespace lyx { +namespace support { + + +ProgressInterface* SystemProcess::progress = 0; + + +SystemProcess::SystemProcess() +{ + if (progress) { + connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(newProcessOutput())); + connect(&process, SIGNAL(started()), this, SLOT(processStarted())); + connect(&process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); + connect(&process, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(processFinished(int, QProcess::ExitStatus))); + } +} + + +void SystemProcess::registerProgressInterface(ProgressInterface* p) +{ + progress = p; +} + + +int SystemProcess::start(const std::string& cmd, bool waitForFinished) +{ + if (progress) { + progress->clearMessages(); + progress->appendMessage("starting LaTex with command"); + progress->appendMessage(cmd.c_str()); + } + + process.setReadChannel(QProcess::StandardOutput); + process.start(cmd.c_str(), QStringList(), QIODevice::ReadOnly); + // wait some seconds until the process has started + process.waitForStarted(10 * 1000); + if (waitForFinished) { + // with waitForFinished(-1); we only get one signal per run + while (process.state() == QProcess::Running) + process.waitForFinished(500); + return process.exitCode(); + } + if (process.state() != QProcess::Running) { + process.kill(); + // TODO this needs more testing + deleteLater(); + return -1; + } + return 0; +} + + +void SystemProcess::newProcessOutput() +{ + if (!progress) + return; + // parse output for page number, etc., could be used for a progress bar + const QString output = QString::fromLocal8Bit(process.readAllStandardOutput()); + progress->appendMessage(output); +} + + +void SystemProcess::processStarted() +{ + if (!progress) + return; + progress->appendMessage("LaTex started\n"); +} + + +void SystemProcess::processError(QProcess::ProcessError) +{ + if (!progress) + return; + progress->appendMessage("LaTex error\n"); +} + + +void SystemProcess::processFinished(int, QProcess::ExitStatus) +{ + deleteLater(); +} + + +} // namespace support +} // namespace lyx + +#include "SystemProcess_moc.cpp" + + Property changes on: src/support/SystemProcess.cpp ___________________________________________________________________ Name: svn:eol-style + native Index: src/support/ProgressInterface.h =================================================================== --- src/support/ProgressInterface.h (revision 0) +++ src/support/ProgressInterface.h (revision 0) @@ -0,0 +1,38 @@ +// -*- C++ -*- +/** + * \file ProgressInterface.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 LYX_SUPPORT_PROGRESSINTERFACE_H +#define LYX_SUPPORT_PROGRESSINTERFACE_H + +class QString; + +namespace lyx { +namespace support { + + +class ProgressInterface +{ +public: + virtual ~ProgressInterface() {} + + virtual void appendMessage(QString const &) = 0; + virtual void clearMessages() = 0; + +protected: + ProgressInterface() {} +}; + + +} // namespace support +} // namespace lyx + +#endif // LYX_SUPPORT_PROGRESSINTERFACE_H + Property changes on: src/support/ProgressInterface.h ___________________________________________________________________ Name: svn:eol-style + native Index: src/Buffer.cpp =================================================================== --- src/Buffer.cpp (revision 21106) +++ src/Buffer.cpp (working copy) @@ -1078,8 +1078,7 @@ if (output_preamble) { if (!runparams.nice) { // code for usual, NOT nice-latex-file - os << "\\batchmode\n"; // changed - // from \nonstopmode + os << "\\nonstopmode\n"; texrow().newline(); } if (!original_path.empty()) {