1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #include "filespage.h"
35 #include <utils/newclasswidget.h>
37 #include <QtGui/QLabel>
38 #include <QtGui/QLayout>
40 namespace Qt4ProjectManager {
43 FilesPage::FilesPage(QWidget *parent) :
45 m_newClassWidget(new Utils::NewClassWidget)
47 m_newClassWidget->setPathInputVisible(false);
48 setTitle(tr("Class Information"));
50 QLabel *label = new QLabel(tr("Specify basic information about the classes "
51 "for which you want to generate skeleton source code files."));
52 label->setWordWrap(true);
54 QVBoxLayout *vlayout = new QVBoxLayout;
55 vlayout->addWidget(label);
56 vlayout->addItem(new QSpacerItem(0, 20));
58 vlayout->addWidget(m_newClassWidget);
60 vlayout->addItem(new QSpacerItem(0, 20));
61 m_errorLabel = new QLabel;
62 m_errorLabel->setStyleSheet(QLatin1String("color: red;"));
63 vlayout->addWidget(m_errorLabel);
66 connect(m_newClassWidget, SIGNAL(validChanged()), this, SIGNAL(completeChanged()));
69 void FilesPage::setSuffixes(const QString &header, const QString &source, const QString &form)
71 m_newClassWidget->setSourceExtension(source);
72 m_newClassWidget->setHeaderExtension(header);
74 m_newClassWidget->setFormExtension(form);
77 void FilesPage::setClassName(const QString &suggestedClassName)
79 m_newClassWidget->setClassName(suggestedClassName);
83 bool FilesPage::isComplete() const
86 const bool complete = m_newClassWidget->isValid(&error);
87 m_errorLabel->setText(error);
91 QString FilesPage::className() const
93 return m_newClassWidget->className();
96 QString FilesPage::baseClassName() const
98 return m_newClassWidget->baseClassName();
101 void FilesPage::setBaseClassName(const QString &b)
103 m_newClassWidget->setBaseClassName(b);
106 QString FilesPage::sourceFileName() const
108 return m_newClassWidget->sourceFileName();
111 QString FilesPage::headerFileName() const
113 return m_newClassWidget->headerFileName();
116 QString FilesPage::formFileName() const
118 return m_newClassWidget->formFileName();
121 bool FilesPage::namespacesEnabled() const
123 return m_newClassWidget->namespacesEnabled();
126 void FilesPage::setNamespacesEnabled(bool b)
128 m_newClassWidget->setNamespacesEnabled(b);
131 void FilesPage::setBaseClassInputVisible(bool visible)
133 m_newClassWidget->setBaseClassInputVisible(visible);
136 bool FilesPage::isBaseClassInputVisible() const
138 return m_newClassWidget->isBaseClassInputVisible();
141 QStringList FilesPage::baseClassChoices() const
143 return m_newClassWidget->baseClassChoices();
146 void FilesPage::setBaseClassChoices(const QStringList &choices)
148 m_newClassWidget->setBaseClassChoices(choices);
151 void FilesPage::setFormFileInputVisible(bool visible)
153 m_newClassWidget->setFormInputVisible(visible);
156 bool FilesPage::isFormInputVisible() const
158 return m_newClassWidget->isFormInputVisible();
161 bool FilesPage::formInputCheckable() const
163 return m_newClassWidget->formInputCheckable();
166 bool FilesPage::formInputChecked() const
168 return m_newClassWidget->formInputChecked();
171 void FilesPage::setFormInputCheckable(bool checkable)
173 m_newClassWidget->setFormInputCheckable(checkable);
176 void FilesPage::setFormInputChecked(bool checked)
178 m_newClassWidget->setFormInputChecked(checked);
181 bool FilesPage::lowerCaseFiles() const
183 return m_newClassWidget->lowerCaseFiles();
186 void FilesPage::setLowerCaseFiles(bool l)
188 m_newClassWidget->setLowerCaseFiles(l);
191 bool FilesPage::isClassTypeComboVisible() const
193 return m_newClassWidget->isClassTypeComboVisible();
196 void FilesPage::setClassTypeComboVisible(bool v)
198 m_newClassWidget->setClassTypeComboVisible(v);
201 } // namespace Internal
202 } // namespace Qt4ProjectManager