examples/dialogs/configdialog/pages.cpp
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the examples of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    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 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    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 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #include <QtGui>
       
    43 
       
    44 #include "pages.h"
       
    45 
       
    46 ConfigurationPage::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 (Australia)"));
       
    54     serverCombo->addItem(tr("Qt (Germany)"));
       
    55     serverCombo->addItem(tr("Qt (Norway)"));
       
    56     serverCombo->addItem(tr("Qt (People's Republic of China)"));
       
    57     serverCombo->addItem(tr("Qt (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 
       
    73 UpdatePage::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 
       
   112 QueryPage::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 }