2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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 Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef NEWCLASSWIDGET_H
|
|
|
|
|
#define NEWCLASSWIDGET_H
|
|
|
|
|
|
|
|
|
|
#include "utils_global.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QWidget>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QStringList;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Utils {
|
|
|
|
|
|
|
|
|
|
struct NewClassWidgetPrivate;
|
|
|
|
|
|
2009-05-08 12:09:21 +02:00
|
|
|
class QTCREATOR_UTILS_EXPORT NewClassWidget : public QWidget
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
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 pathInputVisible READ isPathInputVisible WRITE setPathInputVisible DESIGNABLE true)
|
2009-11-02 15:46:51 +01:00
|
|
|
Q_PROPERTY(bool classTypeComboVisible READ isClassTypeComboVisible WRITE setClassTypeComboVisible DESIGNABLE true)
|
2008-12-02 12:01:29 +01:00
|
|
|
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(bool formInputCheckable READ formInputCheckable WRITE setFormInputCheckable DESIGNABLE true)
|
|
|
|
|
Q_PROPERTY(bool formInputChecked READ formInputChecked WRITE setFormInputChecked DESIGNABLE true)
|
2008-12-05 10:39:08 +01:00
|
|
|
Q_PROPERTY(bool allowDirectories READ allowDirectories WRITE setAllowDirectories)
|
2009-03-18 16:43:01 +01:00
|
|
|
Q_PROPERTY(bool lowerCaseFiles READ lowerCaseFiles WRITE setLowerCaseFiles)
|
2009-11-02 15:46:51 +01:00
|
|
|
Q_PROPERTY(ClassType classType READ classType WRITE setClassType)
|
2008-12-02 12:01:29 +01:00
|
|
|
// Utility "USER" property for wizards containing file names.
|
|
|
|
|
Q_PROPERTY(QStringList files READ files DESIGNABLE false USER true)
|
2009-11-02 15:46:51 +01:00
|
|
|
Q_ENUMS(ClassType)
|
2011-07-13 18:02:35 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
public:
|
2009-12-01 16:17:45 +01:00
|
|
|
enum ClassType { NoClassType, ClassInheritsQObject, ClassInheritsQWidget,
|
2010-07-05 10:47:24 +02:00
|
|
|
ClassInheritsQDeclarativeItem,
|
2009-12-01 16:17:45 +01:00
|
|
|
SharedDataClass };
|
2009-11-02 15:46:51 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
explicit NewClassWidget(QWidget *parent = 0);
|
|
|
|
|
~NewClassWidget();
|
|
|
|
|
|
|
|
|
|
bool namespacesEnabled() const;
|
|
|
|
|
bool isBaseClassInputVisible() const;
|
|
|
|
|
bool isBaseClassEditable() const;
|
|
|
|
|
bool isFormInputVisible() 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;
|
2008-12-05 10:39:08 +01:00
|
|
|
bool allowDirectories() const;
|
2009-03-18 16:43:01 +01:00
|
|
|
bool lowerCaseFiles() const;
|
2009-11-02 15:46:51 +01:00
|
|
|
ClassType classType() const;
|
|
|
|
|
bool isClassTypeComboVisible() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
bool isValid(QString *error = 0) 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 setPathInputVisible(bool visible);
|
|
|
|
|
void setFormInputCheckable(bool v);
|
|
|
|
|
void setFormInputChecked(bool v);
|
|
|
|
|
|
2009-03-20 11:06:09 +01:00
|
|
|
/**
|
|
|
|
|
* The name passed into the new class widget will be reformatted to be a
|
|
|
|
|
* valid class name.
|
|
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
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);
|
2008-12-05 10:39:08 +01:00
|
|
|
void setAllowDirectories(bool v);
|
2009-03-18 16:43:01 +01:00
|
|
|
void setLowerCaseFiles(bool v);
|
2009-11-02 15:46:51 +01:00
|
|
|
void setClassType(ClassType ct);
|
|
|
|
|
void setClassTypeComboVisible(bool v);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-03-20 11:06:09 +01:00
|
|
|
/**
|
|
|
|
|
* Suggest a class name from the base class by stripping the leading 'Q'
|
2008-12-02 12:01:29 +01:00
|
|
|
* character. This will happen automagically if the base class combo
|
2009-03-20 11:06:09 +01:00
|
|
|
* changes until the class line edited is manually edited.
|
|
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
void suggestClassNameFromBase();
|
|
|
|
|
|
2009-03-18 16:43:01 +01:00
|
|
|
public slots:
|
2009-03-20 11:06:09 +01:00
|
|
|
/** Trigger an update (after changing settings) */
|
2009-03-18 16:43:01 +01:00
|
|
|
void triggerUpdateFileNames();
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
private slots:
|
2009-03-18 16:43:01 +01:00
|
|
|
void slotUpdateFileNames(const QString &t);
|
2008-12-02 12:01:29 +01:00
|
|
|
void slotValidChanged();
|
|
|
|
|
void slotActivated();
|
|
|
|
|
void classNameEdited();
|
|
|
|
|
void slotFormInputChecked();
|
2010-02-26 16:11:14 +01:00
|
|
|
void slotBaseClassEdited(const QString &);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void setFormInputCheckable(bool checkable, bool force);
|
|
|
|
|
|
|
|
|
|
QString fixSuffix(const QString &suffix);
|
2011-09-07 14:26:11 +02:00
|
|
|
NewClassWidgetPrivate *d;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Utils
|
|
|
|
|
|
|
|
|
|
#endif // NEWCLASSWIDGET_H
|