diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2012-11-16 14:15:41 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2012-11-27 15:36:27 +0100 |
commit | ee7b117b62d220e7ea3f38168ef5e07bd41786d6 (patch) | |
tree | 37d952ac2479f929746a0307ff51309dda1b6d22 /src/app/qbs/application.cpp | |
parent | 6d6714519cb3e292d52b3ad684201950a01f7c7f (diff) |
Make the public API asynchronous.
This simplifies things a lot for IDEs, which are no longer
forced to run a dedicated thread for a QbsEngine, as
everything on the calling side can now happen in the main loop.
Getting rid of blocking operations also allows for more flexibility
in that it is now possible to load one project while
another is building etc.
This patch also moves all the high-level types into src/lib/api/.
Until now, they were scattered around language/ and tools/, where
they do not belong.
Very few things had to be touched in the back-end; most notable
is the fact that BuildGraph's ScriptEngine is now settable,
because we must exchange it between resolving and building,
as the former operation runs in its own thread.
Change-Id: I5c8a7cc3517ebc2489678c0d5b1068972997e930
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/app/qbs/application.cpp')
-rw-r--r-- | src/app/qbs/application.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/app/qbs/application.cpp b/src/app/qbs/application.cpp index 9a8842b52..7c83d4f59 100644 --- a/src/app/qbs/application.cpp +++ b/src/app/qbs/application.cpp @@ -29,7 +29,7 @@ #include "application.h" -#include "consoleprogressobserver.h" +#include "commandlinefrontend.h" #include "ctrlchandler.h" #include <logging/logger.h> #include <logging/translator.h> @@ -39,10 +39,11 @@ namespace qbs { static QString cancelMessageTemplate = Tr::tr("Received termination request " "from user; canceling build. [pid=%1]"); -Application::Application(int &argc, char **argv) - : QCoreApplication(argc, argv), m_observer(new ConsoleProgressObserver) +Application::Application(int &argc, char **argv) : QCoreApplication(argc, argv), m_clFrontend(0) { - installCtrlCHandler(); + setApplicationName(QLatin1String("qbs")); + setOrganizationName(QLatin1String("QtProject")); + setOrganizationDomain(QLatin1String("qt-project.org")); } Application *Application::instance() @@ -50,11 +51,10 @@ Application *Application::instance() return qobject_cast<Application *>(QCoreApplication::instance()); } -void Application::init() +void Application::setCommandLineFrontend(CommandLineFrontend *clFrontend) { - setApplicationName(QLatin1String("qbs")); - setOrganizationName(QLatin1String("QtProject")); - setOrganizationDomain(QLatin1String("qt-project.org")); + installCtrlCHandler(); + m_clFrontend = clFrontend; } /** @@ -62,11 +62,9 @@ void Application::init() */ void Application::userInterrupt() { - if (!m_observer) - return; - qbsInfo() << cancelMessageTemplate.arg(applicationPid()); - m_observer->setCanceled(true); + Q_ASSERT(m_clFrontend); + m_clFrontend->cancel(); } } // namespace qbs |