2021-07-26 13:17:06 +03:00
|
|
|
/*
|
2024-12-30 22:39:49 +01:00
|
|
|
* Copyright (C) 2021-2025 QuasarApp.
|
2021-07-26 13:17:06 +03:00
|
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
* of this license document, but changing it is not allowed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "optiondata.h"
|
|
|
|
|
|
|
|
namespace QuasarAppUtils{
|
|
|
|
|
2021-07-27 17:24:43 +03:00
|
|
|
OptionData::OptionData(const QStringList& name,
|
2021-07-26 13:17:06 +03:00
|
|
|
const QString& arguments,
|
|
|
|
const QString& description,
|
|
|
|
const QString& example,
|
|
|
|
const QString& depricatedMsg,
|
|
|
|
bool removed) {
|
|
|
|
|
2021-07-27 17:24:43 +03:00
|
|
|
setNames(name);
|
2021-07-26 13:17:06 +03:00
|
|
|
setArguments(arguments);
|
|
|
|
setDescription(description);
|
|
|
|
setExample(example);
|
|
|
|
setDepricatedMsg(depricatedMsg);
|
|
|
|
_removed = removed;
|
|
|
|
}
|
|
|
|
|
2021-07-27 17:24:43 +03:00
|
|
|
const QStringList &OptionData::names() const {
|
2021-07-26 13:17:06 +03:00
|
|
|
return _name;
|
|
|
|
}
|
|
|
|
|
2021-07-27 17:24:43 +03:00
|
|
|
void OptionData::setNames(const QStringList &newName) {
|
2021-07-26 13:17:06 +03:00
|
|
|
_name = newName;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &OptionData::description() const {
|
|
|
|
return _description;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OptionData::setDescription(const QString &newDescription) {
|
|
|
|
_description = newDescription;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &OptionData::example() const {
|
|
|
|
return _example;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OptionData::setExample(const QString &newExample) {
|
|
|
|
_example = newExample;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &OptionData::arguments() const {
|
|
|
|
return _arguments;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OptionData::setArguments(const QString &newArguments) {
|
|
|
|
_arguments = newArguments;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &OptionData::depricatedMsg() const {
|
|
|
|
return _depricatedMsg;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OptionData::setDepricatedMsg(const QString &newDepricatedMsg) {
|
|
|
|
_depricatedMsg = newDepricatedMsg;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OptionData::isRemoved() const {
|
|
|
|
return _removed;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OptionData::isDepricated() const {
|
|
|
|
return depricatedMsg().size();
|
|
|
|
}
|
|
|
|
|
|
|
|
Help::Options OptionData::toHelp() const {
|
2021-07-28 12:38:44 +03:00
|
|
|
QString left = names().join(" / ") + " " + arguments();
|
|
|
|
|
|
|
|
QString right = description();
|
|
|
|
if (example().size()) {
|
|
|
|
right += " Example: " + example();
|
|
|
|
}
|
|
|
|
|
|
|
|
return {{left, {right}}};
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OptionData::isValid() const {
|
|
|
|
return names().size();
|
2021-07-26 13:17:06 +03:00
|
|
|
}
|
|
|
|
}
|