2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2020 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2020-03-11 17:03:23 +02:00
|
|
|
|
|
|
|
|
#include "commandbuilder.h"
|
|
|
|
|
|
2023-01-19 17:19:57 +01:00
|
|
|
#include "incredibuildtr.h"
|
|
|
|
|
|
2021-09-28 12:29:29 +02:00
|
|
|
using namespace Utils;
|
|
|
|
|
|
2023-01-19 17:19:57 +01:00
|
|
|
namespace IncrediBuild::Internal {
|
2020-03-11 17:03:23 +02:00
|
|
|
|
2021-09-28 12:29:29 +02:00
|
|
|
const char CUSTOMCOMMANDBUILDER_COMMAND[] = "IncrediBuild.BuildConsole.%1.Command";
|
|
|
|
|
const char CUSTOMCOMMANDBUILDER_ARGS[] = "IncrediBuild.BuildConsole.%1.Arguments";
|
2020-03-11 17:03:23 +02:00
|
|
|
|
2023-01-19 17:19:57 +01:00
|
|
|
QString CommandBuilder::displayName() const
|
|
|
|
|
{
|
|
|
|
|
return Tr::tr("Custom Command");
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-23 16:53:06 +02:00
|
|
|
void CommandBuilder::fromMap(const Store &map)
|
2020-03-11 17:03:23 +02:00
|
|
|
{
|
2023-01-03 12:31:52 +01:00
|
|
|
m_command = FilePath::fromSettings(map.value(QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id())));
|
2021-09-28 12:29:29 +02:00
|
|
|
m_args = map.value(QString(CUSTOMCOMMANDBUILDER_ARGS).arg(id())).toString();
|
2020-03-11 17:03:23 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-06 18:11:52 +02:00
|
|
|
void CommandBuilder::toMap(QVariantMap *map) const
|
2020-03-11 17:03:23 +02:00
|
|
|
{
|
2023-01-03 12:31:52 +01:00
|
|
|
(*map)[QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id())] = m_command.toSettings();
|
2021-09-28 12:29:29 +02:00
|
|
|
(*map)[QString(CUSTOMCOMMANDBUILDER_ARGS).arg(id())] = QVariant(m_args);
|
2020-03-11 17:03:23 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-28 12:29:29 +02:00
|
|
|
void CommandBuilder::setCommand(const FilePath &command)
|
2020-03-11 17:03:23 +02:00
|
|
|
{
|
2020-08-28 10:38:20 +02:00
|
|
|
m_command = command;
|
2020-03-11 17:03:23 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-06 18:11:52 +02:00
|
|
|
void CommandBuilder::setArguments(const QString &arguments)
|
2020-03-11 17:03:23 +02:00
|
|
|
{
|
2020-08-06 18:11:52 +02:00
|
|
|
if (arguments == defaultArguments())
|
|
|
|
|
m_args.clear();
|
|
|
|
|
else
|
|
|
|
|
m_args = arguments;
|
2020-03-11 17:03:23 +02:00
|
|
|
}
|
|
|
|
|
|
2023-01-19 17:19:57 +01:00
|
|
|
} // IncrediBuild::Internal
|