forked from qt-creator/qt-creator
Move KitAspectWidget definitions alongside their KitAspects
A KitAspectWidget class is tightly coupled with the respective KitAspect, and no one else ever needs to see any KitAspectWidget subclass at build time. Change-Id: I1883af3b054c225e1ff5dd913118715bfdbaacfc Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -50,6 +50,31 @@ using namespace Utils;
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
class AndroidGdbServerKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Android::Internal::AndroidGdbServerKitAspect)
|
||||
public:
|
||||
AndroidGdbServerKitAspectWidget(Kit *kit, const KitAspect *ki);
|
||||
~AndroidGdbServerKitAspectWidget() override;
|
||||
|
||||
QString displayName() const override;
|
||||
QString toolTip() const override;
|
||||
void makeReadOnly() override;
|
||||
void refresh() override;
|
||||
bool visibleInKit() override;
|
||||
|
||||
QWidget *mainWidget() const override;
|
||||
QWidget *buttonWidget() const override;
|
||||
|
||||
private:
|
||||
void autoDetectDebugger();
|
||||
void showDialog();
|
||||
|
||||
QLabel *m_label;
|
||||
QPushButton *m_button;
|
||||
};
|
||||
|
||||
|
||||
AndroidGdbServerKitAspect::AndroidGdbServerKitAspect()
|
||||
{
|
||||
setId(AndroidGdbServerKitAspect::id());
|
||||
|
@@ -26,41 +26,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/kitconfigwidget.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
class AndroidGdbServerKitAspectWidget : public ProjectExplorer::KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AndroidGdbServerKitAspectWidget(ProjectExplorer::Kit *kit,
|
||||
const ProjectExplorer::KitAspect *ki);
|
||||
~AndroidGdbServerKitAspectWidget() override;
|
||||
|
||||
QString displayName() const override;
|
||||
QString toolTip() const override;
|
||||
void makeReadOnly() override;
|
||||
void refresh() override;
|
||||
bool visibleInKit() override;
|
||||
|
||||
QWidget *mainWidget() const override;
|
||||
QWidget *buttonWidget() const override;
|
||||
|
||||
private:
|
||||
void autoDetectDebugger();
|
||||
void showDialog();
|
||||
|
||||
QLabel *m_label;
|
||||
QPushButton *m_button;
|
||||
};
|
||||
|
||||
class AndroidGdbServerKitAspect : public ProjectExplorer::KitAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -1,142 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 Canonical Ltd.
|
||||
** 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
|
||||
|
||||
#include <projectexplorer/kitconfigwidget.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QDialog;
|
||||
class QLabel;
|
||||
class QPlainTextEdit;
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Kit;
|
||||
class KitAspect;
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
class CMakeTool;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeKitAspectWidget:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
class CMakeKitAspectWidget : public ProjectExplorer::KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CMakeKitAspectWidget(ProjectExplorer::Kit *kit, const ProjectExplorer::KitAspect *ki);
|
||||
~CMakeKitAspectWidget() override;
|
||||
|
||||
// KitAspectWidget interface
|
||||
QString displayName() const override;
|
||||
void makeReadOnly() override;
|
||||
void refresh() override;
|
||||
QWidget *mainWidget() const override;
|
||||
QWidget *buttonWidget() const override;
|
||||
QString toolTip() const override;
|
||||
|
||||
private:
|
||||
int indexOf(const Core::Id &id);
|
||||
void updateComboBox();
|
||||
void cmakeToolAdded(const Core::Id &id);
|
||||
void cmakeToolUpdated(const Core::Id &id);
|
||||
void cmakeToolRemoved(const Core::Id &id);
|
||||
void currentCMakeToolChanged(int index);
|
||||
void manageCMakeTools();
|
||||
|
||||
bool m_removingItem = false;
|
||||
QComboBox *m_comboBox;
|
||||
QPushButton *m_manageButton;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeGeneratorKitAspectWidget:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
class CMakeGeneratorKitAspectWidget : public ProjectExplorer::KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CMakeGeneratorKitAspectWidget(ProjectExplorer::Kit *kit, const ProjectExplorer::KitAspect *ki);
|
||||
~CMakeGeneratorKitAspectWidget() override;
|
||||
|
||||
// KitAspectWidget interface
|
||||
QString displayName() const override;
|
||||
void makeReadOnly() override;
|
||||
void refresh() override;
|
||||
QWidget *mainWidget() const override;
|
||||
QWidget *buttonWidget() const override;
|
||||
QString toolTip() const override;
|
||||
|
||||
private:
|
||||
void changeGenerator();
|
||||
|
||||
bool m_ignoreChange = false;
|
||||
QLabel *m_label;
|
||||
QPushButton *m_changeButton;
|
||||
CMakeTool *m_currentTool = nullptr;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeConfigurationKitAspectWidget:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
class CMakeConfigurationKitAspectWidget : public ProjectExplorer::KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CMakeConfigurationKitAspectWidget(ProjectExplorer::Kit *kit, const ProjectExplorer::KitAspect *ki);
|
||||
|
||||
// KitAspectWidget interface
|
||||
QString displayName() const override;
|
||||
void makeReadOnly() override;
|
||||
void refresh() override;
|
||||
QWidget *mainWidget() const override;
|
||||
QWidget *buttonWidget() const override;
|
||||
QString toolTip() const override;
|
||||
|
||||
private:
|
||||
void editConfigurationChanges();
|
||||
|
||||
void applyChanges();
|
||||
void closeChangesDialog();
|
||||
void acceptChangesDialog();
|
||||
|
||||
QLabel *m_summaryLabel;
|
||||
QPushButton *m_manageButton;
|
||||
QDialog *m_dialog = nullptr;
|
||||
QPlainTextEdit *m_editor = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
@@ -24,12 +24,13 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "cmakekitinformation.h"
|
||||
#include "cmakekitconfigwidget.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmaketoolmanager.h"
|
||||
#include "cmaketool.h"
|
||||
|
||||
#include <app/app_version.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/variablechooser.h>
|
||||
#include <projectexplorer/task.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
@@ -37,16 +38,26 @@
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/elidinglabel.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QPointer>
|
||||
#include <QPushButton>
|
||||
#include <QVariant>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeKitAspect:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -59,9 +70,144 @@ static Core::Id defaultCMakeToolId()
|
||||
|
||||
static const char TOOL_ID[] = "CMakeProjectManager.CMakeKitInformation";
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeKitAspect:
|
||||
// --------------------------------------------------------------------
|
||||
class CMakeKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeKitAspect)
|
||||
public:
|
||||
CMakeKitAspectWidget(Kit *kit, const KitAspect *ki) : KitAspectWidget(kit, ki),
|
||||
m_comboBox(new QComboBox),
|
||||
m_manageButton(new QPushButton(KitAspectWidget::msgManage()))
|
||||
{
|
||||
m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
|
||||
m_comboBox->setEnabled(false);
|
||||
m_comboBox->setToolTip(toolTip());
|
||||
|
||||
foreach (CMakeTool *tool, CMakeToolManager::cmakeTools())
|
||||
cmakeToolAdded(tool->id());
|
||||
|
||||
updateComboBox();
|
||||
refresh();
|
||||
connect(m_comboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &CMakeKitAspectWidget::currentCMakeToolChanged);
|
||||
|
||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||
connect(m_manageButton, &QPushButton::clicked,
|
||||
this, &CMakeKitAspectWidget::manageCMakeTools);
|
||||
|
||||
CMakeToolManager *cmakeMgr = CMakeToolManager::instance();
|
||||
connect(cmakeMgr, &CMakeToolManager::cmakeAdded,
|
||||
this, &CMakeKitAspectWidget::cmakeToolAdded);
|
||||
connect(cmakeMgr, &CMakeToolManager::cmakeRemoved,
|
||||
this, &CMakeKitAspectWidget::cmakeToolRemoved);
|
||||
connect(cmakeMgr, &CMakeToolManager::cmakeUpdated,
|
||||
this, &CMakeKitAspectWidget::cmakeToolUpdated);
|
||||
}
|
||||
|
||||
~CMakeKitAspectWidget() override
|
||||
{
|
||||
delete m_comboBox;
|
||||
delete m_manageButton;
|
||||
}
|
||||
|
||||
private:
|
||||
// KitAspectWidget interface
|
||||
QString displayName() const override { return tr("CMake Tool"); }
|
||||
void makeReadOnly() override { m_comboBox->setEnabled(false); }
|
||||
QWidget *mainWidget() const override { return m_comboBox; }
|
||||
QWidget *buttonWidget() const override { return m_manageButton; }
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(m_kit);
|
||||
m_comboBox->setCurrentIndex(tool ? indexOf(tool->id()) : -1);
|
||||
}
|
||||
|
||||
QString toolTip() const override
|
||||
{
|
||||
return tr("The CMake Tool to use when building a project with CMake.<br>"
|
||||
"This setting is ignored when using other build systems.");
|
||||
}
|
||||
|
||||
int indexOf(const Core::Id &id)
|
||||
{
|
||||
for (int i = 0; i < m_comboBox->count(); ++i) {
|
||||
if (id == Core::Id::fromSetting(m_comboBox->itemData(i)))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void updateComboBox()
|
||||
{
|
||||
// remove unavailable cmake tool:
|
||||
int pos = indexOf(Core::Id());
|
||||
if (pos >= 0)
|
||||
m_comboBox->removeItem(pos);
|
||||
|
||||
if (m_comboBox->count() == 0) {
|
||||
m_comboBox->addItem(tr("<No CMake Tool available>"),
|
||||
Core::Id().toSetting());
|
||||
m_comboBox->setEnabled(false);
|
||||
} else {
|
||||
m_comboBox->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void cmakeToolAdded(const Core::Id &id)
|
||||
{
|
||||
const CMakeTool *tool = CMakeToolManager::findById(id);
|
||||
QTC_ASSERT(tool, return);
|
||||
|
||||
m_comboBox->addItem(tool->displayName(), tool->id().toSetting());
|
||||
updateComboBox();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void cmakeToolUpdated(const Core::Id &id)
|
||||
{
|
||||
const int pos = indexOf(id);
|
||||
QTC_ASSERT(pos >= 0, return);
|
||||
|
||||
const CMakeTool *tool = CMakeToolManager::findById(id);
|
||||
QTC_ASSERT(tool, return);
|
||||
|
||||
m_comboBox->setItemText(pos, tool->displayName());
|
||||
}
|
||||
|
||||
void cmakeToolRemoved(const Core::Id &id)
|
||||
{
|
||||
const int pos = indexOf(id);
|
||||
QTC_ASSERT(pos >= 0, return);
|
||||
|
||||
// do not handle the current index changed signal
|
||||
m_removingItem = true;
|
||||
m_comboBox->removeItem(pos);
|
||||
m_removingItem = false;
|
||||
|
||||
// update the checkbox and set the current index
|
||||
updateComboBox();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void currentCMakeToolChanged(int index)
|
||||
{
|
||||
if (m_removingItem)
|
||||
return;
|
||||
|
||||
const Core::Id id = Core::Id::fromSetting(m_comboBox->itemData(index));
|
||||
CMakeKitAspect::setCMakeTool(m_kit, id);
|
||||
}
|
||||
|
||||
void manageCMakeTools()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Constants::CMAKE_SETTINGSPAGE_ID,
|
||||
buttonWidget());
|
||||
}
|
||||
|
||||
bool m_removingItem = false;
|
||||
QComboBox *m_comboBox;
|
||||
QPushButton *m_manageButton;
|
||||
};
|
||||
|
||||
CMakeKitAspect::CMakeKitAspect()
|
||||
{
|
||||
@@ -146,7 +292,7 @@ KitAspect::ItemList CMakeKitAspect::toUserOutput(const Kit *k) const
|
||||
KitAspectWidget *CMakeKitAspect::createConfigWidget(Kit *k) const
|
||||
{
|
||||
QTC_ASSERT(k, return nullptr);
|
||||
return new Internal::CMakeKitAspectWidget(k, this);
|
||||
return new CMakeKitAspectWidget(k, this);
|
||||
}
|
||||
|
||||
void CMakeKitAspect::addToMacroExpander(Kit *k, Utils::MacroExpander *expander) const
|
||||
@@ -177,6 +323,165 @@ static const char EXTRA_GENERATOR_KEY[] = "ExtraGenerator";
|
||||
static const char PLATFORM_KEY[] = "Platform";
|
||||
static const char TOOLSET_KEY[] = "Toolset";
|
||||
|
||||
class CMakeGeneratorKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeGeneratorKitAspect)
|
||||
public:
|
||||
CMakeGeneratorKitAspectWidget(Kit *kit, const ::KitAspect *ki)
|
||||
: KitAspectWidget(kit, ki),
|
||||
m_label(new QLabel),
|
||||
m_changeButton(new QPushButton)
|
||||
{
|
||||
m_label->setToolTip(toolTip());
|
||||
m_changeButton->setText(tr("Change..."));
|
||||
refresh();
|
||||
connect(m_changeButton, &QPushButton::clicked,
|
||||
this, &CMakeGeneratorKitAspectWidget::changeGenerator);
|
||||
}
|
||||
|
||||
~CMakeGeneratorKitAspectWidget() override
|
||||
{
|
||||
delete m_label;
|
||||
delete m_changeButton;
|
||||
}
|
||||
|
||||
private:
|
||||
// KitAspectWidget interface
|
||||
QString displayName() const override { return tr("CMake generator"); }
|
||||
void makeReadOnly() override { m_changeButton->setEnabled(false); }
|
||||
QWidget *mainWidget() const override { return m_label; }
|
||||
QWidget *buttonWidget() const override { return m_changeButton; }
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
|
||||
CMakeTool *const tool = CMakeKitAspect::cmakeTool(m_kit);
|
||||
if (tool != m_currentTool)
|
||||
m_currentTool = tool;
|
||||
|
||||
m_changeButton->setEnabled(m_currentTool);
|
||||
const QString generator = CMakeGeneratorKitAspect::generator(kit());
|
||||
const QString extraGenerator = CMakeGeneratorKitAspect::extraGenerator(kit());
|
||||
const QString platform = CMakeGeneratorKitAspect::platform(kit());
|
||||
const QString toolset = CMakeGeneratorKitAspect::toolset(kit());
|
||||
|
||||
const QString message = tr("%1 - %2, Platform: %3, Toolset: %4")
|
||||
.arg(extraGenerator.isEmpty() ? tr("<none>") : extraGenerator)
|
||||
.arg(generator.isEmpty() ? tr("<none>") : generator)
|
||||
.arg(platform.isEmpty() ? tr("<none>") : platform)
|
||||
.arg(toolset.isEmpty() ? tr("<none>") : toolset);
|
||||
m_label->setText(message);
|
||||
}
|
||||
|
||||
QString toolTip() const override
|
||||
{
|
||||
return tr("CMake generator defines how a project is built when using CMake.<br>"
|
||||
"This setting is ignored when using other build systems.");
|
||||
}
|
||||
|
||||
void changeGenerator()
|
||||
{
|
||||
QPointer<QDialog> changeDialog = new QDialog(m_changeButton);
|
||||
|
||||
// Disable help button in titlebar on windows:
|
||||
Qt::WindowFlags flags = changeDialog->windowFlags();
|
||||
flags &= ~Qt::WindowContextHelpButtonHint;
|
||||
flags |= Qt::MSWindowsFixedSizeDialogHint;
|
||||
changeDialog->setWindowFlags(flags);
|
||||
|
||||
changeDialog->setWindowTitle(tr("CMake Generator"));
|
||||
|
||||
auto *layout = new QGridLayout(changeDialog);
|
||||
layout->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
auto *cmakeLabel = new QLabel;
|
||||
cmakeLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
|
||||
auto *generatorCombo = new QComboBox;
|
||||
auto *extraGeneratorCombo = new QComboBox;
|
||||
auto *platformEdit = new QLineEdit;
|
||||
auto *toolsetEdit = new QLineEdit;
|
||||
|
||||
int row = 0;
|
||||
layout->addWidget(new QLabel(QLatin1String("Executable:")));
|
||||
layout->addWidget(cmakeLabel, row, 1);
|
||||
|
||||
++row;
|
||||
layout->addWidget(new QLabel(tr("Generator:")), row, 0);
|
||||
layout->addWidget(generatorCombo, row, 1);
|
||||
|
||||
++row;
|
||||
layout->addWidget(new QLabel(tr("Extra generator:")), row, 0);
|
||||
layout->addWidget(extraGeneratorCombo, row, 1);
|
||||
|
||||
++row;
|
||||
layout->addWidget(new QLabel(tr("Platform:")), row, 0);
|
||||
layout->addWidget(platformEdit, row, 1);
|
||||
|
||||
++row;
|
||||
layout->addWidget(new QLabel(tr("Toolset:")), row, 0);
|
||||
layout->addWidget(toolsetEdit, row, 1);
|
||||
|
||||
++row;
|
||||
auto *bb = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
||||
layout->addWidget(bb, row, 0, 1, 2);
|
||||
|
||||
connect(bb, &QDialogButtonBox::accepted, changeDialog.data(), &QDialog::accept);
|
||||
connect(bb, &QDialogButtonBox::rejected, changeDialog.data(), &QDialog::reject);
|
||||
|
||||
cmakeLabel->setText(m_currentTool->cmakeExecutable().toUserOutput());
|
||||
|
||||
QList<CMakeTool::Generator> generatorList = m_currentTool->supportedGenerators();
|
||||
Utils::sort(generatorList, &CMakeTool::Generator::name);
|
||||
|
||||
for (auto it = generatorList.constBegin(); it != generatorList.constEnd(); ++it)
|
||||
generatorCombo->addItem(it->name);
|
||||
|
||||
auto updateDialog = [&generatorList, generatorCombo, extraGeneratorCombo,
|
||||
platformEdit, toolsetEdit](const QString &name) {
|
||||
auto it = std::find_if(generatorList.constBegin(), generatorList.constEnd(),
|
||||
[name](const CMakeTool::Generator &g) { return g.name == name; });
|
||||
QTC_ASSERT(it != generatorList.constEnd(), return);
|
||||
generatorCombo->setCurrentText(name);
|
||||
|
||||
extraGeneratorCombo->clear();
|
||||
extraGeneratorCombo->addItem(tr("<none>"), QString());
|
||||
foreach (const QString &eg, it->extraGenerators)
|
||||
extraGeneratorCombo->addItem(eg, eg);
|
||||
extraGeneratorCombo->setEnabled(extraGeneratorCombo->count() > 1);
|
||||
|
||||
platformEdit->setEnabled(it->supportsPlatform);
|
||||
toolsetEdit->setEnabled(it->supportsToolset);
|
||||
};
|
||||
|
||||
updateDialog(CMakeGeneratorKitAspect::generator(kit()));
|
||||
|
||||
generatorCombo->setCurrentText(CMakeGeneratorKitAspect::generator(kit()));
|
||||
extraGeneratorCombo->setCurrentText(CMakeGeneratorKitAspect::extraGenerator(kit()));
|
||||
platformEdit->setText(platformEdit->isEnabled() ? CMakeGeneratorKitAspect::platform(kit()) : QLatin1String("<unsupported>"));
|
||||
toolsetEdit->setText(toolsetEdit->isEnabled() ? CMakeGeneratorKitAspect::toolset(kit()) : QLatin1String("<unsupported>"));
|
||||
|
||||
connect(generatorCombo, &QComboBox::currentTextChanged, updateDialog);
|
||||
|
||||
if (changeDialog->exec() == QDialog::Accepted) {
|
||||
if (!changeDialog)
|
||||
return;
|
||||
|
||||
CMakeGeneratorKitAspect::set(kit(), generatorCombo->currentText(),
|
||||
extraGeneratorCombo->currentData().toString(),
|
||||
platformEdit->isEnabled() ? platformEdit->text() : QString(),
|
||||
toolsetEdit->isEnabled() ? toolsetEdit->text() : QString());
|
||||
}
|
||||
}
|
||||
|
||||
bool m_ignoreChange = false;
|
||||
QLabel *m_label;
|
||||
QPushButton *m_changeButton;
|
||||
CMakeTool *m_currentTool = nullptr;
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
struct GeneratorInfo {
|
||||
@@ -468,7 +773,7 @@ KitAspect::ItemList CMakeGeneratorKitAspect::toUserOutput(const Kit *k) const
|
||||
|
||||
KitAspectWidget *CMakeGeneratorKitAspect::createConfigWidget(Kit *k) const
|
||||
{
|
||||
return new Internal::CMakeGeneratorKitAspectWidget(k, this);
|
||||
return new CMakeGeneratorKitAspectWidget(k, this);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -482,6 +787,118 @@ static const char CMAKE_CXX_TOOLCHAIN_KEY[] = "CMAKE_CXX_COMPILER";
|
||||
static const char CMAKE_QMAKE_KEY[] = "QT_QMAKE_EXECUTABLE";
|
||||
static const char CMAKE_PREFIX_PATH_KEY[] = "CMAKE_PREFIX_PATH";
|
||||
|
||||
class CMakeConfigurationKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeConfigurationKitAspect)
|
||||
public:
|
||||
CMakeConfigurationKitAspectWidget(Kit *kit, const KitAspect *ki)
|
||||
: KitAspectWidget(kit, ki),
|
||||
m_summaryLabel(new Utils::ElidingLabel),
|
||||
m_manageButton(new QPushButton)
|
||||
{
|
||||
refresh();
|
||||
m_manageButton->setText(tr("Change..."));
|
||||
connect(m_manageButton, &QAbstractButton::clicked,
|
||||
this, &CMakeConfigurationKitAspectWidget::editConfigurationChanges);
|
||||
}
|
||||
|
||||
private:
|
||||
// KitAspectWidget interface
|
||||
QString displayName() const override { return tr("CMake Configuration"); }
|
||||
QWidget *mainWidget() const override { return m_summaryLabel; }
|
||||
QWidget *buttonWidget() const override { return m_manageButton; }
|
||||
|
||||
void makeReadOnly() override
|
||||
{
|
||||
m_manageButton->setEnabled(false);
|
||||
if (m_dialog)
|
||||
m_dialog->reject();
|
||||
}
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
const QStringList current = CMakeConfigurationKitAspect::toStringList(kit());
|
||||
|
||||
m_summaryLabel->setText(current.join("; "));
|
||||
if (m_editor)
|
||||
m_editor->setPlainText(current.join('\n'));
|
||||
}
|
||||
|
||||
QString toolTip() const override
|
||||
{
|
||||
return tr("Default configuration passed to CMake when setting up a project.");
|
||||
}
|
||||
|
||||
void editConfigurationChanges()
|
||||
{
|
||||
if (m_dialog) {
|
||||
m_dialog->activateWindow();
|
||||
m_dialog->raise();
|
||||
return;
|
||||
}
|
||||
|
||||
QTC_ASSERT(!m_editor, return);
|
||||
|
||||
m_dialog = new QDialog(m_summaryLabel->window());
|
||||
m_dialog->setWindowTitle(tr("Edit CMake Configuration"));
|
||||
auto layout = new QVBoxLayout(m_dialog);
|
||||
m_editor = new QPlainTextEdit;
|
||||
m_editor->setToolTip(tr("Enter one variable per line with the variable name "
|
||||
"separated from the variable value by \"=\".<br>"
|
||||
"You may provide a type hint by adding \":TYPE\" before the \"=\"."));
|
||||
m_editor->setMinimumSize(800, 200);
|
||||
|
||||
auto chooser = new Core::VariableChooser(m_dialog);
|
||||
chooser->addSupportedWidget(m_editor);
|
||||
chooser->addMacroExpanderProvider([this]() { return kit()->macroExpander(); });
|
||||
|
||||
auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Apply
|
||||
|QDialogButtonBox::Reset|QDialogButtonBox::Cancel);
|
||||
|
||||
layout->addWidget(m_editor);
|
||||
layout->addWidget(buttons);
|
||||
|
||||
connect(buttons, &QDialogButtonBox::accepted, m_dialog, &QDialog::accept);
|
||||
connect(buttons, &QDialogButtonBox::rejected, m_dialog, &QDialog::reject);
|
||||
connect(buttons, &QDialogButtonBox::clicked, m_dialog, [buttons, this](QAbstractButton *button) {
|
||||
if (button != buttons->button(QDialogButtonBox::Reset))
|
||||
return;
|
||||
CMakeConfigurationKitAspect::setConfiguration(kit(),
|
||||
CMakeConfigurationKitAspect::defaultConfiguration(kit()));
|
||||
});
|
||||
connect(m_dialog, &QDialog::accepted, this, &CMakeConfigurationKitAspectWidget::acceptChangesDialog);
|
||||
connect(m_dialog, &QDialog::rejected, this, &CMakeConfigurationKitAspectWidget::closeChangesDialog);
|
||||
connect(buttons->button(QDialogButtonBox::Apply), &QAbstractButton::clicked,
|
||||
this, &CMakeConfigurationKitAspectWidget::applyChanges);
|
||||
|
||||
refresh();
|
||||
m_dialog->show();
|
||||
}
|
||||
|
||||
void applyChanges()
|
||||
{
|
||||
QTC_ASSERT(m_editor, return);
|
||||
CMakeConfigurationKitAspect::fromStringList(kit(), m_editor->toPlainText().split(QLatin1Char('\n')));
|
||||
}
|
||||
void closeChangesDialog()
|
||||
{
|
||||
m_dialog->deleteLater();
|
||||
m_dialog = nullptr;
|
||||
m_editor = nullptr;
|
||||
}
|
||||
void acceptChangesDialog()
|
||||
{
|
||||
applyChanges();
|
||||
closeChangesDialog();
|
||||
}
|
||||
|
||||
QLabel *m_summaryLabel;
|
||||
QPushButton *m_manageButton;
|
||||
QDialog *m_dialog = nullptr;
|
||||
QPlainTextEdit *m_editor = nullptr;
|
||||
};
|
||||
|
||||
|
||||
CMakeConfigurationKitAspect::CMakeConfigurationKitAspect()
|
||||
{
|
||||
setObjectName(QLatin1String("CMakeConfigurationKitAspect"));
|
||||
@@ -671,7 +1088,8 @@ KitAspectWidget *CMakeConfigurationKitAspect::createConfigWidget(Kit *k) const
|
||||
{
|
||||
if (!k)
|
||||
return nullptr;
|
||||
return new Internal::CMakeConfigurationKitAspectWidget(k, this);
|
||||
return new CMakeConfigurationKitAspectWidget(k, this);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
@@ -25,17 +25,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cmake_global.h"
|
||||
|
||||
#include "cmakeconfigitem.h"
|
||||
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
class CMakeTool;
|
||||
|
||||
class CMAKE_EXPORT CMakeKitAspect : public ProjectExplorer::KitAspect
|
||||
namespace Internal {
|
||||
|
||||
class CMakeKitAspect : public ProjectExplorer::KitAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -60,7 +59,7 @@ public:
|
||||
QSet<Core::Id> availableFeatures(const ProjectExplorer::Kit *k) const final;
|
||||
};
|
||||
|
||||
class CMAKE_EXPORT CMakeGeneratorKitAspect : public ProjectExplorer::KitAspect
|
||||
class CMakeGeneratorKitAspect : public ProjectExplorer::KitAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -88,7 +87,7 @@ public:
|
||||
ProjectExplorer::KitAspectWidget *createConfigWidget(ProjectExplorer::Kit *k) const final;
|
||||
};
|
||||
|
||||
class CMAKE_EXPORT CMakeConfigurationKitAspect : public ProjectExplorer::KitAspect
|
||||
class CMakeConfigurationKitAspect : public ProjectExplorer::KitAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -111,4 +110,5 @@ public:
|
||||
ProjectExplorer::KitAspectWidget *createConfigWidget(ProjectExplorer::Kit *k) const final;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
@@ -25,7 +25,6 @@ HEADERS = builddirmanager.h \
|
||||
cmaketoolmanager.h \
|
||||
cmake_global.h \
|
||||
cmakekitinformation.h \
|
||||
cmakekitconfigwidget.h \
|
||||
cmakecbpparser.h \
|
||||
cmakebuildsettingswidget.h \
|
||||
cmakeindenter.h \
|
||||
@@ -61,7 +60,6 @@ SOURCES = builddirmanager.cpp \
|
||||
cmakesettingspage.cpp \
|
||||
cmaketoolmanager.cpp \
|
||||
cmakekitinformation.cpp \
|
||||
cmakekitconfigwidget.cpp \
|
||||
cmakecbpparser.cpp \
|
||||
cmakebuildsettingswidget.cpp \
|
||||
cmakeindenter.cpp \
|
||||
|
@@ -42,8 +42,6 @@ QtcPlugin {
|
||||
"cmakeeditor.h",
|
||||
"cmakefilecompletionassist.cpp",
|
||||
"cmakefilecompletionassist.h",
|
||||
"cmakekitconfigwidget.h",
|
||||
"cmakekitconfigwidget.cpp",
|
||||
"cmakekitinformation.h",
|
||||
"cmakekitinformation.cpp",
|
||||
"cmakelocatorfilter.cpp",
|
||||
@@ -92,6 +90,6 @@ QtcPlugin {
|
||||
"tealeafreader.cpp",
|
||||
"tealeafreader.h",
|
||||
"treescanner.cpp",
|
||||
"treescanner.h"
|
||||
"treescanner.h",
|
||||
]
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@ HEADERS += \
|
||||
debuggerprotocol.h \
|
||||
debuggerrunconfigurationaspect.h \
|
||||
debuggerruncontrol.h \
|
||||
debuggerkitconfigwidget.h \
|
||||
debuggerkitinformation.h \
|
||||
disassembleragent.h \
|
||||
disassemblerlines.h \
|
||||
@@ -76,7 +75,6 @@ SOURCES += \
|
||||
debuggerprotocol.cpp \
|
||||
debuggerrunconfigurationaspect.cpp \
|
||||
debuggerruncontrol.cpp \
|
||||
debuggerkitconfigwidget.cpp \
|
||||
debuggerkitinformation.cpp \
|
||||
disassembleragent.cpp \
|
||||
disassemblerlines.cpp \
|
||||
|
@@ -51,7 +51,6 @@ Project {
|
||||
"debuggerinternalconstants.h",
|
||||
"debuggeritem.cpp", "debuggeritem.h",
|
||||
"debuggeritemmanager.cpp", "debuggeritemmanager.h",
|
||||
"debuggerkitconfigwidget.cpp", "debuggerkitconfigwidget.h",
|
||||
"debuggerkitinformation.cpp", "debuggerkitinformation.h",
|
||||
"debuggermainwindow.cpp", "debuggermainwindow.h",
|
||||
"debuggerplugin.cpp", "debuggerplugin.h",
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "debuggeritem.h"
|
||||
#include "debuggeritemmanager.h"
|
||||
#include "debuggerkitinformation.h"
|
||||
#include "debuggerkitconfigwidget.h"
|
||||
#include "debuggerprotocol.h"
|
||||
|
||||
#include <projectexplorer/abi.h>
|
||||
|
@@ -1,81 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** 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
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
#include <projectexplorer/kitconfigwidget.h>
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// DebuggerKitAspectWidget
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
class DebuggerKitAspectWidget : public ProjectExplorer::KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerKitAspectWidget(ProjectExplorer::Kit *workingCopy,
|
||||
const ProjectExplorer::KitAspect *ki);
|
||||
~DebuggerKitAspectWidget() override;
|
||||
|
||||
QString displayName() const override;
|
||||
QString toolTip() const override;
|
||||
void makeReadOnly() override;
|
||||
void refresh() override;
|
||||
QWidget *buttonWidget() const override;
|
||||
QWidget *mainWidget() const override;
|
||||
|
||||
private:
|
||||
void manageDebuggers();
|
||||
void currentDebuggerChanged(int idx);
|
||||
|
||||
QVariant currentId() const;
|
||||
void updateComboBox(const QVariant &id);
|
||||
|
||||
bool m_isReadOnly;
|
||||
bool m_ignoreChanges = false;
|
||||
QComboBox *m_comboBox;
|
||||
QPushButton *m_manageButton;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
@@ -27,7 +27,8 @@
|
||||
|
||||
#include "debuggeritemmanager.h"
|
||||
#include "debuggeritem.h"
|
||||
#include "debuggerkitconfigwidget.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -37,7 +38,9 @@
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QFileInfo>
|
||||
#include <QPushButton>
|
||||
#include <utility>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
@@ -49,6 +52,99 @@ namespace Debugger {
|
||||
// DebuggerKitAspect
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class DebuggerKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Debugger::DebuggerKitAspect)
|
||||
|
||||
public:
|
||||
DebuggerKitAspectWidget(Kit *workingCopy, const KitAspect *ki)
|
||||
: KitAspectWidget(workingCopy, ki)
|
||||
{
|
||||
m_comboBox = new QComboBox;
|
||||
m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
|
||||
m_comboBox->setEnabled(true);
|
||||
|
||||
refresh();
|
||||
connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &DebuggerKitAspectWidget::currentDebuggerChanged);
|
||||
|
||||
m_manageButton = new QPushButton(KitAspectWidget::msgManage());
|
||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||
connect(m_manageButton, &QAbstractButton::clicked,
|
||||
this, &DebuggerKitAspectWidget::manageDebuggers);
|
||||
}
|
||||
|
||||
~DebuggerKitAspectWidget() override
|
||||
{
|
||||
delete m_comboBox;
|
||||
delete m_manageButton;
|
||||
}
|
||||
|
||||
private:
|
||||
QString displayName() const override { return tr("Debugger"); }
|
||||
QString toolTip() const override { return tr("The debugger to use for this kit."); }
|
||||
QWidget *buttonWidget() const override { return m_manageButton; }
|
||||
QWidget *mainWidget() const override { return m_comboBox; }
|
||||
|
||||
void makeReadOnly() override
|
||||
{
|
||||
m_manageButton->setEnabled(false);
|
||||
m_comboBox->setEnabled(false);
|
||||
}
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
m_ignoreChanges = true;
|
||||
m_comboBox->clear();
|
||||
m_comboBox->setToolTip(toolTip());
|
||||
m_comboBox->addItem(tr("None"), QString());
|
||||
for (const DebuggerItem &item : DebuggerItemManager::debuggers())
|
||||
m_comboBox->addItem(item.displayName(), item.id());
|
||||
|
||||
const DebuggerItem *item = DebuggerKitAspect::debugger(m_kit);
|
||||
updateComboBox(item ? item->id() : QVariant());
|
||||
m_ignoreChanges = false;
|
||||
}
|
||||
|
||||
void manageDebuggers()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(ProjectExplorer::Constants::DEBUGGER_SETTINGS_PAGE_ID,
|
||||
buttonWidget());
|
||||
}
|
||||
|
||||
void currentDebuggerChanged(int idx)
|
||||
{
|
||||
Q_UNUSED(idx);
|
||||
if (m_ignoreChanges)
|
||||
return;
|
||||
|
||||
int currentIndex = m_comboBox->currentIndex();
|
||||
QVariant id = m_comboBox->itemData(currentIndex);
|
||||
m_kit->setValue(DebuggerKitAspect::id(), id);
|
||||
}
|
||||
|
||||
QVariant currentId() const { return m_comboBox->itemData(m_comboBox->currentIndex()); }
|
||||
|
||||
void updateComboBox(const QVariant &id)
|
||||
{
|
||||
for (int i = 0; i < m_comboBox->count(); ++i) {
|
||||
if (id == m_comboBox->itemData(i)) {
|
||||
m_comboBox->setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_comboBox->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
bool m_isReadOnly;
|
||||
bool m_ignoreChanges = false;
|
||||
QComboBox *m_comboBox;
|
||||
QPushButton *m_manageButton;
|
||||
};
|
||||
} // namespace Internal
|
||||
|
||||
DebuggerKitAspect::DebuggerKitAspect()
|
||||
{
|
||||
setObjectName("DebuggerKitAspect");
|
||||
|
@@ -28,7 +28,6 @@
|
||||
#include "debuggeractions.h"
|
||||
#include "debuggerinternalconstants.h"
|
||||
#include "debuggercore.h"
|
||||
#include "debuggerkitconfigwidget.h"
|
||||
#include "debuggerdialogs.h"
|
||||
#include "debuggerengine.h"
|
||||
#include "debuggericons.h"
|
||||
|
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "kitchooser.h"
|
||||
|
||||
#include "kitconfigwidget.h"
|
||||
#include "kitinformation.h"
|
||||
#include "kitmanager.h"
|
||||
#include "project.h"
|
||||
|
@@ -1,73 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "kitconfigwidget.h"
|
||||
|
||||
#include "kit.h"
|
||||
#include "kitinformation.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
KitAspectWidget::KitAspectWidget(Kit *kit, const KitAspect *ki) : m_kit(kit),
|
||||
m_kitInformation(ki), m_isSticky(kit->isSticky(ki->id()))
|
||||
{ }
|
||||
|
||||
Core::Id KitAspectWidget::kitInformationId() const
|
||||
{
|
||||
return m_kitInformation->id();
|
||||
}
|
||||
|
||||
bool KitAspectWidget::isMutable() const
|
||||
{
|
||||
return m_kit->isMutable(m_kitInformation->id());
|
||||
}
|
||||
|
||||
void KitAspectWidget::setMutable(bool b)
|
||||
{
|
||||
m_kit->setMutable(m_kitInformation->id(), b);
|
||||
}
|
||||
|
||||
QString KitAspectWidget::msgManage()
|
||||
{
|
||||
return tr("Manage...");
|
||||
}
|
||||
|
||||
void KitAspectWidget::setPalette(const QPalette &p)
|
||||
{
|
||||
if (mainWidget())
|
||||
mainWidget()->setPalette(p);
|
||||
if (buttonWidget())
|
||||
buttonWidget()->setPalette(p);
|
||||
}
|
||||
|
||||
void KitAspectWidget::setStyle(QStyle *s)
|
||||
{
|
||||
if (mainWidget())
|
||||
mainWidget()->setStyle(s);
|
||||
if (buttonWidget())
|
||||
buttonWidget()->setStyle(s);
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
@@ -1,81 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** 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
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Kit;
|
||||
class KitAspect;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// KitAspectWidget
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
class PROJECTEXPLORER_EXPORT KitAspectWidget : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KitAspectWidget(Kit *kit, const KitAspect *ki);
|
||||
|
||||
Core::Id kitInformationId() const;
|
||||
|
||||
virtual QString displayName() const = 0;
|
||||
virtual QString toolTip() const { return QString(); }
|
||||
virtual void makeReadOnly() = 0;
|
||||
virtual void refresh() = 0;
|
||||
virtual bool visibleInKit() { return true; }
|
||||
|
||||
virtual QWidget *mainWidget() const = 0;
|
||||
virtual QWidget *buttonWidget() const { return nullptr; }
|
||||
|
||||
bool isSticky() const { return m_isSticky; }
|
||||
bool isMutable() const;
|
||||
void setMutable(bool b);
|
||||
|
||||
static QString msgManage();
|
||||
|
||||
Kit *kit() const { return m_kit; }
|
||||
|
||||
virtual void setPalette(const QPalette &p);
|
||||
virtual void setStyle(QStyle *s);
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
|
||||
protected:
|
||||
Kit *m_kit;
|
||||
const KitAspect *m_kitInformation;
|
||||
bool m_isSticky;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
@@ -28,20 +28,32 @@
|
||||
#include "abi.h"
|
||||
#include "devicesupport/desktopdevice.h"
|
||||
#include "devicesupport/devicemanager.h"
|
||||
#include "devicesupport/devicemanagermodel.h"
|
||||
#include "devicesupport/idevicefactory.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "kit.h"
|
||||
#include "kitinformationconfigwidget.h"
|
||||
#include "toolchain.h"
|
||||
#include "toolchainmanager.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/variablechooser.h>
|
||||
#include <ssh/sshconnection.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/environmentdialog.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QFontMetrics>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -53,6 +65,60 @@ const char KITINFORMATION_ID_V3[] = "PE.Profile.ToolChainsV3";
|
||||
// SysRootKitAspect:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
namespace Internal {
|
||||
class SysRootKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::SysRootKitAspect)
|
||||
|
||||
public:
|
||||
SysRootKitAspectWidget(Kit *k, const KitAspect *ki) : KitAspectWidget(k, ki)
|
||||
{
|
||||
m_chooser = new Utils::PathChooser;
|
||||
m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
|
||||
m_chooser->setHistoryCompleter(QLatin1String("PE.SysRoot.History"));
|
||||
m_chooser->setFileName(SysRootKitAspect::sysRoot(k));
|
||||
connect(m_chooser, &Utils::PathChooser::pathChanged,
|
||||
this, &SysRootKitAspectWidget::pathWasChanged);
|
||||
}
|
||||
|
||||
~SysRootKitAspectWidget() override { delete m_chooser; }
|
||||
|
||||
private:
|
||||
QString displayName() const override { return tr("Sysroot"); }
|
||||
void makeReadOnly() override { m_chooser->setReadOnly(true); }
|
||||
QWidget *buttonWidget() const override { return m_chooser->buttonAtIndex(0); }
|
||||
QWidget *mainWidget() const override { return m_chooser->lineEdit(); }
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
if (!m_ignoreChange)
|
||||
m_chooser->setFileName(SysRootKitAspect::sysRoot(m_kit));
|
||||
}
|
||||
|
||||
QString toolTip() const override
|
||||
{
|
||||
return tr("The root directory of the system image to use.<br>"
|
||||
"Leave empty when building for the desktop.");
|
||||
}
|
||||
|
||||
void setPalette(const QPalette &p) override
|
||||
{
|
||||
KitAspectWidget::setPalette(p);
|
||||
m_chooser->setOkColor(p.color(QPalette::Active, QPalette::Text));
|
||||
}
|
||||
|
||||
void pathWasChanged()
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
SysRootKitAspect::setSysRoot(m_kit, m_chooser->fileName());
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
Utils::PathChooser *m_chooser;
|
||||
bool m_ignoreChange = false;
|
||||
};
|
||||
} // namespace Internal
|
||||
|
||||
SysRootKitAspect::SysRootKitAspect()
|
||||
{
|
||||
setObjectName(QLatin1String("SysRootInformation"));
|
||||
@@ -155,6 +221,134 @@ void SysRootKitAspect::setSysRoot(Kit *k, const Utils::FileName &v)
|
||||
// ToolChainKitAspect:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
namespace Internal {
|
||||
class ToolChainKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::ToolChainKitAspect)
|
||||
|
||||
public:
|
||||
ToolChainKitAspectWidget(Kit *k, const KitAspect *ki) : KitAspectWidget(k, ki)
|
||||
{
|
||||
m_mainWidget = new QWidget;
|
||||
m_mainWidget->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
auto layout = new QGridLayout(m_mainWidget);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setColumnStretch(1, 2);
|
||||
|
||||
QList<Core::Id> languageList = ToolChainManager::allLanguages().toList();
|
||||
Utils::sort(languageList, [](Core::Id l1, Core::Id l2) {
|
||||
return ToolChainManager::displayNameOfLanguageId(l1)
|
||||
< ToolChainManager::displayNameOfLanguageId(l2);
|
||||
});
|
||||
QTC_ASSERT(!languageList.isEmpty(), return);
|
||||
int row = 0;
|
||||
foreach (Core::Id l, languageList) {
|
||||
layout->addWidget(new QLabel(ToolChainManager::displayNameOfLanguageId(l) + ':'), row, 0);
|
||||
auto cb = new QComboBox;
|
||||
cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy());
|
||||
cb->setToolTip(toolTip());
|
||||
|
||||
m_languageComboboxMap.insert(l, cb);
|
||||
layout->addWidget(cb, row, 1);
|
||||
++row;
|
||||
|
||||
connect(cb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, [this, l](int idx) { currentToolChainChanged(l, idx); });
|
||||
}
|
||||
|
||||
refresh();
|
||||
|
||||
m_manageButton = new QPushButton(KitAspectWidget::msgManage());
|
||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||
connect(m_manageButton, &QAbstractButton::clicked,
|
||||
this, &ToolChainKitAspectWidget::manageToolChains);
|
||||
}
|
||||
|
||||
~ToolChainKitAspectWidget() override
|
||||
{
|
||||
delete m_mainWidget;
|
||||
delete m_manageButton;
|
||||
}
|
||||
|
||||
private:
|
||||
QString displayName() const override { return tr("Compiler"); }
|
||||
QWidget *mainWidget() const override { return m_mainWidget; }
|
||||
QWidget *buttonWidget() const override { return m_manageButton; }
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
m_ignoreChanges = true;
|
||||
foreach (Core::Id l, m_languageComboboxMap.keys()) {
|
||||
const QList<ToolChain *> ltcList
|
||||
= ToolChainManager::toolChains(Utils::equal(&ToolChain::language, l));
|
||||
|
||||
QComboBox *cb = m_languageComboboxMap.value(l);
|
||||
cb->clear();
|
||||
cb->addItem(tr("<No compiler>"), QByteArray());
|
||||
|
||||
foreach (ToolChain *tc, ltcList)
|
||||
cb->addItem(tc->displayName(), tc->id());
|
||||
|
||||
cb->setEnabled(cb->count() > 1 && !m_isReadOnly);
|
||||
const int index = indexOf(cb, ToolChainKitAspect::toolChain(m_kit, l));
|
||||
cb->setCurrentIndex(index);
|
||||
}
|
||||
m_ignoreChanges = false;
|
||||
}
|
||||
|
||||
void makeReadOnly() override
|
||||
{
|
||||
m_isReadOnly = true;
|
||||
foreach (Core::Id l, m_languageComboboxMap.keys()) {
|
||||
m_languageComboboxMap.value(l)->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
QString toolTip() const override
|
||||
{
|
||||
return tr("The compiler to use for building.<br>"
|
||||
"Make sure the compiler will produce binaries compatible with the target device, "
|
||||
"Qt version and other libraries used.");
|
||||
}
|
||||
|
||||
void manageToolChains()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Constants::TOOLCHAIN_SETTINGS_PAGE_ID, buttonWidget());
|
||||
}
|
||||
|
||||
void currentToolChainChanged(Core::Id language, int idx)
|
||||
{
|
||||
if (m_ignoreChanges || idx < 0)
|
||||
return;
|
||||
|
||||
const QByteArray id = m_languageComboboxMap.value(language)->itemData(idx).toByteArray();
|
||||
ToolChain *tc = ToolChainManager::findToolChain(id);
|
||||
QTC_ASSERT(!tc || tc->language() == language, return);
|
||||
if (tc)
|
||||
ToolChainKitAspect::setToolChain(m_kit, tc);
|
||||
else
|
||||
ToolChainKitAspect::clearToolChain(m_kit, language);
|
||||
}
|
||||
|
||||
int indexOf(QComboBox *cb, const ToolChain *tc)
|
||||
{
|
||||
const QByteArray id = tc ? tc->id() : QByteArray();
|
||||
for (int i = 0; i < cb->count(); ++i) {
|
||||
if (id == cb->itemData(i).toByteArray())
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
QWidget *m_mainWidget = nullptr;
|
||||
QPushButton *m_manageButton = nullptr;
|
||||
QHash<Core::Id, QComboBox *> m_languageComboboxMap;
|
||||
bool m_ignoreChanges = false;
|
||||
bool m_isReadOnly = false;
|
||||
};
|
||||
} // namespace Internal
|
||||
|
||||
ToolChainKitAspect::ToolChainKitAspect()
|
||||
{
|
||||
setObjectName(QLatin1String("ToolChainInformation"));
|
||||
@@ -571,6 +765,53 @@ void ToolChainKitAspect::toolChainRemoved(ToolChain *tc)
|
||||
// --------------------------------------------------------------------------
|
||||
// DeviceTypeKitAspect:
|
||||
// --------------------------------------------------------------------------
|
||||
namespace Internal {
|
||||
class DeviceTypeKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::DeviceTypeKitAspect)
|
||||
|
||||
public:
|
||||
DeviceTypeKitAspectWidget(Kit *workingCopy, const KitAspect *ki)
|
||||
: KitAspectWidget(workingCopy, ki), m_comboBox(new QComboBox)
|
||||
{
|
||||
for (IDeviceFactory *factory : IDeviceFactory::allDeviceFactories())
|
||||
m_comboBox->addItem(factory->displayName(), factory->deviceType().toSetting());
|
||||
m_comboBox->setToolTip(toolTip());
|
||||
refresh();
|
||||
connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &DeviceTypeKitAspectWidget::currentTypeChanged);
|
||||
}
|
||||
|
||||
~DeviceTypeKitAspectWidget() override { delete m_comboBox; }
|
||||
|
||||
private:
|
||||
QWidget *mainWidget() const override { return m_comboBox; }
|
||||
QString displayName() const override { return tr("Device type"); }
|
||||
QString toolTip() const override { return tr("The type of device to run applications on."); }
|
||||
void makeReadOnly() override { m_comboBox->setEnabled(false); }
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
Core::Id devType = DeviceTypeKitAspect::deviceTypeId(m_kit);
|
||||
if (!devType.isValid())
|
||||
m_comboBox->setCurrentIndex(-1);
|
||||
for (int i = 0; i < m_comboBox->count(); ++i) {
|
||||
if (m_comboBox->itemData(i) == devType.toSetting()) {
|
||||
m_comboBox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void currentTypeChanged(int idx)
|
||||
{
|
||||
Core::Id type = idx < 0 ? Core::Id() : Core::Id::fromSetting(m_comboBox->itemData(idx));
|
||||
DeviceTypeKitAspect::setDeviceTypeId(m_kit, type);
|
||||
}
|
||||
|
||||
QComboBox *m_comboBox;
|
||||
};
|
||||
} // namespace Internal
|
||||
|
||||
DeviceTypeKitAspect::DeviceTypeKitAspect()
|
||||
{
|
||||
@@ -646,6 +887,84 @@ QSet<Core::Id> DeviceTypeKitAspect::availableFeatures(const Kit *k) const
|
||||
// --------------------------------------------------------------------------
|
||||
// DeviceKitAspect:
|
||||
// --------------------------------------------------------------------------
|
||||
namespace Internal {
|
||||
class DeviceKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::DeviceKitAspect)
|
||||
|
||||
public:
|
||||
DeviceKitAspectWidget(Kit *workingCopy, const KitAspect *ki)
|
||||
: KitAspectWidget(workingCopy, ki), m_comboBox(new QComboBox),
|
||||
m_model(new DeviceManagerModel(DeviceManager::instance()))
|
||||
{
|
||||
m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
|
||||
m_comboBox->setModel(m_model);
|
||||
m_manageButton = new QPushButton(KitAspectWidget::msgManage());
|
||||
refresh();
|
||||
m_comboBox->setToolTip(toolTip());
|
||||
|
||||
connect(m_model, &QAbstractItemModel::modelAboutToBeReset,
|
||||
this, &DeviceKitAspectWidget::modelAboutToReset);
|
||||
connect(m_model, &QAbstractItemModel::modelReset,
|
||||
this, &DeviceKitAspectWidget::modelReset);
|
||||
connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &DeviceKitAspectWidget::currentDeviceChanged);
|
||||
connect(m_manageButton, &QAbstractButton::clicked,
|
||||
this, &DeviceKitAspectWidget::manageDevices);
|
||||
}
|
||||
|
||||
~DeviceKitAspectWidget() override
|
||||
{
|
||||
delete m_comboBox;
|
||||
delete m_model;
|
||||
delete m_manageButton;
|
||||
}
|
||||
|
||||
private:
|
||||
QWidget *mainWidget() const override { return m_comboBox; }
|
||||
QWidget *buttonWidget() const override { return m_manageButton; }
|
||||
QString displayName() const override { return tr("Device"); }
|
||||
QString toolTip() const override { return tr("The device to run the applications on."); }
|
||||
void makeReadOnly() override { m_comboBox->setEnabled(false); }
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
m_model->setTypeFilter(DeviceTypeKitAspect::deviceTypeId(m_kit));
|
||||
m_comboBox->setCurrentIndex(m_model->indexOf(DeviceKitAspect::device(m_kit)));
|
||||
}
|
||||
|
||||
void manageDevices()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Constants::DEVICE_SETTINGS_PAGE_ID, buttonWidget());
|
||||
}
|
||||
|
||||
void modelAboutToReset()
|
||||
{
|
||||
m_selectedId = m_model->deviceId(m_comboBox->currentIndex());
|
||||
m_ignoreChange = true;
|
||||
}
|
||||
|
||||
void modelReset()
|
||||
{
|
||||
m_comboBox->setCurrentIndex(m_model->indexForId(m_selectedId));
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void currentDeviceChanged()
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
DeviceKitAspect::setDeviceId(m_kit, m_model->deviceId(m_comboBox->currentIndex()));
|
||||
}
|
||||
|
||||
bool m_isReadOnly = false;
|
||||
bool m_ignoreChange = false;
|
||||
QComboBox *m_comboBox;
|
||||
QPushButton *m_manageButton;
|
||||
DeviceManagerModel *m_model;
|
||||
Core::Id m_selectedId;
|
||||
};
|
||||
} // namespace Internal
|
||||
|
||||
DeviceKitAspect::DeviceKitAspect()
|
||||
{
|
||||
@@ -822,6 +1141,117 @@ void DeviceKitAspect::devicesChanged()
|
||||
// --------------------------------------------------------------------------
|
||||
// EnvironmentKitAspect:
|
||||
// --------------------------------------------------------------------------
|
||||
namespace Internal {
|
||||
class EnvironmentKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::EnvironmentKitAspect)
|
||||
|
||||
public:
|
||||
EnvironmentKitAspectWidget(Kit *workingCopy, const KitAspect *ki)
|
||||
: KitAspectWidget(workingCopy, ki),
|
||||
m_summaryLabel(new QLabel),
|
||||
m_manageButton(new QPushButton),
|
||||
m_mainWidget(new QWidget)
|
||||
{
|
||||
auto *layout = new QVBoxLayout;
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(m_summaryLabel);
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
initMSVCOutputSwitch(layout);
|
||||
m_mainWidget->setLayout(layout);
|
||||
refresh();
|
||||
m_manageButton->setText(tr("Change..."));
|
||||
connect(m_manageButton, &QAbstractButton::clicked,
|
||||
this, &EnvironmentKitAspectWidget::editEnvironmentChanges);
|
||||
}
|
||||
|
||||
private:
|
||||
QWidget *mainWidget() const override { return m_mainWidget; }
|
||||
QWidget *buttonWidget() const override { return m_manageButton; }
|
||||
QString displayName() const override { return tr("Environment"); }
|
||||
void makeReadOnly() override { m_manageButton->setEnabled(false); }
|
||||
|
||||
QString toolTip() const override
|
||||
{
|
||||
return tr("Additional build environment settings when using this kit.");
|
||||
}
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
const QList<Utils::EnvironmentItem> changes = currentEnvironment();
|
||||
QString shortSummary = Utils::EnvironmentItem::toStringList(changes).join(QLatin1String("; "));
|
||||
QFontMetrics fm(m_summaryLabel->font());
|
||||
shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, m_summaryLabel->width());
|
||||
m_summaryLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.") : shortSummary);
|
||||
}
|
||||
|
||||
void editEnvironmentChanges()
|
||||
{
|
||||
bool ok;
|
||||
Utils::MacroExpander *expander = m_kit->macroExpander();
|
||||
Utils::EnvironmentDialog::Polisher polisher = [expander](QWidget *w) {
|
||||
Core::VariableChooser::addSupportForChildWidgets(w, expander);
|
||||
};
|
||||
QList<Utils::EnvironmentItem>
|
||||
changes = Utils::EnvironmentDialog::getEnvironmentItems(&ok,
|
||||
m_summaryLabel,
|
||||
currentEnvironment(),
|
||||
QString(),
|
||||
polisher);
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
const Utils::EnvironmentItem forceMSVCEnglishItem("VSLANG", "1033");
|
||||
if (m_vslangCheckbox->isChecked() && changes.indexOf(forceMSVCEnglishItem) < 0)
|
||||
changes.append(forceMSVCEnglishItem);
|
||||
}
|
||||
|
||||
EnvironmentKitAspect::setEnvironmentChanges(m_kit, changes);
|
||||
}
|
||||
|
||||
QList<Utils::EnvironmentItem> currentEnvironment() const
|
||||
{
|
||||
QList<Utils::EnvironmentItem> changes = EnvironmentKitAspect::environmentChanges(m_kit);
|
||||
|
||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
const Utils::EnvironmentItem forceMSVCEnglishItem("VSLANG", "1033");
|
||||
if (changes.indexOf(forceMSVCEnglishItem) >= 0) {
|
||||
m_vslangCheckbox->setCheckState(Qt::Checked);
|
||||
changes.removeAll(forceMSVCEnglishItem);
|
||||
}
|
||||
}
|
||||
|
||||
Utils::sort(changes, [](const Utils::EnvironmentItem &lhs, const Utils::EnvironmentItem &rhs)
|
||||
{ return QString::localeAwareCompare(lhs.name, rhs.name) < 0; });
|
||||
return changes;
|
||||
}
|
||||
|
||||
void initMSVCOutputSwitch(QVBoxLayout *layout)
|
||||
{
|
||||
m_vslangCheckbox = new QCheckBox(tr("Force UTF-8 MSVC compiler output"));
|
||||
layout->addWidget(m_vslangCheckbox);
|
||||
m_vslangCheckbox->setToolTip(tr("Either switches MSVC to English or keeps the language and "
|
||||
"just forces UTF-8 output (may vary depending on the used MSVC "
|
||||
"compiler)."));
|
||||
connect(m_vslangCheckbox, &QCheckBox::toggled, this, [this](bool checked) {
|
||||
QList<Utils::EnvironmentItem> changes
|
||||
= EnvironmentKitAspect::environmentChanges(m_kit);
|
||||
const Utils::EnvironmentItem forceMSVCEnglishItem("VSLANG", "1033");
|
||||
if (!checked && changes.indexOf(forceMSVCEnglishItem) >= 0)
|
||||
changes.removeAll(forceMSVCEnglishItem);
|
||||
if (checked && changes.indexOf(forceMSVCEnglishItem) < 0)
|
||||
changes.append(forceMSVCEnglishItem);
|
||||
EnvironmentKitAspect::setEnvironmentChanges(m_kit, changes);
|
||||
});
|
||||
}
|
||||
|
||||
QLabel *m_summaryLabel;
|
||||
QPushButton *m_manageButton;
|
||||
QCheckBox *m_vslangCheckbox;
|
||||
QWidget *m_mainWidget;
|
||||
};
|
||||
} // namespace Internal
|
||||
|
||||
EnvironmentKitAspect::EnvironmentKitAspect()
|
||||
{
|
||||
|
@@ -1,196 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** 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
|
||||
|
||||
#include "kitconfigwidget.h"
|
||||
#include "toolchain.h"
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QPlainTextEdit;
|
||||
class QPushButton;
|
||||
class QVBoxLayout;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class PathChooser; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class DeviceManagerModel;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// SysRootKitAspectWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
class SysRootKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SysRootKitAspectWidget(Kit *k, const KitAspect *ki);
|
||||
~SysRootKitAspectWidget() override;
|
||||
|
||||
QString displayName() const override;
|
||||
void refresh() override;
|
||||
void makeReadOnly() override;
|
||||
QWidget *buttonWidget() const override;
|
||||
QWidget *mainWidget() const override;
|
||||
QString toolTip() const override;
|
||||
|
||||
void setPalette(const QPalette &p) override;
|
||||
|
||||
private:
|
||||
void pathWasChanged();
|
||||
|
||||
Utils::PathChooser *m_chooser;
|
||||
bool m_ignoreChange = false;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// ToolChainKitAspectWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
class ToolChainKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ToolChainKitAspectWidget(Kit *k, const KitAspect *ki);
|
||||
~ToolChainKitAspectWidget() override;
|
||||
|
||||
QString displayName() const override;
|
||||
void refresh() override;
|
||||
void makeReadOnly() override;
|
||||
QWidget *mainWidget() const override;
|
||||
QWidget *buttonWidget() const override;
|
||||
QString toolTip() const override;
|
||||
|
||||
private:
|
||||
void manageToolChains();
|
||||
void currentToolChainChanged(Core::Id language, int idx);
|
||||
|
||||
int indexOf(QComboBox *cb, const ToolChain *tc);
|
||||
|
||||
QWidget *m_mainWidget = nullptr;
|
||||
QPushButton *m_manageButton = nullptr;
|
||||
QHash<Core::Id, QComboBox *> m_languageComboboxMap;
|
||||
bool m_ignoreChanges = false;
|
||||
bool m_isReadOnly = false;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// DeviceTypeKitAspectWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
class DeviceTypeKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeviceTypeKitAspectWidget(Kit *workingCopy, const KitAspect *ki);
|
||||
~DeviceTypeKitAspectWidget() override;
|
||||
|
||||
QWidget *mainWidget() const override;
|
||||
QString displayName() const override;
|
||||
QString toolTip() const override;
|
||||
void refresh() override;
|
||||
void makeReadOnly() override;
|
||||
|
||||
private:
|
||||
void currentTypeChanged(int idx);
|
||||
|
||||
QComboBox *m_comboBox;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// DeviceKitAspectWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
class DeviceKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeviceKitAspectWidget(Kit *workingCopy, const KitAspect *ki);
|
||||
~DeviceKitAspectWidget() override;
|
||||
|
||||
QWidget *mainWidget() const override;
|
||||
QWidget *buttonWidget() const override;
|
||||
QString displayName() const override;
|
||||
QString toolTip() const override;
|
||||
void refresh() override;
|
||||
void makeReadOnly() override;
|
||||
|
||||
private:
|
||||
void manageDevices();
|
||||
void modelAboutToReset();
|
||||
void modelReset();
|
||||
void currentDeviceChanged();
|
||||
|
||||
bool m_isReadOnly = false;
|
||||
bool m_ignoreChange = false;
|
||||
QComboBox *m_comboBox;
|
||||
QPushButton *m_manageButton;
|
||||
DeviceManagerModel *m_model;
|
||||
Core::Id m_selectedId;
|
||||
};
|
||||
|
||||
class EnvironmentKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EnvironmentKitAspectWidget(Kit *workingCopy, const KitAspect *ki);
|
||||
|
||||
QWidget *mainWidget() const override;
|
||||
QWidget *buttonWidget() const override;
|
||||
QString displayName() const override;
|
||||
QString toolTip() const override;
|
||||
void refresh() override;
|
||||
void makeReadOnly() override;
|
||||
|
||||
private:
|
||||
void editEnvironmentChanges();
|
||||
QList<Utils::EnvironmentItem> currentEnvironment() const;
|
||||
|
||||
void initMSVCOutputSwitch(QVBoxLayout *layout);
|
||||
|
||||
QLabel *m_summaryLabel;
|
||||
QPushButton *m_manageButton;
|
||||
QCheckBox *m_vslangCheckbox;
|
||||
QWidget *m_mainWidget;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
@@ -41,6 +41,7 @@
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QStyle>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Utils;
|
||||
@@ -497,6 +498,46 @@ void KitAspect::notifyAboutUpdate(Kit *k)
|
||||
k->kitUpdated();
|
||||
}
|
||||
|
||||
KitAspectWidget::KitAspectWidget(Kit *kit, const KitAspect *ki) : m_kit(kit),
|
||||
m_kitInformation(ki), m_isSticky(kit->isSticky(ki->id()))
|
||||
{ }
|
||||
|
||||
Core::Id KitAspectWidget::kitInformationId() const
|
||||
{
|
||||
return m_kitInformation->id();
|
||||
}
|
||||
|
||||
bool KitAspectWidget::isMutable() const
|
||||
{
|
||||
return m_kit->isMutable(m_kitInformation->id());
|
||||
}
|
||||
|
||||
void KitAspectWidget::setMutable(bool b)
|
||||
{
|
||||
m_kit->setMutable(m_kitInformation->id(), b);
|
||||
}
|
||||
|
||||
QString KitAspectWidget::msgManage()
|
||||
{
|
||||
return tr("Manage...");
|
||||
}
|
||||
|
||||
void KitAspectWidget::setPalette(const QPalette &p)
|
||||
{
|
||||
if (mainWidget())
|
||||
mainWidget()->setPalette(p);
|
||||
if (buttonWidget())
|
||||
buttonWidget()->setPalette(p);
|
||||
}
|
||||
|
||||
void KitAspectWidget::setStyle(QStyle *s)
|
||||
{
|
||||
if (mainWidget())
|
||||
mainWidget()->setStyle(s);
|
||||
if (buttonWidget())
|
||||
buttonWidget()->setStyle(s);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// KitFeatureProvider:
|
||||
// --------------------------------------------------------------------
|
||||
|
@@ -37,6 +37,10 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QStyle;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
class Environment;
|
||||
class FileName;
|
||||
@@ -107,6 +111,44 @@ private:
|
||||
int m_priority = 0; // The higher the closer to the top.
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT KitAspectWidget : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KitAspectWidget(Kit *kit, const KitAspect *ki);
|
||||
|
||||
Core::Id kitInformationId() const;
|
||||
|
||||
virtual QString displayName() const = 0;
|
||||
virtual QString toolTip() const { return QString(); }
|
||||
virtual void makeReadOnly() = 0;
|
||||
virtual void refresh() = 0;
|
||||
virtual bool visibleInKit() { return true; }
|
||||
|
||||
virtual QWidget *mainWidget() const = 0;
|
||||
virtual QWidget *buttonWidget() const { return nullptr; }
|
||||
|
||||
bool isSticky() const { return m_isSticky; }
|
||||
bool isMutable() const;
|
||||
void setMutable(bool b);
|
||||
|
||||
static QString msgManage();
|
||||
|
||||
Kit *kit() const { return m_kit; }
|
||||
|
||||
virtual void setPalette(const QPalette &p);
|
||||
virtual void setStyle(QStyle *s);
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
|
||||
protected:
|
||||
Kit *m_kit;
|
||||
const KitAspect *m_kitInformation;
|
||||
bool m_isSticky;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT KitManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "kitconfigwidget.h"
|
||||
#include "kitmanager.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
@@ -25,10 +25,8 @@
|
||||
|
||||
#include "buildconfiguration.h"
|
||||
#include "deployconfiguration.h"
|
||||
#include "kitconfigwidget.h"
|
||||
#include "kit.h"
|
||||
#include "kitmanager.h"
|
||||
#include "kitmanager.h"
|
||||
#include "miniprojecttargetselector.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "projectexplorericons.h"
|
||||
|
@@ -31,9 +31,7 @@ HEADERS += projectexplorer.h \
|
||||
targetsetupwidget.h \
|
||||
kit.h \
|
||||
kitchooser.h \
|
||||
kitconfigwidget.h \
|
||||
kitinformation.h \
|
||||
kitinformationconfigwidget.h \
|
||||
kitfeatureprovider.h \
|
||||
kitmanager.h \
|
||||
kitmanagerconfigwidget.h \
|
||||
@@ -184,9 +182,7 @@ SOURCES += projectexplorer.cpp \
|
||||
targetsetupwidget.cpp \
|
||||
kit.cpp \
|
||||
kitchooser.cpp \
|
||||
kitconfigwidget.cpp \
|
||||
kitinformation.cpp \
|
||||
kitinformationconfigwidget.cpp \
|
||||
kitmanager.cpp \
|
||||
kitmanagerconfigwidget.cpp \
|
||||
kitmodel.cpp \
|
||||
|
@@ -81,10 +81,8 @@ Project {
|
||||
"itaskhandler.h",
|
||||
"kit.cpp", "kit.h",
|
||||
"kitchooser.cpp", "kitchooser.h",
|
||||
"kitconfigwidget.cpp", "kitconfigwidget.h",
|
||||
"kitfeatureprovider.h",
|
||||
"kitinformation.cpp", "kitinformation.h",
|
||||
"kitinformationconfigwidget.cpp", "kitinformationconfigwidget.h",
|
||||
"kitmanager.cpp", "kitmanager.h",
|
||||
"kitmanagerconfigwidget.cpp", "kitmanagerconfigwidget.h",
|
||||
"kitmodel.cpp", "kitmodel.h",
|
||||
|
@@ -29,7 +29,6 @@
|
||||
#include "buildinfo.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "kit.h"
|
||||
#include "kitconfigwidget.h"
|
||||
#include "kitmanager.h"
|
||||
#include "kitoptionspage.h"
|
||||
|
||||
|
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "customqbspropertiesdialog.h"
|
||||
|
||||
#include <projectexplorer/kitconfigwidget.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
|
||||
#include <utils/elidinglabel.h>
|
||||
@@ -44,7 +43,7 @@ namespace Internal {
|
||||
|
||||
class AspectWidget final : public KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_TR_FUNCTIONS(QbsProjectManager::Internal::AspectWidget)
|
||||
public:
|
||||
AspectWidget(Kit *kit, const KitAspect *kitInfo)
|
||||
: KitAspectWidget(kit, kitInfo),
|
||||
@@ -128,5 +127,3 @@ KitAspectWidget *QbsKitAspect::createConfigWidget(Kit *k) const
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
|
||||
#include <qbskitinformation.moc>
|
||||
|
@@ -1,61 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** 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
|
||||
|
||||
#include <projectexplorer/kitconfigwidget.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QmakeKitAspectWidget : public ProjectExplorer::KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmakeKitAspectWidget(ProjectExplorer::Kit *k, const ProjectExplorer::KitAspect *ki);
|
||||
~QmakeKitAspectWidget() override;
|
||||
|
||||
QWidget *mainWidget() const override;
|
||||
QString displayName() const override;
|
||||
QString toolTip() const override;
|
||||
|
||||
void makeReadOnly() override;
|
||||
void refresh() override;
|
||||
|
||||
private:
|
||||
void mkspecWasChanged(const QString &text);
|
||||
int findQtVersion(const int id) const;
|
||||
|
||||
QLineEdit *m_lineEdit = nullptr;
|
||||
bool m_ignoreChange = false;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "qmakekitinformation.h"
|
||||
|
||||
#include "qmakekitconfigwidget.h"
|
||||
#include "qmakeprojectmanagerconstants.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -37,10 +36,57 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QmakeKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(QmakeProjectManager::Internal::QmakeKitAspect)
|
||||
|
||||
public:
|
||||
QmakeKitAspectWidget(Kit *k, const KitAspect *ki)
|
||||
: KitAspectWidget(k, ki), m_lineEdit(new QLineEdit)
|
||||
{
|
||||
refresh(); // set up everything according to kit
|
||||
m_lineEdit->setToolTip(toolTip());
|
||||
connect(m_lineEdit, &QLineEdit::textEdited, this, &QmakeKitAspectWidget::mkspecWasChanged);
|
||||
}
|
||||
|
||||
~QmakeKitAspectWidget() override { delete m_lineEdit; }
|
||||
|
||||
private:
|
||||
QWidget *mainWidget() const override { return m_lineEdit; }
|
||||
QString displayName() const override { return tr("Qt mkspec"); }
|
||||
void makeReadOnly() override { m_lineEdit->setEnabled(false); }
|
||||
|
||||
QString toolTip() const override
|
||||
{
|
||||
return tr("The mkspec to use when building the project with qmake.<br>"
|
||||
"This setting is ignored when using other build systems.");
|
||||
}
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
if (!m_ignoreChange)
|
||||
m_lineEdit->setText(QmakeKitAspect::mkspec(m_kit).toUserOutput());
|
||||
}
|
||||
|
||||
void mkspecWasChanged(const QString &text)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
QmakeKitAspect::setMkspec(m_kit, Utils::FileName::fromString(text));
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
QLineEdit *m_lineEdit = nullptr;
|
||||
bool m_ignoreChange = false;
|
||||
};
|
||||
|
||||
|
||||
QmakeKitAspect::QmakeKitAspect()
|
||||
{
|
||||
@@ -171,4 +217,5 @@ FileName QmakeKitAspect::defaultMkspec(const Kit *k)
|
||||
ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
||||
|
@@ -25,13 +25,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "qmakeprojectmanager_global.h"
|
||||
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QMAKEPROJECTMANAGER_EXPORT QmakeKitAspect : public ProjectExplorer::KitAspect
|
||||
class QmakeKitAspect : public ProjectExplorer::KitAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -56,4 +55,5 @@ public:
|
||||
static Utils::FileName defaultMkspec(const ProjectExplorer::Kit *k);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
||||
|
@@ -7,7 +7,6 @@ DEFINES += \
|
||||
HEADERS += \
|
||||
qmakebuildinfo.h \
|
||||
qmakekitinformation.h \
|
||||
qmakekitconfigwidget.h \
|
||||
qmakeparsernodes.h \
|
||||
qmakeprojectimporter.h \
|
||||
qmakeprojectmanagerplugin.h \
|
||||
@@ -46,7 +45,6 @@ HEADERS += \
|
||||
qmakemakestep.h
|
||||
|
||||
SOURCES += \
|
||||
qmakekitconfigwidget.cpp \
|
||||
qmakekitinformation.cpp \
|
||||
qmakeparsernodes.cpp \
|
||||
qmakeprojectimporter.cpp \
|
||||
|
@@ -36,7 +36,6 @@ Project {
|
||||
"profilehighlighter.cpp", "profilehighlighter.h",
|
||||
"profilehoverhandler.cpp", "profilehoverhandler.h",
|
||||
"qmakebuildinfo.h",
|
||||
"qmakekitconfigwidget.cpp", "qmakekitconfigwidget.h",
|
||||
"qmakekitinformation.cpp", "qmakekitinformation.h",
|
||||
"qmakemakestep.cpp", "qmakemakestep.h",
|
||||
"qmakeparser.cpp", "qmakeparser.h",
|
||||
|
@@ -499,7 +499,7 @@ FileName QMakeStep::mkspec() const
|
||||
}
|
||||
}
|
||||
|
||||
return QmakeProjectManager::QmakeKitAspect::effectiveMkspec(target()->kit());
|
||||
return QmakeKitAspect::effectiveMkspec(target()->kit());
|
||||
}
|
||||
|
||||
QVariantMap QMakeStep::toMap() const
|
||||
|
@@ -1,66 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** 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
|
||||
|
||||
#include <projectexplorer/kitconfigwidget.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace QtSupport {
|
||||
namespace Internal {
|
||||
|
||||
class QtKitAspectWidget : public ProjectExplorer::KitAspectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtKitAspectWidget(ProjectExplorer::Kit *k, const ProjectExplorer::KitAspect *ki);
|
||||
~QtKitAspectWidget() override;
|
||||
|
||||
QString displayName() const override;
|
||||
|
||||
void makeReadOnly() override;
|
||||
|
||||
void refresh() override;
|
||||
QWidget *mainWidget() const override;
|
||||
QWidget *buttonWidget() const override;
|
||||
QString toolTip() const override;
|
||||
|
||||
private:
|
||||
void versionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed);
|
||||
void manageQtVersions();
|
||||
void currentWasChanged(int idx);
|
||||
int findQtVersion(const int id) const;
|
||||
|
||||
QComboBox *m_combo;
|
||||
QPushButton *m_manageButton;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
@@ -27,23 +27,132 @@
|
||||
|
||||
#include <QRegExp>
|
||||
|
||||
#include "qtkitconfigwidget.h"
|
||||
#include "qtsupportconstants.h"
|
||||
#include "qtversionmanager.h"
|
||||
#include "qtparser.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/task.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/buildablehelperlibrary.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace QtSupport {
|
||||
namespace Internal {
|
||||
|
||||
class QtKitAspectWidget : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(QtSupport::QtKitAspectWidget)
|
||||
public:
|
||||
QtKitAspectWidget(Kit *k, const KitAspect *ki) : KitAspectWidget(k, ki)
|
||||
{
|
||||
m_combo = new QComboBox;
|
||||
m_combo->setSizePolicy(QSizePolicy::Ignored, m_combo->sizePolicy().verticalPolicy());
|
||||
m_combo->addItem(tr("None"), -1);
|
||||
|
||||
QList<int> versionIds = Utils::transform(QtVersionManager::versions(), &BaseQtVersion::uniqueId);
|
||||
versionsChanged(versionIds, QList<int>(), QList<int>());
|
||||
|
||||
m_manageButton = new QPushButton(KitAspectWidget::msgManage());
|
||||
|
||||
refresh();
|
||||
m_combo->setToolTip(toolTip());
|
||||
|
||||
connect(m_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &QtKitAspectWidget::currentWasChanged);
|
||||
|
||||
connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged,
|
||||
this, &QtKitAspectWidget::versionsChanged);
|
||||
|
||||
connect(m_manageButton, &QAbstractButton::clicked, this, &QtKitAspectWidget::manageQtVersions);
|
||||
}
|
||||
|
||||
~QtKitAspectWidget() override
|
||||
{
|
||||
delete m_combo;
|
||||
delete m_manageButton;
|
||||
}
|
||||
|
||||
private:
|
||||
QString displayName() const override { return tr("Qt version"); }
|
||||
void makeReadOnly() override { m_combo->setEnabled(false); }
|
||||
QWidget *mainWidget() const override { return m_combo; }
|
||||
QWidget *buttonWidget() const override { return m_manageButton; }
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
m_combo->setCurrentIndex(findQtVersion(QtKitAspect::qtVersionId(m_kit)));
|
||||
}
|
||||
|
||||
QString toolTip() const override
|
||||
{
|
||||
return tr("The Qt library to use for all projects using this kit.<br>"
|
||||
"A Qt version is required for qmake-based projects "
|
||||
"and optional when using other build systems.");
|
||||
}
|
||||
|
||||
private:
|
||||
static QString itemNameFor(const BaseQtVersion *v)
|
||||
{
|
||||
QTC_ASSERT(v, return QString());
|
||||
QString name = v->displayName();
|
||||
if (!v->isValid())
|
||||
name = QCoreApplication::translate("QtSupport::Internal::QtKitConfigWidget", "%1 (invalid)").arg(v->displayName());
|
||||
return name;
|
||||
}
|
||||
|
||||
void versionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed)
|
||||
{
|
||||
foreach (const int id, added) {
|
||||
BaseQtVersion *v = QtVersionManager::version(id);
|
||||
QTC_CHECK(v);
|
||||
QTC_CHECK(findQtVersion(id) < 0);
|
||||
m_combo->addItem(itemNameFor(v), id);
|
||||
}
|
||||
foreach (const int id, removed) {
|
||||
int pos = findQtVersion(id);
|
||||
if (pos >= 0) // We do not include invalid Qt versions, so do not try to remove those.
|
||||
m_combo->removeItem(pos);
|
||||
}
|
||||
foreach (const int id, changed) {
|
||||
BaseQtVersion *v = QtVersionManager::version(id);
|
||||
int pos = findQtVersion(id);
|
||||
QTC_CHECK(pos >= 0);
|
||||
m_combo->setItemText(pos, itemNameFor(v));
|
||||
}
|
||||
}
|
||||
|
||||
void manageQtVersions()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Constants::QTVERSION_SETTINGS_PAGE_ID, buttonWidget());
|
||||
}
|
||||
|
||||
void currentWasChanged(int idx)
|
||||
{
|
||||
QtKitAspect::setQtVersionId(m_kit, m_combo->itemData(idx).toInt());
|
||||
}
|
||||
|
||||
int findQtVersion(const int id) const
|
||||
{
|
||||
for (int i = 0; i < m_combo->count(); ++i) {
|
||||
if (id == m_combo->itemData(i).toInt())
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
QComboBox *m_combo;
|
||||
QPushButton *m_manageButton;
|
||||
};
|
||||
} // namespace Internal
|
||||
|
||||
QtKitAspect::QtKitAspect()
|
||||
{
|
||||
|
@@ -15,7 +15,6 @@ HEADERS += \
|
||||
qtprojectimporter.h \
|
||||
qtsupportplugin.h \
|
||||
qtsupport_global.h \
|
||||
qtkitconfigwidget.h \
|
||||
qtkitinformation.h \
|
||||
qtoutputformatter.h \
|
||||
qtversionmanager.h \
|
||||
@@ -42,7 +41,6 @@ SOURCES += \
|
||||
qtcppkitinfo.cpp \
|
||||
qtprojectimporter.cpp \
|
||||
qtsupportplugin.cpp \
|
||||
qtkitconfigwidget.cpp \
|
||||
qtkitinformation.cpp \
|
||||
qtoutputformatter.cpp \
|
||||
qtversionmanager.cpp \
|
||||
|
@@ -76,8 +76,6 @@ Project {
|
||||
"qmldumptool.h",
|
||||
"qscxmlcgenerator.cpp",
|
||||
"qscxmlcgenerator.h",
|
||||
"qtkitconfigwidget.cpp",
|
||||
"qtkitconfigwidget.h",
|
||||
"qtkitinformation.cpp",
|
||||
"qtkitinformation.h",
|
||||
"qtoptionspage.cpp",
|
||||
|
Reference in New Issue
Block a user