OSDN Git Service

Maemo: Add publishing support for Extras-devel repository.
authorChristian Kandeler <christian.kandeler@nokia.com>
Wed, 24 Nov 2010 17:28:41 +0000 (18:28 +0100)
committerChristian Kandeler <christian.kandeler@nokia.com>
Wed, 24 Nov 2010 17:29:15 +0000 (18:29 +0100)
23 files changed:
src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp
src/plugins/qt4projectmanager/qt-maemo/maemomanager.h
src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.cpp [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.h [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.cpp [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.h [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.cpp [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.h [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.ui [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.cpp [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.h [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.ui [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.cpp [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.h [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.ui [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.cpp [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.h [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.ui [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.cpp [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.h [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.cpp [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.h [new file with mode: 0644]
src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri

index eb25f41..af03ca4 100644 (file)
@@ -33,6 +33,7 @@
 #include "maemodeploystepfactory.h"
 #include "maemodeviceconfigurations.h"
 #include "maemopackagecreationfactory.h"
+#include "maemopublishingwizardfactories.h"
 #include "maemoqemumanager.h"
 #include "maemorunfactories.h"
 #include "maemosettingspage.h"
@@ -61,6 +62,7 @@ MaemoManager::MaemoManager()
     , m_packageCreationFactory(new MaemoPackageCreationFactory(this))
     , m_deployStepFactory(new MaemoDeployStepFactory(this))
     , m_settingsPage(new MaemoSettingsPage(this))
+    , m_publishingFactoryFremantleFree(new MaemoPublishingWizardFactoryFremantleFree(this))
 {
     Q_ASSERT(!m_instance);
 
@@ -75,6 +77,7 @@ MaemoManager::MaemoManager()
     pluginManager->addObject(m_packageCreationFactory);
     pluginManager->addObject(m_deployStepFactory);
     pluginManager->addObject(m_settingsPage);
+    pluginManager->addObject(m_publishingFactoryFremantleFree);
 }
 
 MaemoManager::~MaemoManager()
@@ -85,6 +88,7 @@ MaemoManager::~MaemoManager()
     pluginManager->removeObject(m_deployStepFactory);
     pluginManager->removeObject(m_packageCreationFactory);
     pluginManager->removeObject(m_settingsPage);
+    pluginManager->removeObject(m_publishingFactoryFremantleFree);
 
     m_instance = 0;
 }
index a806c36..7aa11e7 100644 (file)
@@ -43,6 +43,7 @@ namespace Internal {
 
 class MaemoDeployStepFactory;
 class MaemoPackageCreationFactory;
+class MaemoPublishingWizardFactoryFremantleFree;
 class MaemoRunControlFactory;
 class MaemoRunConfigurationFactory;
 class MaemoSettingsPage;
@@ -71,6 +72,7 @@ private:
     MaemoDeployStepFactory *m_deployStepFactory;
     MaemoSettingsPage *m_settingsPage;
     MaemoQemuManager *m_qemuRuntimeManager;
+    MaemoPublishingWizardFactoryFremantleFree *m_publishingFactoryFremantleFree;
 };
 
     } // namespace Internal
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.cpp
new file mode 100644 (file)
index 0000000..e2e6301
--- /dev/null
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of Qt Creator.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "maemopublishedprojectmodel.h"
+
+namespace Qt4ProjectManager {
+namespace Internal {
+namespace {
+const int IncludeColumn = 2;
+} // anonymous namespace
+
+MaemoPublishedProjectModel::MaemoPublishedProjectModel(QObject *parent)
+    : QFileSystemModel(parent)
+{
+}
+
+int MaemoPublishedProjectModel::columnCount(const QModelIndex &parent) const
+{
+    Q_UNUSED(parent);
+    return IncludeColumn + 1;
+}
+
+int MaemoPublishedProjectModel::rowCount(const QModelIndex &parent) const
+{
+    if (isDir(parent) && m_filesToExclude.contains(filePath(parent)))
+        return 0;
+    return QFileSystemModel::rowCount(parent);
+}
+
+QVariant MaemoPublishedProjectModel::headerData(int section,
+    Qt::Orientation orientation, int role) const
+{
+    if (orientation != Qt::Horizontal || section != IncludeColumn)
+        return QFileSystemModel::headerData(section, orientation, role);
+    return tr("Include in package");
+}
+
+Qt::ItemFlags MaemoPublishedProjectModel::flags(const QModelIndex &index) const
+{
+    if (index.column() != IncludeColumn)
+        return QFileSystemModel::flags(index);
+    return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable;
+}
+
+QVariant MaemoPublishedProjectModel::data(const QModelIndex &index,
+    int role) const
+{
+    if (index.column() != IncludeColumn)
+        return QFileSystemModel::data(index, role);
+    const bool include = !m_filesToExclude.contains(filePath(index));
+    if (role == Qt::DisplayRole)
+        return include ? tr("Include") : tr("Don't include");
+    else if (role == Qt::CheckStateRole)
+        return include ? Qt::Checked : Qt::Unchecked;
+    else
+        return QVariant();
+}
+
+bool MaemoPublishedProjectModel::setData(const QModelIndex &index,
+    const QVariant &value, int role)
+{
+    if (index.column() != IncludeColumn)
+        return QFileSystemModel::setData(index, value, role);
+    if (role == Qt::CheckStateRole) {
+        if (value == Qt::Checked) {
+            m_filesToExclude.remove(filePath(index));
+        } else {
+            m_filesToExclude.insert(filePath(index));
+        }
+        if (isDir(index))
+            emit layoutChanged();
+        return true;
+    }
+    return false;
+}
+
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.h
new file mode 100644 (file)
index 0000000..cb31070
--- /dev/null
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of Qt Creator.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef MAEMOPUBLISHEDPROJECTMODEL_H
+#define MAEMOPUBLISHEDPROJECTMODEL_H
+
+#include <QtCore/QPersistentModelIndex>
+#include <QtCore/QSet>
+#include <QtCore/QStringList>
+#include <QtGui/QFileSystemModel>
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+class MaemoPublishedProjectModel : public QFileSystemModel
+{
+    Q_OBJECT
+public:
+    explicit MaemoPublishedProjectModel(QObject *parent = 0);
+    QStringList filesToExclude() const { return m_filesToExclude.toList(); }
+
+private:
+    virtual int columnCount(const QModelIndex &parent) const;
+    virtual int rowCount(const QModelIndex &parent) const;
+    virtual QVariant headerData(int section, Qt::Orientation orientation,
+        int role) const;
+    virtual QVariant data(const QModelIndex &index, int role) const;
+    virtual bool setData(const QModelIndex &index, const QVariant &value,
+        int role);
+    virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+
+    QSet<QString> m_filesToExclude;
+    QPersistentModelIndex m_rootIndex;
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // MAEMOPUBLISHEDPROJECTMODEL_H
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.cpp
new file mode 100644 (file)
index 0000000..ae23e32
--- /dev/null
@@ -0,0 +1,534 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#include "maemopublisherfremantlefree.h"
+
+#include "maemoglobal.h"
+#include "maemopackagecreationstep.h"
+#include "maemopublishingfileselectiondialog.h"
+#include "maemotoolchain.h"
+
+#include <coreplugin/ifile.h>
+#include <projectexplorer/project.h>
+#include <qt4projectmanager/qmakestep.h>
+#include <qt4projectmanager/qt4buildconfiguration.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+#include <QtCore/QFileInfo>
+#include <QtCore/QStringList>
+
+#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state)
+
+using namespace Core;
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+MaemoPublisherFremantleFree::MaemoPublisherFremantleFree(const ProjectExplorer::Project *project,
+    QObject *parent) :
+    QObject(parent),
+    m_project(project),
+    m_state(Inactive),
+    m_sshParams(SshConnectionParameters::DefaultProxy)
+{
+    m_sshParams.authType = SshConnectionParameters::AuthByKey;
+    m_sshParams.timeout = 30;
+    m_sshParams.port = 22;
+    m_process = new QProcess(this);
+    connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
+        SLOT(handleProcessFinished()));
+    connect(m_process, SIGNAL(error(QProcess::ProcessError)),
+        SLOT(handleProcessError(QProcess::ProcessError)));
+    connect(m_process, SIGNAL(readyReadStandardOutput()),
+        SLOT(handleProcessStdOut()));
+    connect(m_process, SIGNAL(readyReadStandardError()),
+        SLOT(handleProcessStdErr()));
+}
+
+MaemoPublisherFremantleFree::~MaemoPublisherFremantleFree()
+{
+    ASSERT_STATE(Inactive);
+    m_process->kill();
+}
+
+void MaemoPublisherFremantleFree::publish()
+{
+    createPackage();
+}
+
+void MaemoPublisherFremantleFree::setSshParams(const QString &hostName,
+    const QString &userName, const QString &keyFile, const QString &remoteDir)
+{
+    Q_ASSERT(m_doUpload);
+    m_sshParams.host = hostName;
+    m_sshParams.uname = userName;
+    m_sshParams.privateKeyFile = keyFile;
+    m_remoteDir = remoteDir;
+}
+
+void MaemoPublisherFremantleFree::cancel()
+{
+    finishWithFailure(tr("Canceled."), tr("Publishing canceled by user."));
+}
+
+void MaemoPublisherFremantleFree::createPackage()
+{
+    // Step 1: Copy project directory.
+    setState(CopyingProjectDir);
+    m_tmpProjectDir = tmpDirContainer() + QLatin1Char('/')
+        + m_project->displayName();
+    if (QFileInfo(tmpDirContainer()).exists()) {
+        emit progressReport(tr("Removing left-over temporary directory ..."));
+        if (!removeRecursively(tmpDirContainer())) {
+            finishWithFailure(tr("Error: Could not remove temporary directory."),
+                tr("Publishing failed: Could not create source package."));
+            return;
+        }
+    }
+
+    emit progressReport(tr("Setting up temporary directory ..."));
+    if (!QDir::temp().mkdir(QFileInfo(tmpDirContainer()).fileName())) {
+        finishWithFailure(tr("Error: Could not create temporary directory."),
+            tr("Publishing failed: Could not create source package."));
+        return;
+    }
+    if (!copyRecursively(m_project->projectDirectory(), m_tmpProjectDir)) {
+        finishWithFailure(tr("Error: Could not copy project directory"),
+            tr("Publishing failed: Could not create source package."));
+        return;
+    }
+
+    emit progressReport(tr("Cleaning up temporary directory ..."));
+    QString error;
+    if (!MaemoPackageCreationStep::preparePackagingProcess(m_process,
+            m_buildConfig, m_tmpProjectDir, &error)) {
+        finishWithFailure(tr("Error preparing packaging process: %1").arg(error),
+            tr("Publishing failed: Could not create package."));
+        return;
+    }
+
+    setState(RunningQmake);
+    const ProjectExplorer::ProcessParameters * const pp
+        = m_buildConfig->qmakeStep()->processParameters();
+    m_process->start(pp->effectiveCommand() + QLatin1String(" ")
+        + pp->effectiveArguments());
+}
+
+// TODO: The same exists in packaging step. Move to MaemoGlobal.
+bool MaemoPublisherFremantleFree::removeRecursively(const QString &filePath)
+{
+    QFileInfo fileInfo(filePath);
+    if (fileInfo.isDir()) {
+        QDir dir(filePath);
+        QStringList fileNames = dir.entryList(QDir::Files | QDir::Hidden
+            | QDir::System | QDir::Dirs | QDir::NoDotAndDotDot);
+        foreach (const QString &fileName, fileNames) {
+            if (!removeRecursively(filePath + QLatin1Char('/') + fileName))
+                return false;
+        }
+        dir.cdUp();
+        if (!dir.rmdir(fileInfo.fileName())) {
+            emit progressReport(tr("Failed to remove directory '%1'.")
+                .arg(QDir::toNativeSeparators(filePath)));
+            return false;
+        }
+    } else {
+        if (!QFile::remove(filePath)) {
+            emit progressReport(tr("Failed to remove file '%1'.")
+                .arg(QDir::toNativeSeparators(filePath)), ErrorOutput);
+            return false;
+        }
+    }
+    return true;
+}
+
+bool MaemoPublisherFremantleFree::copyRecursively(const QString &srcFilePath,
+    const QString &tgtFilePath)
+{
+    if (m_state == Inactive)
+        return true;
+
+    QFileInfo srcFileInfo(srcFilePath);
+    if (srcFileInfo.isDir()) {
+        if (srcFileInfo == QFileInfo(m_project->projectDirectory()
+               + QLatin1String("/debian")))
+            return true;
+        QString actualSourcePath = srcFilePath;
+        QString actualTargetPath = tgtFilePath;
+
+        if (srcFileInfo.fileName() == QLatin1String("qtc_packaging")) {
+            actualSourcePath += QLatin1String("/debian_fremantle");
+            actualTargetPath.replace(QRegExp(QLatin1String("qtc_packaging$")),
+                QLatin1String("debian"));
+        }
+
+        QDir targetDir(actualTargetPath);
+        targetDir.cdUp();
+        if (!targetDir.mkdir(QFileInfo(actualTargetPath).fileName())) {
+            emit progressReport(tr("Failed to create directory '%1'.")
+                .arg(QDir::toNativeSeparators(actualTargetPath)), ErrorOutput);
+            return false;
+        }
+        QDir sourceDir(actualSourcePath);
+        QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Hidden
+            | QDir::System | QDir::Dirs | QDir::NoDotAndDotDot);
+        foreach (const QString &fileName, fileNames) {
+            if (!copyRecursively(actualSourcePath + QLatin1Char('/') + fileName,
+                    actualTargetPath + QLatin1Char('/') + fileName))
+                return false;
+        }
+    } else {
+        if (!QFile::copy(srcFilePath, tgtFilePath)) {
+            emit progressReport(tr("Could not copy file '%1' to '%2'.")
+                .arg(QDir::toNativeSeparators(srcFilePath),
+                     QDir::toNativeSeparators(tgtFilePath)));
+            return false;
+        }
+
+        if (tgtFilePath == m_tmpProjectDir + QLatin1String("/debian/rules")) {
+            QFile rulesFile(tgtFilePath);
+            if (!rulesFile.open(QIODevice::ReadWrite)) {
+                emit progressReport(tr("Error: Cannot open file '%1'.")
+                    .arg(QDir::toNativeSeparators(tgtFilePath)));
+                return false;
+            }
+            QByteArray rulesContents = rulesFile.readAll();
+            rulesContents.replace("$(MAKE) clean", "# $(MAKE) clean");
+            rulesContents.replace("# Add here commands to configure the package.",
+                "qmake " + QFileInfo(m_project->file()->fileName()).fileName().toLocal8Bit());
+            rulesFile.resize(0);
+            rulesFile.write(rulesContents);
+        }
+    }
+    return true;
+}
+
+void MaemoPublisherFremantleFree::handleProcessError(QProcess::ProcessError error)
+{
+    if (error == QProcess::FailedToStart)
+        handleProcessFinished(true);
+}
+
+void MaemoPublisherFremantleFree::handleProcessFinished()
+{
+    handleProcessFinished(false);
+}
+
+void MaemoPublisherFremantleFree::handleProcessStdOut()
+{
+    if (m_state == RunningQmake || m_state == RunningMakeDistclean
+            || m_state == BuildingPackage) {
+        emit progressReport(QString::fromLocal8Bit(m_process->readAllStandardOutput()),
+            ToolStatusOutput);
+    }
+}
+
+void MaemoPublisherFremantleFree::handleProcessStdErr()
+{
+    if (m_state == RunningQmake || m_state == RunningMakeDistclean
+            || m_state == BuildingPackage) {
+        emit progressReport(QString::fromLocal8Bit(m_process->readAllStandardError()),
+            ToolErrorOutput);
+    }
+}
+
+void MaemoPublisherFremantleFree::handleProcessFinished(bool failedToStart)
+{
+    ASSERT_STATE(QList<State>() << RunningQmake << RunningMakeDistclean
+        << BuildingPackage << Inactive);
+
+    switch (m_state) {
+    case RunningQmake:
+        if (failedToStart || m_process->exitStatus() != QProcess::NormalExit
+                ||m_process->exitCode() != 0) {
+            runDpkgBuildPackage();
+        } else {
+            setState(RunningMakeDistclean);
+            m_process->start(m_buildConfig->makeCommand(),
+                QStringList() << QLatin1String("distclean"));
+        }
+        break;
+    case RunningMakeDistclean:
+        runDpkgBuildPackage();
+        break;
+    case BuildingPackage: {
+        QString error;
+        if (failedToStart) {
+            error = tr("Error: Failed to start dpkg-buildpackage.");
+        } else if (m_process->exitStatus() != QProcess::NormalExit
+                   || m_process->exitCode() != 0) {
+            error = tr("Error: dpkg-buildpackage did not succeed.");
+        }
+
+        if (!error.isEmpty()) {
+            finishWithFailure(error, tr("Package creation failed."));
+            return;
+        }
+
+        QDir dir(tmpDirContainer());
+        const QStringList &fileNames = dir.entryList(QDir::Files);
+        foreach (const QString &fileName, fileNames) {
+            const QString filePath
+                = tmpDirContainer() + QLatin1Char('/') + fileName;
+            if (fileName.endsWith(QLatin1String(".dsc")))
+                m_filesToUpload.append(filePath);
+            else
+                m_filesToUpload.prepend(filePath);
+        }
+        if (!m_doUpload) {
+            emit progressReport(tr("Done."));
+            QStringList nativeFilePaths;
+            foreach (const QString &filePath, m_filesToUpload)
+                nativeFilePaths << QDir::toNativeSeparators(filePath);
+            m_resultString = tr("Packaging finished successfully. "
+                "The following files were created:\n")
+                + nativeFilePaths.join(QLatin1String("\n"));
+            setState(Inactive);
+        } else {
+            uploadPackage();
+        }
+        break;
+    }
+    default:
+        break;
+    }
+}
+
+void MaemoPublisherFremantleFree::runDpkgBuildPackage()
+{
+    MaemoPublishingFileSelectionDialog d(m_tmpProjectDir);
+    if (d.exec() == QDialog::Rejected) {
+        cancel();
+        return;
+    }
+    foreach (const QString &filePath, d.filesToExclude()) {
+        if (!removeRecursively(filePath))
+            finishWithFailure(QString(),
+                tr("Publishing failed: Could not create package."));
+    }
+
+    if (m_state == Inactive)
+        return;
+    setState(BuildingPackage);
+    emit progressReport(tr("Building source package..."));
+    const MaemoToolChain * const tc
+        = dynamic_cast<MaemoToolChain *>(m_buildConfig->toolChain());
+    QStringList args = QStringList() << QLatin1String("-t")
+        << tc->targetName() << QLatin1String("dpkg-buildpackage")
+        << QLatin1String("-S") << QLatin1String("-us") << QLatin1String("-uc");
+    QString madCommand = tc->maddeRoot() + QLatin1String("/bin/mad");
+
+#ifdef Q_OS_WIN
+    args.prepend(madCommand);
+    madCommand = tc->maddeRoot() + QLatin1String("/bin/sh.exe");
+#endif
+    m_process->start(madCommand, args);
+}
+
+// We have to implement the SCP protocol, because the maemo.org
+// webmaster refuses to enable SFTP "for security reasons" ...
+void MaemoPublisherFremantleFree::uploadPackage()
+{
+    m_uploader = SshRemoteProcessRunner::create(m_sshParams);
+    connect(m_uploader.data(), SIGNAL(processStarted()),
+        SLOT(handleScpStarted()));
+    connect(m_uploader.data(), SIGNAL(connectionError(Core::SshError)),
+        SLOT(handleConnectionError()));
+    connect(m_uploader.data(), SIGNAL(processClosed(int)),
+        SLOT(handleUploadJobFinished(int)));
+    connect(m_uploader.data(), SIGNAL(processOutputAvailable(QByteArray)),
+        SLOT(handleScpStdOut(QByteArray)));
+    emit progressReport(tr("Starting scp ..."));
+    setState(StartingScp);
+    m_uploader->run("scp -td " + m_remoteDir.toUtf8());
+}
+
+void MaemoPublisherFremantleFree::handleScpStarted()
+{
+    ASSERT_STATE(QList<State>() << StartingScp << Inactive);
+
+    if (m_state == StartingScp)
+        prepareToSendFile();
+}
+
+void MaemoPublisherFremantleFree::handleConnectionError()
+{
+    if (m_state != Inactive) {
+        finishWithFailure(tr("SSH error: %1").arg(m_uploader->connection()->errorString()),
+            tr("Upload failed."));
+    }
+}
+
+void MaemoPublisherFremantleFree::handleUploadJobFinished(int exitStatus)
+{
+    ASSERT_STATE(QList<State>() << PreparingToUploadFile << UploadingFile
+        << Inactive);
+
+    if (m_state != Inactive && (exitStatus != SshRemoteProcess::ExitedNormally
+            || m_uploader->process()->exitCode() != 0)) {
+        QString error;
+        if (exitStatus != SshRemoteProcess::ExitedNormally) {
+            error = tr("Error uploading file: %1")
+                .arg(m_uploader->process()->errorString());
+        } else {
+            error = tr("Error uploading file.");
+        }
+        finishWithFailure(error, tr("Upload failed."));
+    }
+}
+
+void MaemoPublisherFremantleFree::prepareToSendFile()
+{
+    if (m_filesToUpload.isEmpty()) {
+        emit progressReport(tr("All files uploaded."));
+        m_resultString = tr("Upload succeeded. You should shortly "
+            "receive an email informing you about the outcome "
+            "of the build process.");
+        setState(Inactive);
+        return;
+    }
+
+    setState(PreparingToUploadFile);
+    const QString &nextFilePath = m_filesToUpload.first();
+    emit progressReport(tr("Uploading file %1 ...")
+        .arg(QDir::toNativeSeparators(nextFilePath)));
+    QFileInfo info(nextFilePath);
+    m_uploader->process()->sendInput("C0644 " + QByteArray::number(info.size())
+        + ' ' + info.fileName().toUtf8() + '\n');
+}
+
+void MaemoPublisherFremantleFree::sendFile()
+{
+    Q_ASSERT(!m_filesToUpload.isEmpty());
+    Q_ASSERT(m_state == PreparingToUploadFile);
+
+    setState(UploadingFile);
+    const QString filePath = m_filesToUpload.takeFirst();
+    QFile file(filePath);
+    if (!file.open(QIODevice::ReadOnly)) {
+        finishWithFailure(tr("Cannot open file for reading: %1")
+            .arg(file.errorString()), tr("Upload failed."));
+        return;
+    }
+    qint64 bytesToSend = file.size();
+    while (bytesToSend > 0) {
+        const QByteArray &data
+            = file.read(qMin(bytesToSend, Q_INT64_C(1024*1024)));
+        if (data.count() == 0) {
+            finishWithFailure(tr("Cannot read file: %1").arg(file.errorString()),
+                tr("Upload failed."));
+            return;
+        }
+        m_uploader->process()->sendInput(data);
+        bytesToSend -= data.size();
+        QCoreApplication::processEvents();
+        if (m_state == Inactive)
+            return;
+    }
+    m_uploader->process()->sendInput(QByteArray(1, '\0'));
+}
+
+void MaemoPublisherFremantleFree::handleScpStdOut(const QByteArray &output)
+{
+    ASSERT_STATE(QList<State>() << PreparingToUploadFile << UploadingFile
+        << Inactive);
+
+    if (m_state == Inactive)
+        return;
+
+    m_scpOutput += output;
+    if (m_scpOutput == QByteArray(1, '\0')) {
+        m_scpOutput.clear();
+        switch (m_state) {
+        case PreparingToUploadFile:
+            sendFile();
+            break;
+        case UploadingFile:
+            prepareToSendFile();
+            break;
+        default:
+            break;
+        }
+    } else if (m_scpOutput.endsWith('\n')) {
+        const QByteArray error = m_scpOutput.mid(1, m_scpOutput.count() - 2);
+        QString progressError;
+        if (!error.isEmpty()) {
+            progressError = tr("Error uploading file: %1")
+                .arg(QString::fromUtf8(error));
+        } else {
+            progressError = tr("Error uploading file.");
+        }
+        finishWithFailure(progressError, tr("Upload failed."));
+    }
+}
+
+QString MaemoPublisherFremantleFree::tmpDirContainer() const
+{
+    return QDir::tempPath() + QLatin1String("/qtc_packaging_")
+        + m_project->displayName();
+}
+
+void MaemoPublisherFremantleFree::finishWithFailure(const QString &progressMsg,
+    const QString &resultMsg)
+{
+    if (!progressMsg.isEmpty())
+        emit progressReport(progressMsg, ErrorOutput);
+    m_resultString = resultMsg;
+    setState(Inactive);
+}
+
+void MaemoPublisherFremantleFree::setState(State newState)
+{
+    if (m_state == newState)
+        return;
+    const State oldState = m_state;
+    m_state = newState;
+    if (m_state == Inactive) {
+        switch (oldState) {
+        case RunningQmake:
+        case RunningMakeDistclean:
+        case BuildingPackage:
+            disconnect(m_process, 0, this, 0);
+            m_process->terminate();
+            break;
+        case StartingScp:
+        case PreparingToUploadFile:
+        case UploadingFile:
+            disconnect(m_uploader.data(), 0, this, 0);
+            m_uploader = SshRemoteProcessRunner::Ptr();
+            break;
+        default:
+            break;
+        }
+        emit finished();
+    }
+}
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.h
new file mode 100644 (file)
index 0000000..f8ac98b
--- /dev/null
@@ -0,0 +1,118 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#ifndef MAEMOPUBLISHERFREMANTLEFREE_H
+#define MAEMOPUBLISHERFREMANTLEFREE_H
+
+#include <coreplugin/ssh/sshremoteprocessrunner.h>
+
+#include <QtCore/QObject>
+#include <QtCore/QProcess>
+
+namespace ProjectExplorer {
+class Project;
+}
+
+namespace Qt4ProjectManager {
+namespace Internal {
+class Qt4BuildConfiguration;
+
+class MaemoPublisherFremantleFree : public QObject
+{
+    Q_OBJECT
+public:
+    enum OutputType {
+        StatusOutput, ErrorOutput, ToolStatusOutput, ToolErrorOutput
+    };
+
+    explicit MaemoPublisherFremantleFree(const ProjectExplorer::Project *project,
+        QObject *parent = 0);
+    ~MaemoPublisherFremantleFree();
+
+    void publish();
+    void cancel();
+
+    void setBuildConfiguration(const Qt4BuildConfiguration *buildConfig) { m_buildConfig = buildConfig; }
+    void setDoUpload(bool doUpload) { m_doUpload = doUpload; }
+    void setSshParams(const QString &hostName, const QString &userName,
+        const QString &keyFile, const QString &remoteDir);
+
+    QString resultString() const { return m_resultString; }
+
+signals:
+    void progressReport(const QString &text,
+        MaemoPublisherFremantleFree::OutputType = StatusOutput);
+    void finished();
+
+private slots:
+    void handleProcessFinished();
+    void handleProcessStdOut();
+    void handleProcessStdErr();
+    void handleProcessError(QProcess::ProcessError error);
+    void handleScpStarted();
+    void handleConnectionError();
+    void handleUploadJobFinished(int exitStatus);
+    void handleScpStdOut(const QByteArray &output);
+
+private:
+    enum State {
+        Inactive, CopyingProjectDir, RunningQmake, RunningMakeDistclean,
+        BuildingPackage, StartingScp, PreparingToUploadFile, UploadingFile
+    };
+
+    void setState(State newState);
+    void createPackage();
+    void uploadPackage();
+    bool removeRecursively(const QString &filePath);
+    bool copyRecursively(const QString &srcFilePath,
+        const QString &tgtFilePath);
+    void handleProcessFinished(bool failedToStart);
+    void runDpkgBuildPackage();
+    QString tmpDirContainer() const;
+    void prepareToSendFile();
+    void sendFile();
+    void finishWithFailure(const QString &progressMsg, const QString &resultMsg);
+
+    const ProjectExplorer::Project * const m_project;
+    bool m_doUpload;
+    const Qt4BuildConfiguration *m_buildConfig;
+    State m_state;
+    QString m_tmpProjectDir;
+    QProcess *m_process;
+    Core::SshConnectionParameters m_sshParams;
+    QString m_remoteDir;
+    QSharedPointer<Core::SshRemoteProcessRunner> m_uploader;
+    QByteArray m_scpOutput;
+    QList<QString> m_filesToUpload;
+    QString m_resultString;
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // MAEMOPUBLISHERFREMANTLEFREE_H
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.cpp
new file mode 100644 (file)
index 0000000..5f50f3c
--- /dev/null
@@ -0,0 +1,108 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#include "maemopublishingbuildsettingspagefremantlefree.h"
+#include "ui_maemopublishingbuildsettingspagefremantlefree.h"
+
+#include "maemopublisherfremantlefree.h"
+#include "maemotoolchain.h"
+
+#include <projectexplorer/project.h>
+#include <projectexplorer/target.h>
+#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qt4projectmanager/qt4projectmanagerconstants.h>
+#include <utils/qtcassert.h>
+
+using namespace ProjectExplorer;
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+MaemoPublishingBuildSettingsPageFremantleFree::MaemoPublishingBuildSettingsPageFremantleFree(const Project *project,
+    MaemoPublisherFremantleFree *publisher, QWidget *parent) :
+    QWizardPage(parent),
+    m_publisher(publisher),
+    ui(new Ui::MaemoPublishingWizardPageFremantleFree)
+{
+    ui->setupUi(this);
+    collectBuildConfigurations(project);
+    QTC_ASSERT(!m_buildConfigs.isEmpty(), return);
+    foreach (const Qt4BuildConfiguration * const bc, m_buildConfigs) {
+        ui->buildConfigComboBox->addItem(bc->displayName());
+    }
+    ui->buildConfigComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
+    ui->buildConfigComboBox->setCurrentIndex(0);
+    connect(ui->skipUploadCheckBox, SIGNAL(toggled(bool)),
+        SLOT(handleNoUploadSettingChanged()));
+}
+
+MaemoPublishingBuildSettingsPageFremantleFree::~MaemoPublishingBuildSettingsPageFremantleFree()
+{
+    delete ui;
+}
+
+void MaemoPublishingBuildSettingsPageFremantleFree::collectBuildConfigurations(const Project *project)
+{
+    foreach (const Target *const target, project->targets()) {
+        if (target->id() != QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
+            continue;
+        foreach (BuildConfiguration * const bc, target->buildConfigurations()) {
+            Qt4BuildConfiguration * const qt4Bc
+                = qobject_cast<Qt4BuildConfiguration *>(bc);
+            if (!qt4Bc)
+                continue;
+            const MaemoToolChain * const tc
+                = dynamic_cast<MaemoToolChain *>(qt4Bc->toolChain());
+            if (!tc)
+                continue;
+            if (tc->version() == MaemoToolChain::Maemo5)
+                m_buildConfigs << qt4Bc;
+        }
+        break;
+    }
+}
+
+bool MaemoPublishingBuildSettingsPageFremantleFree::validatePage()
+{
+    m_publisher->setBuildConfiguration(m_buildConfigs.at(ui->buildConfigComboBox->currentIndex()));
+    m_publisher->setDoUpload(!skipUpload());
+    return true;
+}
+
+void MaemoPublishingBuildSettingsPageFremantleFree::handleNoUploadSettingChanged()
+{
+    setCommitPage(skipUpload());
+}
+
+bool MaemoPublishingBuildSettingsPageFremantleFree::skipUpload() const
+{
+    return ui->skipUploadCheckBox->isChecked();
+}
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.h
new file mode 100644 (file)
index 0000000..3dd9d56
--- /dev/null
@@ -0,0 +1,71 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#ifndef MAEMOPUBLISHINGBUILDSETTINGSPAGEFREMANTLEFREE_H
+#define MAEMOPUBLISHINGBUILDSETTINGSPAGEFREMANTLEFREE_H
+
+#include <QtCore/QList>
+#include <QtGui/QWizardPage>
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+    class MaemoPublishingWizardPageFremantleFree;
+}
+QT_END_NAMESPACE
+
+namespace ProjectExplorer { class Project; }
+
+namespace Qt4ProjectManager {
+namespace Internal {
+class MaemoPublisherFremantleFree;
+class Qt4BuildConfiguration;
+
+class MaemoPublishingBuildSettingsPageFremantleFree : public QWizardPage
+{
+    Q_OBJECT
+
+public:
+    explicit MaemoPublishingBuildSettingsPageFremantleFree(const ProjectExplorer::Project *project,
+        MaemoPublisherFremantleFree *publisher, QWidget *parent = 0);
+    ~MaemoPublishingBuildSettingsPageFremantleFree();
+
+private:
+    Q_SLOT void handleNoUploadSettingChanged();
+    virtual bool validatePage();
+    void collectBuildConfigurations(const ProjectExplorer::Project *project);
+    bool skipUpload() const;
+
+    QList<Qt4BuildConfiguration *> m_buildConfigs;
+    MaemoPublisherFremantleFree * const m_publisher;
+    Ui::MaemoPublishingWizardPageFremantleFree *ui;
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // MAEMOPUBLISHINGBUILDSETTINGSPAGEFREMANTLEFREE_H
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.ui
new file mode 100644 (file)
index 0000000..9940600
--- /dev/null
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MaemoPublishingWizardPageFremantleFree</class>
+ <widget class="QWizardPage" name="MaemoPublishingWizardPageFremantleFree">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>433</width>
+    <height>149</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>WizardPage</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="buildConfigLabel">
+       <property name="text">
+        <string>Choose build configuration:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QComboBox" name="buildConfigComboBox"/>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="Line" name="line">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="skipUploadCheckBox">
+     <property name="text">
+      <string>Only create source package, don't upload</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>78</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.cpp
new file mode 100644 (file)
index 0000000..5bc2256
--- /dev/null
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of Qt Creator.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "maemopublishingfileselectiondialog.h"
+#include "ui_maemopublishingfileselectiondialog.h"
+
+#include "maemopublishedprojectmodel.h"
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+MaemoPublishingFileSelectionDialog::MaemoPublishingFileSelectionDialog(const QString &projectPath,
+    QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::MaemoPublishingFileSelectionDialog)
+{
+    ui->setupUi(this);
+    m_projectModel = new MaemoPublishedProjectModel(this);
+    const QModelIndex rootIndex = m_projectModel->setRootPath(projectPath);
+    ui->projectView->setModel(m_projectModel);
+    ui->projectView->setRootIndex(rootIndex);
+}
+
+MaemoPublishingFileSelectionDialog::~MaemoPublishingFileSelectionDialog()
+{
+    delete ui;
+}
+
+QStringList MaemoPublishingFileSelectionDialog::filesToExclude() const
+{
+    return m_projectModel->filesToExclude();
+}
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.h
new file mode 100644 (file)
index 0000000..b1d1e4d
--- /dev/null
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of Qt Creator.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef MAEMOPUBLISHINGFILESELECTIONDIALOG_H
+#define MAEMOPUBLISHINGFILESELECTIONDIALOG_H
+
+#include <QtCore/QStringList>
+#include <QtGui/QDialog>
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+    class MaemoPublishingFileSelectionDialog;
+}
+QT_END_NAMESPACE
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+class MaemoPublishingFileSelectionDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit MaemoPublishingFileSelectionDialog(const QString &projectPath,
+        QWidget *parent = 0);
+    ~MaemoPublishingFileSelectionDialog();
+    QStringList filesToExclude() const;
+
+private:
+    Ui::MaemoPublishingFileSelectionDialog *ui;
+    class MaemoPublishedProjectModel *m_projectModel;
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // MAEMOPUBLISHINGFILESELECTIONDIALOG_H
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.ui
new file mode 100644 (file)
index 0000000..a66247f
--- /dev/null
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MaemoPublishingFileSelectionDialog</class>
+ <widget class="QDialog" name="MaemoPublishingFileSelectionDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>704</width>
+    <height>528</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Choose Package Contents</string>
+  </property>
+  <property name="modal">
+   <bool>false</bool>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>&lt;b&gt;Please select the files you want to be included in the source tarball.&lt;/b&gt;
+</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QTreeView" name="projectView"/>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>MaemoPublishingFileSelectionDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>MaemoPublishingFileSelectionDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.cpp
new file mode 100644 (file)
index 0000000..5011633
--- /dev/null
@@ -0,0 +1,106 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#include "maemopublishingresultpagefremantlefree.h"
+#include "ui_maemopublishingresultpagefremantlefree.h"
+
+#include <QtGui/QAbstractButton>
+
+namespace Qt4ProjectManager {
+namespace Internal {
+typedef MaemoPublisherFremantleFree MPSFF;
+
+MaemoPublishingResultPageFremantleFree::MaemoPublishingResultPageFremantleFree(MPSFF *publisher,
+    QWidget *parent) : QWizardPage(parent), m_publisher(publisher),
+    ui(new Ui::MaemoPublishingResultPageFremantleFree)
+{
+    m_lastOutputType = MPSFF::StatusOutput;
+    ui->setupUi(this);
+}
+
+MaemoPublishingResultPageFremantleFree::~MaemoPublishingResultPageFremantleFree()
+{
+    delete ui;
+}
+
+void MaemoPublishingResultPageFremantleFree::initializePage()
+{
+    cancelButton()->disconnect();
+    connect(cancelButton(), SIGNAL(clicked()), SLOT(handleCancelRequest()));
+    connect(m_publisher, SIGNAL(finished()), SLOT(handleFinished()));
+    connect(m_publisher,
+        SIGNAL(progressReport(QString, MaemoPublisherFremantleFree::OutputType)),
+        SLOT(handleProgress(QString, MaemoPublisherFremantleFree::OutputType)));
+    m_publisher->publish();
+}
+
+void MaemoPublishingResultPageFremantleFree::handleFinished()
+{
+    handleProgress(m_publisher->resultString(), MPSFF::StatusOutput);
+    m_isComplete = true;
+    cancelButton()->setEnabled(false);
+    emit completeChanged();
+}
+
+void MaemoPublishingResultPageFremantleFree::handleProgress(const QString &text,
+    MPSFF::OutputType type)
+{
+    const QString color = QLatin1String(type == MPSFF::StatusOutput
+        || type == MPSFF::ToolStatusOutput ? "blue" : "red");
+    ui->progressTextEdit->setTextColor(QColor(color));
+    const bool bold = type == MPSFF::StatusOutput
+            || type == MPSFF::ErrorOutput ? true : false;
+    QFont font = ui->progressTextEdit->currentFont();
+    font.setBold(bold);
+    ui->progressTextEdit->setCurrentFont(font);
+
+    if (type == MPSFF::StatusOutput || type == MPSFF::ErrorOutput
+            || m_lastOutputType == MPSFF::StatusOutput
+            || m_lastOutputType == MPSFF::ErrorOutput) {
+        ui->progressTextEdit->append(text);
+    } else {
+        ui->progressTextEdit->insertPlainText(text);
+    }
+    ui->progressTextEdit->moveCursor(QTextCursor::End);
+    m_lastOutputType = type;
+}
+
+void MaemoPublishingResultPageFremantleFree::handleCancelRequest()
+{
+    qDebug("Calling cancel()");
+    cancelButton()->setEnabled(false);
+    m_publisher->cancel();
+}
+
+QAbstractButton *MaemoPublishingResultPageFremantleFree::cancelButton() const
+{
+    return wizard()->button(QWizard::CancelButton);
+}
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.h
new file mode 100644 (file)
index 0000000..eb732e3
--- /dev/null
@@ -0,0 +1,74 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#ifndef MAEMOPUBLISHINGRESULTPAGEFREMANTLEFREE_H
+#define MAEMOPUBLISHINGRESULTPAGEFREMANTLEFREE_H
+
+#include "maemopublisherfremantlefree.h"
+#include <QtGui/QWizardPage>
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+    class MaemoPublishingResultPageFremantleFree;
+}
+QT_END_NAMESPACE
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+class MaemoPublishingResultPageFremantleFree : public QWizardPage
+{
+    Q_OBJECT
+
+public:
+    explicit MaemoPublishingResultPageFremantleFree(MaemoPublisherFremantleFree *publisher,
+        QWidget *parent = 0);
+    ~MaemoPublishingResultPageFremantleFree();
+
+private slots:
+    void handleFinished();
+    void handleProgress(const QString &text,
+        MaemoPublisherFremantleFree::OutputType type);
+    void handleCancelRequest();
+
+private:
+    virtual bool isComplete() const { return m_isComplete; }
+    virtual void initializePage();
+
+    QAbstractButton *cancelButton() const;
+
+    MaemoPublisherFremantleFree * const m_publisher;
+    bool m_isComplete;
+    MaemoPublisherFremantleFree::OutputType m_lastOutputType;
+    Ui::MaemoPublishingResultPageFremantleFree *ui;
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // MAEMOPUBLISHINGRESULTPAGEFREMANTLEFREE_H
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.ui
new file mode 100644 (file)
index 0000000..f7f429c
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MaemoPublishingResultPageFremantleFree</class>
+ <widget class="QWizardPage" name="MaemoPublishingResultPageFremantleFree">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>414</width>
+    <height>337</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>WizardPage</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <widget class="QGroupBox" name="progressGroupBox">
+     <property name="title">
+      <string>Progress</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QTextEdit" name="progressTextEdit"/>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.cpp
new file mode 100644 (file)
index 0000000..608598a
--- /dev/null
@@ -0,0 +1,71 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#include "maemopublishinguploadsettingspagefremantlefree.h"
+#include "ui_maemopublishinguploadsettingspagefremantlefree.h"
+
+#include "maemopublisherfremantlefree.h"
+
+#include <utils/pathchooser.h>
+
+#include <QtCore/QDir>
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+MaemoPublishingUploadSettingsPageFremantleFree::MaemoPublishingUploadSettingsPageFremantleFree(MaemoPublisherFremantleFree *publisher,
+    QWidget *parent) :
+    QWizardPage(parent),
+    m_publisher(publisher),
+    ui(new Ui::MaemoPublishingUploadSettingsPageFremantleFree)
+{
+    ui->setupUi(this);
+    setTitle(tr("Publishing to Fremantle's \"Extras-devel/free\" Repository"));
+    setSubTitle(tr("Upload options"));
+    ui->privateKeyPathChooser->setExpectedKind(Utils::PathChooser::File);
+    ui->privateKeyPathChooser->setPromptDialogTitle(tr("Choose a private key file"));
+    ui->privateKeyPathChooser->setPath(QDir::toNativeSeparators(QDir::homePath() + QLatin1String("/.ssh/id_rsa")));
+    ui->serverAddressLineEdit->setText(QLatin1String("drop.maemo.org"));
+    ui->targetDirectoryOnServerLineEdit->setText(QLatin1String("/var/www/extras-devel/incoming-builder/fremantle/"));
+}
+
+MaemoPublishingUploadSettingsPageFremantleFree::~MaemoPublishingUploadSettingsPageFremantleFree()
+{
+    delete ui;
+}
+
+bool MaemoPublishingUploadSettingsPageFremantleFree::validatePage()
+{
+    m_publisher->setSshParams(ui->serverAddressLineEdit->text(),
+        ui->garageAccountLineEdit->text(), ui->privateKeyPathChooser->path(),
+        ui->targetDirectoryOnServerLineEdit->text());
+    return true;
+}
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.h
new file mode 100644 (file)
index 0000000..1ecba22
--- /dev/null
@@ -0,0 +1,63 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#ifndef MAEMOPUBLISHINGUPLOADSETTINGSWIZARDPAGE_H
+#define MAEMOPUBLISHINGUPLOADSETTINGSWIZARDPAGE_H
+
+#include <QtGui/QWizardPage>
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+    class MaemoPublishingUploadSettingsPageFremantleFree;
+}
+QT_END_NAMESPACE
+
+namespace Qt4ProjectManager {
+namespace Internal {
+class MaemoPublisherFremantleFree;
+
+class MaemoPublishingUploadSettingsPageFremantleFree : public QWizardPage
+{
+    Q_OBJECT
+
+public:
+    explicit MaemoPublishingUploadSettingsPageFremantleFree(MaemoPublisherFremantleFree *publisher,
+        QWidget *parent = 0);
+    ~MaemoPublishingUploadSettingsPageFremantleFree();
+
+private:
+    virtual bool validatePage();
+
+    MaemoPublisherFremantleFree * const m_publisher;
+    Ui::MaemoPublishingUploadSettingsPageFremantleFree *ui;
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // MAEMOPUBLISHINGUPLOADSETTINGSWIZARDPAGE_H
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.ui
new file mode 100644 (file)
index 0000000..439da30
--- /dev/null
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MaemoPublishingUploadSettingsPageFremantleFree</class>
+ <widget class="QWizardPage" name="MaemoPublishingUploadSettingsPageFremantleFree">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>496</width>
+    <height>123</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>WizardPage</string>
+  </property>
+  <property name="title">
+   <string>Upload Settings</string>
+  </property>
+  <layout class="QFormLayout" name="formLayout">
+   <item row="0" column="0">
+    <widget class="QLabel" name="accountNameLabel">
+     <property name="text">
+      <string>Garage account name:</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <widget class="QLineEdit" name="garageAccountLineEdit"/>
+     </item>
+     <item>
+      <widget class="QLabel" name="getAccountLabel">
+       <property name="text">
+        <string>&lt;a href=&quot;https://garage.maemo.org/account/register.php&quot;&gt;Click here to get an account&lt;/a&gt;</string>
+       </property>
+       <property name="openExternalLinks">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="keyFileLabel">
+     <property name="text">
+      <string>Private key file:</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="Utils::PathChooser" name="privateKeyPathChooser"/>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="serverAddressLabel">
+     <property name="text">
+      <string>Server address:</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QLineEdit" name="serverAddressLineEdit"/>
+   </item>
+   <item row="3" column="0">
+    <widget class="QLabel" name="targetDirectoryOnServerLabel">
+     <property name="text">
+      <string>Target directory on server:</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="1">
+    <widget class="QLineEdit" name="targetDirectoryOnServerLineEdit"/>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>Utils::PathChooser</class>
+   <extends>QWidget</extends>
+   <header location="global">utils/pathchooser.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.cpp
new file mode 100644 (file)
index 0000000..a4cb095
--- /dev/null
@@ -0,0 +1,95 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#include "maemopublishingwizardfactories.h"
+
+#include "maemopublishingwizardfremantlefree.h"
+#include "maemotoolchain.h"
+
+#include <projectexplorer/target.h>
+#include <qt4projectmanager/qmakestep.h>
+#include <qt4projectmanager/qt4project.h>
+#include <qt4projectmanager/qt4projectmanagerconstants.h>
+
+using namespace ProjectExplorer;
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+MaemoPublishingWizardFactoryFremantleFree::MaemoPublishingWizardFactoryFremantleFree(QObject *parent)
+    : IPublishingWizardFactory(parent)
+{
+}
+
+QString MaemoPublishingWizardFactoryFremantleFree::displayName() const
+{
+    return tr("Publish for \"Fremantle Extras-devel free\" repository");
+}
+
+QString MaemoPublishingWizardFactoryFremantleFree::description() const
+{
+    return tr("This wizard will create a source archive and optionally upload "
+              "it to a build server, where the project will be compiled and "
+              "packaged and then moved to the \"Extras-devel free\" "
+              "repository, from where users can install it onto their N900 "
+              "devices. For the upload part, an account at garage.maemo.org "
+              "is required.");
+}
+
+bool MaemoPublishingWizardFactoryFremantleFree::canCreateWizard(const Project *project) const
+{
+    if (!qobject_cast<const Qt4Project *>(project))
+        return false;
+    foreach (const Target *const target, project->targets()) {
+        if (target->id() != QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
+            continue;
+        foreach (const BuildConfiguration *const bc, target->buildConfigurations()) {
+            const Qt4BuildConfiguration *const qt4Bc
+                = qobject_cast<const Qt4BuildConfiguration *>(bc);
+            if (!qt4Bc)
+                continue;
+            const MaemoToolChain * const tc
+                = dynamic_cast<MaemoToolChain *>(qt4Bc->toolChain());
+            if (!tc)
+                continue;
+            if (tc->version() == MaemoToolChain::Maemo5)
+                return true;
+        }
+        break;
+    }
+    return false;
+}
+
+QWizard *MaemoPublishingWizardFactoryFremantleFree::createWizard(const Project *project) const
+{
+    Q_ASSERT(canCreateWizard(project));
+    return new MaemoPublishingWizardFremantleFree(project);
+}
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.h
new file mode 100644 (file)
index 0000000..dbbc30d
--- /dev/null
@@ -0,0 +1,57 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#ifndef MAEMOPUBLISHINGSERVICE_H
+#define MAEMOPUBLISHINGSERVICE_H
+
+#include <projectexplorer/publishing/ipublishingwizardfactory.h>
+
+namespace Core {
+class SshRemoteProcessRunner;
+}
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+class MaemoPublishingWizardFactoryFremantleFree
+    : public ProjectExplorer::IPublishingWizardFactory
+{
+    Q_OBJECT
+public:
+    explicit MaemoPublishingWizardFactoryFremantleFree(QObject *parent =0);
+private:
+    virtual QString displayName() const;
+    virtual QString description() const;
+    virtual bool canCreateWizard(const ProjectExplorer::Project *project) const;
+    virtual QWizard *createWizard(const ProjectExplorer::Project *project) const;
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // MAEMOPUBLISHINGSERVICE_H
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.cpp
new file mode 100644 (file)
index 0000000..b2b8caf
--- /dev/null
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of Qt Creator.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "maemopublishingwizardfremantlefree.h"
+
+#include "maemopublishingresultpagefremantlefree.h"
+#include "maemopublisherfremantlefree.h"
+#include "maemopublishinguploadsettingspagefremantlefree.h"
+#include "maemopublishingbuildsettingspagefremantlefree.h"
+
+using namespace ProjectExplorer;
+
+namespace Qt4ProjectManager {
+namespace Internal {
+namespace {
+enum PageId { BuildSettingsPageId, UploadSettingsPageId, ResultPageId };
+} // anonymous namespace
+
+MaemoPublishingWizardFremantleFree::MaemoPublishingWizardFremantleFree(const Project *project,
+    QWidget *parent) :
+    QWizard(parent),
+    m_project(project),
+    m_publisher(new MaemoPublisherFremantleFree(project, this))
+{
+    setOption(NoCancelButton, false);
+    const QString titleText
+        = tr("Publishing to Fremantle's \"Extras-devel/free\" Repository");
+    m_buildSettingsPage
+        = new MaemoPublishingBuildSettingsPageFremantleFree(project, m_publisher);
+    m_buildSettingsPage->setTitle(titleText);
+    m_buildSettingsPage->setSubTitle(tr("Build Settings"));
+    setPage(BuildSettingsPageId, m_buildSettingsPage);
+    m_uploadSettingsPage
+        = new MaemoPublishingUploadSettingsPageFremantleFree(m_publisher);
+    m_uploadSettingsPage->setTitle(titleText);
+    m_uploadSettingsPage->setSubTitle(tr("Upload Settings"));
+    m_uploadSettingsPage->setCommitPage(true);
+    setPage(UploadSettingsPageId, m_uploadSettingsPage);
+    m_resultPage = new MaemoPublishingResultPageFremantleFree(m_publisher);
+    m_resultPage->setTitle(titleText);
+    m_resultPage->setSubTitle(tr("Result"));
+    setPage(ResultPageId, m_resultPage);
+}
+
+int MaemoPublishingWizardFremantleFree::nextId() const
+{
+    if (currentPage()->isCommitPage())
+        return ResultPageId;
+    return QWizard::nextId();
+}
+
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.h
new file mode 100644 (file)
index 0000000..0158fd7
--- /dev/null
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of Qt Creator.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef MAEMOPUBLISHINGWIZARDFREMANTLEFREE_H
+#define MAEMOPUBLISHINGWIZARDFREMANTLEFREE_H
+
+#include <QtGui/QWizard>
+
+namespace ProjectExplorer {
+class Project;
+}
+
+namespace Qt4ProjectManager {
+namespace Internal {
+class MaemoPublishingResultPageFremantleFree;
+class MaemoPublisherFremantleFree;
+class MaemoPublishingUploadSettingsPageFremantleFree;
+class MaemoPublishingBuildSettingsPageFremantleFree;
+
+class MaemoPublishingWizardFremantleFree : public QWizard
+{
+    Q_OBJECT
+public:
+    explicit MaemoPublishingWizardFremantleFree(const ProjectExplorer::Project *project,
+        QWidget *parent = 0);
+
+private:
+    virtual int nextId() const;
+
+    const ProjectExplorer::Project * const m_project;
+    MaemoPublisherFremantleFree * const m_publisher;
+    MaemoPublishingBuildSettingsPageFremantleFree *m_buildSettingsPage;
+    MaemoPublishingUploadSettingsPageFremantleFree *m_uploadSettingsPage;
+    MaemoPublishingResultPageFremantleFree *m_resultPage;
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // MAEMOPUBLISHINGWIZARDFREMANTLEFREE_H
index f5bcbd8..4fb2963 100644 (file)
@@ -33,7 +33,15 @@ HEADERS += \
     $$PWD/maemoprofilesupdatedialog.h \
     $$PWD/maemousedportsgatherer.h \
     $$PWD/maemoremoteprocesslist.h \
-    $$PWD/maemoremoteprocessesdialog.h
+    $$PWD/maemoremoteprocessesdialog.h \
+    $$PWD/maemopublishingwizardfactories.h \
+    $$PWD/maemopublishingbuildsettingspagefremantlefree.h \
+    $$PWD/maemopublishingfileselectiondialog.h \
+    $$PWD/maemopublishedprojectmodel.h \
+    $$PWD/maemopublishinguploadsettingspagefremantlefree.h \
+    $$PWD/maemopublishingwizardfremantlefree.h \
+    $$PWD/maemopublishingresultpagefremantlefree.h \
+    $$PWD/maemopublisherfremantlefree.h
 
 SOURCES += \
     $$PWD/maemoconfigtestdialog.cpp \
@@ -68,7 +76,15 @@ SOURCES += \
     $$PWD/maemoprofilesupdatedialog.cpp \
     $$PWD/maemousedportsgatherer.cpp \
     $$PWD/maemoremoteprocesslist.cpp \
-    $$PWD/maemoremoteprocessesdialog.cpp
+    $$PWD/maemoremoteprocessesdialog.cpp \
+    $$PWD/maemopublishingwizardfactories.cpp \
+    $$PWD/maemopublishingbuildsettingspagefremantlefree.cpp \
+    $$PWD/maemopublishingfileselectiondialog.cpp \
+    $$PWD/maemopublishedprojectmodel.cpp \
+    $$PWD/maemopublishinguploadsettingspagefremantlefree.cpp \
+    $$PWD/maemopublishingwizardfremantlefree.cpp \
+    $$PWD/maemopublishingresultpagefremantlefree.cpp \
+    $$PWD/maemopublisherfremantlefree.cpp
 
 FORMS += \
     $$PWD/maemoconfigtestdialog.ui \
@@ -77,6 +93,10 @@ FORMS += \
     $$PWD/maemopackagecreationwidget.ui \
     $$PWD/maemodeploystepwidget.ui \
     $$PWD/maemoprofilesupdatedialog.ui \
-    $$PWD/maemoremoteprocessesdialog.ui
+    $$PWD/maemoremoteprocessesdialog.ui \
+    $$PWD/maemopublishingbuildsettingspagefremantlefree.ui \
+    $$PWD/maemopublishingfileselectiondialog.ui \
+    $$PWD/maemopublishinguploadsettingspagefremantlefree.ui \
+    $$PWD/maemopublishingresultpagefremantlefree.ui
 
 RESOURCES += $$PWD/qt-maemo.qrc