~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.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 "customwidgetwizarddialog.h"
 
31
#include "customwidgetwidgetswizardpage.h"
 
32
#include "customwidgetpluginwizardpage.h"
 
33
#include "pluginoptions.h"
 
34
#include <projectexplorer/projectexplorerconstants.h>
 
35
 
 
36
#include <qtsupport/qtkitinformation.h>
 
37
#include <qtsupport/qtsupportconstants.h>
 
38
 
 
39
namespace {
 
40
 
 
41
class DesktopQtKitMatcher : public ProjectExplorer::KitMatcher
 
42
{
 
43
public:
 
44
    bool matches(const ProjectExplorer::Kit *k) const
 
45
    {
 
46
        ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(k);
 
47
        if (dev.isNull() || dev->id() != ProjectExplorer::Constants::DESKTOP_DEVICE_ID)
 
48
            return false;
 
49
        QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
 
50
        return version && version->type() == QLatin1String(QtSupport::Constants::DESKTOPQT);
 
51
    }
 
52
};
 
53
 
 
54
} // namespace
 
55
 
 
56
namespace QmakeProjectManager {
 
57
namespace Internal {
 
58
 
 
59
enum { IntroPageId = 0};
 
60
 
 
61
CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName,
 
62
                                                   const QIcon &icon,
 
63
                                                   QWidget *parent,
 
64
                                                   const Core::WizardDialogParameters &parameters) :
 
65
    BaseQmakeProjectWizardDialog(false, parent, parameters),
 
66
    m_widgetsPage(new CustomWidgetWidgetsWizardPage),
 
67
    m_pluginPage(new CustomWidgetPluginWizardPage),
 
68
    m_widgetPageId(-1), m_pluginPageId(-1)
 
69
{
 
70
    setWindowIcon(icon);
 
71
    setWindowTitle(templateName);
 
72
 
 
73
    setIntroDescription(tr("This wizard generates a Qt Designer Custom Widget "
 
74
                           "or a Qt Designer Custom Widget Collection project."));
 
75
 
 
76
    if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
 
77
        addTargetSetupPage();
 
78
    m_widgetPageId = addPage(m_widgetsPage);
 
79
    m_pluginPageId = addPage(m_pluginPage);
 
80
    wizardProgress()->item(m_widgetPageId)->setTitle(tr("Custom Widgets"));
 
81
    wizardProgress()->item(m_pluginPageId)->setTitle(tr("Plugin Details"));
 
82
 
 
83
    addExtensionPages(parameters.extensionPages());
 
84
    connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
 
85
}
 
86
 
 
87
FileNamingParameters CustomWidgetWizardDialog::fileNamingParameters() const
 
88
{
 
89
    return m_widgetsPage->fileNamingParameters();
 
90
}
 
91
 
 
92
void CustomWidgetWizardDialog::setFileNamingParameters(const FileNamingParameters &fnp)
 
93
{
 
94
    m_widgetsPage->setFileNamingParameters(fnp);
 
95
    m_pluginPage->setFileNamingParameters(fnp);
 
96
}
 
97
 
 
98
void CustomWidgetWizardDialog::slotCurrentIdChanged(int id)
 
99
{
 
100
    if (id == m_pluginPageId)
 
101
        m_pluginPage->init(m_widgetsPage);
 
102
}
 
103
 
 
104
QSharedPointer<PluginOptions> CustomWidgetWizardDialog::pluginOptions() const
 
105
{
 
106
    QSharedPointer<PluginOptions> rc = m_pluginPage->basicPluginOptions();
 
107
    rc->widgetOptions = m_widgetsPage->widgetOptions();
 
108
    return rc;
 
109
}
 
110
 
 
111
} // namespace Internal
 
112
} // namespace QmakeProjectManager