source: trunk/examples/dialogs/configdialog/pages.cpp@ 440

Last change on this file since 440 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 5.8 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the examples of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include <QtGui>
43
44#include "pages.h"
45
46ConfigurationPage::ConfigurationPage(QWidget *parent)
47 : QWidget(parent)
48{
49 QGroupBox *configGroup = new QGroupBox(tr("Server configuration"));
50
51 QLabel *serverLabel = new QLabel(tr("Server:"));
52 QComboBox *serverCombo = new QComboBox;
53 serverCombo->addItem(tr("Qt Software (Australia)"));
54 serverCombo->addItem(tr("Qt Software (Germany)"));
55 serverCombo->addItem(tr("Qt Software (Norway)"));
56 serverCombo->addItem(tr("Qt Software (People's Republic of China)"));
57 serverCombo->addItem(tr("Qt Software (USA)"));
58
59 QHBoxLayout *serverLayout = new QHBoxLayout;
60 serverLayout->addWidget(serverLabel);
61 serverLayout->addWidget(serverCombo);
62
63 QVBoxLayout *configLayout = new QVBoxLayout;
64 configLayout->addLayout(serverLayout);
65 configGroup->setLayout(configLayout);
66
67 QVBoxLayout *mainLayout = new QVBoxLayout;
68 mainLayout->addWidget(configGroup);
69 mainLayout->addStretch(1);
70 setLayout(mainLayout);
71}
72
73UpdatePage::UpdatePage(QWidget *parent)
74 : QWidget(parent)
75{
76 QGroupBox *updateGroup = new QGroupBox(tr("Package selection"));
77 QCheckBox *systemCheckBox = new QCheckBox(tr("Update system"));
78 QCheckBox *appsCheckBox = new QCheckBox(tr("Update applications"));
79 QCheckBox *docsCheckBox = new QCheckBox(tr("Update documentation"));
80
81 QGroupBox *packageGroup = new QGroupBox(tr("Existing packages"));
82
83 QListWidget *packageList = new QListWidget;
84 QListWidgetItem *qtItem = new QListWidgetItem(packageList);
85 qtItem->setText(tr("Qt"));
86 QListWidgetItem *qsaItem = new QListWidgetItem(packageList);
87 qsaItem->setText(tr("QSA"));
88 QListWidgetItem *teamBuilderItem = new QListWidgetItem(packageList);
89 teamBuilderItem->setText(tr("Teambuilder"));
90
91 QPushButton *startUpdateButton = new QPushButton(tr("Start update"));
92
93 QVBoxLayout *updateLayout = new QVBoxLayout;
94 updateLayout->addWidget(systemCheckBox);
95 updateLayout->addWidget(appsCheckBox);
96 updateLayout->addWidget(docsCheckBox);
97 updateGroup->setLayout(updateLayout);
98
99 QVBoxLayout *packageLayout = new QVBoxLayout;
100 packageLayout->addWidget(packageList);
101 packageGroup->setLayout(packageLayout);
102
103 QVBoxLayout *mainLayout = new QVBoxLayout;
104 mainLayout->addWidget(updateGroup);
105 mainLayout->addWidget(packageGroup);
106 mainLayout->addSpacing(12);
107 mainLayout->addWidget(startUpdateButton);
108 mainLayout->addStretch(1);
109 setLayout(mainLayout);
110}
111
112QueryPage::QueryPage(QWidget *parent)
113 : QWidget(parent)
114{
115 QGroupBox *packagesGroup = new QGroupBox(tr("Look for packages"));
116
117 QLabel *nameLabel = new QLabel(tr("Name:"));
118 QLineEdit *nameEdit = new QLineEdit;
119
120 QLabel *dateLabel = new QLabel(tr("Released after:"));
121 QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate());
122
123 QCheckBox *releasesCheckBox = new QCheckBox(tr("Releases"));
124 QCheckBox *upgradesCheckBox = new QCheckBox(tr("Upgrades"));
125
126 QSpinBox *hitsSpinBox = new QSpinBox;
127 hitsSpinBox->setPrefix(tr("Return up to "));
128 hitsSpinBox->setSuffix(tr(" results"));
129 hitsSpinBox->setSpecialValueText(tr("Return only the first result"));
130 hitsSpinBox->setMinimum(1);
131 hitsSpinBox->setMaximum(100);
132 hitsSpinBox->setSingleStep(10);
133
134 QPushButton *startQueryButton = new QPushButton(tr("Start query"));
135
136 QGridLayout *packagesLayout = new QGridLayout;
137 packagesLayout->addWidget(nameLabel, 0, 0);
138 packagesLayout->addWidget(nameEdit, 0, 1);
139 packagesLayout->addWidget(dateLabel, 1, 0);
140 packagesLayout->addWidget(dateEdit, 1, 1);
141 packagesLayout->addWidget(releasesCheckBox, 2, 0);
142 packagesLayout->addWidget(upgradesCheckBox, 3, 0);
143 packagesLayout->addWidget(hitsSpinBox, 4, 0, 1, 2);
144 packagesGroup->setLayout(packagesLayout);
145
146 QVBoxLayout *mainLayout = new QVBoxLayout;
147 mainLayout->addWidget(packagesGroup);
148 mainLayout->addSpacing(12);
149 mainLayout->addWidget(startQueryButton);
150 mainLayout->addStretch(1);
151 setLayout(mainLayout);
152}
Note: See TracBrowser for help on using the repository browser.