forked from qt-creator/qt-creator
Utils/QMakeProjectManager: Remove dead code
...otherwise I would have had to fix some theming issue. Change-Id: I70eecd8c2e4f592749f89aab0384d281ab3fdee3 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
@@ -103,7 +103,6 @@ add_qtc_library(Utils
|
||||
namevaluevalidator.cpp namevaluevalidator.h
|
||||
navigationtreeview.cpp navigationtreeview.h
|
||||
networkaccessmanager.cpp networkaccessmanager.h
|
||||
newclasswidget.cpp newclasswidget.h newclasswidget.ui
|
||||
optional.h
|
||||
osspecificaspects.h
|
||||
outputformat.h
|
||||
|
@@ -1,577 +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 "newclasswidget.h"
|
||||
#include "ui_newclasswidget.h"
|
||||
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QDebug>
|
||||
#include <QRegExp>
|
||||
|
||||
enum { debugNewClassWidget = 0 };
|
||||
|
||||
/*! \class Utils::NewClassWidget
|
||||
|
||||
\brief The NewClassWidget class is a utility widget for 'New Class' wizards.
|
||||
|
||||
This widget prompts the user
|
||||
to enter a class name (optionally derived from some base class) and file
|
||||
names for header, source and form files. Has some smart logic to derive
|
||||
the file names from the class name. */
|
||||
|
||||
namespace Utils {
|
||||
|
||||
struct NewClassWidgetPrivate {
|
||||
NewClassWidgetPrivate();
|
||||
|
||||
Ui::NewClassWidget m_ui;
|
||||
QString m_headerExtension;
|
||||
QString m_sourceExtension;
|
||||
QString m_formExtension;
|
||||
bool m_valid = false;
|
||||
bool m_classEdited = false;
|
||||
// Store the "visible" values to prevent the READ accessors from being
|
||||
// fooled by a temporarily hidden widget
|
||||
bool m_baseClassInputVisible = true;
|
||||
bool m_formInputVisible = true;
|
||||
bool m_headerInputVisible = true;
|
||||
bool m_sourceInputVisible = true;
|
||||
bool m_pathInputVisible = true;
|
||||
bool m_qobjectCheckBoxVisible = false;
|
||||
bool m_formInputCheckable = false;
|
||||
QRegExp m_classNameValidator;
|
||||
};
|
||||
|
||||
NewClassWidgetPrivate:: NewClassWidgetPrivate() :
|
||||
m_headerExtension(QLatin1Char('h')),
|
||||
m_sourceExtension(QLatin1String("cpp")),
|
||||
m_formExtension(QLatin1String("ui"))
|
||||
{
|
||||
}
|
||||
|
||||
// --------------------- NewClassWidget
|
||||
NewClassWidget::NewClassWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
d(new NewClassWidgetPrivate)
|
||||
{
|
||||
d->m_ui.setupUi(this);
|
||||
|
||||
d->m_ui.baseClassComboBox->setEditable(false);
|
||||
|
||||
setNamesDelimiter(QLatin1String("::"));
|
||||
|
||||
connect(d->m_ui.classLineEdit, &ClassNameValidatingLineEdit::updateFileName,
|
||||
this, &NewClassWidget::slotUpdateFileNames);
|
||||
connect(d->m_ui.classLineEdit, &QLineEdit::textEdited,
|
||||
this, &NewClassWidget::classNameEdited);
|
||||
connect(d->m_ui.baseClassComboBox,
|
||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &NewClassWidget::suggestClassNameFromBase);
|
||||
connect(d->m_ui.baseClassComboBox, &QComboBox::editTextChanged,
|
||||
this, &NewClassWidget::slotValidChanged);
|
||||
connect(d->m_ui.classLineEdit, &FancyLineEdit::validChanged,
|
||||
this, &NewClassWidget::slotValidChanged);
|
||||
connect(d->m_ui.headerFileLineEdit, &FancyLineEdit::validChanged,
|
||||
this, &NewClassWidget::slotValidChanged);
|
||||
connect(d->m_ui.sourceFileLineEdit, &FancyLineEdit::validChanged,
|
||||
this, &NewClassWidget::slotValidChanged);
|
||||
connect(d->m_ui.formFileLineEdit, &FancyLineEdit::validChanged,
|
||||
this, &NewClassWidget::slotValidChanged);
|
||||
connect(d->m_ui.pathChooser, &PathChooser::validChanged,
|
||||
this, &NewClassWidget::slotValidChanged);
|
||||
connect(d->m_ui.generateFormCheckBox, &QAbstractButton::toggled,
|
||||
this, &NewClassWidget::slotValidChanged);
|
||||
|
||||
connect(d->m_ui.classLineEdit, &FancyLineEdit::validReturnPressed,
|
||||
this, &NewClassWidget::slotActivated);
|
||||
connect(d->m_ui.headerFileLineEdit, &FancyLineEdit::validReturnPressed,
|
||||
this, &NewClassWidget::slotActivated);
|
||||
connect(d->m_ui.sourceFileLineEdit, &FancyLineEdit::validReturnPressed,
|
||||
this, &NewClassWidget::slotActivated);
|
||||
connect(d->m_ui.formFileLineEdit, &FancyLineEdit::validReturnPressed,
|
||||
this, &NewClassWidget::slotActivated);
|
||||
connect(d->m_ui.formFileLineEdit, &FancyLineEdit::validReturnPressed,
|
||||
this, &NewClassWidget::slotActivated);
|
||||
connect(d->m_ui.pathChooser, &PathChooser::returnPressed,
|
||||
this, &NewClassWidget::slotActivated);
|
||||
|
||||
connect(d->m_ui.generateFormCheckBox, &QCheckBox::stateChanged,
|
||||
this, &NewClassWidget::slotFormInputChecked);
|
||||
connect(d->m_ui.baseClassComboBox, &QComboBox::editTextChanged,
|
||||
this, &NewClassWidget::slotBaseClassEdited);
|
||||
d->m_ui.generateFormCheckBox->setChecked(true);
|
||||
setFormInputCheckable(false, true);
|
||||
setClassType(NoClassType);
|
||||
}
|
||||
|
||||
NewClassWidget::~NewClassWidget()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void NewClassWidget::classNameEdited()
|
||||
{
|
||||
if (debugNewClassWidget)
|
||||
qDebug() << Q_FUNC_INFO << d->m_headerExtension << d->m_sourceExtension;
|
||||
d->m_classEdited = true;
|
||||
}
|
||||
|
||||
void NewClassWidget::suggestClassNameFromBase()
|
||||
{
|
||||
if (debugNewClassWidget)
|
||||
qDebug() << Q_FUNC_INFO << d->m_headerExtension << d->m_sourceExtension;
|
||||
if (d->m_classEdited)
|
||||
return;
|
||||
// Suggest a class unless edited ("QMainWindow"->"MainWindow")
|
||||
QString base = baseClassName();
|
||||
if (base.startsWith(QLatin1Char('Q'))) {
|
||||
base.remove(0, 1);
|
||||
setClassName(base);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList NewClassWidget::baseClassChoices() const
|
||||
{
|
||||
QStringList rc;
|
||||
const int count = d->m_ui.baseClassComboBox->count();
|
||||
for (int i = 0; i < count; i++)
|
||||
rc.push_back(d->m_ui.baseClassComboBox->itemText(i));
|
||||
return rc;
|
||||
}
|
||||
|
||||
void NewClassWidget::setBaseClassChoices(const QStringList &choices)
|
||||
{
|
||||
d->m_ui.baseClassComboBox->clear();
|
||||
d->m_ui.baseClassComboBox->addItems(choices);
|
||||
}
|
||||
|
||||
void NewClassWidget::setBaseClassInputVisible(bool visible)
|
||||
{
|
||||
d->m_baseClassInputVisible = visible;
|
||||
d->m_ui.baseClassLabel->setVisible(visible);
|
||||
d->m_ui.baseClassComboBox->setVisible(visible);
|
||||
}
|
||||
|
||||
void NewClassWidget::setBaseClassEditable(bool editable)
|
||||
{
|
||||
d->m_ui.baseClassComboBox->setEditable(editable);
|
||||
}
|
||||
|
||||
bool NewClassWidget::isBaseClassInputVisible() const
|
||||
{
|
||||
return d->m_baseClassInputVisible;
|
||||
}
|
||||
|
||||
bool NewClassWidget::isBaseClassEditable() const
|
||||
{
|
||||
return d->m_ui.baseClassComboBox->isEditable();
|
||||
}
|
||||
|
||||
void NewClassWidget::setFormInputVisible(bool visible)
|
||||
{
|
||||
d->m_formInputVisible = visible;
|
||||
d->m_ui.formLabel->setVisible(visible);
|
||||
d->m_ui.formFileLineEdit->setVisible(visible);
|
||||
}
|
||||
|
||||
bool NewClassWidget::isFormInputVisible() const
|
||||
{
|
||||
return d->m_formInputVisible;
|
||||
}
|
||||
|
||||
void NewClassWidget::setHeaderInputVisible(bool visible)
|
||||
{
|
||||
d->m_headerInputVisible = visible;
|
||||
d->m_ui.headerLabel->setVisible(visible);
|
||||
d->m_ui.headerFileLineEdit->setVisible(visible);
|
||||
}
|
||||
|
||||
bool NewClassWidget::isHeaderInputVisible() const
|
||||
{
|
||||
return d->m_headerInputVisible;
|
||||
}
|
||||
|
||||
void NewClassWidget::setSourceInputVisible(bool visible)
|
||||
{
|
||||
d->m_sourceInputVisible = visible;
|
||||
d->m_ui.sourceLabel->setVisible(visible);
|
||||
d->m_ui.sourceFileLineEdit->setVisible(visible);
|
||||
}
|
||||
|
||||
bool NewClassWidget::isSourceInputVisible() const
|
||||
{
|
||||
return d->m_sourceInputVisible;
|
||||
}
|
||||
|
||||
void NewClassWidget::setFormInputCheckable(bool checkable)
|
||||
{
|
||||
setFormInputCheckable(checkable, false);
|
||||
}
|
||||
|
||||
void NewClassWidget::setFormInputCheckable(bool checkable, bool force)
|
||||
{
|
||||
if (!force && checkable == d->m_formInputCheckable)
|
||||
return;
|
||||
d->m_formInputCheckable = checkable;
|
||||
d->m_ui.generateFormLabel->setVisible(checkable);
|
||||
d->m_ui.generateFormCheckBox->setVisible(checkable);
|
||||
}
|
||||
|
||||
void NewClassWidget::setFormInputChecked(bool v)
|
||||
{
|
||||
d->m_ui.generateFormCheckBox->setChecked(v);
|
||||
}
|
||||
|
||||
bool NewClassWidget::formInputCheckable() const
|
||||
{
|
||||
return d->m_formInputCheckable;
|
||||
}
|
||||
|
||||
bool NewClassWidget::formInputChecked() const
|
||||
{
|
||||
return d->m_ui.generateFormCheckBox->isChecked();
|
||||
}
|
||||
|
||||
void NewClassWidget::slotFormInputChecked()
|
||||
{
|
||||
const bool checked = formInputChecked();
|
||||
d->m_ui.formLabel->setEnabled(checked);
|
||||
d->m_ui.formFileLineEdit->setEnabled(checked);
|
||||
}
|
||||
|
||||
void NewClassWidget::setPathInputVisible(bool visible)
|
||||
{
|
||||
d->m_pathInputVisible = visible;
|
||||
d->m_ui.pathLabel->setVisible(visible);
|
||||
d->m_ui.pathChooser->setVisible(visible);
|
||||
}
|
||||
|
||||
bool NewClassWidget::isPathInputVisible() const
|
||||
{
|
||||
return d->m_pathInputVisible;
|
||||
}
|
||||
|
||||
void NewClassWidget::setClassName(const QString &suggestedName)
|
||||
{
|
||||
if (debugNewClassWidget)
|
||||
qDebug() << Q_FUNC_INFO << suggestedName << d->m_headerExtension << d->m_sourceExtension;
|
||||
d->m_ui.classLineEdit->setText(ClassNameValidatingLineEdit::createClassName(suggestedName));
|
||||
}
|
||||
|
||||
QString NewClassWidget::className() const
|
||||
{
|
||||
return d->m_ui.classLineEdit->text();
|
||||
}
|
||||
|
||||
QString NewClassWidget::baseClassName() const
|
||||
{
|
||||
return d->m_ui.baseClassComboBox->currentText();
|
||||
}
|
||||
|
||||
void NewClassWidget::setBaseClassName(const QString &c)
|
||||
{
|
||||
const int index = d->m_ui.baseClassComboBox->findText(c);
|
||||
if (index != -1) {
|
||||
d->m_ui.baseClassComboBox->setCurrentIndex(index);
|
||||
suggestClassNameFromBase();
|
||||
}
|
||||
}
|
||||
|
||||
QString NewClassWidget::sourceFileName() const
|
||||
{
|
||||
return d->m_ui.sourceFileLineEdit->text();
|
||||
}
|
||||
|
||||
QString NewClassWidget::headerFileName() const
|
||||
{
|
||||
return d->m_ui.headerFileLineEdit->text();
|
||||
}
|
||||
|
||||
QString NewClassWidget::formFileName() const
|
||||
{
|
||||
return d->m_ui.formFileLineEdit->text();
|
||||
}
|
||||
|
||||
QString NewClassWidget::path() const
|
||||
{
|
||||
return d->m_ui.pathChooser->path();
|
||||
}
|
||||
|
||||
void NewClassWidget::setPath(const QString &path)
|
||||
{
|
||||
d->m_ui.pathChooser->setPath(path);
|
||||
}
|
||||
|
||||
bool NewClassWidget::namespacesEnabled() const
|
||||
{
|
||||
return d->m_ui.classLineEdit->namespacesEnabled();
|
||||
}
|
||||
|
||||
void NewClassWidget::setNamespacesEnabled(bool b)
|
||||
{
|
||||
d->m_ui.classLineEdit->setNamespacesEnabled(b);
|
||||
}
|
||||
|
||||
QString NewClassWidget::sourceExtension() const
|
||||
{
|
||||
return d->m_sourceExtension;
|
||||
}
|
||||
|
||||
void NewClassWidget::setSourceExtension(const QString &e)
|
||||
{
|
||||
if (debugNewClassWidget)
|
||||
qDebug() << Q_FUNC_INFO << e;
|
||||
d->m_sourceExtension = fixSuffix(e);
|
||||
}
|
||||
|
||||
QString NewClassWidget::headerExtension() const
|
||||
{
|
||||
return d->m_headerExtension;
|
||||
}
|
||||
|
||||
void NewClassWidget::setHeaderExtension(const QString &e)
|
||||
{
|
||||
if (debugNewClassWidget)
|
||||
qDebug() << Q_FUNC_INFO << e;
|
||||
d->m_headerExtension = fixSuffix(e);
|
||||
}
|
||||
|
||||
QString NewClassWidget::formExtension() const
|
||||
{
|
||||
return d->m_formExtension;
|
||||
}
|
||||
|
||||
void NewClassWidget::setFormExtension(const QString &e)
|
||||
{
|
||||
if (debugNewClassWidget)
|
||||
qDebug() << Q_FUNC_INFO << e;
|
||||
d->m_formExtension = fixSuffix(e);
|
||||
}
|
||||
|
||||
bool NewClassWidget::allowDirectories() const
|
||||
{
|
||||
return d->m_ui.headerFileLineEdit->allowDirectories();
|
||||
}
|
||||
|
||||
void NewClassWidget::setAllowDirectories(bool v)
|
||||
{
|
||||
// We keep all in sync
|
||||
if (allowDirectories() != v) {
|
||||
d->m_ui.sourceFileLineEdit->setAllowDirectories(v);
|
||||
d->m_ui.headerFileLineEdit->setAllowDirectories(v);
|
||||
d->m_ui.formFileLineEdit->setAllowDirectories(v);
|
||||
}
|
||||
}
|
||||
|
||||
bool NewClassWidget::lowerCaseFiles() const
|
||||
{
|
||||
return d->m_ui.classLineEdit->lowerCaseFileName();
|
||||
}
|
||||
|
||||
void NewClassWidget::setLowerCaseFiles(bool v)
|
||||
{
|
||||
d->m_ui.classLineEdit->setLowerCaseFileName(v);
|
||||
}
|
||||
|
||||
NewClassWidget::ClassType NewClassWidget::classType() const
|
||||
{
|
||||
return static_cast<ClassType>(d->m_ui.classTypeComboBox->currentIndex());
|
||||
}
|
||||
|
||||
QString NewClassWidget::namesDelimiter() const
|
||||
{
|
||||
return d->m_ui.classLineEdit->namespaceDelimiter();
|
||||
}
|
||||
|
||||
void NewClassWidget::setClassType(ClassType ct)
|
||||
{
|
||||
d->m_ui.classTypeComboBox->setCurrentIndex(ct);
|
||||
}
|
||||
|
||||
void NewClassWidget::setNamesDelimiter(const QString &delimiter)
|
||||
{
|
||||
d->m_ui.classLineEdit->setNamespaceDelimiter(delimiter);
|
||||
const QString escaped = QRegExp::escape(delimiter);
|
||||
d->m_classNameValidator = QRegExp(QLatin1String("[a-zA-Z_][a-zA-Z0-9_]*(")
|
||||
+ escaped
|
||||
+ QLatin1String("[a-zA-Z_][a-zA-Z0-9_]*)*"));
|
||||
}
|
||||
|
||||
bool NewClassWidget::isClassTypeComboVisible() const
|
||||
{
|
||||
return d->m_ui.classTypeLabel->isVisible();
|
||||
}
|
||||
|
||||
void NewClassWidget::setClassTypeComboVisible(bool v)
|
||||
{
|
||||
d->m_ui.classTypeLabel->setVisible(v);
|
||||
d->m_ui.classTypeComboBox->setVisible(v);
|
||||
}
|
||||
|
||||
// Guess suitable type information with some smartness
|
||||
static inline NewClassWidget::ClassType classTypeForBaseClass(const QString &baseClass)
|
||||
{
|
||||
if (!baseClass.startsWith(QLatin1Char('Q')))
|
||||
return NewClassWidget::NoClassType;
|
||||
// QObject types: QObject as such and models.
|
||||
if (baseClass == QLatin1String("QObject") ||
|
||||
(baseClass.startsWith(QLatin1String("QAbstract")) && baseClass.endsWith(QLatin1String("Model"))))
|
||||
return NewClassWidget::ClassInheritsQObject;
|
||||
// Widgets.
|
||||
if (baseClass == QLatin1String("QWidget") || baseClass == QLatin1String("QMainWindow")
|
||||
|| baseClass == QLatin1String("QDialog"))
|
||||
return NewClassWidget::ClassInheritsQWidget;
|
||||
// Declarative Items
|
||||
if (baseClass == QLatin1String("QDeclarativeItem"))
|
||||
return NewClassWidget::ClassInheritsQDeclarativeItem;
|
||||
if (baseClass == QLatin1String("QQuickItem"))
|
||||
return NewClassWidget::ClassInheritsQQuickItem;
|
||||
return NewClassWidget::NoClassType;
|
||||
}
|
||||
|
||||
void NewClassWidget::slotBaseClassEdited(const QString &baseClass)
|
||||
{
|
||||
// Set type information with some smartness.
|
||||
const ClassType currentClassType = classType();
|
||||
const ClassType recommendedClassType = classTypeForBaseClass(baseClass);
|
||||
if (recommendedClassType != NoClassType && currentClassType != recommendedClassType)
|
||||
setClassType(recommendedClassType);
|
||||
}
|
||||
|
||||
void NewClassWidget::slotValidChanged()
|
||||
{
|
||||
const bool newValid = isValid();
|
||||
if (newValid != d->m_valid) {
|
||||
d->m_valid = newValid;
|
||||
emit validChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewClassWidget::isValid(QString *error) const
|
||||
{
|
||||
if (!d->m_ui.classLineEdit->isValid()) {
|
||||
if (error)
|
||||
*error = d->m_ui.classLineEdit->errorMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBaseClassInputVisible() && isBaseClassEditable()) {
|
||||
const QString baseClass = d->m_ui.baseClassComboBox->currentText().trimmed();
|
||||
if (!baseClass.isEmpty() && !d->m_classNameValidator.exactMatch(baseClass)) {
|
||||
if (error)
|
||||
*error = tr("Invalid base class name");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isHeaderInputVisible() && !d->m_ui.headerFileLineEdit->isValid()) {
|
||||
if (error)
|
||||
*error = tr("Invalid header file name: \"%1\"").arg(d->m_ui.headerFileLineEdit->errorMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isSourceInputVisible() && !d->m_ui.sourceFileLineEdit->isValid()) {
|
||||
if (error)
|
||||
*error = tr("Invalid source file name: \"%1\"").arg(d->m_ui.sourceFileLineEdit->errorMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isFormInputVisible() &&
|
||||
(!d->m_formInputCheckable || d->m_ui.generateFormCheckBox->isChecked())) {
|
||||
if (!d->m_ui.formFileLineEdit->isValid()) {
|
||||
if (error)
|
||||
*error = tr("Invalid form file name: \"%1\"").arg(d->m_ui.formFileLineEdit->errorMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isPathInputVisible()) {
|
||||
if (!d->m_ui.pathChooser->isValid()) {
|
||||
if (error)
|
||||
*error = d->m_ui.pathChooser->errorMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void NewClassWidget::slotUpdateFileNames(const QString &baseName)
|
||||
{
|
||||
if (debugNewClassWidget)
|
||||
qDebug() << Q_FUNC_INFO << baseName << d->m_headerExtension << d->m_sourceExtension;
|
||||
const QChar dot = QLatin1Char('.');
|
||||
d->m_ui.sourceFileLineEdit->setText(baseName + dot + d->m_sourceExtension);
|
||||
d->m_ui.headerFileLineEdit->setText(baseName + dot + d->m_headerExtension);
|
||||
d->m_ui.formFileLineEdit->setText(baseName + dot + d->m_formExtension);
|
||||
}
|
||||
|
||||
void NewClassWidget::slotActivated()
|
||||
{
|
||||
if (d->m_valid)
|
||||
emit activated();
|
||||
}
|
||||
|
||||
QString NewClassWidget::fixSuffix(const QString &suffix)
|
||||
{
|
||||
QString s = suffix;
|
||||
if (s.startsWith(QLatin1Char('.')))
|
||||
s.remove(0, 1);
|
||||
return s;
|
||||
}
|
||||
|
||||
// Utility to add a suffix to a file unless the user specified one
|
||||
static QString ensureSuffix(QString f, const QString &extension)
|
||||
{
|
||||
const QChar dot = QLatin1Char('.');
|
||||
if (f.contains(dot))
|
||||
return f;
|
||||
f += dot;
|
||||
f += extension;
|
||||
return f;
|
||||
}
|
||||
|
||||
// If a non-empty name was passed, expand to directory and suffix
|
||||
static QString expandFileName(const QDir &dir, const QString &name, const QString &extension)
|
||||
{
|
||||
if (name.isEmpty())
|
||||
return QString();
|
||||
return dir.absoluteFilePath(ensureSuffix(name, extension));
|
||||
}
|
||||
|
||||
QStringList NewClassWidget::files() const
|
||||
{
|
||||
QStringList rc;
|
||||
const QDir dir = QDir(path());
|
||||
if (isHeaderInputVisible())
|
||||
rc.push_back(expandFileName(dir, headerFileName(), headerExtension()));
|
||||
if (isSourceInputVisible())
|
||||
rc.push_back(expandFileName(dir, sourceFileName(), sourceExtension()));
|
||||
if (isFormInputVisible())
|
||||
rc.push_back(expandFileName(dir, formFileName(), formExtension()));
|
||||
return rc;
|
||||
}
|
||||
|
||||
} // namespace Utils
|
@@ -1,165 +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 "utils_global.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QStringList;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
|
||||
struct NewClassWidgetPrivate;
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT NewClassWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool namespacesEnabled READ namespacesEnabled WRITE setNamespacesEnabled DESIGNABLE true)
|
||||
Q_PROPERTY(bool baseClassInputVisible READ isBaseClassInputVisible WRITE setBaseClassInputVisible DESIGNABLE true)
|
||||
Q_PROPERTY(bool baseClassEditable READ isBaseClassEditable WRITE setBaseClassEditable DESIGNABLE false)
|
||||
Q_PROPERTY(bool formInputVisible READ isFormInputVisible WRITE setFormInputVisible DESIGNABLE true)
|
||||
Q_PROPERTY(bool headerInputVisible READ isHeaderInputVisible WRITE setHeaderInputVisible DESIGNABLE true)
|
||||
Q_PROPERTY(bool sourceInputVisible READ isSourceInputVisible WRITE setSourceInputVisible DESIGNABLE true)
|
||||
Q_PROPERTY(bool pathInputVisible READ isPathInputVisible WRITE setPathInputVisible DESIGNABLE true)
|
||||
Q_PROPERTY(bool classTypeComboVisible READ isClassTypeComboVisible WRITE setClassTypeComboVisible DESIGNABLE true)
|
||||
Q_PROPERTY(QString className READ className WRITE setClassName DESIGNABLE true)
|
||||
Q_PROPERTY(QString baseClassName READ baseClassName WRITE setBaseClassName DESIGNABLE true)
|
||||
Q_PROPERTY(QString sourceFileName READ sourceFileName DESIGNABLE false)
|
||||
Q_PROPERTY(QString headerFileName READ headerFileName DESIGNABLE false)
|
||||
Q_PROPERTY(QString formFileName READ formFileName DESIGNABLE false)
|
||||
Q_PROPERTY(QString path READ path WRITE setPath DESIGNABLE true)
|
||||
Q_PROPERTY(QStringList baseClassChoices READ baseClassChoices WRITE setBaseClassChoices DESIGNABLE true)
|
||||
Q_PROPERTY(QString sourceExtension READ sourceExtension WRITE setSourceExtension DESIGNABLE true)
|
||||
Q_PROPERTY(QString headerExtension READ headerExtension WRITE setHeaderExtension DESIGNABLE true)
|
||||
Q_PROPERTY(QString formExtension READ formExtension WRITE setFormExtension DESIGNABLE true)
|
||||
Q_PROPERTY(QString namesDelimiter READ namesDelimiter WRITE setNamesDelimiter)
|
||||
Q_PROPERTY(bool formInputCheckable READ formInputCheckable WRITE setFormInputCheckable DESIGNABLE true)
|
||||
Q_PROPERTY(bool formInputChecked READ formInputChecked WRITE setFormInputChecked DESIGNABLE true)
|
||||
Q_PROPERTY(bool allowDirectories READ allowDirectories WRITE setAllowDirectories)
|
||||
Q_PROPERTY(bool lowerCaseFiles READ lowerCaseFiles WRITE setLowerCaseFiles)
|
||||
Q_PROPERTY(ClassType classType READ classType WRITE setClassType)
|
||||
// Utility "USER" property for wizards containing file names.
|
||||
Q_PROPERTY(QStringList files READ files DESIGNABLE false USER true)
|
||||
Q_ENUMS(ClassType)
|
||||
|
||||
public:
|
||||
enum ClassType { NoClassType,
|
||||
ClassInheritsQObject,
|
||||
ClassInheritsQWidget,
|
||||
ClassInheritsQDeclarativeItem,
|
||||
ClassInheritsQQuickItem,
|
||||
SharedDataClass
|
||||
};
|
||||
|
||||
explicit NewClassWidget(QWidget *parent = nullptr);
|
||||
~NewClassWidget() override;
|
||||
|
||||
bool namespacesEnabled() const;
|
||||
bool isBaseClassInputVisible() const;
|
||||
bool isBaseClassEditable() const;
|
||||
bool isFormInputVisible() const;
|
||||
bool isHeaderInputVisible() const;
|
||||
bool isSourceInputVisible() const;
|
||||
bool isPathInputVisible() const;
|
||||
bool formInputCheckable() const;
|
||||
bool formInputChecked() const;
|
||||
|
||||
QString className() const;
|
||||
QString baseClassName() const;
|
||||
QString sourceFileName() const;
|
||||
QString headerFileName() const;
|
||||
QString formFileName() const;
|
||||
QString path() const;
|
||||
QStringList baseClassChoices() const;
|
||||
QString sourceExtension() const;
|
||||
QString headerExtension() const;
|
||||
QString formExtension() const;
|
||||
bool allowDirectories() const;
|
||||
bool lowerCaseFiles() const;
|
||||
ClassType classType() const;
|
||||
QString namesDelimiter() const;
|
||||
bool isClassTypeComboVisible() const;
|
||||
|
||||
bool isValid(QString *error = nullptr) const;
|
||||
|
||||
QStringList files() const;
|
||||
|
||||
signals:
|
||||
void validChanged();
|
||||
void activated();
|
||||
|
||||
public slots:
|
||||
void setNamespacesEnabled(bool b);
|
||||
void setBaseClassInputVisible(bool visible);
|
||||
void setBaseClassEditable(bool editable);
|
||||
void setFormInputVisible(bool visible);
|
||||
void setHeaderInputVisible(bool visible);
|
||||
void setSourceInputVisible(bool visible);
|
||||
void setPathInputVisible(bool visible);
|
||||
void setFormInputCheckable(bool v);
|
||||
void setFormInputChecked(bool v);
|
||||
|
||||
/**
|
||||
* The name passed into the new class widget will be reformatted to be a
|
||||
* valid class name.
|
||||
*/
|
||||
void setClassName(const QString &suggestedName);
|
||||
void setBaseClassName(const QString &);
|
||||
void setPath(const QString &path);
|
||||
void setBaseClassChoices(const QStringList &choices);
|
||||
void setSourceExtension(const QString &e);
|
||||
void setHeaderExtension(const QString &e);
|
||||
void setFormExtension(const QString &e);
|
||||
void setAllowDirectories(bool v);
|
||||
void setLowerCaseFiles(bool v);
|
||||
void setClassType(ClassType ct);
|
||||
void setNamesDelimiter(const QString &delimiter);
|
||||
void setClassTypeComboVisible(bool v);
|
||||
|
||||
/**
|
||||
* Suggest a class name from the base class by stripping the leading 'Q'
|
||||
* character. This will happen automagically if the base class combo
|
||||
* changes until the class line edited is manually edited.
|
||||
*/
|
||||
void suggestClassNameFromBase();
|
||||
|
||||
private:
|
||||
void slotUpdateFileNames(const QString &t);
|
||||
void slotValidChanged();
|
||||
void slotActivated();
|
||||
void classNameEdited();
|
||||
void slotFormInputChecked();
|
||||
void slotBaseClassEdited(const QString &);
|
||||
void setFormInputCheckable(bool checkable, bool force);
|
||||
|
||||
QString fixSuffix(const QString &suffix);
|
||||
NewClassWidgetPrivate *d;
|
||||
};
|
||||
|
||||
} // namespace Utils
|
@@ -1,212 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Utils::NewClassWidget</class>
|
||||
<widget class="QWidget" name="Utils::NewClassWidget">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="classNameLabel">
|
||||
<property name="text">
|
||||
<string>&Class name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>classLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Utils::ClassNameValidatingLineEdit" name="classLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="baseClassLabel">
|
||||
<property name="text">
|
||||
<string>&Base class:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>baseClassComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="baseClassComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="classTypeLabel">
|
||||
<property name="text">
|
||||
<string>&Type information:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>classTypeComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="classTypeComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Inherits QObject</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Inherits QWidget</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Inherits QDeclarativeItem - Qt Quick 1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Inherits QQuickItem - Qt Quick 2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Based on QSharedData</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="headerLabel">
|
||||
<property name="text">
|
||||
<string>&Header file:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>headerFileLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="Utils::FileNameValidatingLineEdit" name="headerFileLineEdit"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="sourceLabel">
|
||||
<property name="text">
|
||||
<string>&Source file:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sourceFileLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="Utils::FileNameValidatingLineEdit" name="sourceFileLineEdit"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="generateFormLabel">
|
||||
<property name="text">
|
||||
<string>&Generate form:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>generateFormCheckBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="generateFormCheckBox">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="formLabel">
|
||||
<property name="text">
|
||||
<string>&Form file:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>formFileLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="Utils::FileNameValidatingLineEdit" name="formFileLineEdit"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="pathLabel">
|
||||
<property name="text">
|
||||
<string>&Path:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>pathLabel</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="Utils::PathChooser" name="pathChooser"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::ClassNameValidatingLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">utils/classnamevalidatinglineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Utils::FileNameValidatingLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">utils/filenamevalidatinglineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -55,7 +55,6 @@ SOURCES += \
|
||||
$$PWD/projectintropage.cpp \
|
||||
$$PWD/filenamevalidatinglineedit.cpp \
|
||||
$$PWD/codegeneration.cpp \
|
||||
$$PWD/newclasswidget.cpp \
|
||||
$$PWD/classnamevalidatinglineedit.cpp \
|
||||
$$PWD/fancylineedit.cpp \
|
||||
$$PWD/qtcolorbutton.cpp \
|
||||
@@ -174,7 +173,6 @@ HEADERS += \
|
||||
$$PWD/projectintropage.h \
|
||||
$$PWD/filenamevalidatinglineedit.h \
|
||||
$$PWD/codegeneration.h \
|
||||
$$PWD/newclasswidget.h \
|
||||
$$PWD/classnamevalidatinglineedit.h \
|
||||
$$PWD/fancylineedit.h \
|
||||
$$PWD/qtcolorbutton.h \
|
||||
@@ -284,7 +282,6 @@ HEADERS += \
|
||||
$$PWD/infolabel.h
|
||||
|
||||
FORMS += $$PWD/filewizardpage.ui \
|
||||
$$PWD/newclasswidget.ui \
|
||||
$$PWD/projectintropage.ui \
|
||||
$$PWD/proxycredentialsdialog.ui \
|
||||
$$PWD/removefiledialog.ui
|
||||
|
@@ -170,9 +170,6 @@ Project {
|
||||
"navigationtreeview.h",
|
||||
"networkaccessmanager.cpp",
|
||||
"networkaccessmanager.h",
|
||||
"newclasswidget.cpp",
|
||||
"newclasswidget.h",
|
||||
"newclasswidget.ui",
|
||||
"optional.h",
|
||||
"../3rdparty/optional/optional.hpp",
|
||||
"osspecificaspects.h",
|
||||
|
@@ -39,7 +39,6 @@ add_qtc_plugin(QmakeProjectManager
|
||||
qmakeprojectmanagerplugin.cpp qmakeprojectmanagerplugin.h
|
||||
qmakesettings.cpp qmakesettings.h
|
||||
qmakestep.cpp qmakestep.h
|
||||
wizards/filespage.cpp wizards/filespage.h
|
||||
wizards/qtprojectparameters.cpp wizards/qtprojectparameters.h
|
||||
wizards/qtwizard.cpp wizards/qtwizard.h
|
||||
wizards/simpleprojectwizard.cpp wizards/simpleprojectwizard.h
|
||||
|
@@ -19,7 +19,6 @@ HEADERS += \
|
||||
profilehighlighter.h \
|
||||
profilehoverhandler.h \
|
||||
wizards/qtprojectparameters.h \
|
||||
wizards/filespage.h \
|
||||
wizards/qtwizard.h \
|
||||
wizards/subdirsprojectwizard.h \
|
||||
wizards/subdirsprojectwizarddialog.h \
|
||||
@@ -50,7 +49,6 @@ SOURCES += \
|
||||
profilehighlighter.cpp \
|
||||
profilehoverhandler.cpp \
|
||||
wizards/qtprojectparameters.cpp \
|
||||
wizards/filespage.cpp \
|
||||
wizards/qtwizard.cpp \
|
||||
wizards/subdirsprojectwizard.cpp \
|
||||
wizards/subdirsprojectwizarddialog.cpp \
|
||||
|
@@ -74,7 +74,6 @@ Project {
|
||||
name: "Wizards"
|
||||
prefix: "wizards/"
|
||||
files: [
|
||||
"filespage.cpp", "filespage.h",
|
||||
"qtprojectparameters.cpp", "qtprojectparameters.h",
|
||||
"qtwizard.cpp", "qtwizard.h",
|
||||
"subdirsprojectwizard.cpp", "subdirsprojectwizard.h",
|
||||
|
@@ -1,199 +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 "filespage.h"
|
||||
|
||||
#include <utils/newclasswidget.h>
|
||||
#include <utils/wizard.h>
|
||||
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QVariant>
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
FilesPage::FilesPage(QWidget *parent) :
|
||||
QWizardPage(parent),
|
||||
m_newClassWidget(new Utils::NewClassWidget)
|
||||
{
|
||||
m_newClassWidget->setPathInputVisible(false);
|
||||
setTitle(tr("Class Information"));
|
||||
|
||||
QLabel *label = new QLabel(tr("Specify basic information about the classes "
|
||||
"for which you want to generate skeleton source code files."));
|
||||
label->setWordWrap(true);
|
||||
|
||||
auto *vlayout = new QVBoxLayout;
|
||||
vlayout->addWidget(label);
|
||||
vlayout->addItem(new QSpacerItem(0, 20));
|
||||
|
||||
vlayout->addWidget(m_newClassWidget);
|
||||
|
||||
vlayout->addItem(new QSpacerItem(0, 20));
|
||||
m_errorLabel = new QLabel;
|
||||
m_errorLabel->setStyleSheet(QLatin1String("color: red;"));
|
||||
vlayout->addWidget(m_errorLabel);
|
||||
setLayout(vlayout);
|
||||
|
||||
connect(m_newClassWidget, &Utils::NewClassWidget::validChanged, this, &QWizardPage::completeChanged);
|
||||
|
||||
setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Details"));
|
||||
}
|
||||
|
||||
void FilesPage::setSuffixes(const QString &header, const QString &source, const QString &form)
|
||||
{
|
||||
m_newClassWidget->setSourceExtension(source);
|
||||
m_newClassWidget->setHeaderExtension(header);
|
||||
if (!form.isEmpty())
|
||||
m_newClassWidget->setFormExtension(form);
|
||||
}
|
||||
|
||||
void FilesPage::setClassName(const QString &suggestedClassName)
|
||||
{
|
||||
m_newClassWidget->setClassName(suggestedClassName);
|
||||
}
|
||||
|
||||
|
||||
bool FilesPage::isComplete() const
|
||||
{
|
||||
QString error;
|
||||
const bool complete = m_newClassWidget->isValid(&error);
|
||||
m_errorLabel->setText(error);
|
||||
return complete;
|
||||
}
|
||||
|
||||
QString FilesPage::className() const
|
||||
{
|
||||
return m_newClassWidget->className();
|
||||
}
|
||||
|
||||
QString FilesPage::baseClassName() const
|
||||
{
|
||||
return m_newClassWidget->baseClassName();
|
||||
}
|
||||
|
||||
void FilesPage::setBaseClassName(const QString &b)
|
||||
{
|
||||
m_newClassWidget->setBaseClassName(b);
|
||||
}
|
||||
|
||||
QString FilesPage::sourceFileName() const
|
||||
{
|
||||
return m_newClassWidget->sourceFileName();
|
||||
}
|
||||
|
||||
QString FilesPage::headerFileName() const
|
||||
{
|
||||
return m_newClassWidget->headerFileName();
|
||||
}
|
||||
|
||||
QString FilesPage::formFileName() const
|
||||
{
|
||||
return m_newClassWidget->formFileName();
|
||||
}
|
||||
|
||||
bool FilesPage::namespacesEnabled() const
|
||||
{
|
||||
return m_newClassWidget->namespacesEnabled();
|
||||
}
|
||||
|
||||
void FilesPage::setNamespacesEnabled(bool b)
|
||||
{
|
||||
m_newClassWidget->setNamespacesEnabled(b);
|
||||
}
|
||||
|
||||
void FilesPage::setBaseClassInputVisible(bool visible)
|
||||
{
|
||||
m_newClassWidget->setBaseClassInputVisible(visible);
|
||||
}
|
||||
|
||||
bool FilesPage::isBaseClassInputVisible() const
|
||||
{
|
||||
return m_newClassWidget->isBaseClassInputVisible();
|
||||
}
|
||||
|
||||
QStringList FilesPage::baseClassChoices() const
|
||||
{
|
||||
return m_newClassWidget->baseClassChoices();
|
||||
}
|
||||
|
||||
void FilesPage::setBaseClassChoices(const QStringList &choices)
|
||||
{
|
||||
m_newClassWidget->setBaseClassChoices(choices);
|
||||
}
|
||||
|
||||
void FilesPage::setFormFileInputVisible(bool visible)
|
||||
{
|
||||
m_newClassWidget->setFormInputVisible(visible);
|
||||
}
|
||||
|
||||
bool FilesPage::isFormInputVisible() const
|
||||
{
|
||||
return m_newClassWidget->isFormInputVisible();
|
||||
}
|
||||
|
||||
bool FilesPage::formInputCheckable() const
|
||||
{
|
||||
return m_newClassWidget->formInputCheckable();
|
||||
}
|
||||
|
||||
bool FilesPage::formInputChecked() const
|
||||
{
|
||||
return m_newClassWidget->formInputChecked();
|
||||
}
|
||||
|
||||
void FilesPage::setFormInputCheckable(bool checkable)
|
||||
{
|
||||
m_newClassWidget->setFormInputCheckable(checkable);
|
||||
}
|
||||
|
||||
void FilesPage::setFormInputChecked(bool checked)
|
||||
{
|
||||
m_newClassWidget->setFormInputChecked(checked);
|
||||
}
|
||||
|
||||
bool FilesPage::lowerCaseFiles() const
|
||||
{
|
||||
return m_newClassWidget->lowerCaseFiles();
|
||||
}
|
||||
|
||||
void FilesPage::setLowerCaseFiles(bool l)
|
||||
{
|
||||
m_newClassWidget->setLowerCaseFiles(l);
|
||||
}
|
||||
|
||||
bool FilesPage::isClassTypeComboVisible() const
|
||||
{
|
||||
return m_newClassWidget->isClassTypeComboVisible();
|
||||
}
|
||||
|
||||
void FilesPage::setClassTypeComboVisible(bool v)
|
||||
{
|
||||
m_newClassWidget->setClassTypeComboVisible(v);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
@@ -1,83 +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 <QWizard>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLabel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class NewClassWidget; }
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class FilesPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FilesPage(QWidget *parent = nullptr);
|
||||
bool isComplete() const override;
|
||||
|
||||
QString className() const;
|
||||
void setClassName(const QString &suggestedClassName);
|
||||
|
||||
QString baseClassName() const;
|
||||
QString sourceFileName() const;
|
||||
QString headerFileName() const;
|
||||
QString formFileName() const;
|
||||
|
||||
// API of the embedded NewClassWidget
|
||||
bool namespacesEnabled() const;
|
||||
bool isBaseClassInputVisible() const;
|
||||
bool isFormInputVisible() const;
|
||||
bool formInputCheckable() const;
|
||||
bool formInputChecked() const;
|
||||
QStringList baseClassChoices() const;
|
||||
bool lowerCaseFiles() const;
|
||||
bool isClassTypeComboVisible() const;
|
||||
|
||||
void setSuffixes(const QString &header, const QString &source, const QString &form = QString());
|
||||
|
||||
void setBaseClassName(const QString &);
|
||||
void setNamespacesEnabled(bool b);
|
||||
void setBaseClassInputVisible(bool visible);
|
||||
void setBaseClassChoices(const QStringList &choices);
|
||||
void setFormFileInputVisible(bool visible);
|
||||
void setFormInputCheckable(bool checkable);
|
||||
void setFormInputChecked(bool checked);
|
||||
void setLowerCaseFiles(bool l);
|
||||
void setClassTypeComboVisible(bool v);
|
||||
|
||||
private:
|
||||
Utils::NewClassWidget *m_newClassWidget;
|
||||
QLabel *m_errorLabel;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
Reference in New Issue
Block a user