~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/plugins/qmakeprojectmanager/wizards/html5appwizardpages.cpp

  • Committer: Timo Jyrinki
  • Date: 2013-12-02 09:16:15 UTC
  • mfrom: (1.1.29)
  • Revision ID: timo.jyrinki@canonical.com-20131202091615-xbj1os1f604ber1m
New upstream release candidate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 
4
** Contact: http://www.qt-project.org/legal
 
5
**
 
6
** This file is part of Qt Creator.
 
7
**
 
8
** Commercial License Usage
 
9
** Licensees holding valid commercial Qt licenses may use this file in
 
10
** accordance with the commercial license agreement provided with the
 
11
** Software or, alternatively, in accordance with the terms contained in
 
12
** a written agreement between you and Digia.  For licensing terms and
 
13
** conditions see http://qt.digia.com/licensing.  For further information
 
14
** use the contact form at http://qt.digia.com/contact-us.
 
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, Digia gives you certain additional
 
25
** rights.  These rights are described in the Digia Qt LGPL Exception
 
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 
27
**
 
28
****************************************************************************/
 
29
 
 
30
#include "html5appwizardpages.h"
 
31
#include "ui_html5appwizardsourcespage.h"
 
32
 
 
33
namespace QmakeProjectManager {
 
34
namespace Internal {
 
35
 
 
36
class Html5AppWizardOptionsPagePrivate
 
37
{
 
38
    Ui::Html5AppWizardSourcesPage ui;
 
39
    friend class Html5AppWizardOptionsPage;
 
40
};
 
41
 
 
42
Html5AppWizardOptionsPage::Html5AppWizardOptionsPage(QWidget *parent)
 
43
    : QWizardPage(parent)
 
44
    , d(new Html5AppWizardOptionsPagePrivate)
 
45
{
 
46
    d->ui.setupUi(this);
 
47
    d->ui.importLineEdit->setExpectedKind(Utils::PathChooser::File);
 
48
    d->ui.importLineEdit->setPromptDialogFilter(QLatin1String("*.html"));
 
49
    d->ui.importLineEdit->setPromptDialogTitle(tr("Select HTML File"));
 
50
    connect(d->ui.importLineEdit, SIGNAL(changed(QString)), SIGNAL(completeChanged()));
 
51
    connect(d->ui.importRadioButton,
 
52
            SIGNAL(toggled(bool)), SIGNAL(completeChanged()));
 
53
    connect(d->ui.generateRadioButton, SIGNAL(toggled(bool)), SLOT(setLineEditsEnabled()));
 
54
    connect(d->ui.importRadioButton, SIGNAL(toggled(bool)), SLOT(setLineEditsEnabled()));
 
55
    connect(d->ui.urlRadioButton, SIGNAL(toggled(bool)), SLOT(setLineEditsEnabled()));
 
56
    d->ui.generateRadioButton->setChecked(true);
 
57
}
 
58
 
 
59
Html5AppWizardOptionsPage::~Html5AppWizardOptionsPage()
 
60
{
 
61
    delete d;
 
62
}
 
63
 
 
64
Html5App::Mode Html5AppWizardOptionsPage::mainHtmlMode() const
 
65
{
 
66
    Html5App::Mode result = Html5App::ModeGenerate;
 
67
    if (d->ui.importRadioButton->isChecked())
 
68
        result = Html5App::ModeImport;
 
69
    else if (d->ui.urlRadioButton->isChecked())
 
70
        result = Html5App::ModeUrl;
 
71
    return result;
 
72
}
 
73
 
 
74
QString Html5AppWizardOptionsPage::mainHtmlData() const
 
75
{
 
76
    switch (mainHtmlMode()) {
 
77
    case Html5App::ModeImport: return d->ui.importLineEdit->path();
 
78
    case Html5App::ModeUrl: return d->ui.urlLineEdit->text();
 
79
    default:
 
80
    case Html5App::ModeGenerate: return QString();
 
81
    }
 
82
}
 
83
 
 
84
void Html5AppWizardOptionsPage::setTouchOptimizationEndabled(bool enabled)
 
85
{
 
86
    d->ui.touchOptimizationCheckBox->setChecked(enabled);
 
87
}
 
88
 
 
89
bool Html5AppWizardOptionsPage::touchOptimizationEndabled() const
 
90
{
 
91
    return d->ui.touchOptimizationCheckBox->isChecked();
 
92
}
 
93
 
 
94
bool Html5AppWizardOptionsPage::isComplete() const
 
95
{
 
96
    return mainHtmlMode() != Html5App::ModeImport || d->ui.importLineEdit->isValid();
 
97
}
 
98
 
 
99
void Html5AppWizardOptionsPage::setLineEditsEnabled()
 
100
{
 
101
    d->ui.importLineEdit->setEnabled(d->ui.importRadioButton->isChecked());
 
102
    d->ui.urlLineEdit->setEnabled(d->ui.urlRadioButton->isChecked());
 
103
}
 
104
 
 
105
} // namespace Internal
 
106
} // namespace QmakeProjectManager