Commit 69ef6609 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

fix dtkDistributedApplication (do not inherit from dtkApplication)

parent 3dcfa454
......@@ -29,6 +29,7 @@ target_link_libraries(${PROJECT_NAME}
dtkComposer
dtkDistributed
dtkLog
dtkWidgets
)
target_link_libraries(${PROJECT_NAME} Qt5::Core)
......
......@@ -19,6 +19,7 @@
#include <dtkDistributed>
#include <dtkComposer>
#include <dtkCore>
#include <dtkWidgets>
#include <dtkCoreSupport/dtkPluginManager.h>
#include <dtkCoreSupport/dtkAbstractProcessFactory.h>
......@@ -27,13 +28,13 @@
int main(int argc, char **argv)
{
dtkDistributedApplication *application = dtkDistributed::create(argc, argv);
dtkDistributedGuiApplication *application = dtkDistributedGuiApplication::create(argc, argv);
application->setApplicationName("dtkComposerEvaluator");
application->setApplicationVersion("1.0.0");
application->setOrganizationName("inria");
application->setOrganizationDomain("fr");
bool no_gui = dtkDistributed::app()->noGui();
bool no_gui = application->noGui();
QCommandLineParser *parser = application->parser();
parser->setApplicationDescription("DTK composer evaluator. Run the given compostion (XML file).");
......
......@@ -23,8 +23,6 @@
#include <dtkLog>
/*!
\class dtkDistributedApplication
\inmodule dtkDistributed
......@@ -32,7 +30,7 @@
*/
dtkDistributedApplication::dtkDistributedApplication(int &argc, char **argv): dtkCoreApplication(argc, argv)
dtkDistributedApplication::dtkDistributedApplication(int &argc, char **argv): QCoreApplication(argc, argv)
{
d = new dtkDistributedApplicationPrivate;
......@@ -64,6 +62,11 @@ void dtkDistributedApplication::unspawn(void)
d->unspawn();
}
QCommandLineParser *dtkDistributedApplication::parser(void)
{
return d->parser;
}
dtkDistributedPolicy *dtkDistributedApplication::policy(void)
{
return &(d->policy);
......
......@@ -17,13 +17,13 @@
#include "dtkDistributedExport.h"
#include <dtkCore/dtkCoreApplication.h>
#include <QtCore>
class dtkDistributedCommunicator;
class dtkDistributedPolicy;
class dtkDistributedApplicationPrivate;
class DTKDISTRIBUTED_EXPORT dtkDistributedApplication: public dtkCoreApplication
class DTKDISTRIBUTED_EXPORT dtkDistributedApplication: public QCoreApplication
{
public:
dtkDistributedApplication(int &argc, char **argv);
......@@ -35,6 +35,15 @@ public:
virtual void spawn(QMap<QString, QString> options = QMap<QString, QString>() );
virtual void unspawn(void);
public:
QCommandLineParser *parser(void);
public:
static dtkDistributedApplication *create(int &argc, char *argv[])
{
return new dtkDistributedApplication(argc, argv);
}
public:
bool isMaster(void);
virtual bool noGui(void);
......
......@@ -29,7 +29,7 @@
*/
dtkDistributedGuiApplication::dtkDistributedGuiApplication(int &argc, char **argv): dtkApplication(argc, argv)
dtkDistributedGuiApplication::dtkDistributedGuiApplication(int &argc, char **argv): QApplication(argc, argv)
{
d = new dtkDistributedApplicationPrivate;
......@@ -49,6 +49,15 @@ void dtkDistributedGuiApplication::initialize(void)
d->initialize();
}
QCommandLineParser *dtkDistributedGuiApplication::parser(void)
{
return d->parser;
}
bool dtkDistributedGuiApplication::noGui(void)
{
return !(qApp && qobject_cast<QGuiApplication *>(qApp) && (QGuiApplication::platformName() != "minimal")) ;
}
void dtkDistributedGuiApplication::exec(QRunnable *task)
{
......
......@@ -17,13 +17,14 @@
#include "dtkWidgetsExport.h"
#include "dtkApplication.h"
#include <QApplication>
#include <QtCore>
class dtkDistributedCommunicator;
class dtkDistributedPolicy;
class dtkDistributedApplicationPrivate;
class DTKWIDGETS_EXPORT dtkDistributedGuiApplication: public dtkApplication
class DTKWIDGETS_EXPORT dtkDistributedGuiApplication: public QApplication
{
public:
dtkDistributedGuiApplication(int &argc, char **argv);
......@@ -35,6 +36,12 @@ public:
virtual void spawn(QMap<QString, QString> options = QMap<QString, QString>() );
virtual void unspawn(void);
public:
virtual bool noGui(void);
public:
QCommandLineParser *parser(void);
public:
static dtkDistributedGuiApplication *create(int &argc, char *argv[])
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment