2011-07-07 10:43:59 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at info@qt.nokia.com.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
#include "genericdirectuploadstep.h"
|
|
|
|
|
|
|
|
|
|
#include "deployablefile.h"
|
|
|
|
|
#include "deploymentinfo.h"
|
|
|
|
|
#include "genericdirectuploadservice.h"
|
2011-07-27 18:04:43 +02:00
|
|
|
#include "remotelinuxdeployconfiguration.h"
|
2011-09-07 09:07:41 +02:00
|
|
|
#include "remotelinuxdeploystepwidget.h"
|
2011-07-07 10:43:59 +02:00
|
|
|
|
2011-09-07 09:07:41 +02:00
|
|
|
#include <QtGui/QCheckBox>
|
|
|
|
|
#include <QtGui/QVBoxLayout>
|
2011-07-07 10:43:59 +02:00
|
|
|
#include <QtCore/QList>
|
|
|
|
|
#include <QtCore/QSharedPointer>
|
|
|
|
|
|
2011-09-07 09:07:41 +02:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
2011-07-07 10:43:59 +02:00
|
|
|
namespace RemoteLinux {
|
2011-08-02 12:20:16 +02:00
|
|
|
namespace Internal {
|
2011-09-07 09:07:41 +02:00
|
|
|
namespace {
|
|
|
|
|
const char IncrementalKey[] = "RemoteLinux.GenericDirectUploadStep.Incremental";
|
|
|
|
|
|
|
|
|
|
class ConfigWidget : public BuildStepConfigWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
ConfigWidget(GenericDirectUploadStep *step) : m_widget(step)
|
|
|
|
|
{
|
|
|
|
|
m_incrementalCheckBox.setText(tr("Incremental deployment"));
|
|
|
|
|
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
|
|
|
|
mainLayout->setMargin(0);
|
|
|
|
|
mainLayout->addWidget(&m_widget);
|
|
|
|
|
mainLayout->addWidget(&m_incrementalCheckBox);
|
|
|
|
|
m_incrementalCheckBox.setChecked(step->incrementalDeployment());
|
|
|
|
|
connect(&m_widget, SIGNAL(updateSummary()), SIGNAL(updateSummary()));
|
|
|
|
|
connect(&m_incrementalCheckBox, SIGNAL(toggled(bool)),
|
|
|
|
|
SLOT(handleIncrementalChanged(bool)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString summaryText() const { return m_widget.summaryText(); }
|
|
|
|
|
QString displayName() const { return m_widget.displayName(); }
|
|
|
|
|
|
|
|
|
|
GenericDirectUploadStep *myStep() const {
|
|
|
|
|
return qobject_cast<GenericDirectUploadStep *>(m_widget.step());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_SLOT void handleIncrementalChanged(bool incremental) {
|
|
|
|
|
myStep()->setIncrementalDeployment(incremental);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RemoteLinuxDeployStepWidget m_widget;
|
|
|
|
|
QCheckBox m_incrementalCheckBox;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
2011-08-02 12:20:16 +02:00
|
|
|
class GenericDirectUploadStepPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
2011-09-07 09:07:41 +02:00
|
|
|
GenericDirectUploadStepPrivate() : incremental(true) {}
|
|
|
|
|
|
2011-08-02 12:20:16 +02:00
|
|
|
GenericDirectUploadService deployService;
|
2011-09-07 09:07:41 +02:00
|
|
|
bool incremental;
|
2011-08-02 12:20:16 +02:00
|
|
|
};
|
2011-09-07 09:07:41 +02:00
|
|
|
|
2011-08-02 12:20:16 +02:00
|
|
|
} // namespace Internal
|
2011-07-07 10:43:59 +02:00
|
|
|
|
|
|
|
|
GenericDirectUploadStep::GenericDirectUploadStep(ProjectExplorer::BuildStepList *bsl, const QString &id)
|
|
|
|
|
: AbstractRemoteLinuxDeployStep(bsl, id)
|
|
|
|
|
{
|
|
|
|
|
ctor();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GenericDirectUploadStep::GenericDirectUploadStep(ProjectExplorer::BuildStepList *bsl, GenericDirectUploadStep *other)
|
|
|
|
|
: AbstractRemoteLinuxDeployStep(bsl, other)
|
|
|
|
|
{
|
|
|
|
|
ctor();
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-02 12:20:16 +02:00
|
|
|
GenericDirectUploadStep::~GenericDirectUploadStep()
|
|
|
|
|
{
|
|
|
|
|
delete m_d;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-07 09:07:41 +02:00
|
|
|
BuildStepConfigWidget *GenericDirectUploadStep::createConfigWidget()
|
|
|
|
|
{
|
|
|
|
|
return new Internal::ConfigWidget(this);
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-07 10:43:59 +02:00
|
|
|
bool GenericDirectUploadStep::isDeploymentPossible(QString *whyNot) const
|
|
|
|
|
{
|
|
|
|
|
QList<DeployableFile> deployableFiles;
|
|
|
|
|
const QSharedPointer<DeploymentInfo> deploymentInfo = deployConfiguration()->deploymentInfo();
|
|
|
|
|
const int deployableCount = deploymentInfo->deployableCount();
|
|
|
|
|
for (int i = 0; i < deployableCount; ++i)
|
|
|
|
|
deployableFiles << deploymentInfo->deployableAt(i);
|
2011-08-02 12:20:16 +02:00
|
|
|
m_d->deployService.setDeployableFiles(deployableFiles);
|
2011-09-07 09:07:41 +02:00
|
|
|
m_d->deployService.setIncrementalDeployment(incrementalDeployment());
|
2011-07-07 10:43:59 +02:00
|
|
|
return AbstractRemoteLinuxDeployStep::isDeploymentPossible(whyNot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AbstractRemoteLinuxDeployService *GenericDirectUploadStep::deployService() const
|
|
|
|
|
{
|
2011-08-02 12:20:16 +02:00
|
|
|
return &m_d->deployService;
|
2011-07-07 10:43:59 +02:00
|
|
|
}
|
|
|
|
|
|
2011-09-07 09:07:41 +02:00
|
|
|
bool GenericDirectUploadStep::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
if (!AbstractRemoteLinuxDeployStep::fromMap(map))
|
|
|
|
|
return false;
|
|
|
|
|
setIncrementalDeployment(map.value(QLatin1String(Internal::IncrementalKey), true).toBool());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap GenericDirectUploadStep::toMap() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap map = AbstractRemoteLinuxDeployStep::toMap();
|
|
|
|
|
map.insert(QLatin1String(Internal::IncrementalKey), incrementalDeployment());
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-07 10:43:59 +02:00
|
|
|
void GenericDirectUploadStep::ctor()
|
|
|
|
|
{
|
|
|
|
|
setDefaultDisplayName(displayName());
|
2011-08-02 12:20:16 +02:00
|
|
|
m_d = new Internal::GenericDirectUploadStepPrivate;
|
2011-07-07 10:43:59 +02:00
|
|
|
}
|
|
|
|
|
|
2011-09-07 09:07:41 +02:00
|
|
|
void GenericDirectUploadStep::setIncrementalDeployment(bool incremental)
|
|
|
|
|
{
|
|
|
|
|
m_d->incremental = incremental;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GenericDirectUploadStep::incrementalDeployment() const
|
|
|
|
|
{
|
|
|
|
|
return m_d->incremental;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-07 10:43:59 +02:00
|
|
|
QString GenericDirectUploadStep::stepId()
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String("RemoteLinux.DirectUploadStep");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString GenericDirectUploadStep::displayName()
|
|
|
|
|
{
|
|
|
|
|
return tr("Upload files via SFTP");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} //namespace RemoteLinux
|
2011-09-07 09:07:41 +02:00
|
|
|
|
|
|
|
|
#include "genericdirectuploadstep.moc"
|