Commit 8801c76a authored by Christian Kandeler's avatar Christian Kandeler Committed by hjk
Browse files

Coding style: Pure virtual functions, private implementation pointers.

Change-Id: I293f8dbd4e467e866bab381841659a07e32b9d90
Reviewed-on: http://codereview.qt-project.org/4948


Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 63e8b907
......@@ -58,7 +58,7 @@ struct AbstractSftpOperation
AbstractSftpOperation(SftpJobId jobId);
virtual ~AbstractSftpOperation();
virtual Type type() const=0;
virtual Type type() const = 0;
virtual SftpOutgoingPacket &initialPacket(SftpOutgoingPacket &packet)=0;
const SftpJobId jobId;
......
......@@ -75,15 +75,15 @@ private:
SshAbstractCryptoFacility(const SshAbstractCryptoFacility &);
SshAbstractCryptoFacility &operator=(const SshAbstractCryptoFacility &);
virtual QByteArray cryptAlgoName(const SshKeyExchange &kex) const=0;
virtual QByteArray hMacAlgoName(const SshKeyExchange &kex) const=0;
virtual QByteArray cryptAlgoName(const SshKeyExchange &kex) const = 0;
virtual QByteArray hMacAlgoName(const SshKeyExchange &kex) const = 0;
virtual Botan::BlockCipherMode *makeCipherMode(Botan::BlockCipher *cipher,
Botan::BlockCipherModePaddingMethod *paddingMethod,
const Botan::InitializationVector &iv,
const Botan::SymmetricKey &key)=0;
virtual char ivChar() const=0;
virtual char keyChar() const=0;
virtual char macChar() const=0;
virtual char ivChar() const = 0;
virtual char keyChar() const = 0;
virtual char macChar() const = 0;
QByteArray generateHash(const SshKeyExchange &kex, char c, quint32 length);
void checkInvariant() const;
......
......@@ -120,8 +120,8 @@ public:
protected:
AbstractSshPacket();
virtual quint32 cipherBlockSize() const=0;
virtual quint32 macLength() const=0;
virtual quint32 cipherBlockSize() const = 0;
virtual quint32 macLength() const = 0;
virtual void calculateLength() const;
quint32 length() const;
......
......@@ -67,19 +67,19 @@ public:
A short, one-line description of the type of wizard that this
factory can create.
*/
virtual QString displayName() const=0;
virtual QString displayName() const = 0;
/*!
A longer description explaining the exact purpose of the wizard
created by this factory.
*/
virtual QString description() const=0;
virtual QString description() const = 0;
/*!
Returns true iff the type of wizard that this factory can create
is available for the given project.
*/
virtual bool canCreateWizard(const Project *project) const=0;
virtual bool canCreateWizard(const Project *project) const = 0;
/*!
Creates a wizard that can publish the given project.
......@@ -88,7 +88,7 @@ public:
\return The newly created publishing wizard
\sa canCreateWizard()
*/
virtual QWizard *createWizard(const Project *project) const=0;
virtual QWizard *createWizard(const Project *project) const = 0;
protected:
IPublishingWizardFactory(QObject *parent = 0) : QObject(parent) {}
......
......@@ -48,7 +48,7 @@ public:
const QString &file);
virtual ~Exception();
virtual QString type() const=0;
virtual QString type() const = 0;
virtual QString description() const;
int line() const;
......
......@@ -174,12 +174,12 @@ private:
QByteArray generateProFile(QString *errorMessage) const;
virtual QByteArray generateFileExtended(int fileType,
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const=0;
virtual QString pathExtended(int fileType) const=0;
virtual QString originsRoot() const=0;
virtual QString mainWindowClassName() const=0;
virtual int stubVersionMinor() const=0;
virtual bool adaptCurrentMainCppTemplateLine(QString &line) const=0;
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const = 0;
virtual QString pathExtended(int fileType) const = 0;
virtual QString originsRoot() const = 0;
virtual QString mainWindowClassName() const = 0;
virtual int stubVersionMinor() const = 0;
virtual bool adaptCurrentMainCppTemplateLine(QString &line) const = 0;
virtual void handleCurrentProFileTemplateLine(const QString &line,
QTextStream &proFileTemplate, QTextStream &proFile,
bool &commentOutNextLine) const = 0;
......
......@@ -121,12 +121,12 @@ private:
virtual bool postGenerateFiles(const QWizard *w,
const Core::GeneratedFiles &l, QString *errorMessage);
virtual AbstractMobileApp *app() const=0;
virtual AbstractMobileAppWizardDialog *wizardDialog() const=0;
virtual AbstractMobileAppWizardDialog *createWizardDialogInternal(QWidget *parent) const=0;
virtual void projectPathChanged(const QString &path) const=0;
virtual AbstractMobileApp *app() const = 0;
virtual AbstractMobileAppWizardDialog *wizardDialog() const = 0;
virtual AbstractMobileAppWizardDialog *createWizardDialogInternal(QWidget *parent) const = 0;
virtual void projectPathChanged(const QString &path) const = 0;
virtual void prepareGenerateFiles(const QWizard *wizard,
QString *errorMessage) const=0;
QString *errorMessage) const = 0;
};
} // namespace Qt4ProjectManager
......
......@@ -71,7 +71,7 @@ private slots:
void handleBuildConfigurationChanged();
private:
virtual QString packageFileName() const=0;
virtual QString packageFileName() const = 0;
void ctor();
......
......@@ -81,39 +81,39 @@ public:
using namespace Internal;
AbstractRemoteLinuxDeployService::AbstractRemoteLinuxDeployService(QObject *parent)
: QObject(parent), m_d(new AbstractRemoteLinuxDeployServicePrivate)
: QObject(parent), d(new AbstractRemoteLinuxDeployServicePrivate)
{
}
AbstractRemoteLinuxDeployService::~AbstractRemoteLinuxDeployService()
{
delete m_d;
delete d;
}
const Qt4BuildConfiguration *AbstractRemoteLinuxDeployService::qt4BuildConfiguration() const
{
return m_d->buildConfiguration;
return d->buildConfiguration;
}
LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxDeployService::deviceConfiguration() const
{
return m_d->deviceConfiguration;
return d->deviceConfiguration;
}
SshConnection::Ptr AbstractRemoteLinuxDeployService::connection() const
{
return m_d->connection;
return d->connection;
}
void AbstractRemoteLinuxDeployService::saveDeploymentTimeStamp(const DeployableFile &deployableFile)
{
m_d->lastDeployed.insert(DeployablePerHost(deployableFile,
d->lastDeployed.insert(DeployablePerHost(deployableFile,
deviceConfiguration()->sshParameters().host), QDateTime::currentDateTime());
}
bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const DeployableFile &deployableFile) const
{
const QDateTime &lastDeployed = m_d->lastDeployed.value(DeployablePerHost(deployableFile,
const QDateTime &lastDeployed = d->lastDeployed.value(DeployablePerHost(deployableFile,
deviceConfiguration()->sshParameters().host));
return !lastDeployed.isValid()
|| QFileInfo(deployableFile.localFilePath).lastModified() > lastDeployed;
......@@ -121,17 +121,17 @@ bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const Deplo
void AbstractRemoteLinuxDeployService::setDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &deviceConfiguration)
{
m_d->deviceConfiguration = deviceConfiguration;
d->deviceConfiguration = deviceConfiguration;
}
void AbstractRemoteLinuxDeployService::setBuildConfiguration(Qt4BuildConfiguration *bc)
{
m_d->buildConfiguration = bc;
d->buildConfiguration = bc;
}
void AbstractRemoteLinuxDeployService::start()
{
QTC_ASSERT(m_d->state == Inactive, return);
QTC_ASSERT(d->state == Inactive, return);
QString errorMsg;
if (!isDeploymentPossible(&errorMsg)) {
......@@ -146,27 +146,27 @@ void AbstractRemoteLinuxDeployService::start()
return;
}
m_d->state = SettingUpDevice;
d->state = SettingUpDevice;
doDeviceSetup();
}
void AbstractRemoteLinuxDeployService::stop()
{
if (m_d->stopRequested)
if (d->stopRequested)
return;
switch (m_d->state) {
switch (d->state) {
case Inactive:
break;
case SettingUpDevice:
m_d->stopRequested = true;
d->stopRequested = true;
stopDeviceSetup();
break;
case Connecting:
setFinished();
break;
case Deploying:
m_d->stopRequested = true;
d->stopRequested = true;
stopDeployment();
break;
}
......@@ -190,7 +190,7 @@ QVariantMap AbstractRemoteLinuxDeployService::exportDeployTimes() const
QVariantList remotePathList;
QVariantList timeList;
typedef QHash<DeployablePerHost, QDateTime>::ConstIterator DepIt;
for (DepIt it = m_d->lastDeployed.begin(); it != m_d->lastDeployed.end(); ++it) {
for (DepIt it = d->lastDeployed.begin(); it != d->lastDeployed.end(); ++it) {
fileList << it.key().first.localFilePath;
remotePathList << it.key().first.remoteDir;
hostList << it.key().second;
......@@ -214,64 +214,64 @@ void AbstractRemoteLinuxDeployService::importDeployTimes(const QVariantMap &map)
= qMin(qMin(hostList.size(), fileList.size()),
qMin(remotePathList.size(), timeList.size()));
for (int i = 0; i < elemCount; ++i) {
const DeployableFile d(fileList.at(i).toString(), remotePathList.at(i).toString());
m_d->lastDeployed.insert(DeployablePerHost(d, hostList.at(i).toString()),
const DeployableFile df(fileList.at(i).toString(), remotePathList.at(i).toString());
d->lastDeployed.insert(DeployablePerHost(df, hostList.at(i).toString()),
timeList.at(i).toDateTime());
}
}
void AbstractRemoteLinuxDeployService::handleDeviceSetupDone(bool success)
{
QTC_ASSERT(m_d->state == SettingUpDevice, return);
QTC_ASSERT(d->state == SettingUpDevice, return);
if (!success || m_d->stopRequested) {
if (!success || d->stopRequested) {
setFinished();
return;
}
m_d->state = Connecting;
m_d->connection = SshConnectionManager::instance().acquireConnection(m_d->deviceConfiguration->sshParameters());
connect(m_d->connection.data(), SIGNAL(error(Utils::SshError)),
d->state = Connecting;
d->connection = SshConnectionManager::instance().acquireConnection(d->deviceConfiguration->sshParameters());
connect(d->connection.data(), SIGNAL(error(Utils::SshError)),
SLOT(handleConnectionFailure()));
if (m_d->connection->state() == SshConnection::Connected) {
if (d->connection->state() == SshConnection::Connected) {
handleConnected();
} else {
connect(m_d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
emit progressMessage(tr("Connecting to device..."));
if (m_d->connection->state() == SshConnection::Unconnected)
m_d->connection->connectToHost();
if (d->connection->state() == SshConnection::Unconnected)
d->connection->connectToHost();
}
}
void AbstractRemoteLinuxDeployService::handleDeploymentDone()
{
QTC_ASSERT(m_d->state == Deploying, return);
QTC_ASSERT(d->state == Deploying, return);
setFinished();
}
void AbstractRemoteLinuxDeployService::handleConnected()
{
QTC_ASSERT(m_d->state == Connecting, return);
QTC_ASSERT(d->state == Connecting, return);
if (m_d->stopRequested) {
if (d->stopRequested) {
setFinished();
return;
}
m_d->state = Deploying;
d->state = Deploying;
doDeploy();
}
void AbstractRemoteLinuxDeployService::handleConnectionFailure()
{
switch (m_d->state) {
switch (d->state) {
case Inactive:
case SettingUpDevice:
qWarning("%s: Unexpected state %d.", Q_FUNC_INFO, m_d->state);
qWarning("%s: Unexpected state %d.", Q_FUNC_INFO, d->state);
break;
case Connecting: {
QString errorMsg = tr("Could not connect to host: %1").arg(m_d->connection->errorString());
QString errorMsg = tr("Could not connect to host: %1").arg(d->connection->errorString());
if (deviceConfiguration()->deviceType() == LinuxDeviceConfiguration::Emulator)
errorMsg += tr("\nDid the emulator fail to start?");
else
......@@ -281,20 +281,20 @@ void AbstractRemoteLinuxDeployService::handleConnectionFailure()
break;
}
case Deploying:
emit errorMessage(tr("Connection error: %1").arg(m_d->connection->errorString()));
emit errorMessage(tr("Connection error: %1").arg(d->connection->errorString()));
stopDeployment();
}
}
void AbstractRemoteLinuxDeployService::setFinished()
{
m_d->state = Inactive;
if (m_d->connection) {
disconnect(m_d->connection.data(), 0, this, 0);
SshConnectionManager::instance().releaseConnection(m_d->connection);
m_d->connection = SshConnection::Ptr();
d->state = Inactive;
if (d->connection) {
disconnect(d->connection.data(), 0, this, 0);
SshConnectionManager::instance().releaseConnection(d->connection);
d->connection = SshConnection::Ptr();
}
m_d->stopRequested = false;
d->stopRequested = false;
emit finished();
}
......
......@@ -96,7 +96,7 @@ private slots:
private:
Q_SIGNAL void finished();
virtual bool isDeploymentNecessary() const=0;
virtual bool isDeploymentNecessary() const = 0;
// Should do things needed *before* connecting. Call handleDeviceSetupDone() afterwards.
virtual void doDeviceSetup()=0;
......@@ -107,7 +107,7 @@ private:
void setFinished();
Internal::AbstractRemoteLinuxDeployServicePrivate * const m_d;
Internal::AbstractRemoteLinuxDeployServicePrivate * const d;
};
} // namespace RemoteLinux
......
......@@ -61,7 +61,7 @@ public:
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
RemoteLinuxDeployConfiguration *deployConfiguration() const;
virtual AbstractRemoteLinuxDeployService *deployService() const=0;
virtual AbstractRemoteLinuxDeployService *deployService() const = 0;
virtual bool isDeploymentPossible(QString *whyNot = 0) const;
protected:
......
......@@ -68,23 +68,23 @@ using namespace Internal;
AbstractUploadAndInstallPackageService::AbstractUploadAndInstallPackageService(QObject *parent)
: AbstractRemoteLinuxDeployService(parent),
m_d(new AbstractUploadAndInstallPackageServicePrivate)
d(new AbstractUploadAndInstallPackageServicePrivate)
{
}
AbstractUploadAndInstallPackageService::~AbstractUploadAndInstallPackageService()
{
delete m_d;
delete d;
}
void AbstractUploadAndInstallPackageService::setPackageFilePath(const QString &filePath)
{
m_d->packageFilePath = filePath;
d->packageFilePath = filePath;
}
QString AbstractUploadAndInstallPackageService::packageFilePath() const
{
return m_d->packageFilePath;
return d->packageFilePath;
}
QString AbstractUploadAndInstallPackageService::uploadDir() const
......@@ -99,38 +99,38 @@ bool AbstractUploadAndInstallPackageService::isDeploymentNecessary() const
void AbstractUploadAndInstallPackageService::doDeviceSetup()
{
QTC_ASSERT(m_d->state == Inactive, return);
QTC_ASSERT(d->state == Inactive, return);
handleDeviceSetupDone(true);
}
void AbstractUploadAndInstallPackageService::stopDeviceSetup()
{
QTC_ASSERT(m_d->state == Inactive, return);
QTC_ASSERT(d->state == Inactive, return);
handleDeviceSetupDone(false);
}
void AbstractUploadAndInstallPackageService::doDeploy()
{
QTC_ASSERT(m_d->state == Inactive, return);
QTC_ASSERT(d->state == Inactive, return);
m_d->state = Uploading;
d->state = Uploading;
const QString fileName = QFileInfo(packageFilePath()).fileName();
const QString remoteFilePath = uploadDir() + QLatin1Char('/') + fileName;
connect(m_d->uploader, SIGNAL(progress(QString)), SIGNAL(progressMessage(QString)));
connect(m_d->uploader, SIGNAL(uploadFinished(QString)), SLOT(handleUploadFinished(QString)));
m_d->uploader->uploadPackage(connection(), packageFilePath(), remoteFilePath);
connect(d->uploader, SIGNAL(progress(QString)), SIGNAL(progressMessage(QString)));
connect(d->uploader, SIGNAL(uploadFinished(QString)), SLOT(handleUploadFinished(QString)));
d->uploader->uploadPackage(connection(), packageFilePath(), remoteFilePath);
}
void AbstractUploadAndInstallPackageService::stopDeployment()
{
switch (m_d->state) {
switch (d->state) {
case Inactive:
qWarning("%s: Unexpected state 'Inactive'.", Q_FUNC_INFO);
break;
case Uploading:
m_d->uploader->cancelUpload();
d->uploader->cancelUpload();
setFinished();
break;
case Installing:
......@@ -142,7 +142,7 @@ void AbstractUploadAndInstallPackageService::stopDeployment()
void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString &errorMsg)
{
QTC_ASSERT(m_d->state == Uploading, return);
QTC_ASSERT(d->state == Uploading, return);
if (!errorMsg.isEmpty()) {
emit errorMessage(errorMsg);
......@@ -153,7 +153,7 @@ void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString
emit progressMessage(tr("Successfully uploaded package file."));
const QString remoteFilePath = uploadDir() + QLatin1Char('/')
+ QFileInfo(packageFilePath()).fileName();
m_d->state = Installing;
d->state = Installing;
emit progressMessage(tr("Installing package to device..."));
connect(packageInstaller(), SIGNAL(stdoutData(QString)), SIGNAL(stdOutData(QString)));
connect(packageInstaller(), SIGNAL(stderrData(QString)), SIGNAL(stdErrData(QString)));
......@@ -164,7 +164,7 @@ void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString
void AbstractUploadAndInstallPackageService::handleInstallationFinished(const QString &errorMsg)
{
QTC_ASSERT(m_d->state == Installing, return);
QTC_ASSERT(d->state == Installing, return);
if (errorMsg.isEmpty()) {
saveDeploymentTimeStamp(DeployableFile(packageFilePath(), QString()));
......@@ -177,8 +177,8 @@ void AbstractUploadAndInstallPackageService::handleInstallationFinished(const QS
void AbstractUploadAndInstallPackageService::setFinished()
{
m_d->state = Inactive;
disconnect(m_d->uploader, 0, this, 0);
d->state = Inactive;
disconnect(d->uploader, 0, this, 0);
disconnect(packageInstaller(), 0, this, 0);
handleDeploymentDone();
}
......
......@@ -60,7 +60,7 @@ private slots:
void handleInstallationFinished(const QString &errorMsg);
private:
virtual AbstractRemoteLinuxPackageInstaller *packageInstaller() const=0;
virtual AbstractRemoteLinuxPackageInstaller *packageInstaller() const = 0;
virtual QString uploadDir() const; // Defaults to remote user's home directory.
bool isDeploymentNecessary() const;
......@@ -71,7 +71,7 @@ private:
void setFinished();
Internal::AbstractUploadAndInstallPackageServicePrivate * const m_d;
Internal::AbstractUploadAndInstallPackageServicePrivate * const d;
};
} // namespace RemoteLinux
......
......@@ -75,37 +75,37 @@ using namespace Internal;
DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode,
QObject *parent)
: QAbstractTableModel(parent), m_d(new DeployableFilesPerProFilePrivate(proFileNode))
: QAbstractTableModel(parent), d(new DeployableFilesPerProFilePrivate(proFileNode))
{
if (m_d->projectType == ApplicationTemplate) {
m_d->deployables.prepend(DeployableFile(localExecutableFilePath(),
m_d->installsList.targetPath));
} else if (m_d->projectType == LibraryTemplate) {
if (d->projectType == ApplicationTemplate) {
d->deployables.prepend(DeployableFile(localExecutableFilePath(),
d->installsList.targetPath));
} else if (d->projectType == LibraryTemplate) {
foreach (const QString &filePath, localLibraryFilePaths()) {
m_d->deployables.prepend(DeployableFile(filePath,
m_d->installsList.targetPath));
d->deployables.prepend(DeployableFile(filePath,
d->installsList.targetPath));
}
}
foreach (const InstallsItem &elem, m_d->installsList.items) {
foreach (const InstallsItem &elem, d->installsList.items) {
foreach (const QString &file, elem.files)
m_d->deployables << DeployableFile(file, elem.path);
d->deployables << DeployableFile(file, elem.path);
}
}
DeployableFilesPerProFile::~DeployableFilesPerProFile()
{
delete m_d;
delete d;
}
DeployableFile DeployableFilesPerProFile::deployableAt(int row) const
{
Q_ASSERT(row >= 0 && row < rowCount());
return m_d->deployables.at(row);
return d->deployables.at(row);
}
int DeployableFilesPerProFile::rowCount(const QModelIndex &parent) const
{
return parent.isValid() ? 0 : m_d->deployables.count();
return parent.isValid() ? 0 : d->deployables.count();
}
int DeployableFilesPerProFile::columnCount(const QModelIndex &parent) const
......@@ -118,7 +118,7 @@ QVariant DeployableFilesPerProFile::data(const QModelIndex &index, int role) con
if (!index.isValid() || index.row() >= rowCount())
return QVariant();
if (m_d->projectType != AuxTemplate && !hasTargetPath() && index.row() == 0
if (d->projectType != AuxTemplate && !hasTargetPath() && index.row() == 0
&& index.column() == 1) {
if (role == Qt::DisplayRole)
return tr("<no target path set>");
......@@ -147,34 +147,34 @@ QVariant DeployableFilesPerProFile::headerData(int section,
QString DeployableFilesPerProFile::localExecutableFilePath() const