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 "publishingwizardselectiondialog.h"
33 #include "ui_publishingwizardselectiondialog.h"
35 #include "ipublishingwizardfactory.h"
37 #include <extensionsystem/pluginmanager.h>
38 #include <projectexplorer/project.h>
39 #include <utils/qtcassert.h>
41 #include <QtGui/QPushButton>
43 namespace ProjectExplorer {
46 PublishingWizardSelectionDialog::PublishingWizardSelectionDialog(const Project *project,
49 ui(new Ui::PublishingWizardSelectionDialog),
53 ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Start Wizard"));
54 const QList<IPublishingWizardFactory *> &factories
55 = ExtensionSystem::PluginManager::instance()->getObjects<IPublishingWizardFactory>();
56 foreach (const IPublishingWizardFactory * const factory, factories) {
57 if (factory->canCreateWizard(project)) {
58 m_factories << factory;
59 ui->serviceComboBox->addItem(factory->displayName());
62 if (!m_factories.isEmpty()) {
63 connect(ui->serviceComboBox, SIGNAL(currentIndexChanged(int)),
64 SLOT(handleWizardIndexChanged(int)));
65 ui->serviceComboBox->setCurrentIndex(0);
66 handleWizardIndexChanged(ui->serviceComboBox->currentIndex());
68 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
69 ui->descriptionTextArea->appendHtml(QLatin1String("<font color=\"red\">")
70 + tr("Publishing is currently not possible for project '%1'.")
71 .arg(project->displayName())
72 + QLatin1String("</font>"));
76 PublishingWizardSelectionDialog::~PublishingWizardSelectionDialog()
81 QWizard *PublishingWizardSelectionDialog::createSelectedWizard() const
83 return m_factories.at(ui->serviceComboBox->currentIndex())->createWizard(m_project);
86 void PublishingWizardSelectionDialog::handleWizardIndexChanged(int index)
88 ui->descriptionTextArea->setPlainText(m_factories.at(index)->description());
91 } // namespace Internal
92 } // namespace ProjectExplorer