OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qt4projectmanager / wizards / filespage.cpp
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
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
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
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.
24 **
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.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #include "filespage.h"
35
36 #include <utils/newclasswidget.h>
37
38 #include <QtGui/QLabel>
39 #include <QtGui/QLayout>
40
41 namespace Qt4ProjectManager {
42 namespace Internal {
43
44 FilesPage::FilesPage(QWidget *parent) :
45     QWizardPage(parent),
46     m_newClassWidget(new Utils::NewClassWidget)
47 {
48     m_newClassWidget->setPathInputVisible(false);
49     setTitle(tr("Class Information"));
50
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);
54
55     QVBoxLayout *vlayout = new QVBoxLayout;
56     vlayout->addWidget(label);
57     vlayout->addItem(new QSpacerItem(0, 20));
58
59     vlayout->addWidget(m_newClassWidget);
60
61     vlayout->addItem(new QSpacerItem(0, 20));
62     m_errorLabel = new QLabel;
63     m_errorLabel->setStyleSheet(QLatin1String("color: red;"));
64     vlayout->addWidget(m_errorLabel);
65     setLayout(vlayout);
66
67     connect(m_newClassWidget, SIGNAL(validChanged()), this, SIGNAL(completeChanged()));
68 }
69
70 void FilesPage::setSuffixes(const QString &header, const QString &source,  const QString &form)
71 {
72     m_newClassWidget->setSourceExtension(source);
73     m_newClassWidget->setHeaderExtension(header);
74     if (!form.isEmpty())
75         m_newClassWidget->setFormExtension(form);
76 }
77
78 void FilesPage::setClassName(const QString &suggestedClassName)
79 {
80     m_newClassWidget->setClassName(suggestedClassName);
81 }
82
83
84 bool FilesPage::isComplete() const
85 {
86     QString error;
87     const bool complete = m_newClassWidget->isValid(&error);
88     m_errorLabel->setText(error);
89     return complete;
90 }
91
92 QString FilesPage::className() const
93 {
94     return m_newClassWidget->className();
95 }
96
97 QString FilesPage::baseClassName() const
98 {
99     return m_newClassWidget->baseClassName();
100 }
101
102 void FilesPage::setBaseClassName(const QString &b)
103 {
104     m_newClassWidget->setBaseClassName(b);
105 }
106
107 QString FilesPage::sourceFileName() const
108 {
109     return m_newClassWidget->sourceFileName();
110 }
111
112 QString FilesPage::headerFileName() const
113 {
114     return m_newClassWidget->headerFileName();
115 }
116
117 QString FilesPage::formFileName() const
118 {
119     return m_newClassWidget->formFileName();
120 }
121
122 bool FilesPage::namespacesEnabled() const
123 {
124     return m_newClassWidget->namespacesEnabled();
125 }
126
127 void FilesPage::setNamespacesEnabled(bool b)
128 {
129     m_newClassWidget->setNamespacesEnabled(b);
130 }
131
132 void FilesPage::setBaseClassInputVisible(bool visible)
133 {
134     m_newClassWidget->setBaseClassInputVisible(visible);
135 }
136
137 bool FilesPage::isBaseClassInputVisible() const
138 {
139     return m_newClassWidget->isBaseClassInputVisible();
140 }
141
142 QStringList FilesPage::baseClassChoices() const
143 {
144     return m_newClassWidget->baseClassChoices();
145 }
146
147 void FilesPage::setBaseClassChoices(const QStringList &choices)
148 {
149     m_newClassWidget->setBaseClassChoices(choices);
150 }
151
152 void FilesPage::setFormFileInputVisible(bool visible)
153 {
154     m_newClassWidget->setFormInputVisible(visible);
155 }
156
157 bool FilesPage::isFormInputVisible() const
158 {
159     return m_newClassWidget->isFormInputVisible();
160 }
161
162 bool FilesPage::formInputCheckable() const
163 {
164     return m_newClassWidget->formInputCheckable();
165 }
166
167 bool FilesPage::formInputChecked() const
168 {
169     return m_newClassWidget->formInputChecked();
170 }
171
172 void FilesPage::setFormInputCheckable(bool checkable)
173 {
174     m_newClassWidget->setFormInputCheckable(checkable);
175 }
176
177 void FilesPage::setFormInputChecked(bool checked)
178 {
179     m_newClassWidget->setFormInputChecked(checked);
180 }
181
182 bool FilesPage::lowerCaseFiles() const
183 {
184     return m_newClassWidget->lowerCaseFiles();
185 }
186
187 void FilesPage::setLowerCaseFiles(bool l)
188 {
189     m_newClassWidget->setLowerCaseFiles(l);
190 }
191
192 bool FilesPage::isClassTypeComboVisible() const
193 {
194     return m_newClassWidget->isClassTypeComboVisible();
195 }
196
197 void FilesPage::setClassTypeComboVisible(bool v)
198 {
199     m_newClassWidget->setClassTypeComboVisible(v);
200 }
201
202 } // namespace Internal
203 } // namespace Qt4ProjectManager