Commit 705b2efe authored by Kai Koehne's avatar Kai Koehne
Browse files

PortList: Move to utils



Change-Id: I99dbef56a2a5b06bb4b89ca442e44bf586efdb22
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 59594ad2
......@@ -29,6 +29,7 @@
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#include "portlist.h"
#include <QList>
......@@ -37,7 +38,7 @@
#include <cctype>
namespace RemoteLinux {
namespace Utils {
namespace Internal {
namespace {
......@@ -217,4 +218,4 @@ QString PortList::regularExpression()
return QString::fromLatin1("((%1)(,%1)*)?").arg(listElemExpr);
}
} // namespace RemoteLinux
} // namespace Utils
......@@ -29,19 +29,20 @@
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef PORTLIST_H
#define PORTLIST_H
#include "remotelinux_export.h"
#include "utils_global.h"
QT_FORWARD_DECLARE_CLASS(QString)
namespace RemoteLinux {
namespace Utils {
namespace Internal {
class PortListPrivate;
} // namespace Internal
class REMOTELINUX_EXPORT PortList
class QTCREATOR_UTILS_EXPORT PortList
{
public:
PortList();
......@@ -64,6 +65,6 @@ private:
Internal::PortListPrivate * const d;
};
} // namespace RemoteLinux
} // namespace Utils
#endif // PORTLIST_H
......@@ -93,7 +93,8 @@ SOURCES += $$PWD/environment.cpp \
$$PWD/networkaccessmanager.cpp \
$$PWD/persistentsettings.cpp \
$$PWD/completingtextedit.cpp \
$$PWD/json.cpp
$$PWD/json.cpp \
$$PWD/portlist.cpp
win32 {
SOURCES += \
......@@ -203,7 +204,8 @@ HEADERS += \
$$PWD/completingtextedit.h \
$$PWD/json.h \
$$PWD/multitask.h \
$$PWD/runextensions.h
$$PWD/runextensions.h \
$$PWD/portlist.h
FORMS += $$PWD/filewizardpage.ui \
$$PWD/projectintropage.ui \
......
......@@ -150,6 +150,8 @@ DynamicLibrary {
"networkaccessmanager.cpp",
"pathlisteditor.cpp",
"persistentsettings.cpp",
"portlist.cpp",
"portlist.h",
"proxyaction.cpp",
"qtcprocess.cpp",
"savedaction.cpp",
......
......@@ -35,7 +35,7 @@
#include "maemomountspecification.h"
#include <remotelinux/portlist.h>
#include <utils/portlist.h>
#include <QList>
#include <QObject>
......@@ -97,7 +97,7 @@ private:
QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> m_devConf;
MaemoRemoteMounter * const m_mounter;
RemoteLinux::RemoteLinuxUsedPortsGatherer * const m_portsGatherer;
RemoteLinux::PortList m_freePorts;
Utils::PortList m_freePorts;
QList<MaemoMountSpecification> m_mountSpecs;
const Qt4ProjectManager::Qt4BuildConfiguration *m_buildConfig;
};
......
......@@ -153,11 +153,11 @@ QString MaemoGlobal::remoteSourceProfilesCommand()
return QString::fromAscii(remoteCall);
}
PortList MaemoGlobal::freePorts(const LinuxDeviceConfiguration::ConstPtr &devConf,
Utils::PortList MaemoGlobal::freePorts(const LinuxDeviceConfiguration::ConstPtr &devConf,
const QtSupport::BaseQtVersion *qtVersion)
{
if (!devConf || !qtVersion)
return PortList();
return Utils::PortList();
if (devConf->deviceType() == LinuxDeviceConfiguration::Emulator) {
MaemoQemuRuntime rt;
const int id = qtVersion->uniqueId();
......
......@@ -34,7 +34,7 @@
#define MAEMOGLOBAL_H
#include <coreplugin/idocument.h>
#include <remotelinux/portlist.h>
#include <utils/portlist.h>
#include <utils/environment.h>
#include <QCoreApplication>
......@@ -100,7 +100,7 @@ public:
static int applicationIconSize(const QString &osType);
static QString remoteSudo(const QString &osType, const QString &uname);
static QString remoteSourceProfilesCommand();
static RemoteLinux::PortList freePorts(const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf,
static Utils::PortList freePorts(const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf,
const QtSupport::BaseQtVersion *qtVersion);
static void addMaddeEnvironment(Utils::Environment &env, const QString &qmakePath);
......
......@@ -34,7 +34,7 @@
#include "maemoqemusettings.h"
#include <remotelinux/portlist.h>
#include <utils/portlist.h>
#include <QHash>
#include <QList>
......@@ -79,7 +79,7 @@ struct MaemoQemuRuntime
QString m_args;
QString m_sshPort;
QString m_watchPath;
RemoteLinux::PortList m_freePorts;
Utils::PortList m_freePorts;
QList<Variable> m_normalVars;
QString m_openGlBackendVarName;
QHash<MaemoQemuSettings::OpenGlMode, QString> m_openGlBackendVarValues;
......
......@@ -190,7 +190,7 @@ void MaemoQemuRuntimeParserV1::fillRuntimeInformation(MaemoQemuRuntime *runtime)
runtime->m_args = map.value(QLatin1String("qemu_args"));
setEnvironment(runtime, map.value(QLatin1String("libpath")));
runtime->m_sshPort = map.value(QLatin1String("sshport"));
runtime->m_freePorts = PortList();
runtime->m_freePorts = Utils::PortList();
int i = 2;
while (true) {
const QString port = map.value(QLatin1String("redirport")
......
......@@ -44,6 +44,7 @@
QT_FORWARD_DECLARE_CLASS(QTimer)
namespace Utils {
class PortList;
class SftpChannel;
class SshConnection;
class SshRemoteProcess;
......@@ -53,7 +54,6 @@ namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
namespace RemoteLinux {
class LinuxDeviceConfiguration;
class PortList;
class RemoteLinuxUsedPortsGatherer;
}
......@@ -76,7 +76,7 @@ public:
bool mountAsRoot);
bool hasValidMountSpecifications() const;
void resetMountSpecifications() { m_mountSpecs.clear(); }
void mount(RemoteLinux::PortList *freePorts,
void mount(Utils::PortList *freePorts,
const RemoteLinux::RemoteLinuxUsedPortsGatherer *portsGatherer);
void unmount();
void stop();
......@@ -132,7 +132,7 @@ private:
typedef QSharedPointer<QProcess> ProcPtr;
QList<ProcPtr> m_utfsServers;
RemoteLinux::PortList *m_freePorts;
Utils::PortList *m_freePorts;
const RemoteLinux::RemoteLinuxUsedPortsGatherer *m_portsGatherer;
bool m_remoteMountsAllowed;
QString m_maddeRoot;
......
......@@ -41,7 +41,7 @@
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <remotelinux/portlist.h>
#include <utils/portlist.h>
#include <utils/ssh/sshconnection.h>
#include <QDir>
......@@ -131,12 +131,12 @@ QString MaemoRunConfiguration::commandPrefix() const
return QString::fromLatin1("%1 %2").arg(prefix, userEnvironmentChangesAsString());
}
PortList MaemoRunConfiguration::freePorts() const
Utils::PortList MaemoRunConfiguration::freePorts() const
{
const Qt4BuildConfiguration * const bc = activeQt4BuildConfiguration();
return bc && deployConfig()
? MaemoGlobal::freePorts(deployConfig()->deviceConfiguration(), bc->qtVersion())
: PortList();
: Utils::PortList();
}
QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const
......
......@@ -52,7 +52,7 @@ public:
QWidget *createConfigurationWidget();
QString environmentPreparationCommand() const;
QString commandPrefix() const;
RemoteLinux::PortList freePorts() const;
Utils::PortList freePorts() const;
Internal::MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; }
bool hasEnoughFreePorts(ProjectExplorer::RunMode mode) const;
......
......@@ -214,7 +214,7 @@ void MaemoRunConfigurationWidget::handleRemoteMountsChanged()
void MaemoRunConfigurationWidget::updateMountWarning()
{
QString mountWarning;
const PortList &portList = m_runConfiguration->freePorts();
const Utils::PortList &portList = m_runConfiguration->freePorts();
const int availablePortCount = portList.count();
const int mountDirCount
= m_runConfiguration->remoteMounts()->validMountSpecificationCount();
......
......@@ -33,8 +33,8 @@
#include "remotelinuxqmlprofilerrunner.h"
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <remotelinux/portlist.h>
#include <remotelinux/remotelinuxapplicationrunner.h>
#include <utils/portlist.h>
#include <utils/qtcassert.h>
using namespace ExtensionSystem;
......
......@@ -32,14 +32,15 @@
#include "genericlinuxdeviceconfigurationwidget.h"
#include "ui_genericlinuxdeviceconfigurationwidget.h"
#include <remotelinux/portlist.h>
#include <remotelinux/linuxdeviceconfigurations.h>
#include <utils/portlist.h>
#include <utils/ssh/sshconnection.h>
#include <QTextStream>
using namespace RemoteLinux;
using namespace Utils;
GenericLinuxDeviceConfigurationWidget::GenericLinuxDeviceConfigurationWidget(
const LinuxDeviceConfiguration::Ptr &deviceConfig,
......@@ -73,11 +74,11 @@ GenericLinuxDeviceConfigurationWidget::~GenericLinuxDeviceConfigurationWidget()
void GenericLinuxDeviceConfigurationWidget::authenticationTypeChanged()
{
Utils::SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
const bool usePassword = m_ui->passwordButton->isChecked();
sshParams.authenticationType = usePassword
? Utils::SshConnectionParameters::AuthenticationByPassword
: Utils::SshConnectionParameters::AuthenticationByKey;
? SshConnectionParameters::AuthenticationByPassword
: SshConnectionParameters::AuthenticationByKey;
deviceConfiguration()->setSshParameters(sshParams);
m_ui->pwdLineEdit->setEnabled(usePassword);
m_ui->passwordLabel->setEnabled(usePassword);
......@@ -88,42 +89,42 @@ void GenericLinuxDeviceConfigurationWidget::authenticationTypeChanged()
void GenericLinuxDeviceConfigurationWidget::hostNameEditingFinished()
{
Utils::SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
sshParams.host = m_ui->hostLineEdit->text();
deviceConfiguration()->setSshParameters(sshParams);
}
void GenericLinuxDeviceConfigurationWidget::sshPortEditingFinished()
{
Utils::SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
sshParams.port = m_ui->sshPortSpinBox->value();
deviceConfiguration()->setSshParameters(sshParams);
}
void GenericLinuxDeviceConfigurationWidget::timeoutEditingFinished()
{
Utils::SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
sshParams.timeout = m_ui->timeoutSpinBox->value();
deviceConfiguration()->setSshParameters(sshParams);
}
void GenericLinuxDeviceConfigurationWidget::userNameEditingFinished()
{
Utils::SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
sshParams.userName = m_ui->userLineEdit->text();
deviceConfiguration()->setSshParameters(sshParams);
}
void GenericLinuxDeviceConfigurationWidget::passwordEditingFinished()
{
Utils::SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
sshParams.password = m_ui->pwdLineEdit->text();
deviceConfiguration()->setSshParameters(sshParams);
}
void GenericLinuxDeviceConfigurationWidget::keyFileEditingFinished()
{
Utils::SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
SshConnectionParameters sshParams = deviceConfiguration()->sshParameters();
sshParams.privateKeyFile = m_ui->keyFileLineEdit->path();
deviceConfiguration()->setSshParameters(sshParams);
}
......@@ -161,15 +162,15 @@ void GenericLinuxDeviceConfigurationWidget::initGui()
m_ui->portsWarningLabel->setPixmap(QPixmap(":/projectexplorer/images/compile_error.png"));
m_ui->portsWarningLabel->setToolTip(QLatin1String("<font color=\"red\">")
+ tr("You will need at least one port.") + QLatin1String("</font>"));
m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
m_ui->keyFileLineEdit->setExpectedKind(PathChooser::File);
m_ui->keyFileLineEdit->lineEdit()->setMinimumWidth(0);
QRegExpValidator * const portsValidator
= new QRegExpValidator(QRegExp(PortList::regularExpression()), this);
m_ui->portsLineEdit->setValidator(portsValidator);
const Utils::SshConnectionParameters &sshParams = deviceConfiguration()->sshParameters();
const SshConnectionParameters &sshParams = deviceConfiguration()->sshParameters();
if (sshParams.authenticationType == Utils::SshConnectionParameters::AuthenticationByPassword)
if (sshParams.authenticationType == SshConnectionParameters::AuthenticationByPassword)
m_ui->passwordButton->setChecked(true);
else
m_ui->keyButton->setChecked(true);
......
......@@ -33,8 +33,8 @@
#include "genericlinuxdeviceconfigurationwizardpages.h"
#include "linuxdevicetestdialog.h"
#include "linuxdevicetester.h"
#include "portlist.h"
#include "remotelinux_constants.h"
#include <utils/portlist.h>
using namespace Utils;
......@@ -86,7 +86,7 @@ LinuxDeviceConfiguration::Ptr GenericLinuxDeviceConfigurationWizard::deviceConfi
sshParams.privateKeyFile = d->setupPage.privateKeyFilePath();
LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(d->setupPage.configurationName(),
QLatin1String(Constants::GenericLinuxOsType), LinuxDeviceConfiguration::Hardware,
PortList::fromString(QLatin1String("10000-10100")), sshParams);
Utils::PortList::fromString(QLatin1String("10000-10100")), sshParams);
LinuxDeviceTestDialog dlg(devConf, new GenericLinuxDeviceTester(this), this);
dlg.exec();
return devConf;
......
......@@ -32,9 +32,9 @@
#include "linuxdeviceconfiguration.h"
#include "linuxdeviceconfigurations.h"
#include "portlist.h"
#include "remotelinux_constants.h"
#include <utils/portlist.h>
#include <utils/ssh/sshconnection.h>
#include <utils/qtcassert.h>
......
......@@ -47,11 +47,11 @@ QT_END_NAMESPACE
namespace Utils {
class SshConnectionParameters;
class PortList;
}
namespace RemoteLinux {
class LinuxDeviceConfigurations;
class PortList;
namespace Internal {
class LinuxDeviceConfigurationPrivate;
......@@ -71,7 +71,7 @@ public:
~LinuxDeviceConfiguration();
PortList freePorts() const;
Utils::PortList freePorts() const;
Utils::SshConnectionParameters sshParameters() const;
QString displayName() const;
QString osType() const;
......@@ -83,7 +83,7 @@ public:
QVariant attribute(const QString &name) const;
void setSshParameters(const Utils::SshConnectionParameters &sshParameters);
void setFreePorts(const PortList &freePorts);
void setFreePorts(const Utils::PortList &freePorts);
void setAttribute(const QString &name, const QVariant &value);
static QString defaultPrivateKeyFilePath();
......@@ -92,11 +92,11 @@ public:
static const Id InvalidId;
static Ptr create(const QString &name, const QString &osType, DeviceType deviceType,
const PortList &freePorts, const Utils::SshConnectionParameters &sshParams,
const Utils::PortList &freePorts, const Utils::SshConnectionParameters &sshParams,
const QVariantHash &attributes = QVariantHash(), Origin origin = ManuallyAdded);
private:
LinuxDeviceConfiguration(const QString &name, const QString &osType, DeviceType deviceType,
const PortList &freePorts, const Utils::SshConnectionParameters &sshParams,
const Utils::PortList &freePorts, const Utils::SshConnectionParameters &sshParams,
const QVariantHash &attributes, Origin origin);
LinuxDeviceConfiguration(const QSettings &settings, Id &nextId);
LinuxDeviceConfiguration(const ConstPtr &other);
......
......@@ -246,7 +246,7 @@ void LinuxDeviceConfigurations::setSshParameters(int i,
d->devConfigs.at(i)->setSshParameters(params);
}
void LinuxDeviceConfigurations::setFreePorts(int i, const PortList &freePorts)
void LinuxDeviceConfigurations::setFreePorts(int i, const Utils::PortList &freePorts)
{
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
Q_ASSERT(i >= 0 && i < rowCount());
......
......@@ -67,7 +67,7 @@ public:
void removeConfiguration(int index);
void setConfigurationName(int i, const QString &name);
void setSshParameters(int i, const Utils::SshConnectionParameters &params);
void setFreePorts(int i, const PortList &freePorts);
void setFreePorts(int i, const Utils::PortList &freePorts);
void setDefaultDevice(int index);
void setAttribute(int index, const QString &name, const QVariant &value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment