From 993120483715a9fcb21e27a1bf3ec6227ac92aff Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Tue, 14 Mar 2017 05:51:53 +0300 Subject: [PATCH] some work on queuedctl --- .../queued-daemon/src/QueuedApplication.cpp | 2 +- sources/queued-daemon/src/QueuedApplication.h | 2 +- .../src/QueuedApplicationInterface.cpp | 2 +- .../src/QueuedApplicationInterface.h | 2 +- sources/queued-daemon/src/main.cpp | 3 +- sources/queued/QueuedConfig.h.in | 2 +- sources/queued/include/queued/Queued.h | 2 +- .../include/queued/QueuedAdvancedSettings.h | 2 +- sources/queued/include/queued/QueuedCore.h | 2 +- .../queued/include/queued/QueuedCoreAdaptor.h | 2 +- .../include/queued/QueuedCoreInterface.h | 2 +- .../queued/QueuedCorePropertiesInterface.h | 2 +- .../queued/include/queued/QueuedDatabase.h | 2 +- .../include/queued/QueuedDatabaseManager.h | 2 +- .../include/queued/QueuedDatabaseSchema.h | 2 +- sources/queued/include/queued/QueuedDebug.h | 2 +- sources/queued/include/queued/QueuedEnums.h | 2 +- .../queued/include/queued/QueuedExceptions.h | 2 +- sources/queued/include/queued/QueuedLimits.h | 2 +- .../include/queued/QueuedPluginInterface.h | 2 +- .../include/queued/QueuedPluginManager.h | 2 +- .../queued/QueuedPluginManagerInterface.h | 2 +- sources/queued/include/queued/QueuedProcess.h | 2 +- .../include/queued/QueuedProcessManager.h | 2 +- .../include/queued/QueuedReportManager.h | 2 +- .../queued/include/queued/QueuedSettings.h | 2 +- .../include/queued/QueuedStaticConfig.h | 2 +- .../queued/include/queued/QueuedSystemInfo.h | 2 +- .../include/queued/QueuedTokenManager.h | 2 +- sources/queued/include/queued/QueuedUser.h | 2 +- .../queued/include/queued/QueuedUserManager.h | 2 +- sources/queued/src/QueuedAdvancedSettings.cpp | 2 +- sources/queued/src/QueuedCore.cpp | 2 +- sources/queued/src/QueuedCoreAdaptor.cpp | 121 +++++------ sources/queued/src/QueuedCoreInterface.cpp | 2 +- .../src/QueuedCorePropertiesInterface.cpp | 2 +- sources/queued/src/QueuedDatabase.cpp | 2 +- sources/queued/src/QueuedDatabaseManager.cpp | 2 +- sources/queued/src/QueuedDebug.cpp | 2 +- sources/queued/src/QueuedLimits.cpp | 2 +- sources/queued/src/QueuedPluginManager.cpp | 2 +- sources/queued/src/QueuedProcess.cpp | 2 +- sources/queued/src/QueuedProcessManager.cpp | 2 +- sources/queued/src/QueuedReportManager.cpp | 2 +- sources/queued/src/QueuedSettings.cpp | 2 +- sources/queued/src/QueuedSystemInfo.cpp | 2 +- sources/queued/src/QueuedTokenManager.cpp | 2 +- sources/queued/src/QueuedUser.cpp | 2 +- sources/queued/src/QueuedUserManager.cpp | 2 +- sources/queuedctl/src/QueuedctlAuth.cpp | 3 +- sources/queuedctl/src/QueuedctlAuth.h | 2 +- sources/queuedctl/src/QueuedctlCommon.cpp | 124 ++++++++++++ sources/queuedctl/src/QueuedctlCommon.h | 38 ++++ sources/queuedctl/src/QueuedctlOption.cpp | 30 ++- sources/queuedctl/src/QueuedctlOption.h | 8 +- sources/queuedctl/src/QueuedctlTask.cpp | 188 ++++++++++++++++++ sources/queuedctl/src/QueuedctlTask.h | 39 ++++ sources/queuedctl/src/main.cpp | 37 ++-- 58 files changed, 539 insertions(+), 148 deletions(-) create mode 100644 sources/queuedctl/src/QueuedctlCommon.cpp create mode 100644 sources/queuedctl/src/QueuedctlCommon.h create mode 100644 sources/queuedctl/src/QueuedctlTask.cpp create mode 100644 sources/queuedctl/src/QueuedctlTask.h diff --git a/sources/queued-daemon/src/QueuedApplication.cpp b/sources/queued-daemon/src/QueuedApplication.cpp index ef5d024..86b0646 100644 --- a/sources/queued-daemon/src/QueuedApplication.cpp +++ b/sources/queued-daemon/src/QueuedApplication.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued-daemon/src/QueuedApplication.h b/sources/queued-daemon/src/QueuedApplication.h index cd3267e..5f46a74 100644 --- a/sources/queued-daemon/src/QueuedApplication.h +++ b/sources/queued-daemon/src/QueuedApplication.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued-daemon/src/QueuedApplicationInterface.cpp b/sources/queued-daemon/src/QueuedApplicationInterface.cpp index 1af44df..120ef08 100644 --- a/sources/queued-daemon/src/QueuedApplicationInterface.cpp +++ b/sources/queued-daemon/src/QueuedApplicationInterface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued-daemon/src/QueuedApplicationInterface.h b/sources/queued-daemon/src/QueuedApplicationInterface.h index 577d686..f1603dd 100644 --- a/sources/queued-daemon/src/QueuedApplicationInterface.h +++ b/sources/queued-daemon/src/QueuedApplicationInterface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued-daemon/src/main.cpp b/sources/queued-daemon/src/main.cpp index 67cea8f..1ac26c0 100644 --- a/sources/queued-daemon/src/main.cpp +++ b/sources/queued-daemon/src/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -53,7 +53,6 @@ int main(int argc, char *argv[]) ::daemon(0, 0); } - QCoreApplication app(argc, argv); app.setApplicationName(NAME); app.setApplicationVersion(VERSION); diff --git a/sources/queued/QueuedConfig.h.in b/sources/queued/QueuedConfig.h.in index 7e5a686..37bd626 100644 --- a/sources/queued/QueuedConfig.h.in +++ b/sources/queued/QueuedConfig.h.in @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/Queued.h b/sources/queued/include/queued/Queued.h index 268199b..5982ab0 100644 --- a/sources/queued/include/queued/Queued.h +++ b/sources/queued/include/queued/Queued.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedAdvancedSettings.h b/sources/queued/include/queued/QueuedAdvancedSettings.h index 2116f46..4a0516d 100644 --- a/sources/queued/include/queued/QueuedAdvancedSettings.h +++ b/sources/queued/include/queued/QueuedAdvancedSettings.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedCore.h b/sources/queued/include/queued/QueuedCore.h index 4a34f83..25414fc 100644 --- a/sources/queued/include/queued/QueuedCore.h +++ b/sources/queued/include/queued/QueuedCore.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedCoreAdaptor.h b/sources/queued/include/queued/QueuedCoreAdaptor.h index 320fbd0..17acf6a 100644 --- a/sources/queued/include/queued/QueuedCoreAdaptor.h +++ b/sources/queued/include/queued/QueuedCoreAdaptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedCoreInterface.h b/sources/queued/include/queued/QueuedCoreInterface.h index 8c6d58b..8a0cc55 100644 --- a/sources/queued/include/queued/QueuedCoreInterface.h +++ b/sources/queued/include/queued/QueuedCoreInterface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedCorePropertiesInterface.h b/sources/queued/include/queued/QueuedCorePropertiesInterface.h index b8868fc..1f6b458 100644 --- a/sources/queued/include/queued/QueuedCorePropertiesInterface.h +++ b/sources/queued/include/queued/QueuedCorePropertiesInterface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedDatabase.h b/sources/queued/include/queued/QueuedDatabase.h index 237ff0a..cd1bdb5 100644 --- a/sources/queued/include/queued/QueuedDatabase.h +++ b/sources/queued/include/queued/QueuedDatabase.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedDatabaseManager.h b/sources/queued/include/queued/QueuedDatabaseManager.h index 0aeb84b..fc647d3 100644 --- a/sources/queued/include/queued/QueuedDatabaseManager.h +++ b/sources/queued/include/queued/QueuedDatabaseManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedDatabaseSchema.h b/sources/queued/include/queued/QueuedDatabaseSchema.h index f88fd0e..6a568c2 100644 --- a/sources/queued/include/queued/QueuedDatabaseSchema.h +++ b/sources/queued/include/queued/QueuedDatabaseSchema.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedDebug.h b/sources/queued/include/queued/QueuedDebug.h index d1dc5e4..67a8a5e 100644 --- a/sources/queued/include/queued/QueuedDebug.h +++ b/sources/queued/include/queued/QueuedDebug.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedEnums.h b/sources/queued/include/queued/QueuedEnums.h index 7ac1f5f..a032bd6 100644 --- a/sources/queued/include/queued/QueuedEnums.h +++ b/sources/queued/include/queued/QueuedEnums.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedExceptions.h b/sources/queued/include/queued/QueuedExceptions.h index c98e4d5..cac1141 100644 --- a/sources/queued/include/queued/QueuedExceptions.h +++ b/sources/queued/include/queued/QueuedExceptions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedLimits.h b/sources/queued/include/queued/QueuedLimits.h index f1fc50c..c49770b 100644 --- a/sources/queued/include/queued/QueuedLimits.h +++ b/sources/queued/include/queued/QueuedLimits.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedPluginInterface.h b/sources/queued/include/queued/QueuedPluginInterface.h index ee983a0..afa6776 100644 --- a/sources/queued/include/queued/QueuedPluginInterface.h +++ b/sources/queued/include/queued/QueuedPluginInterface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedPluginManager.h b/sources/queued/include/queued/QueuedPluginManager.h index a6b41c2..40a0abb 100644 --- a/sources/queued/include/queued/QueuedPluginManager.h +++ b/sources/queued/include/queued/QueuedPluginManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedPluginManagerInterface.h b/sources/queued/include/queued/QueuedPluginManagerInterface.h index 0d58cc6..5d54fe2 100644 --- a/sources/queued/include/queued/QueuedPluginManagerInterface.h +++ b/sources/queued/include/queued/QueuedPluginManagerInterface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedProcess.h b/sources/queued/include/queued/QueuedProcess.h index 1a8522d..6b5d25b 100644 --- a/sources/queued/include/queued/QueuedProcess.h +++ b/sources/queued/include/queued/QueuedProcess.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedProcessManager.h b/sources/queued/include/queued/QueuedProcessManager.h index 456d852..4847795 100644 --- a/sources/queued/include/queued/QueuedProcessManager.h +++ b/sources/queued/include/queued/QueuedProcessManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedReportManager.h b/sources/queued/include/queued/QueuedReportManager.h index 8999ecc..4e31e2b 100644 --- a/sources/queued/include/queued/QueuedReportManager.h +++ b/sources/queued/include/queued/QueuedReportManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedSettings.h b/sources/queued/include/queued/QueuedSettings.h index 3ba0ca3..ce2814d 100644 --- a/sources/queued/include/queued/QueuedSettings.h +++ b/sources/queued/include/queued/QueuedSettings.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedStaticConfig.h b/sources/queued/include/queued/QueuedStaticConfig.h index f8b6287..9cffc53 100644 --- a/sources/queued/include/queued/QueuedStaticConfig.h +++ b/sources/queued/include/queued/QueuedStaticConfig.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedSystemInfo.h b/sources/queued/include/queued/QueuedSystemInfo.h index b001bcf..453bd28 100644 --- a/sources/queued/include/queued/QueuedSystemInfo.h +++ b/sources/queued/include/queued/QueuedSystemInfo.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedTokenManager.h b/sources/queued/include/queued/QueuedTokenManager.h index 0bb352a..a85729b 100644 --- a/sources/queued/include/queued/QueuedTokenManager.h +++ b/sources/queued/include/queued/QueuedTokenManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedUser.h b/sources/queued/include/queued/QueuedUser.h index 68c445f..a1f6559 100644 --- a/sources/queued/include/queued/QueuedUser.h +++ b/sources/queued/include/queued/QueuedUser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/include/queued/QueuedUserManager.h b/sources/queued/include/queued/QueuedUserManager.h index 49ae71c..62d198b 100644 --- a/sources/queued/include/queued/QueuedUserManager.h +++ b/sources/queued/include/queued/QueuedUserManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedAdvancedSettings.cpp b/sources/queued/src/QueuedAdvancedSettings.cpp index a37b34a..f4e7ec3 100644 --- a/sources/queued/src/QueuedAdvancedSettings.cpp +++ b/sources/queued/src/QueuedAdvancedSettings.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedCore.cpp b/sources/queued/src/QueuedCore.cpp index bcf96af..cefc160 100644 --- a/sources/queued/src/QueuedCore.cpp +++ b/sources/queued/src/QueuedCore.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedCoreAdaptor.cpp b/sources/queued/src/QueuedCoreAdaptor.cpp index 4a2d69c..c5435b3 100644 --- a/sources/queued/src/QueuedCoreAdaptor.cpp +++ b/sources/queued/src/QueuedCoreAdaptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,10 +33,10 @@ bool QueuedCoreAdaptor::auth(const QString &_token) { QVariantList args = {_token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/TryAuth", - args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "TryAuth", args) + .at(0) .toBool(); } @@ -49,9 +49,10 @@ QString QueuedCoreAdaptor::auth(const QString &_name, const QString &_password) qCDebug(LOG_DBUS) << "Auth user" << _name; QVariantList args = {_name, _password}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/Auth", args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "Auth", args) + .at(0) .toString(); } @@ -65,11 +66,12 @@ bool QueuedCoreAdaptor::sendOptionEdit(const QString &_key, { qCDebug(LOG_DBUS) << "Edit option" << _key << "to" << _value; - QVariantList args = {_key, _value, _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/OptionEdit", - args)) + QVariantList args + = {_key, QVariant::fromValue(QDBusVariant(_value)), _token}; + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "OptionEdit", args) + .at(0) .toBool(); } @@ -83,10 +85,10 @@ bool QueuedCoreAdaptor::sendPluginAdd(const QString &_plugin, qCDebug(LOG_DBUS) << "Add plugin" << _plugin; QVariantList args = {_plugin, _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/PluginAdd", - args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "PluginAdd", args) + .at(0) .toBool(); } @@ -100,10 +102,10 @@ bool QueuedCoreAdaptor::sendPluginRemove(const QString &_plugin, qCDebug(LOG_DBUS) << "Remove plugin" << _plugin; QVariantList args = {_plugin, _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/PluginRemove", - args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "PluginRemove", args) + .at(0) .toBool(); } @@ -128,10 +130,10 @@ long long QueuedCoreAdaptor::sendTaskAdd( limits.gpumemory, limits.storage, _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/TaskAdd", - args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "TaskAdd", args) + .at(0) .toLongLong(); } @@ -161,10 +163,10 @@ bool QueuedCoreAdaptor::sendTaskEdit( limits.gpumemory, limits.storage, _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/TaskEdit", - args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "TaskEdit", args) + .at(0) .toBool(); } @@ -178,10 +180,10 @@ bool QueuedCoreAdaptor::sendTaskStart(const long long _id, qCDebug(LOG_DBUS) << "Start task" << _id; QVariantList args = {_id, _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/TaskStart", - args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "TaskStart", args) + .at(0) .toBool(); } @@ -194,10 +196,10 @@ bool QueuedCoreAdaptor::sendTaskStop(const long long _id, const QString &_token) qCDebug(LOG_DBUS) << "Stop task" << _id; QVariantList args = {_id, _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/TaskStop", - args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "TaskStop", args) + .at(0) .toBool(); } @@ -222,10 +224,10 @@ long long QueuedCoreAdaptor::sendUserAdd( limits.gpumemory, limits.storage, _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/UserAdd", - args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "UserAdd", args) + .at(0) .toLongLong(); } @@ -250,10 +252,10 @@ bool QueuedCoreAdaptor::sendUserEdit( limits.gpumemory, limits.storage, _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, "/UserEdit", - args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "UserEdit", args) + .at(0) .toBool(); } @@ -269,10 +271,10 @@ bool QueuedCoreAdaptor::sendUserPermissionAdd( << "to" << _id; QVariantList args = {_id, static_cast(_permission), _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, - "/UserPermissionAdd", args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "UserPermissionAdd", args) + .at(0) .toBool(); } @@ -288,10 +290,10 @@ bool QueuedCoreAdaptor::sendUserPermissionRemove( << "from" << _id; QVariantList args = {_id, static_cast(_permission), _token}; - return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, - QueuedConfig::DBUS_OBJECT_PATH, - QueuedConfig::DBUS_SERVICE, - "/UserPermissionRemove", args)) + return sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_OBJECT_PATH, + QueuedConfig::DBUS_SERVICE, "UserPermissionRemove", args) + .at(0) .toBool(); } @@ -304,9 +306,10 @@ QVariant QueuedCoreAdaptor::getOption(const QString &_property) qCDebug(LOG_DBUS) << "Get option" << _property; QVariantList args = {_property}; - return toNativeType(sendRequest( - QueuedConfig::DBUS_SERVICE, QueuedConfig::DBUS_PROPERTY_PATH, - QueuedConfig::DBUS_SERVICE, "/Option", args)); + return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, + QueuedConfig::DBUS_PROPERTY_PATH, + QueuedConfig::DBUS_SERVICE, "Option", args) + .at(0)); } @@ -321,7 +324,8 @@ QVariant QueuedCoreAdaptor::getTask(const long long _id, QVariantList args = {_id, _property}; return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, QueuedConfig::DBUS_PROPERTY_PATH, - QueuedConfig::DBUS_SERVICE, "/Task", args)); + QueuedConfig::DBUS_SERVICE, "Task", args) + .at(0)); } @@ -336,7 +340,8 @@ QVariant QueuedCoreAdaptor::getUser(const long long _id, QVariantList args = {_id, _property}; return toNativeType(sendRequest(QueuedConfig::DBUS_SERVICE, QueuedConfig::DBUS_PROPERTY_PATH, - QueuedConfig::DBUS_SERVICE, "/User", args)); + QueuedConfig::DBUS_SERVICE, "User", args) + .at(0)); } diff --git a/sources/queued/src/QueuedCoreInterface.cpp b/sources/queued/src/QueuedCoreInterface.cpp index 6591c29..817234e 100644 --- a/sources/queued/src/QueuedCoreInterface.cpp +++ b/sources/queued/src/QueuedCoreInterface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedCorePropertiesInterface.cpp b/sources/queued/src/QueuedCorePropertiesInterface.cpp index bccc472..e10a054 100644 --- a/sources/queued/src/QueuedCorePropertiesInterface.cpp +++ b/sources/queued/src/QueuedCorePropertiesInterface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedDatabase.cpp b/sources/queued/src/QueuedDatabase.cpp index c8c81e8..5ac6cee 100644 --- a/sources/queued/src/QueuedDatabase.cpp +++ b/sources/queued/src/QueuedDatabase.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedDatabaseManager.cpp b/sources/queued/src/QueuedDatabaseManager.cpp index c1e1d01..c6d3a7e 100644 --- a/sources/queued/src/QueuedDatabaseManager.cpp +++ b/sources/queued/src/QueuedDatabaseManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedDebug.cpp b/sources/queued/src/QueuedDebug.cpp index 44bf1be..9f812af 100644 --- a/sources/queued/src/QueuedDebug.cpp +++ b/sources/queued/src/QueuedDebug.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedLimits.cpp b/sources/queued/src/QueuedLimits.cpp index d349cde..62986a1 100644 --- a/sources/queued/src/QueuedLimits.cpp +++ b/sources/queued/src/QueuedLimits.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedPluginManager.cpp b/sources/queued/src/QueuedPluginManager.cpp index ef1646f..2a448dd 100644 --- a/sources/queued/src/QueuedPluginManager.cpp +++ b/sources/queued/src/QueuedPluginManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedProcess.cpp b/sources/queued/src/QueuedProcess.cpp index a1bfd20..10537d9 100644 --- a/sources/queued/src/QueuedProcess.cpp +++ b/sources/queued/src/QueuedProcess.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedProcessManager.cpp b/sources/queued/src/QueuedProcessManager.cpp index 46dda31..75d791f 100644 --- a/sources/queued/src/QueuedProcessManager.cpp +++ b/sources/queued/src/QueuedProcessManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedReportManager.cpp b/sources/queued/src/QueuedReportManager.cpp index 6669f2f..bbf1b70 100644 --- a/sources/queued/src/QueuedReportManager.cpp +++ b/sources/queued/src/QueuedReportManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedSettings.cpp b/sources/queued/src/QueuedSettings.cpp index a991afa..bd9fd61 100644 --- a/sources/queued/src/QueuedSettings.cpp +++ b/sources/queued/src/QueuedSettings.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedSystemInfo.cpp b/sources/queued/src/QueuedSystemInfo.cpp index fa0dbb8..a68d525 100644 --- a/sources/queued/src/QueuedSystemInfo.cpp +++ b/sources/queued/src/QueuedSystemInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedTokenManager.cpp b/sources/queued/src/QueuedTokenManager.cpp index 1da2fe3..58485ce 100644 --- a/sources/queued/src/QueuedTokenManager.cpp +++ b/sources/queued/src/QueuedTokenManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedUser.cpp b/sources/queued/src/QueuedUser.cpp index 524bf1c..46ca8ec 100644 --- a/sources/queued/src/QueuedUser.cpp +++ b/sources/queued/src/QueuedUser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queued/src/QueuedUserManager.cpp b/sources/queued/src/QueuedUserManager.cpp index 29bfbb3..c45d4bb 100644 --- a/sources/queued/src/QueuedUserManager.cpp +++ b/sources/queued/src/QueuedUserManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queuedctl/src/QueuedctlAuth.cpp b/sources/queuedctl/src/QueuedctlAuth.cpp index d7510c5..349b8a7 100644 --- a/sources/queuedctl/src/QueuedctlAuth.cpp +++ b/sources/queuedctl/src/QueuedctlAuth.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -64,7 +64,6 @@ QString QueuedctlAuth::getToken(const QString &_cache, const QString &_user) void QueuedctlAuth::parser(QCommandLineParser &_parser) { - _parser.clearPositionalArguments(); } diff --git a/sources/queuedctl/src/QueuedctlAuth.h b/sources/queuedctl/src/QueuedctlAuth.h index 2ddfb9e..b2f205a 100644 --- a/sources/queuedctl/src/QueuedctlAuth.h +++ b/sources/queuedctl/src/QueuedctlAuth.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/sources/queuedctl/src/QueuedctlCommon.cpp b/sources/queuedctl/src/QueuedctlCommon.cpp new file mode 100644 index 0000000..15f9380 --- /dev/null +++ b/sources/queuedctl/src/QueuedctlCommon.cpp @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2017 Evgeniy Alekseev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + */ + + +#include "QueuedctlCommon.h" + +#include + +#include "QueuedctlAuth.h" +#include "QueuedctlOption.h" +#include "QueuedctlTask.h" + + +void QueuedctlCommon::checkArgs(const QStringList &_args, const int _count, + QCommandLineParser &_parser) +{ + qCDebug(LOG_APP) << "Check args count" << _args << _count; + + if (_args.count() != _count) { + qWarning() << "Invalid command"; + _parser.showHelp(1); + } +} + + +void QueuedctlCommon::preprocess(const QStringList &_args, + QCommandLineParser &_parser) +{ + qCDebug(LOG_APP) << "Preprocess command" << _args; + + QString command = _args.isEmpty() ? QString() : _args.first(); + // HACK: workaround to show valid help message + _parser.addPositionalArgument(command, "Command to execute."); + + if (command == "auth") + QueuedctlAuth::parser(_parser); + else if (command == "option-get") + QueuedctlOption::parserGet(_parser); + else if (command == "option-set") + QueuedctlOption::parserSet(_parser); + else if (command == "task-add") + QueuedctlTask::parserAdd(_parser); + else if (command == "task-get") + QueuedctlTask::parserGet(_parser); + else if (command == "task-set") + QueuedctlTask::parserSet(_parser); + else if (command == "user-add") { + } else if (command == "user-get") { + } else if (command == "user-set") { + } else if (!command.isEmpty()) + checkArgs(_args, -1, _parser); +} + + +void QueuedctlCommon::print(QueuedctlResult &_result) +{ + if (!_result.status) + qInfo() << "Subprocess returns error"; + if (!_result.output.isEmpty()) + QDebug(QtMsgType::QtInfoMsg).noquote() << _result.output; +} + + +QueuedctlCommon::QueuedctlResult +QueuedctlCommon::process(QCommandLineParser &_parser, const QString &_cache, + const QString &_user) +{ + qCDebug(LOG_APP) << "Process command with args" + << "using auth" << _cache << _user; + + QueuedctlResult result; + QStringList args = _parser.positionalArguments(); + QString command = args.isEmpty() ? QString() : args.first(); + + if (command == "auth") { + checkArgs(args, 1, _parser); + QString token = QueuedctlAuth::auth(_user); + result.status = !token.isEmpty(); + if (result.status) + QueuedctlAuth::setToken(token, _cache); + } else if (command == "option-get") { + checkArgs(args, 2, _parser); + QVariant value = QueuedctlOption::getOption(args.at(1)); + result.status = value.isValid(); + result.output = value.toString(); + } else if (command == "option-set") { + checkArgs(args, 3, _parser); + QString token = QueuedctlAuth::getToken(_cache, _user); + result.status + = QueuedctlOption::editOption(args.at(1), args.at(2), token); + if (result.status) + result.output + = QString("Option %1 set to %2").arg(args.at(1), args.at(2)); + else + result.output = QString("Could not set option %1 to %2") + .arg(args.at(1), args.at(2)); + } else if (command == "task-get") { + checkArgs(args, 3, _parser); + QVariant value + = QueuedctlTask::getTask(args.at(1).toLongLong(), args.at(2)); + result.status = value.isValid(); + result.output = value.toString(); + } else if (command == "task-set") { + checkArgs(args, 2, _parser); + QString token = QueuedctlAuth::getToken(_cache, _user); + auto definitions = QueuedctlTask::getDefinitions(_parser); + result.status = QueuedctlTask::setTask(args.at(1).toLongLong(), + definitions, token); + } + + return result; +} diff --git a/sources/queuedctl/src/QueuedctlCommon.h b/sources/queuedctl/src/QueuedctlCommon.h new file mode 100644 index 0000000..8b58afa --- /dev/null +++ b/sources/queuedctl/src/QueuedctlCommon.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017 Evgeniy Alekseev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + */ + + +#ifndef QUEUEDCTLCOMMON_H +#define QUEUEDCTLCOMMON_H + +#include + + +namespace QueuedctlCommon +{ +typedef struct { + bool status = false; + QString output; +} QueuedctlResult; +void checkArgs(const QStringList &_args, const int _count, + QCommandLineParser &_parser); +void preprocess(const QStringList &_args, QCommandLineParser &_parser); +void print(QueuedctlResult &_result); +QueuedctlResult process(QCommandLineParser &_parser, const QString &_cache, + const QString &_user); +}; + + +#endif /* QUEUEDCTLCOMMON_H */ diff --git a/sources/queuedctl/src/QueuedctlOption.cpp b/sources/queuedctl/src/QueuedctlOption.cpp index 928bde5..7c68004 100644 --- a/sources/queuedctl/src/QueuedctlOption.cpp +++ b/sources/queuedctl/src/QueuedctlOption.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Evgeniy Alekseev + * Copyright (c) 2017 Evgeniy Alekseev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -18,22 +18,32 @@ #include -#include "QueuedctlAuth.h" - bool QueuedctlOption::editOption(const QString &_option, const QVariant &_value, - const QString &_cache, const QString &_user) + const QString &_token) { qCDebug(LOG_APP) << "Edit option" << _option << "to" << _value; - QString token = QueuedctlAuth::getToken(_cache, _user); - return QueuedCoreAdaptor::sendOptionEdit(_option, _value, token); + return QueuedCoreAdaptor::sendOptionEdit(_option, _value, _token); } -void QueuedctlOption::parser(QCommandLineParser &_parser) +QVariant QueuedctlOption::getOption(const QString &_option) { - _parser.clearPositionalArguments(); - _parser.addPositionalArgument("option", "Option name."); - _parser.addPositionalArgument("value", "Option value."); + qCDebug(LOG_APP) << "Get option" << _option; + + return QueuedCoreAdaptor::getOption(_option); +} + + +void QueuedctlOption::parserGet(QCommandLineParser &_parser) +{ + _parser.addPositionalArgument("option", "Option name.", "