You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1021 B
37 lines
1021 B
#include "samplecoreapp.h"
|
|
#include "sampleviewmodel.h"
|
|
|
|
#include <QtCore/QCommandLineParser>
|
|
|
|
SampleCoreApp::SampleCoreApp(QObject *parent) :
|
|
CoreApp(parent)
|
|
{}
|
|
|
|
void SampleCoreApp::performRegistrations()
|
|
{
|
|
QtMvvm::registerInterfaceConverter<IEventService>();
|
|
}
|
|
|
|
int SampleCoreApp::startApp(const QStringList &arguments)
|
|
{
|
|
QCommandLineParser parser;
|
|
parser.addVersionOption();
|
|
parser.addHelpOption();
|
|
|
|
parser.addOption({
|
|
{QStringLiteral("a"), QStringLiteral("active")},
|
|
QStringLiteral("Start with the active checkbox already checked")
|
|
});
|
|
parser.addPositionalArgument(QStringLiteral("names"),
|
|
QStringLiteral("A list of names, joined together as one string"),
|
|
QStringLiteral("[name..."));
|
|
|
|
if(!autoParse(parser, arguments))
|
|
return EXIT_SUCCESS;
|
|
|
|
QVariantHash args;
|
|
args.insert(SampleViewModel::KeyActive, parser.isSet(QStringLiteral("active")));
|
|
args.insert(SampleViewModel::KeyNames, parser.positionalArguments());
|
|
show<SampleViewModel>(args);
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|