lyx_mirror/src/support/ConsoleApplication.cpp
Georg Baum 7b48e2aac0 Start qt event loop for commandline usage
This is needed since src/support calls lots of qt code, and some parts of it
(e.g. QFileInfo) require a running event loop. This fixes bug #4917 which is
a symptom of the problem.
The fix is to create a QCoreApplication for tex2lyx, lyxclient and LyX running
without GUI. In the future this could be extended, i.e. to split up the
frontend Application class in a GUI and a console class, and having the
console class use LyXConsoleApp in the same way as Application now uses
GuiApplication. If that is done, one could also think of moving
support/ConsoleApplication to frontend/console/ConsoleApplication.
2015-01-11 14:06:17 +01:00

52 lines
816 B
C++

/**
* \file ConsoleApplication.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Georg Baum
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "support/ConsoleApplication.h"
#include "support/ConsoleApplicationPrivate.h"
namespace lyx {
namespace support {
ConsoleApplication::~ConsoleApplication()
{
delete d;
}
ConsoleApplication::ConsoleApplication(std::string const & app,
int & argc, char ** argv)
: d(new ConsoleApplicationPrivate(this, app, argc, argv))
{
}
int ConsoleApplication::exec()
{
return d->execute();
}
void ConsoleApplication::exit(int status)
{
d->exit(status);
}
} // namespace support
} // namespace lyx
#include "moc_ConsoleApplicationPrivate.cpp"