1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
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.
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.
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.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
32 #include "maemopublishingbuildsettingspagefremantlefree.h"
33 #include "ui_maemopublishingbuildsettingspagefremantlefree.h"
35 #include "maemoglobal.h"
36 #include "maemopublisherfremantlefree.h"
38 #include <projectexplorer/project.h>
39 #include <projectexplorer/target.h>
40 #include <qt4projectmanager/qt4buildconfiguration.h>
41 #include <qt4projectmanager/qt4projectmanagerconstants.h>
42 #include <utils/qtcassert.h>
44 using namespace ProjectExplorer;
46 namespace Qt4ProjectManager {
49 MaemoPublishingBuildSettingsPageFremantleFree::MaemoPublishingBuildSettingsPageFremantleFree(const Project *project,
50 MaemoPublisherFremantleFree *publisher, QWidget *parent) :
52 m_publisher(publisher),
53 ui(new Ui::MaemoPublishingWizardPageFremantleFree)
56 collectBuildConfigurations(project);
57 QTC_ASSERT(!m_buildConfigs.isEmpty(), return);
58 foreach (const Qt4BuildConfiguration * const bc, m_buildConfigs) {
59 ui->buildConfigComboBox->addItem(bc->displayName());
61 ui->buildConfigComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
62 ui->buildConfigComboBox->setCurrentIndex(0);
63 connect(ui->skipUploadCheckBox, SIGNAL(toggled(bool)),
64 SLOT(handleNoUploadSettingChanged()));
67 MaemoPublishingBuildSettingsPageFremantleFree::~MaemoPublishingBuildSettingsPageFremantleFree()
72 void MaemoPublishingBuildSettingsPageFremantleFree::collectBuildConfigurations(const Project *project)
74 foreach (const Target *const target, project->targets()) {
75 if (target->id() != QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID))
77 foreach (BuildConfiguration * const bc, target->buildConfigurations()) {
78 Qt4BuildConfiguration * const qt4Bc
79 = qobject_cast<Qt4BuildConfiguration *>(bc);
82 if (MaemoGlobal::version(qt4Bc->qtVersion()) == MaemoGlobal::Maemo5)
83 m_buildConfigs << qt4Bc;
89 void MaemoPublishingBuildSettingsPageFremantleFree::initializePage()
91 ui->skipUploadCheckBox->setChecked(true);
94 bool MaemoPublishingBuildSettingsPageFremantleFree::validatePage()
96 m_publisher->setBuildConfiguration(m_buildConfigs.at(ui->buildConfigComboBox->currentIndex()));
97 m_publisher->setDoUpload(!skipUpload());
101 void MaemoPublishingBuildSettingsPageFremantleFree::handleNoUploadSettingChanged()
103 setCommitPage(skipUpload());
106 bool MaemoPublishingBuildSettingsPageFremantleFree::skipUpload() const
108 return ui->skipUploadCheckBox->isChecked();
111 } // namespace Internal
112 } // namespace Qt4ProjectManager