2022-02-01 14:30:35 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2022-02-16 16:48:28 +01:00
|
|
|
** Copyright (C) 2022 The Qt Company Ltd.
|
2022-02-01 14:30:35 +01:00
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-02-11 13:51:42 +01:00
|
|
|
#include "mcuabstractpackage.h"
|
2022-06-02 16:13:08 +02:00
|
|
|
#include "mcusupportversiondetection.h"
|
2022-04-22 11:41:33 +02:00
|
|
|
#include "settingshandler.h"
|
2022-02-01 14:30:35 +01:00
|
|
|
|
|
|
|
|
#include <utils/filepath.h>
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QWidget)
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class ToolChain;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Utils {
|
|
|
|
|
class PathChooser;
|
|
|
|
|
class InfoLabel;
|
2022-02-16 16:48:28 +01:00
|
|
|
class Id;
|
2022-02-01 14:30:35 +01:00
|
|
|
} // namespace Utils
|
|
|
|
|
|
|
|
|
|
namespace McuSupport {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2022-02-11 13:51:42 +01:00
|
|
|
class McuPackage : public McuAbstractPackage
|
2022-02-01 14:30:35 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2022-04-22 11:41:33 +02:00
|
|
|
McuPackage(const SettingsHandler::Ptr &settingsHandler,
|
|
|
|
|
const QString &label,
|
2022-02-11 13:51:42 +01:00
|
|
|
const Utils::FilePath &defaultPath,
|
2022-02-21 15:24:46 +01:00
|
|
|
const Utils::FilePath &detectionPath,
|
2022-02-11 13:51:42 +01:00
|
|
|
const QString &settingsKey,
|
2022-02-22 13:36:55 +01:00
|
|
|
const QString &cmakeVarName,
|
|
|
|
|
const QString &envVarName,
|
2022-06-07 20:58:42 +02:00
|
|
|
const QStringList &versions = {},
|
2022-02-11 13:51:42 +01:00
|
|
|
const QString &downloadUrl = {},
|
2022-02-21 15:24:46 +01:00
|
|
|
const McuPackageVersionDetector *versionDetector = nullptr,
|
|
|
|
|
const bool addToPath = false,
|
|
|
|
|
const Utils::FilePath &relativePathModifier = Utils::FilePath());
|
|
|
|
|
|
2022-03-28 16:42:51 +02:00
|
|
|
~McuPackage() override = default;
|
|
|
|
|
|
2022-02-21 15:24:46 +01:00
|
|
|
QString label() const override;
|
2022-03-23 13:24:02 +01:00
|
|
|
QString cmakeVariableName() const override;
|
|
|
|
|
QString environmentVariableName() const override;
|
2022-02-21 15:24:46 +01:00
|
|
|
bool isAddToSystemPath() const override;
|
2022-06-07 20:58:42 +02:00
|
|
|
QStringList versions() const override;
|
2022-02-21 15:24:46 +01:00
|
|
|
|
2022-02-11 13:51:42 +01:00
|
|
|
Utils::FilePath basePath() const override;
|
|
|
|
|
Utils::FilePath path() const override;
|
|
|
|
|
Utils::FilePath defaultPath() const override;
|
2022-02-21 15:24:46 +01:00
|
|
|
Utils::FilePath detectionPath() const override;
|
2022-03-01 22:35:33 +01:00
|
|
|
QString settingsKey() const final;
|
2022-02-01 14:30:35 +01:00
|
|
|
|
2022-02-21 15:24:46 +01:00
|
|
|
void updateStatus() override;
|
2022-02-11 13:51:42 +01:00
|
|
|
Status status() const override;
|
2022-02-21 15:24:46 +01:00
|
|
|
bool isValidStatus() const override;
|
|
|
|
|
QString statusText() const override;
|
|
|
|
|
|
2022-02-11 13:51:42 +01:00
|
|
|
bool writeToSettings() const override;
|
2022-02-01 14:30:35 +01:00
|
|
|
|
2022-02-11 13:51:42 +01:00
|
|
|
QWidget *widget() override;
|
2022-07-04 22:30:42 +02:00
|
|
|
const McuPackageVersionDetector *getVersionDetector() const override;
|
2022-02-01 14:30:35 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void updatePath();
|
|
|
|
|
void updateStatusUi();
|
|
|
|
|
|
2022-04-22 11:41:33 +02:00
|
|
|
SettingsHandler::Ptr settingsHandler;
|
|
|
|
|
|
2022-02-01 14:30:35 +01:00
|
|
|
Utils::PathChooser *m_fileChooser = nullptr;
|
|
|
|
|
Utils::InfoLabel *m_infoLabel = nullptr;
|
|
|
|
|
|
|
|
|
|
const QString m_label;
|
|
|
|
|
const Utils::FilePath m_defaultPath;
|
2022-02-21 15:24:46 +01:00
|
|
|
const Utils::FilePath m_detectionPath;
|
2022-02-01 14:30:35 +01:00
|
|
|
const QString m_settingsKey;
|
2022-06-02 16:13:08 +02:00
|
|
|
QScopedPointer<const McuPackageVersionDetector> m_versionDetector;
|
2022-02-01 14:30:35 +01:00
|
|
|
|
|
|
|
|
Utils::FilePath m_path;
|
2022-02-21 15:24:46 +01:00
|
|
|
Utils::FilePath m_relativePathModifier; // relative path to m_path to be returned by path()
|
2022-02-01 14:30:35 +01:00
|
|
|
QString m_detectedVersion;
|
|
|
|
|
QStringList m_versions;
|
2022-02-22 13:36:55 +01:00
|
|
|
const QString m_cmakeVariableName;
|
2022-02-01 16:07:50 +01:00
|
|
|
const QString m_environmentVariableName;
|
|
|
|
|
const QString m_downloadUrl;
|
2022-02-21 15:24:46 +01:00
|
|
|
const bool m_addToSystemPath;
|
2022-02-01 14:30:35 +01:00
|
|
|
|
2022-02-11 13:51:42 +01:00
|
|
|
Status m_status = Status::InvalidPath;
|
2022-07-04 22:30:42 +02:00
|
|
|
}; // class McuPackage
|
2022-02-01 14:30:35 +01:00
|
|
|
|
2022-07-04 22:30:42 +02:00
|
|
|
class McuToolChainPackage final : public McuPackage
|
2022-02-01 14:30:35 +01:00
|
|
|
{
|
2022-03-28 16:42:51 +02:00
|
|
|
Q_OBJECT
|
2022-02-01 14:30:35 +01:00
|
|
|
public:
|
2022-02-21 15:24:46 +01:00
|
|
|
enum class ToolChainType { IAR, KEIL, MSVC, GCC, ArmGcc, GHS, GHSArm, Unsupported };
|
2022-02-01 14:30:35 +01:00
|
|
|
|
2022-04-22 11:41:33 +02:00
|
|
|
McuToolChainPackage(const SettingsHandler::Ptr &settingsHandler,
|
|
|
|
|
const QString &label,
|
2022-02-01 14:30:35 +01:00
|
|
|
const Utils::FilePath &defaultPath,
|
2022-02-21 15:24:46 +01:00
|
|
|
const Utils::FilePath &detectionPath,
|
2022-02-01 14:30:35 +01:00
|
|
|
const QString &settingsKey,
|
2022-02-21 15:24:46 +01:00
|
|
|
ToolChainType toolchainType,
|
2022-06-07 20:58:42 +02:00
|
|
|
const QStringList &versions,
|
|
|
|
|
const QString &cmakeVarName,
|
2022-07-04 22:30:42 +02:00
|
|
|
const QString &envVarName,
|
|
|
|
|
const McuPackageVersionDetector *versionDetector);
|
2022-02-01 14:30:35 +01:00
|
|
|
|
2022-02-21 15:24:46 +01:00
|
|
|
ToolChainType toolchainType() const;
|
2022-02-01 14:30:35 +01:00
|
|
|
bool isDesktopToolchain() const;
|
|
|
|
|
ProjectExplorer::ToolChain *toolChain(Utils::Id language) const;
|
|
|
|
|
QString toolChainName() const;
|
|
|
|
|
QVariant debuggerId() const;
|
|
|
|
|
|
2022-06-20 17:51:59 +03:00
|
|
|
static ProjectExplorer::ToolChain *msvcToolChain(Utils::Id language);
|
|
|
|
|
static ProjectExplorer::ToolChain *gccToolChain(Utils::Id language);
|
|
|
|
|
|
2022-02-01 14:30:35 +01:00
|
|
|
private:
|
2022-02-21 15:24:46 +01:00
|
|
|
const ToolChainType m_type;
|
2022-02-01 14:30:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace McuSupport
|
2022-04-04 15:40:56 +02:00
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(McuSupport::Internal::McuToolChainPackage::ToolChainType)
|