diff options
author | hjk <hjk@theqtcompany.com> | 2015-04-29 11:57:43 +0200 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2015-04-29 10:52:21 +0000 |
commit | 7c8a43cac3cd6dfc946ed58fbe24b69b170fccb8 (patch) | |
tree | e95bdb2a44b2f19a698ec830710b80c759977622 /src/plugins/projectexplorer | |
parent | d8a258e55a1536523591628e070a4b743ddf338d (diff) | |
download | qt-creator-7c8a43cac3cd6dfc946ed58fbe24b69b170fccb8.tar.gz |
ProjectExplorer: Merge terminalaspect.* into runconfigurationaspects.*
Change-Id: I24c61feac5e25171f5878c4f87e760481eff7996
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r-- | src/plugins/projectexplorer/projectexplorer.pro | 2 | ||||
-rw-r--r-- | src/plugins/projectexplorer/projectexplorer.qbs | 1 | ||||
-rw-r--r-- | src/plugins/projectexplorer/runconfigurationaspects.cpp | 63 | ||||
-rw-r--r-- | src/plugins/projectexplorer/runconfigurationaspects.h | 28 | ||||
-rw-r--r-- | src/plugins/projectexplorer/terminalaspect.cpp | 107 | ||||
-rw-r--r-- | src/plugins/projectexplorer/terminalaspect.h | 71 |
6 files changed, 91 insertions, 181 deletions
diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index f242579c0b..399980d683 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -12,7 +12,6 @@ HEADERS += projectexplorer.h \ configtaskhandler.h \ environmentaspect.h \ environmentaspectwidget.h \ - terminalaspect.h \ gcctoolchain.h \ importwidget.h \ localapplicationrunconfiguration.h \ @@ -165,7 +164,6 @@ SOURCES += projectexplorer.cpp \ configtaskhandler.cpp \ environmentaspect.cpp \ environmentaspectwidget.cpp \ - terminalaspect.cpp \ gcctoolchain.cpp \ importwidget.cpp \ localapplicationrunconfiguration.cpp \ diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index e319a1de0a..ccc7169b18 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -147,7 +147,6 @@ QtcPlugin { "taskhub.cpp", "taskhub.h", "taskmodel.cpp", "taskmodel.h", "taskwindow.cpp", "taskwindow.h", - "terminalaspect.cpp", "terminalaspect.h", "toolchain.cpp", "toolchain.h", "toolchainconfigwidget.cpp", "toolchainconfigwidget.h", "toolchainmanager.cpp", "toolchainmanager.h", diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 48bb37b00f..056d98853b 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -51,6 +51,69 @@ using namespace Utils; namespace ProjectExplorer { /*! + \class ProjectExplorer::TerminalAspect +*/ + +TerminalAspect::TerminalAspect(RunConfiguration *runConfig, const QString &key, bool useTerminal, bool isForced) + : IRunConfigurationAspect(runConfig), m_useTerminal(useTerminal), + m_isForced(isForced), m_checkBox(0), m_key(key) +{ + setDisplayName(tr("Terminal")); + setId("TerminalAspect"); +} + +IRunConfigurationAspect *TerminalAspect::create(RunConfiguration *runConfig) const +{ + return new TerminalAspect(runConfig, m_key, false, false); +} + +IRunConfigurationAspect *TerminalAspect::clone(RunConfiguration *runConfig) const +{ + return new TerminalAspect(runConfig, m_key, m_useTerminal, m_isForced); +} + +void TerminalAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout) +{ + QTC_CHECK(!m_checkBox); + m_checkBox = new QCheckBox(tr("Run in terminal"), parent); + m_checkBox->setChecked(m_useTerminal); + layout->addRow(QString(), m_checkBox); + connect(m_checkBox.data(), &QAbstractButton::clicked, this, [this] { + m_isForced = true; + setUseTerminal(true); + }); +} + +void TerminalAspect::fromMap(const QVariantMap &map) +{ + if (map.contains(m_key)) { + m_useTerminal = map.value(m_key).toBool(); + m_isForced = true; + } else { + m_isForced = false; + } +} + +void TerminalAspect::toMap(QVariantMap &data) const +{ + if (m_isForced) + data.insert(m_key, m_useTerminal); +} + +bool TerminalAspect::useTerminal() const +{ + return m_useTerminal; +} + +void TerminalAspect::setUseTerminal(bool useTerminal) +{ + if (m_useTerminal != useTerminal) { + m_useTerminal = useTerminal; + emit useTerminalChanged(useTerminal); + } +} + +/*! \class ProjectExplorer::WorkingDirectoryAspect */ diff --git a/src/plugins/projectexplorer/runconfigurationaspects.h b/src/plugins/projectexplorer/runconfigurationaspects.h index e27b79a335..6b25110470 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.h +++ b/src/plugins/projectexplorer/runconfigurationaspects.h @@ -46,6 +46,34 @@ class PathChooser; namespace ProjectExplorer { +class PROJECTEXPLORER_EXPORT TerminalAspect : public IRunConfigurationAspect +{ + Q_OBJECT + +public: + explicit TerminalAspect(RunConfiguration *rc, const QString &key, bool useTerminal = false, bool isForced = false); + + IRunConfigurationAspect *create(RunConfiguration *runConfig) const override; + IRunConfigurationAspect *clone(RunConfiguration *runConfig) const override; + + void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout) override; + + bool useTerminal() const; + void setUseTerminal(bool useTerminal); + +signals: + void useTerminalChanged(bool); + +private: + void fromMap(const QVariantMap &map) override; + void toMap(QVariantMap &map) const override; + + bool m_useTerminal; + bool m_isForced; + QPointer<QCheckBox> m_checkBox; // Owned by RunConfigWidget + QString m_key; +}; + class PROJECTEXPLORER_EXPORT WorkingDirectoryAspect : public IRunConfigurationAspect { Q_OBJECT diff --git a/src/plugins/projectexplorer/terminalaspect.cpp b/src/plugins/projectexplorer/terminalaspect.cpp deleted file mode 100644 index 06d1360ac1..0000000000 --- a/src/plugins/projectexplorer/terminalaspect.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "terminalaspect.h" - -#include <projectexplorer/project.h> -#include <projectexplorer/runconfiguration.h> - -#include <QCheckBox> -#include <QDebug> -#include <QFormLayout> -#include <QLabel> - -const char USE_TERMINAL_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseTerminal"; - -namespace ProjectExplorer { - -/*! - \class ProjectExplorer::TerminalAspect -*/ - -TerminalAspect::TerminalAspect(RunConfiguration *runConfig, bool useTerminal, bool isForced) - : IRunConfigurationAspect(runConfig), m_useTerminal(useTerminal), m_isForced(isForced), m_checkBox(0) -{ - setDisplayName(tr("Terminal")); - setId("TerminalAspect"); -} - -IRunConfigurationAspect *TerminalAspect::create(RunConfiguration *runConfig) const -{ - return new TerminalAspect(runConfig, false, false); -} - -IRunConfigurationAspect *TerminalAspect::clone(RunConfiguration *runConfig) const -{ - return new TerminalAspect(runConfig, m_useTerminal, m_isForced); -} - -void TerminalAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout) -{ - QTC_CHECK(!m_checkBox); - m_checkBox = new QCheckBox(tr("Run in terminal"), parent); - m_checkBox->setChecked(m_useTerminal); - layout->addRow(QString(), m_checkBox); - connect(m_checkBox.data(), &QAbstractButton::clicked, this, [this] { - m_isForced = true; - setUseTerminal(true); - }); -} - -void TerminalAspect::fromMap(const QVariantMap &map) -{ - if (map.contains(QLatin1String(USE_TERMINAL_KEY))) { - m_useTerminal = map.value(QLatin1String(USE_TERMINAL_KEY)).toBool(); - m_isForced = true; - } else { - m_isForced = false; - } -} - -void TerminalAspect::toMap(QVariantMap &data) const -{ - if (m_isForced) - data.insert(QLatin1String(USE_TERMINAL_KEY), m_useTerminal); -} - -bool TerminalAspect::useTerminal() const -{ - return m_useTerminal; -} - -void TerminalAspect::setUseTerminal(bool useTerminal) -{ - if (m_useTerminal != useTerminal) { - m_useTerminal = useTerminal; - emit useTerminalChanged(useTerminal); - } -} - -} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/terminalaspect.h b/src/plugins/projectexplorer/terminalaspect.h deleted file mode 100644 index 3ce425da87..0000000000 --- a/src/plugins/projectexplorer/terminalaspect.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef TERMINALASPECT_H -#define TERMINALASPECT_H - -#include "runconfiguration.h" - -QT_BEGIN_NAMESPACE -class QCheckBox; -QT_END_NAMESPACE - -namespace ProjectExplorer { - -class PROJECTEXPLORER_EXPORT TerminalAspect : public IRunConfigurationAspect -{ - Q_OBJECT - -public: - explicit TerminalAspect(RunConfiguration *rc, bool useTerminal = false, bool isForced = false); - - IRunConfigurationAspect *create(RunConfiguration *runConfig) const override; - IRunConfigurationAspect *clone(RunConfiguration *runConfig) const override; - - void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout) override; - - bool useTerminal() const; - void setUseTerminal(bool useTerminal); - -signals: - void useTerminalChanged(bool); - -private: - void fromMap(const QVariantMap &map) override; - void toMap(QVariantMap &map) const override; - - bool m_useTerminal; - bool m_isForced; - QPointer<QCheckBox> m_checkBox; // Owned by RunConfigWidget -}; - -} // namespace ProjectExplorer - -#endif // TERMINALASPECT_H |