forked from qt-creator/qt-creator
Maemo: Only mention mounting stuff to user when it's actually done.
Otherwise, we clutter the output window with potentially confusing messages. Reviewed-by: kh1
This commit is contained in:
@@ -47,7 +47,7 @@ namespace Qt4ProjectManager {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
MaemoRemoteMounter::MaemoRemoteMounter(QObject *parent)
|
MaemoRemoteMounter::MaemoRemoteMounter(QObject *parent)
|
||||||
: QObject(parent), m_utfsServerTimer(new QTimer(this)),
|
: QObject(parent), m_toolChain(0), m_utfsServerTimer(new QTimer(this)),
|
||||||
m_uploadJobId(SftpInvalidJob), m_state(Inactive)
|
m_uploadJobId(SftpInvalidJob), m_state(Inactive)
|
||||||
{
|
{
|
||||||
connect(m_utfsServerTimer, SIGNAL(timeout()), this,
|
connect(m_utfsServerTimer, SIGNAL(timeout()), this,
|
||||||
@@ -69,9 +69,10 @@ void MaemoRemoteMounter::setConnection(const Core::SshConnection::Ptr &connectio
|
|||||||
bool MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec,
|
bool MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec,
|
||||||
bool mountAsRoot)
|
bool mountAsRoot)
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(m_toolChain);
|
||||||
ASSERT_STATE(Inactive);
|
ASSERT_STATE(Inactive);
|
||||||
|
|
||||||
if (mountSpec.isValid()) {
|
if (m_toolChain->allowsRemoteMounts() && mountSpec.isValid()) {
|
||||||
if (!m_portList.hasMore())
|
if (!m_portList.hasMore())
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
@@ -80,14 +81,17 @@ bool MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MaemoRemoteMounter::hasValidMountSpecifications() const
|
||||||
|
{
|
||||||
|
return !m_mountSpecs.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
void MaemoRemoteMounter::mount()
|
void MaemoRemoteMounter::mount()
|
||||||
{
|
{
|
||||||
ASSERT_STATE(Inactive);
|
ASSERT_STATE(Inactive);
|
||||||
Q_ASSERT(m_utfsServers.isEmpty());
|
Q_ASSERT(m_utfsServers.isEmpty());
|
||||||
Q_ASSERT(m_connection);
|
Q_ASSERT(m_connection);
|
||||||
|
|
||||||
if (!m_toolChain->allowsRemoteMounts())
|
|
||||||
m_mountSpecs.clear();
|
|
||||||
if (m_mountSpecs.isEmpty()) {
|
if (m_mountSpecs.isEmpty()) {
|
||||||
setState(Inactive);
|
setState(Inactive);
|
||||||
emit reportProgress(tr("No directories to mount"));
|
emit reportProgress(tr("No directories to mount"));
|
||||||
@@ -114,7 +118,6 @@ void MaemoRemoteMounter::unmount()
|
|||||||
m_mountSpecs.at(i).mountSpec.remoteMountPoint);
|
m_mountSpecs.at(i).mountSpec.remoteMountPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit reportProgress(tr("Unmounting remote mount points..."));
|
|
||||||
m_umountStderr.clear();
|
m_umountStderr.clear();
|
||||||
m_unmountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
m_unmountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
||||||
connect(m_unmountProcess.data(), SIGNAL(closed(int)), this,
|
connect(m_unmountProcess.data(), SIGNAL(closed(int)), this,
|
||||||
@@ -458,6 +461,8 @@ void MaemoRemoteMounter::setState(State newState)
|
|||||||
m_state = newState;
|
m_state = newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Perhaps remove this one again, since it might interfere with
|
||||||
|
// an unrelated application
|
||||||
void MaemoRemoteMounter::killUtfsClients()
|
void MaemoRemoteMounter::killUtfsClients()
|
||||||
{
|
{
|
||||||
const SshRemoteProcess::Ptr utfsClientKiller
|
const SshRemoteProcess::Ptr utfsClientKiller
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public:
|
|||||||
void setPortList(const MaemoPortList &portList) { m_portList = portList; }
|
void setPortList(const MaemoPortList &portList) { m_portList = portList; }
|
||||||
bool addMountSpecification(const MaemoMountSpecification &mountSpec,
|
bool addMountSpecification(const MaemoMountSpecification &mountSpec,
|
||||||
bool mountAsRoot);
|
bool mountAsRoot);
|
||||||
|
bool hasValidMountSpecifications() const;
|
||||||
void resetMountSpecifications() { m_mountSpecs.clear(); }
|
void resetMountSpecifications() { m_mountSpecs.clear(); }
|
||||||
void mount();
|
void mount();
|
||||||
void unmount();
|
void unmount();
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ void MaemoSshRunner::handleCleanupFinished(int exitStatus)
|
|||||||
<< StopRequested);
|
<< StopRequested);
|
||||||
|
|
||||||
if (m_state == StopRequested || m_state == PostRunCleaning) {
|
if (m_state == StopRequested || m_state == PostRunCleaning) {
|
||||||
m_mounter->unmount();
|
unmount();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ void MaemoSshRunner::handleCleanupFinished(int exitStatus)
|
|||||||
.arg(m_cleaner->errorString()));
|
.arg(m_cleaner->errorString()));
|
||||||
} else {
|
} else {
|
||||||
m_mounter->setConnection(m_connection);
|
m_mounter->setConnection(m_connection);
|
||||||
m_mounter->unmount();
|
unmount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,12 +211,11 @@ void MaemoSshRunner::handleUnmounted()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setState(PreMountUnmounting);
|
setState(PreMountUnmounting);
|
||||||
m_mounter->unmount();
|
unmount();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PreMountUnmounting:
|
case PreMountUnmounting:
|
||||||
setState(Mounting);
|
mount();
|
||||||
m_mounter->mount();
|
|
||||||
break;
|
break;
|
||||||
case PostRunCleaning:
|
case PostRunCleaning:
|
||||||
case StopRequested:
|
case StopRequested:
|
||||||
@@ -333,9 +332,47 @@ void MaemoSshRunner::setState(State newState)
|
|||||||
|
|
||||||
void MaemoSshRunner::emitError(const QString &errorMsg)
|
void MaemoSshRunner::emitError(const QString &errorMsg)
|
||||||
{
|
{
|
||||||
|
if (m_state != Inactive) {
|
||||||
emit error(errorMsg);
|
emit error(errorMsg);
|
||||||
setState(Inactive);
|
setState(Inactive);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoSshRunner::mount()
|
||||||
|
{
|
||||||
|
setState(Mounting);
|
||||||
|
if (m_mounter->hasValidMountSpecifications()) {
|
||||||
|
emit reportProgress(tr("Mounting host directories..."));
|
||||||
|
m_mounter->mount();
|
||||||
|
} else {
|
||||||
|
handleMounted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoSshRunner::unmount()
|
||||||
|
{
|
||||||
|
ASSERT_STATE(QList<State>() << PreRunCleaning << PreMountUnmounting
|
||||||
|
<< PostRunCleaning << StopRequested);
|
||||||
|
if (m_mounter->hasValidMountSpecifications()) {
|
||||||
|
QString message;
|
||||||
|
switch (m_state) {
|
||||||
|
case PreRunCleaning:
|
||||||
|
message = tr("Unmounting left-over host directory mounts...");
|
||||||
|
break;
|
||||||
|
case PreMountUnmounting:
|
||||||
|
message = tr("Potentially unmounting left-over host directory mounts...");
|
||||||
|
case StopRequested: case PostRunCleaning:
|
||||||
|
message = tr("Unmounting host directories...");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
emit reportProgress(message);
|
||||||
|
m_mounter->unmount();
|
||||||
|
} else {
|
||||||
|
handleUnmounted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const qint64 MaemoSshRunner::InvalidExitCode
|
const qint64 MaemoSshRunner::InvalidExitCode
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ private:
|
|||||||
void cleanup();
|
void cleanup();
|
||||||
bool addMountSpecification(const MaemoMountSpecification &mountSpec);
|
bool addMountSpecification(const MaemoMountSpecification &mountSpec);
|
||||||
bool isConnectionUsable() const;
|
bool isConnectionUsable() const;
|
||||||
|
void mount();
|
||||||
|
void unmount();
|
||||||
|
|
||||||
MaemoRunConfiguration * const m_runConfig; // TODO this pointer can be invalid
|
MaemoRunConfiguration * const m_runConfig; // TODO this pointer can be invalid
|
||||||
MaemoRemoteMounter * const m_mounter;
|
MaemoRemoteMounter * const m_mounter;
|
||||||
|
|||||||
Reference in New Issue
Block a user