OSDN Git Service

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