2015-09-21 15:22:31 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2015-09-21 15:22:31 +02:00
|
|
|
**
|
|
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2015-09-21 15:22:31 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2015-09-21 15:22:31 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
#include "jsonfieldpage.h"
|
|
|
|
|
|
|
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QVariant>
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
|
2015-09-21 16:05:04 +02:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// JsonFieldPage::Field::FieldPrivate:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class JsonFieldPage::Field::FieldPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString m_name;
|
|
|
|
|
QString m_displayName;
|
|
|
|
|
QString m_toolTip;
|
|
|
|
|
bool m_isMandatory = false;
|
|
|
|
|
bool m_hasSpan = false;
|
|
|
|
|
|
|
|
|
|
QVariant m_visibleExpression;
|
|
|
|
|
QVariant m_enabledExpression;
|
|
|
|
|
QVariant m_isCompleteExpando;
|
|
|
|
|
QString m_isCompleteExpandoMessage;
|
|
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
QWidget *m_widget = nullptr;
|
2015-09-21 16:05:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// Field Implementations:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
2015-09-21 15:22:31 +02:00
|
|
|
class LabelField : public JsonFieldPage::Field
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
LabelField();
|
|
|
|
|
|
|
|
|
|
private:
|
2016-04-13 15:52:14 +02:00
|
|
|
QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override;
|
|
|
|
|
bool parseData(const QVariant &data, QString *errorMessage) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
bool m_wordWrap;
|
|
|
|
|
QString m_text;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class SpacerField : public JsonFieldPage::Field
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SpacerField();
|
|
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
bool suppressName() const override { return true; }
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
private:
|
2016-04-13 15:52:14 +02:00
|
|
|
bool parseData(const QVariant &data, QString *errorMessage) override;
|
|
|
|
|
QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
int m_factor;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class LineEditField : public JsonFieldPage::Field
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
LineEditField();
|
|
|
|
|
|
|
|
|
|
private:
|
2016-04-13 15:52:14 +02:00
|
|
|
bool parseData(const QVariant &data, QString *errorMessage) override;
|
|
|
|
|
QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
void setup(JsonFieldPage *page, const QString &name) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
bool validate(Utils::MacroExpander *expander, QString *message) override;
|
|
|
|
|
void initializeData(Utils::MacroExpander *expander) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
bool m_isModified;
|
|
|
|
|
bool m_isValidating;
|
2015-12-04 13:55:05 +01:00
|
|
|
bool m_restoreLastHistoryItem;
|
2015-09-21 15:22:31 +02:00
|
|
|
QString m_placeholderText;
|
|
|
|
|
QString m_defaultText;
|
|
|
|
|
QString m_disabledText;
|
2015-12-04 13:55:05 +01:00
|
|
|
QString m_historyId;
|
2015-09-21 15:22:31 +02:00
|
|
|
QRegularExpression m_validatorRegExp;
|
|
|
|
|
QString m_fixupExpando;
|
|
|
|
|
mutable QString m_currentText;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TextEditField : public JsonFieldPage::Field
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TextEditField();
|
|
|
|
|
|
|
|
|
|
private:
|
2016-04-13 15:52:14 +02:00
|
|
|
bool parseData(const QVariant &data, QString *errorMessage) override;
|
|
|
|
|
QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
void setup(JsonFieldPage *page, const QString &name) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
bool validate(Utils::MacroExpander *expander, QString *message) override;
|
|
|
|
|
void initializeData(Utils::MacroExpander *expander) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
QString m_defaultText;
|
|
|
|
|
bool m_acceptRichText;
|
|
|
|
|
QString m_disabledText;
|
|
|
|
|
|
|
|
|
|
mutable QString m_currentText;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PathChooserField : public JsonFieldPage::Field
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
PathChooserField();
|
|
|
|
|
|
|
|
|
|
private:
|
2016-04-13 15:52:14 +02:00
|
|
|
bool parseData(const QVariant &data, QString *errorMessage) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override;
|
|
|
|
|
void setEnabled(bool e) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
void setup(JsonFieldPage *page, const QString &name) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
bool validate(Utils::MacroExpander *expander, QString *message) override;
|
|
|
|
|
void initializeData(Utils::MacroExpander *expander) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
QString m_path;
|
|
|
|
|
QString m_basePath;
|
2015-12-04 13:55:05 +01:00
|
|
|
QString m_historyId;
|
2015-09-21 15:22:31 +02:00
|
|
|
Utils::PathChooser::Kind m_kind;
|
|
|
|
|
|
|
|
|
|
QString m_currentPath;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CheckBoxField : public JsonFieldPage::Field
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CheckBoxField();
|
|
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
bool suppressName() const override { return true; }
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
private:
|
2016-04-13 15:52:14 +02:00
|
|
|
bool parseData(const QVariant &data, QString *errorMessage) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
void setup(JsonFieldPage *page, const QString &name) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
bool validate(Utils::MacroExpander *expander, QString *message) override;
|
|
|
|
|
void initializeData(Utils::MacroExpander *expander) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
QString m_checkedValue;
|
|
|
|
|
QString m_uncheckedValue;
|
|
|
|
|
QVariant m_checkedExpression;
|
|
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
bool m_isModified = false;
|
2015-09-21 15:22:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ComboBoxField : public JsonFieldPage::Field
|
|
|
|
|
{
|
|
|
|
|
public:
|
2016-04-13 15:52:14 +02:00
|
|
|
ComboBoxField() = default;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
private:
|
2016-04-13 15:52:14 +02:00
|
|
|
bool parseData(const QVariant &data, QString *errorMessage) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
QWidget *createWidget(const QString &displayName, JsonFieldPage *page) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
void setup(JsonFieldPage *page, const QString &name) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
bool validate(Utils::MacroExpander *expander, QString *message) override;
|
|
|
|
|
void initializeData(Utils::MacroExpander *expander) override;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
|
|
|
|
QStringList m_itemList;
|
|
|
|
|
QStringList m_itemDataList;
|
|
|
|
|
QVariantList m_itemConditionList;
|
2016-04-13 15:52:14 +02:00
|
|
|
int m_index = -1;
|
|
|
|
|
int m_disabledIndex = -1;
|
2015-09-21 15:22:31 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
mutable int m_savedIndex = -1;
|
2015-09-21 15:22:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace ProjectExplorer
|