forked from qt-creator/qt-creator
Speedup project loading, we now parse only the targets runtime info.
Reviewed-by: ck
This commit is contained in:
@@ -72,7 +72,6 @@ MaemoQemuManager::MaemoQemuManager(QObject *parent)
|
|||||||
, m_qemuAction(0)
|
, m_qemuAction(0)
|
||||||
, m_qemuProcess(new QProcess(this))
|
, m_qemuProcess(new QProcess(this))
|
||||||
, m_runningQtId(-1)
|
, m_runningQtId(-1)
|
||||||
, m_needsSetup(true)
|
|
||||||
, m_userTerminated(false)
|
, m_userTerminated(false)
|
||||||
{
|
{
|
||||||
m_qemuStarterIcon.addFile(":/qt-maemo/images/qemu-run.png", iconSize);
|
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)
|
void MaemoQemuManager::qtVersionsChanged(const QList<int> &uniqueIds)
|
||||||
{
|
{
|
||||||
if (m_needsSetup)
|
|
||||||
setupRuntimes();
|
|
||||||
|
|
||||||
QtVersionManager *manager = QtVersionManager::instance();
|
QtVersionManager *manager = QtVersionManager::instance();
|
||||||
foreach (int uniqueId, uniqueIds) {
|
foreach (int uniqueId, uniqueIds) {
|
||||||
if (manager->isValidId(uniqueId)) {
|
if (manager->isValidId(uniqueId)) {
|
||||||
@@ -199,7 +195,6 @@ void MaemoQemuManager::projectAdded(ProjectExplorer::Project *project)
|
|||||||
|
|
||||||
foreach (Target *target, project->targets())
|
foreach (Target *target, project->targets())
|
||||||
targetAdded(target);
|
targetAdded(target);
|
||||||
m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoQemuManager::projectRemoved(ProjectExplorer::Project *project)
|
void MaemoQemuManager::projectRemoved(ProjectExplorer::Project *project)
|
||||||
@@ -255,7 +250,7 @@ void MaemoQemuManager::targetAdded(ProjectExplorer::Target *target)
|
|||||||
|
|
||||||
foreach (RunConfiguration *rc, target->runConfigurations())
|
foreach (RunConfiguration *rc, target->runConfigurations())
|
||||||
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), true);
|
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), true);
|
||||||
m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
|
toggleStarterButton(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoQemuManager::targetRemoved(ProjectExplorer::Target *target)
|
void MaemoQemuManager::targetRemoved(ProjectExplorer::Target *target)
|
||||||
@@ -522,19 +517,6 @@ void MaemoQemuManager::runtimeFolderChanged(const QString &directory)
|
|||||||
|
|
||||||
// -- private
|
// -- 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)
|
void MaemoQemuManager::updateStarterIcon(bool running)
|
||||||
{
|
{
|
||||||
QIcon::State state;
|
QIcon::State state;
|
||||||
@@ -554,9 +536,6 @@ void MaemoQemuManager::updateStarterIcon(bool running)
|
|||||||
|
|
||||||
void MaemoQemuManager::toggleStarterButton(Target *target)
|
void MaemoQemuManager::toggleStarterButton(Target *target)
|
||||||
{
|
{
|
||||||
if (m_needsSetup)
|
|
||||||
setupRuntimes();
|
|
||||||
|
|
||||||
int uniqueId = -1;
|
int uniqueId = -1;
|
||||||
if (target) {
|
if (target) {
|
||||||
if (Qt4Target *qt4Target = qobject_cast<Qt4Target*>(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;
|
bool isRunning = m_qemuProcess->state() != QProcess::NotRunning;
|
||||||
if (m_runningQtId == uniqueId)
|
if (m_runningQtId == uniqueId)
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
|
|
||||||
m_qemuAction->setEnabled(m_runtimes.value(uniqueId, Runtime()).isValid()
|
m_qemuAction->setEnabled(m_runtimes.value(uniqueId, Runtime()).isValid()
|
||||||
&& targetUsesMatchingRuntimeConfig(target) && !isRunning);
|
&& targetUsesMatchingRuntimeConfig(target) && !isRunning);
|
||||||
|
m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MaemoQemuManager::sessionHasMaemoTarget() const
|
bool MaemoQemuManager::sessionHasMaemoTarget() const
|
||||||
@@ -739,7 +722,12 @@ QString MaemoQemuManager::runtimeForQtVersion(const QString &qmakeCommand) const
|
|||||||
&& infoReader.name() == QLatin1String("installed")) {
|
&& infoReader.name() == QLatin1String("installed")) {
|
||||||
if (infoReader.readNext() == QXmlStreamReader::Characters
|
if (infoReader.readNext() == QXmlStreamReader::Characters
|
||||||
&& infoReader.text() == QLatin1String("true"))
|
&& 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ private:
|
|||||||
MaemoQemuManager(QObject *parent);
|
MaemoQemuManager(QObject *parent);
|
||||||
~MaemoQemuManager();
|
~MaemoQemuManager();
|
||||||
|
|
||||||
void setupRuntimes();
|
|
||||||
bool sessionHasMaemoTarget() const;
|
bool sessionHasMaemoTarget() const;
|
||||||
|
|
||||||
void updateStarterIcon(bool running);
|
void updateStarterIcon(bool running);
|
||||||
@@ -146,7 +145,6 @@ private:
|
|||||||
QProcess *m_qemuProcess;
|
QProcess *m_qemuProcess;
|
||||||
|
|
||||||
int m_runningQtId;
|
int m_runningQtId;
|
||||||
bool m_needsSetup;
|
|
||||||
bool m_userTerminated;
|
bool m_userTerminated;
|
||||||
QIcon m_qemuStarterIcon;
|
QIcon m_qemuStarterIcon;
|
||||||
QMap<int, Runtime> m_runtimes;
|
QMap<int, Runtime> m_runtimes;
|
||||||
|
|||||||
Reference in New Issue
Block a user