summaryrefslogtreecommitdiff
path: root/src/plugins/qt4projectmanager/qt-maemo
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2010-10-06 12:33:02 +0200
committerkh1 <qt-info@nokia.com>2010-10-11 11:05:53 +0200
commita81e33258e5fe2f5c65ee744b1ae1d18fb06f5f8 (patch)
tree728faadedb79d404c3283346bee24694ae5d5e66 /src/plugins/qt4projectmanager/qt-maemo
parent8c6d8854aaf565f1affdde27e8dceb6569ef50f1 (diff)
downloadqt-creator-a81e33258e5fe2f5c65ee744b1ae1d18fb06f5f8.tar.gz
Speedup project loading, we now parse only the targets runtime info.
Reviewed-by: ck
Diffstat (limited to 'src/plugins/qt4projectmanager/qt-maemo')
-rw-r--r--src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp34
-rw-r--r--src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h2
2 files changed, 11 insertions, 25 deletions
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp
index 5641225f1b..d782e50818 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp
@@ -72,7 +72,6 @@ MaemoQemuManager::MaemoQemuManager(QObject *parent)
, m_qemuAction(0)
, m_qemuProcess(new QProcess(this))
, m_runningQtId(-1)
- , m_needsSetup(true)
, m_userTerminated(false)
{
m_qemuStarterIcon.addFile(":/qt-maemo/images/qemu-run.png", iconSize);
@@ -149,9 +148,6 @@ bool MaemoQemuManager::runtimeForQtVersion(int uniqueId, Runtime *rt) const
void MaemoQemuManager::qtVersionsChanged(const QList<int> &uniqueIds)
{
- if (m_needsSetup)
- setupRuntimes();
-
QtVersionManager *manager = QtVersionManager::instance();
foreach (int uniqueId, uniqueIds) {
if (manager->isValidId(uniqueId)) {
@@ -199,7 +195,6 @@ void MaemoQemuManager::projectAdded(ProjectExplorer::Project *project)
foreach (Target *target, project->targets())
targetAdded(target);
- m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
}
void MaemoQemuManager::projectRemoved(ProjectExplorer::Project *project)
@@ -255,7 +250,7 @@ void MaemoQemuManager::targetAdded(ProjectExplorer::Target *target)
foreach (RunConfiguration *rc, target->runConfigurations())
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), true);
- m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
+ toggleStarterButton(target);
}
void MaemoQemuManager::targetRemoved(ProjectExplorer::Target *target)
@@ -522,19 +517,6 @@ void MaemoQemuManager::runtimeFolderChanged(const QString &directory)
// -- private
-void MaemoQemuManager::setupRuntimes()
-{
- m_needsSetup = false;
-
- const QList<QtVersion*> &versions = QtVersionManager::instance()
- ->versionsForTargetId(Constants::MAEMO_DEVICE_TARGET_ID);
-
- QList<int> uniqueIds;
- foreach (QtVersion *version, versions)
- uniqueIds.append(version->uniqueId());
- qtVersionsChanged(uniqueIds);
-}
-
void MaemoQemuManager::updateStarterIcon(bool running)
{
QIcon::State state;
@@ -554,9 +536,6 @@ void MaemoQemuManager::updateStarterIcon(bool running)
void MaemoQemuManager::toggleStarterButton(Target *target)
{
- if (m_needsSetup)
- setupRuntimes();
-
int uniqueId = -1;
if (target) {
if (Qt4Target *qt4Target = qobject_cast<Qt4Target*>(target)) {
@@ -567,12 +546,16 @@ void MaemoQemuManager::toggleStarterButton(Target *target)
}
}
+ if (m_runtimes.isEmpty() || !m_runtimes.contains(uniqueId))
+ qtVersionsChanged(QList<int>() << uniqueId);
+
bool isRunning = m_qemuProcess->state() != QProcess::NotRunning;
if (m_runningQtId == uniqueId)
isRunning = false;
m_qemuAction->setEnabled(m_runtimes.value(uniqueId, Runtime()).isValid()
&& targetUsesMatchingRuntimeConfig(target) && !isRunning);
+ m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
}
bool MaemoQemuManager::sessionHasMaemoTarget() const
@@ -739,7 +722,12 @@ QString MaemoQemuManager::runtimeForQtVersion(const QString &qmakeCommand) const
&& infoReader.name() == QLatin1String("installed")) {
if (infoReader.readNext() == QXmlStreamReader::Characters
&& infoReader.text() == QLatin1String("true"))
- installedRuntimes << attrs.value(QLatin1String("runtime_id")).toString();
+ if (attrs.hasAttribute(QLatin1String(QLatin1String("runtime_id"))))
+ installedRuntimes << attrs.value(QLatin1String("runtime_id")).toString();
+ else if (attrs.hasAttribute(QLatin1String(QLatin1String("id")))) {
+ // older MADDE seems to use only id
+ installedRuntimes << attrs.value(QLatin1String("id")).toString();
+ }
break;
}
}
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h
index 09e47997c7..6222ea972c 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h
@@ -123,7 +123,6 @@ private:
MaemoQemuManager(QObject *parent);
~MaemoQemuManager();
- void setupRuntimes();
bool sessionHasMaemoTarget() const;
void updateStarterIcon(bool running);
@@ -146,7 +145,6 @@ private:
QProcess *m_qemuProcess;
int m_runningQtId;
- bool m_needsSetup;
bool m_userTerminated;
QIcon m_qemuStarterIcon;
QMap<int, Runtime> m_runtimes;