diff --git a/src/plugins/remotelinux/maemodebugsupport.cpp b/src/plugins/remotelinux/maemodebugsupport.cpp index 92371c862e6..ae67f50c3a6 100644 --- a/src/plugins/remotelinux/maemodebugsupport.cpp +++ b/src/plugins/remotelinux/maemodebugsupport.cpp @@ -30,10 +30,11 @@ **************************************************************************/ #include "maemodebugsupport.h" -#include - +#include "maemorunconfiguration.h" #include "maemosshrunner.h" +#include + namespace RemoteLinux { namespace Internal { diff --git a/src/plugins/remotelinux/maemodeploymentmounter.cpp b/src/plugins/remotelinux/maemodeploymentmounter.cpp index a3e3d23dcd5..9ee24742fe3 100644 --- a/src/plugins/remotelinux/maemodeploymentmounter.cpp +++ b/src/plugins/remotelinux/maemodeploymentmounter.cpp @@ -37,10 +37,9 @@ #include "maemousedportsgatherer.h" #include +#include #include -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) - using namespace Qt4ProjectManager; using namespace Utils; @@ -74,7 +73,7 @@ void MaemoDeploymentMounter::setupMounts(const SshConnection::Ptr &connection, const QList &mountSpecs, const Qt4BuildConfiguration *bc) { - ASSERT_STATE(Inactive); + QTC_ASSERT(m_state == Inactive, return); m_mountSpecs = mountSpecs; m_connection = connection; @@ -89,7 +88,7 @@ void MaemoDeploymentMounter::setupMounts(const SshConnection::Ptr &connection, void MaemoDeploymentMounter::tearDownMounts() { - ASSERT_STATE(Mounted); + QTC_ASSERT(m_state == Mounted, return); setState(UnmountingCurrentMounts); unmount(); @@ -97,7 +96,8 @@ void MaemoDeploymentMounter::tearDownMounts() void MaemoDeploymentMounter::setupMounter() { - ASSERT_STATE(UnmountingOldDirs); + QTC_ASSERT(m_state == UnmountingOldDirs, return); + setState(UnmountingCurrentDirs); m_mounter->resetMountSpecifications(); @@ -109,8 +109,8 @@ void MaemoDeploymentMounter::setupMounter() void MaemoDeploymentMounter::unmount() { - ASSERT_STATE(QList() << UnmountingOldDirs << UnmountingCurrentDirs - << UnmountingCurrentMounts); + QTC_ASSERT(m_state == UnmountingOldDirs || m_state == UnmountingCurrentDirs + || m_state == UnmountingCurrentMounts, return); if (m_mounter->hasValidMountSpecifications()) m_mounter->unmount(); @@ -120,7 +120,7 @@ void MaemoDeploymentMounter::unmount() void MaemoDeploymentMounter::handleMounted() { - ASSERT_STATE(QList() << Mounting << Inactive); + QTC_ASSERT(m_state == Mounting || m_state == Inactive, return); if (m_state == Inactive) return; @@ -131,8 +131,8 @@ void MaemoDeploymentMounter::handleMounted() void MaemoDeploymentMounter::handleUnmounted() { - ASSERT_STATE(QList() << UnmountingOldDirs << UnmountingCurrentDirs - << UnmountingCurrentMounts << Inactive); + QTC_ASSERT(m_state == UnmountingOldDirs || m_state == UnmountingCurrentDirs + || m_state == UnmountingCurrentMounts || m_state == Inactive, return); switch (m_state) { case UnmountingOldDirs: @@ -154,7 +154,8 @@ void MaemoDeploymentMounter::handleUnmounted() void MaemoDeploymentMounter::handlePortsGathererError(const QString &errorMsg) { - ASSERT_STATE(QList() << GatheringPorts << Inactive); + QTC_ASSERT(m_state == GatheringPorts || m_state == Inactive, return); + if (m_state == Inactive) return; @@ -165,7 +166,8 @@ void MaemoDeploymentMounter::handlePortsGathererError(const QString &errorMsg) void MaemoDeploymentMounter::handlePortListReady() { - ASSERT_STATE(QList() << GatheringPorts << Inactive); + QTC_ASSERT(m_state == GatheringPorts || m_state == Inactive, return); + if (m_state == Inactive) return; @@ -176,8 +178,10 @@ void MaemoDeploymentMounter::handlePortListReady() void MaemoDeploymentMounter::handleMountError(const QString &errorMsg) { - ASSERT_STATE(QList() << UnmountingOldDirs << UnmountingCurrentDirs - << UnmountingCurrentMounts << Mounting << Mounted << Inactive); + QTC_ASSERT(m_state == UnmountingOldDirs || m_state == UnmountingCurrentDirs + || m_state == UnmountingCurrentMounts || m_state == Mounting || m_state == Mounted + || m_state == Inactive, return); + if (m_state == Inactive) return; diff --git a/src/plugins/remotelinux/maemoglobal.h b/src/plugins/remotelinux/maemoglobal.h index 021857ff939..980a21e677f 100644 --- a/src/plugins/remotelinux/maemoglobal.h +++ b/src/plugins/remotelinux/maemoglobal.h @@ -46,9 +46,6 @@ #include #include -#define ASSERT_STATE_GENERIC(State, expected, actual) \ - MaemoGlobal::assertState(expected, actual, Q_FUNC_INFO) - QT_BEGIN_NAMESPACE class QProcess; class QString; @@ -149,21 +146,6 @@ public: return 0; } - template static void assertState(State expected, - State actual, const char *func) - { - assertState(QList() << expected, actual, func); - } - - template static void assertState(const QList &expected, - State actual, const char *func) - { - if (!expected.contains(actual)) { - qWarning("Warning: Unexpected state %d in function %s.", - actual, func); - } - } - static bool isValidMaemoQtVersion(const QString &qmakePath, const QString &osType); private: static QString madAdminCommand(const QString &qmakePath); diff --git a/src/plugins/remotelinux/maemopublisherfremantlefree.cpp b/src/plugins/remotelinux/maemopublisherfremantlefree.cpp index 6c85b367f99..695969e4bd9 100644 --- a/src/plugins/remotelinux/maemopublisherfremantlefree.cpp +++ b/src/plugins/remotelinux/maemopublisherfremantlefree.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -53,8 +54,6 @@ #include #include -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) - using namespace Core; using namespace Qt4ProjectManager; using namespace Utils; @@ -85,7 +84,7 @@ MaemoPublisherFremantleFree::MaemoPublisherFremantleFree(const ProjectExplorer:: MaemoPublisherFremantleFree::~MaemoPublisherFremantleFree() { - ASSERT_STATE(Inactive); + QTC_ASSERT(m_state == Inactive, return); m_process->kill(); } @@ -291,8 +290,8 @@ void MaemoPublisherFremantleFree::handleProcessStdErr() void MaemoPublisherFremantleFree::handleProcessFinished(bool failedToStart) { - ASSERT_STATE(QList() << RunningQmake << RunningMakeDistclean - << BuildingPackage << Inactive); + QTC_ASSERT(m_state == RunningQmake || m_state == RunningMakeDistclean + || m_state == BuildingPackage || m_state == Inactive, return); switch (m_state) { case RunningQmake: @@ -399,7 +398,7 @@ void MaemoPublisherFremantleFree::uploadPackage() void MaemoPublisherFremantleFree::handleScpStarted() { - ASSERT_STATE(QList() << StartingScp << Inactive); + QTC_ASSERT(m_state == StartingScp || m_state == Inactive, return); if (m_state == StartingScp) prepareToSendFile(); @@ -415,8 +414,8 @@ void MaemoPublisherFremantleFree::handleConnectionError() void MaemoPublisherFremantleFree::handleUploadJobFinished(int exitStatus) { - ASSERT_STATE(QList() << PreparingToUploadFile << UploadingFile - << Inactive); + QTC_ASSERT(m_state == PreparingToUploadFile || m_state == UploadingFile || m_state ==Inactive, + return); if (m_state != Inactive && (exitStatus != SshRemoteProcess::ExitedNormally || m_uploader->process()->exitCode() != 0)) { @@ -484,8 +483,8 @@ void MaemoPublisherFremantleFree::sendFile() void MaemoPublisherFremantleFree::handleScpStdOut(const QByteArray &output) { - ASSERT_STATE(QList() << PreparingToUploadFile << UploadingFile - << Inactive); + QTC_ASSERT(m_state == PreparingToUploadFile || m_state == UploadingFile || m_state == Inactive, + return); if (m_state == Inactive) return; diff --git a/src/plugins/remotelinux/maemoremotemounter.cpp b/src/plugins/remotelinux/maemoremotemounter.cpp index 21e901922b4..4fba5863653 100644 --- a/src/plugins/remotelinux/maemoremotemounter.cpp +++ b/src/plugins/remotelinux/maemoremotemounter.cpp @@ -44,8 +44,6 @@ #include -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) - using namespace Qt4ProjectManager; using namespace Utils; @@ -68,14 +66,16 @@ MaemoRemoteMounter::~MaemoRemoteMounter() void MaemoRemoteMounter::setConnection(const SshConnection::Ptr &connection, const LinuxDeviceConfiguration::ConstPtr &devConf) { - ASSERT_STATE(Inactive); + QTC_ASSERT(m_state == Inactive, return); + m_connection = connection; m_devConf = devConf; } void MaemoRemoteMounter::setBuildConfiguration(const Qt4BuildConfiguration *bc) { - ASSERT_STATE(Inactive); + QTC_ASSERT(m_state == Inactive, return); + const QtSupport::BaseQtVersion * const qtVersion = bc->qtVersion(); const AbstractQt4MaemoTarget * const maemoTarget = qobject_cast(bc->target()); @@ -86,7 +86,7 @@ void MaemoRemoteMounter::setBuildConfiguration(const Qt4BuildConfiguration *bc) void MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec, bool mountAsRoot) { - ASSERT_STATE(Inactive); + QTC_ASSERT(m_state == Inactive, return); if (m_remoteMountsAllowed && mountSpec.isValid()) m_mountSpecs << MountInfo(mountSpec, mountAsRoot); @@ -100,7 +100,8 @@ bool MaemoRemoteMounter::hasValidMountSpecifications() const void MaemoRemoteMounter::mount(PortList *freePorts, const MaemoUsedPortsGatherer *portsGatherer) { - ASSERT_STATE(Inactive); + QTC_ASSERT(m_state == Inactive, return); + Q_ASSERT(m_utfsServers.isEmpty()); Q_ASSERT(m_connection); @@ -117,7 +118,7 @@ void MaemoRemoteMounter::mount(PortList *freePorts, void MaemoRemoteMounter::unmount() { - ASSERT_STATE(Inactive); + QTC_ASSERT(m_state == Inactive, return); if (m_mountSpecs.isEmpty()) { emit reportProgress(tr("No directories to unmount")); @@ -145,7 +146,7 @@ void MaemoRemoteMounter::unmount() void MaemoRemoteMounter::handleUnmountProcessFinished(int exitStatus) { - ASSERT_STATE(QList() << Unmounting << Inactive); + QTC_ASSERT(m_state == Unmounting || m_state == Inactive, return); if (m_state == Inactive) return; @@ -241,7 +242,8 @@ void MaemoRemoteMounter::startUtfsClients() void MaemoRemoteMounter::handleUtfsClientsStarted() { - ASSERT_STATE(QList() << UtfsClientsStarting << Inactive); + QTC_ASSERT(m_state == UtfsClientsStarting || m_state == Inactive, return); + if (m_state == UtfsClientsStarting) { setState(UtfsClientsStarted); QTimer::singleShot(250, this, SLOT(startUtfsServers())); @@ -250,8 +252,8 @@ void MaemoRemoteMounter::handleUtfsClientsStarted() void MaemoRemoteMounter::handleUtfsClientsFinished(int exitStatus) { - ASSERT_STATE(QList() << UtfsClientsStarting << UtfsClientsStarted - << UtfsServersStarted << Inactive); + QTC_ASSERT(m_state == UtfsClientsStarting || m_state == UtfsClientsStarted + || m_state == UtfsServersStarted || m_state == Inactive, return); if (m_state == Inactive) return; @@ -273,7 +275,7 @@ void MaemoRemoteMounter::handleUtfsClientsFinished(int exitStatus) void MaemoRemoteMounter::startUtfsServers() { - ASSERT_STATE(QList() << UtfsClientsStarted << Inactive); + QTC_ASSERT(m_state == UtfsClientsStarted || m_state == Inactive, return); if (m_state == Inactive) return; @@ -378,7 +380,8 @@ void MaemoRemoteMounter::killUtfsServer(QProcess *proc) void MaemoRemoteMounter::handleUtfsServerTimeout() { - ASSERT_STATE(QList() << UtfsServersStarted << Inactive); + QTC_ASSERT(m_state == UtfsServersStarted || m_state == Inactive, return); + if (m_state == Inactive) return; diff --git a/src/plugins/remotelinux/maemosshrunner.cpp b/src/plugins/remotelinux/maemosshrunner.cpp index f4c2dd44b53..8fd4dcb3a7d 100644 --- a/src/plugins/remotelinux/maemosshrunner.cpp +++ b/src/plugins/remotelinux/maemosshrunner.cpp @@ -31,17 +31,15 @@ #include "maemosshrunner.h" -#include "maemoglobal.h" #include "maemoqemumanager.h" #include "maemoremotemounter.h" #include "maemoremotemountsmodel.h" -#include "remotelinuxrunconfiguration.h" +#include "maemorunconfiguration.h" #include +#include #include -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(MountState, state, m_mountState) - using namespace Qt4ProjectManager; using namespace Utils; @@ -93,12 +91,13 @@ bool MaemoSshRunner::canRun(QString &whyNot) const void MaemoSshRunner::doDeviceSetup() { QTC_ASSERT(m_mountState == InactiveMountState, return); + handleDeviceSetupDone(true); } void MaemoSshRunner::doAdditionalInitialCleanup() { - ASSERT_STATE(InactiveMountState); + QTC_ASSERT(m_mountState == InactiveMountState, return); m_mounter->setConnection(connection(), devConfig()); m_mounter->resetMountSpecifications(); @@ -115,14 +114,15 @@ void MaemoSshRunner::doAdditionalInitializations() void MaemoSshRunner::doPostRunCleanup() { - ASSERT_STATE(Mounted); + QTC_ASSERT(m_mountState == Mounted, return); + m_mountState = PostRunUnmounting; unmount(); } void MaemoSshRunner::handleUnmounted() { - ASSERT_STATE(QList() << InitialUnmounting << PostRunUnmounting); + QTC_ASSERT(m_mountState == InitialUnmounting || m_mountState == PostRunUnmounting, return); switch (m_mountState) { case InitialUnmounting: @@ -146,7 +146,7 @@ void MaemoSshRunner::doAdditionalConnectionErrorHandling() void MaemoSshRunner::handleMounted() { - ASSERT_STATE(Mounting); + QTC_ASSERT(m_mountState == Mounting, return); if (m_mountState == Mounting) { m_mountState = Mounted; @@ -156,7 +156,8 @@ void MaemoSshRunner::handleMounted() void MaemoSshRunner::handleMounterError(const QString &errorMsg) { - ASSERT_STATE(QList() << InitialUnmounting << Mounting << PostRunUnmounting); + QTC_ASSERT(m_mountState == InitialUnmounting || m_mountState == Mounting + || m_mountState == PostRunUnmounting, return); const MountState oldMountState = m_mountState; m_mountState = InactiveMountState; @@ -189,7 +190,8 @@ void MaemoSshRunner::mount() void MaemoSshRunner::unmount() { - ASSERT_STATE(QList() << InitialUnmounting << PostRunUnmounting); + QTC_ASSERT(m_mountState == InitialUnmounting || m_mountState == PostRunUnmounting, return); + if (m_mounter->hasValidMountSpecifications()) { QString message; switch (m_mountState) { diff --git a/src/plugins/remotelinux/maemosshrunner.h b/src/plugins/remotelinux/maemosshrunner.h index 48bd9d05ec4..f283f79a494 100644 --- a/src/plugins/remotelinux/maemosshrunner.h +++ b/src/plugins/remotelinux/maemosshrunner.h @@ -34,11 +34,11 @@ #include "remotelinuxapplicationrunner.h" #include "maemomountspecification.h" -#include "maemorunconfiguration.h" namespace RemoteLinux { namespace Internal { class MaemoRemoteMounter; +class MaemoRunConfiguration; class MaemoSshRunner : public AbstractRemoteLinuxApplicationRunner { diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index f0d5a2d269b..98836587d4f 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -31,7 +31,7 @@ #include "remotelinuxdebugsupport.h" -#include "maemoglobal.h" +#include "linuxdeviceconfiguration.h" #include "maemousedportsgatherer.h" #include "qt4maemotarget.h" #include "remotelinuxapplicationrunner.h" @@ -40,8 +40,7 @@ #include #include #include - -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) +#include using namespace Utils; using namespace Debugger; @@ -115,7 +114,7 @@ void AbstractRemoteLinuxDebugSupport::showMessage(const QString &msg, int channe void AbstractRemoteLinuxDebugSupport::handleAdapterSetupRequested() { - ASSERT_STATE(Inactive); + QTC_ASSERT(m_state == Inactive, return); setState(StartingRunner); showMessage(tr("Preparing remote side ...\n"), AppStuff); @@ -142,7 +141,7 @@ void AbstractRemoteLinuxDebugSupport::startExecution() if (m_state == Inactive) return; - ASSERT_STATE(StartingRunner); + QTC_ASSERT(m_state == StartingRunner, return); if (m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { if (!setPort(m_gdbServerPort)) @@ -206,13 +205,15 @@ void AbstractRemoteLinuxDebugSupport::handleDebuggingFinished() void AbstractRemoteLinuxDebugSupport::handleRemoteOutput(const QByteArray &output) { - ASSERT_STATE(QList() << Inactive << Debugging); + QTC_ASSERT(m_state == Inactive || m_state == Debugging, return); + showMessage(QString::fromUtf8(output), AppOutput); } void AbstractRemoteLinuxDebugSupport::handleRemoteErrorOutput(const QByteArray &output) { - ASSERT_STATE(QList() << Inactive << StartingRemoteProcess << Debugging); + QTC_ASSERT(m_state == Inactive || m_state == StartingRemoteProcess || m_state == Debugging, + return); if (!m_engine) return; @@ -248,7 +249,8 @@ void AbstractRemoteLinuxDebugSupport::handleAdapterSetupDone() void AbstractRemoteLinuxDebugSupport::handleRemoteProcessStarted() { Q_ASSERT(m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly); - ASSERT_STATE(StartingRemoteProcess); + QTC_ASSERT(m_state == StartingRemoteProcess, return); + handleAdapterSetupDone(); }