1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #include "filespage.h"
36 #include <utils/newclasswidget.h>
38 #include <QtGui/QLabel>
39 #include <QtGui/QLayout>
41 namespace Qt4ProjectManager {
44 FilesPage::FilesPage(QWidget *parent) :
46 m_newClassWidget(new Utils::NewClassWidget)
48 m_newClassWidget->setPathInputVisible(false);
49 setTitle(tr("Class Information"));
51 QLabel *label = new QLabel(tr("Specify basic information about the classes "
52 "for which you want to generate skeleton source code files."));
53 label->setWordWrap(true);
55 QVBoxLayout *vlayout = new QVBoxLayout;
56 vlayout->addWidget(label);
57 vlayout->addItem(new QSpacerItem(0, 20));
59 vlayout->addWidget(m_newClassWidget);
61 vlayout->addItem(new QSpacerItem(0, 20));
62 m_errorLabel = new QLabel;
63 m_errorLabel->setStyleSheet(QLatin1String("color: red;"));
64 vlayout->addWidget(m_errorLabel);
67 connect(m_newClassWidget, SIGNAL(validChanged()), this, SIGNAL(completeChanged()));
70 void FilesPage::setSuffixes(const QString &header, const QString &source, const QString &form)
72 m_newClassWidget->setSourceExtension(source);
73 m_newClassWidget->setHeaderExtension(header);
75 m_newClassWidget->setFormExtension(form);
78 void FilesPage::setClassName(const QString &suggestedClassName)
80 m_newClassWidget->setClassName(suggestedClassName);
84 bool FilesPage::isComplete() const
87 const bool complete = m_newClassWidget->isValid(&error);
88 m_errorLabel->setText(error);
92 QString FilesPage::className() const
94 return m_newClassWidget->className();
97 QString FilesPage::baseClassName() const
99 return m_newClassWidget->baseClassName();
102 void FilesPage::setBaseClassName(const QString &b)
104 m_newClassWidget->setBaseClassName(b);
107 QString FilesPage::sourceFileName() const
109 return m_newClassWidget->sourceFileName();
112 QString FilesPage::headerFileName() const
114 return m_newClassWidget->headerFileName();
117 QString FilesPage::formFileName() const
119 return m_newClassWidget->formFileName();
122 bool FilesPage::namespacesEnabled() const
124 return m_newClassWidget->namespacesEnabled();
127 void FilesPage::setNamespacesEnabled(bool b)
129 m_newClassWidget->setNamespacesEnabled(b);
132 void FilesPage::setBaseClassInputVisible(bool visible)
134 m_newClassWidget->setBaseClassInputVisible(visible);
137 bool FilesPage::isBaseClassInputVisible() const
139 return m_newClassWidget->isBaseClassInputVisible();
142 QStringList FilesPage::baseClassChoices() const
144 return m_newClassWidget->baseClassChoices();
147 void FilesPage::setBaseClassChoices(const QStringList &choices)
149 m_newClassWidget->setBaseClassChoices(choices);
152 void FilesPage::setFormFileInputVisible(bool visible)
154 m_newClassWidget->setFormInputVisible(visible);
157 bool FilesPage::isFormInputVisible() const
159 return m_newClassWidget->isFormInputVisible();
162 bool FilesPage::formInputCheckable() const
164 return m_newClassWidget->formInputCheckable();
167 bool FilesPage::formInputChecked() const
169 return m_newClassWidget->formInputChecked();
172 void FilesPage::setFormInputCheckable(bool checkable)
174 m_newClassWidget->setFormInputCheckable(checkable);
177 void FilesPage::setFormInputChecked(bool checked)
179 m_newClassWidget->setFormInputChecked(checked);
182 bool FilesPage::lowerCaseFiles() const
184 return m_newClassWidget->lowerCaseFiles();
187 void FilesPage::setLowerCaseFiles(bool l)
189 m_newClassWidget->setLowerCaseFiles(l);
192 bool FilesPage::isClassTypeComboVisible() const
194 return m_newClassWidget->isClassTypeComboVisible();
197 void FilesPage::setClassTypeComboVisible(bool v)
199 m_newClassWidget->setClassTypeComboVisible(v);
202 } // namespace Internal
203 } // namespace Qt4ProjectManager