start with downloading dc: parsing command arguments. started to implement the acrual download
This commit is contained in:
@@ -85,7 +85,17 @@ CommandLineParser::CommandLineParser()
|
||||
, m_yoctoInstallStatusOption(
|
||||
QCommandLineOption(
|
||||
QStringList() << "Y" << "yocto-install",
|
||||
QCoreApplication::translate("main", "Show yocto install status of ATBUpdateTool."))) {
|
||||
QCoreApplication::translate("main", "Show yocto install status of ATBUpdateTool.")))
|
||||
, m_dcDirectoryOption(
|
||||
QCommandLineOption(
|
||||
QStringList() << "dc-directory" << "dc-directory",
|
||||
QCoreApplication::translate("main", "device controller directory."),
|
||||
QCoreApplication::translate("main", "directory")))
|
||||
, m_readDCVersionOption(
|
||||
QCommandLineOption(
|
||||
QStringList() << "D" << "read-dc-version",
|
||||
QCoreApplication::translate("main", "Show version of device controller."),
|
||||
QCoreApplication::translate("main", "Show version of device controller."))) {
|
||||
configure();
|
||||
}
|
||||
|
||||
@@ -138,6 +148,12 @@ void CommandLineParser::configure() {
|
||||
|
||||
m_yoctoInstallStatusOption.setDefaultValue("false");
|
||||
m_parser.addOption(m_yoctoInstallStatusOption);
|
||||
|
||||
m_dcDirectoryOption.setDefaultValue("etc/dc/");
|
||||
m_parser.addOption(m_dcDirectoryOption);
|
||||
|
||||
m_readDCVersionOption.setDefaultValue("false");
|
||||
m_parser.addOption(m_readDCVersionOption);
|
||||
}
|
||||
|
||||
void CommandLineParser::readSettings() {
|
||||
@@ -155,7 +171,7 @@ void CommandLineParser::readSettings() {
|
||||
for (QString const &key: keys) {
|
||||
QVariant v = settings.value(key);
|
||||
|
||||
qCritical() << __PRETTY_FUNCTION__
|
||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
||||
<< key << " -> " << v.toString();
|
||||
|
||||
if (key.contains("repository-url")) {
|
||||
@@ -196,6 +212,12 @@ void CommandLineParser::readSettings() {
|
||||
} else
|
||||
if (key.contains("plugin-name")) {
|
||||
m_plugInName = v.toString();
|
||||
} else
|
||||
if (key.contains("dc-directory")) {
|
||||
m_dcDir = v.toString();
|
||||
} else
|
||||
if (key.contains("read-dc-version")) {
|
||||
m_readDCVersion = (v.toBool() ? "true" : "false");
|
||||
} else {
|
||||
qCritical() << __PRETTY_FUNCTION__
|
||||
<< key << " -> (UNKNOWN) " << v.toString();
|
||||
@@ -243,6 +265,26 @@ QString CommandLineParser::psaTariffDir() {
|
||||
return m_psaTariffDir;
|
||||
}
|
||||
|
||||
QString CommandLineParser::dcDir() {
|
||||
if (m_parser.isSet(m_dcDirectoryOption)) {
|
||||
m_dcDir = m_parser.value(m_dcDirectoryOption);
|
||||
}
|
||||
return m_dcDir;
|
||||
}
|
||||
|
||||
bool CommandLineParser::readDCVersion() {
|
||||
|
||||
qCritical() << __func__ << __LINE__;
|
||||
|
||||
if (m_parser.isSet(m_readDCVersionOption)) {
|
||||
qCritical() << __func__ << __LINE__ << m_readDCVersion;
|
||||
m_readDCVersion = m_parser.value(m_readDCVersionOption);
|
||||
qCritical() << __func__ << __LINE__ << m_readDCVersion;
|
||||
}
|
||||
qCritical() << __func__ << __LINE__ << m_readDCVersion;
|
||||
return m_readDCVersion == "false" ? false : true;
|
||||
}
|
||||
|
||||
QString CommandLineParser::workingDir() {
|
||||
if (m_parser.isSet(m_workingDirectoryOption)) {
|
||||
m_workingDir = m_parser.value(m_workingDirectoryOption);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#ifndef COMMAND_LINE_PARSER_H_INCLUDED
|
||||
#ifndef COMMAND_LINE_PARSER_H_INCLUDED
|
||||
#define COMMAND_LINE_PARSER_H_INCLUDED
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -21,6 +21,8 @@ class CommandLineParser : public QCommandLineParser {
|
||||
QString m_iniFileName;
|
||||
QString m_alwaysDownloadConfig;
|
||||
QString m_alwaysDownloadDC;
|
||||
QString m_readDCVersion;
|
||||
QString m_dcDir;
|
||||
|
||||
QCommandLineOption m_repositoryUrlOption;
|
||||
QCommandLineOption m_iniFileDirectoryOption;
|
||||
@@ -37,6 +39,8 @@ class CommandLineParser : public QCommandLineParser {
|
||||
QCommandLineOption m_extendedVersionOption;
|
||||
QCommandLineOption m_yoctoVersionOption;
|
||||
QCommandLineOption m_yoctoInstallStatusOption;
|
||||
QCommandLineOption m_dcDirectoryOption;
|
||||
QCommandLineOption m_readDCVersionOption;
|
||||
|
||||
QCommandLineParser m_parser;
|
||||
|
||||
@@ -65,5 +69,7 @@ public:
|
||||
bool extendedVersion();
|
||||
bool alwaysDownloadConfig();
|
||||
bool alwaysDownloadDC();
|
||||
bool readDCVersion();
|
||||
QString dcDir();
|
||||
};
|
||||
#endif // COMMAND_LINE_PARSER_H_INCLUDED
|
||||
|
Reference in New Issue
Block a user