Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
1cb07172
Commit
1cb07172
authored
14 years ago
by
kh1
Browse files
Options
Downloads
Patches
Plain Diff
Watch the runtime folders, so we can update the starter once added.
Reviewed-by: ck
parent
965a5f53
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp
+80
-21
80 additions, 21 deletions
src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp
src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h
+11
-0
11 additions, 0 deletions
src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h
with
91 additions
and
21 deletions
src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp
+
80
−
21
View file @
1cb07172
...
@@ -115,6 +115,13 @@ MaemoQemuManager::MaemoQemuManager(QObject *parent)
...
@@ -115,6 +115,13 @@ MaemoQemuManager::MaemoQemuManager(QObject *parent)
SLOT
(
qemuOutput
()));
SLOT
(
qemuOutput
()));
connect
(
this
,
SIGNAL
(
qemuProcessStatus
(
QemuStatus
,
QString
)),
connect
(
this
,
SIGNAL
(
qemuProcessStatus
(
QemuStatus
,
QString
)),
this
,
SLOT
(
qemuStatusChanged
(
QemuStatus
,
QString
)));
this
,
SLOT
(
qemuStatusChanged
(
QemuStatus
,
QString
)));
m_runtimeRootWatcher
=
new
QFileSystemWatcher
(
this
);
connect
(
m_runtimeRootWatcher
,
SIGNAL
(
directoryChanged
(
QString
)),
this
,
SLOT
(
runtimeRootChanged
(
QString
)));
m_runtimeFolderWatcher
=
new
QFileSystemWatcher
(
this
);
connect
(
m_runtimeFolderWatcher
,
SIGNAL
(
directoryChanged
(
QString
)),
this
,
SLOT
(
runtimeFolderChanged
(
QString
)));
}
}
MaemoQemuManager
::~
MaemoQemuManager
()
MaemoQemuManager
::~
MaemoQemuManager
()
...
@@ -132,10 +139,8 @@ MaemoQemuManager &MaemoQemuManager::instance(QObject *parent)
...
@@ -132,10 +139,8 @@ MaemoQemuManager &MaemoQemuManager::instance(QObject *parent)
bool
MaemoQemuManager
::
runtimeForQtVersion
(
int
uniqueId
,
Runtime
*
rt
)
const
bool
MaemoQemuManager
::
runtimeForQtVersion
(
int
uniqueId
,
Runtime
*
rt
)
const
{
{
bool
found
=
m_runtimes
.
contains
(
uniqueId
);
*
rt
=
m_runtimes
.
value
(
uniqueId
,
Runtime
());
if
(
found
)
return
rt
->
isValid
();
*
rt
=
m_runtimes
.
value
(
uniqueId
);
return
found
;
}
}
void
MaemoQemuManager
::
qtVersionsChanged
(
const
QList
<
int
>
&
uniqueIds
)
void
MaemoQemuManager
::
qtVersionsChanged
(
const
QList
<
int
>
&
uniqueIds
)
...
@@ -146,16 +151,22 @@ void MaemoQemuManager::qtVersionsChanged(const QList<int> &uniqueIds)
...
@@ -146,16 +151,22 @@ void MaemoQemuManager::qtVersionsChanged(const QList<int> &uniqueIds)
QtVersionManager
*
manager
=
QtVersionManager
::
instance
();
QtVersionManager
*
manager
=
QtVersionManager
::
instance
();
foreach
(
int
uniqueId
,
uniqueIds
)
{
foreach
(
int
uniqueId
,
uniqueIds
)
{
if
(
manager
->
isValidId
(
uniqueId
))
{
if
(
manager
->
isValidId
(
uniqueId
))
{
const
QString
&
qmake
=
manager
->
version
(
uniqueId
)
->
qmakeCommand
();
QtVersion
*
version
=
manager
->
version
(
uniqueId
);
const
QString
&
runtimeRoot
=
runtimeForQtVersion
(
qmake
);
if
(
version
->
supportsTargetId
(
Constants
::
MAEMO_DEVICE_TARGET_ID
))
{
if
(
runtimeRoot
.
isEmpty
()
||
!
QFile
::
exists
(
runtimeRoot
))
{
const
QString
&
qmake
=
version
->
qmakeCommand
();
// no runtime available, or runtime needs to be installed
const
QString
&
runtimeRoot
=
runtimeForQtVersion
(
qmake
);
m_runtimes
.
remove
(
uniqueId
);
if
(
!
runtimeRoot
.
isEmpty
())
{
}
else
{
Runtime
runtime
(
runtimeRoot
);
// valid maemo qt version, also has a runtime installed
if
(
QFile
::
exists
(
runtimeRoot
))
Runtime
runtime
(
runtimeRoot
);
fillRuntimeInformation
(
&
runtime
);
fillRuntimeInformation
(
&
runtime
);
runtime
.
m_watchPath
=
m_runtimes
.
insert
(
uniqueId
,
runtime
);
runtimeRoot
.
left
(
runtimeRoot
.
lastIndexOf
(
QLatin1Char
(
'/'
)));
m_runtimes
.
insert
(
uniqueId
,
runtime
);
if
(
!
m_runtimeRootWatcher
->
directories
().
contains
(
runtime
.
m_watchPath
))
m_runtimeRootWatcher
->
addPath
(
runtime
.
m_watchPath
);
}
else
{
m_runtimes
.
remove
(
uniqueId
);
}
}
}
}
else
{
}
else
{
// this qt version has been removed from the settings
// this qt version has been removed from the settings
...
@@ -462,6 +473,49 @@ void MaemoQemuManager::qemuOutput()
...
@@ -462,6 +473,49 @@ void MaemoQemuManager::qemuOutput()
qDebug
(
"%s"
,
m_qemuProcess
->
readAllStandardError
().
data
());
qDebug
(
"%s"
,
m_qemuProcess
->
readAllStandardError
().
data
());
}
}
void
MaemoQemuManager
::
runtimeRootChanged
(
const
QString
&
directory
)
{
QList
<
int
>
uniqueIds
;
QMap
<
int
,
Runtime
>::
const_iterator
it
;
for
(
it
=
m_runtimes
.
constBegin
();
it
!=
m_runtimes
.
constEnd
();
++
it
)
{
if
(
QDir
(
it
.
value
().
m_watchPath
)
==
QDir
(
directory
))
uniqueIds
.
append
(
it
.
key
());
}
foreach
(
int
uniqueId
,
uniqueIds
)
{
Runtime
runtime
=
m_runtimes
.
value
(
uniqueId
,
Runtime
());
if
(
runtime
.
isValid
())
{
if
(
QFile
::
exists
(
runtime
.
m_root
))
{
// nothing changed, so we can remove it
uniqueIds
.
removeAll
(
uniqueId
);
}
}
else
{
if
(
QFile
::
exists
(
runtime
.
m_root
))
{
if
(
!
QFile
::
exists
(
runtime
.
m_root
+
QLatin1String
(
"/information"
)))
{
// install might be still in progress
uniqueIds
.
removeAll
(
uniqueId
);
m_runtimeFolderWatcher
->
addPath
(
runtime
.
m_root
);
}
}
}
}
notify
(
uniqueIds
);
}
void
MaemoQemuManager
::
runtimeFolderChanged
(
const
QString
&
directory
)
{
if
(
QFile
::
exists
(
directory
+
QLatin1String
(
"/information"
)))
{
QList
<
int
>
uniqueIds
;
QMap
<
int
,
Runtime
>::
const_iterator
it
;
for
(
it
=
m_runtimes
.
constBegin
();
it
!=
m_runtimes
.
constEnd
();
++
it
)
{
if
(
QDir
(
it
.
value
().
m_root
)
==
QDir
(
directory
))
uniqueIds
.
append
(
it
.
key
());
}
notify
(
uniqueIds
);
m_runtimeFolderWatcher
->
removePath
(
directory
);
}
}
// -- private
// -- private
void
MaemoQemuManager
::
setupRuntimes
()
void
MaemoQemuManager
::
setupRuntimes
()
...
@@ -513,7 +567,7 @@ void MaemoQemuManager::toggleStarterButton(Target *target)
...
@@ -513,7 +567,7 @@ void MaemoQemuManager::toggleStarterButton(Target *target)
if
(
m_runningQtId
==
uniqueId
)
if
(
m_runningQtId
==
uniqueId
)
isRunning
=
false
;
isRunning
=
false
;
m_qemuAction
->
setEnabled
(
m_runtimes
.
contains
(
uniqueId
)
m_qemuAction
->
setEnabled
(
m_runtimes
.
value
(
uniqueId
,
Runtime
()).
isValid
(
)
&&
targetUsesMatchingRuntimeConfig
(
target
)
&&
!
isRunning
);
&&
targetUsesMatchingRuntimeConfig
(
target
)
&&
!
isRunning
);
}
}
...
@@ -542,7 +596,7 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target,
...
@@ -542,7 +596,7 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target,
if
(
!
bc
)
if
(
!
bc
)
return
false
;
return
false
;
QtVersion
*
version
=
bc
->
qtVersion
();
QtVersion
*
version
=
bc
->
qtVersion
();
if
(
!
version
||
!
m_runtimes
.
contains
(
version
->
uniqueId
()))
if
(
!
version
||
!
m_runtimes
.
value
(
version
->
uniqueId
()
,
Runtime
()).
isValid
(
))
return
false
;
return
false
;
if
(
qtVersion
)
if
(
qtVersion
)
...
@@ -569,10 +623,9 @@ bool MaemoQemuManager::fillRuntimeInformation(Runtime *runtime) const
...
@@ -569,10 +623,9 @@ bool MaemoQemuManager::fillRuntimeInformation(Runtime *runtime) const
const
QStringList
files
=
QDir
(
runtime
->
m_root
).
entryList
(
QDir
::
Files
const
QStringList
files
=
QDir
(
runtime
->
m_root
).
entryList
(
QDir
::
Files
|
QDir
::
NoSymLinks
|
QDir
::
NoDotAndDotDot
);
|
QDir
::
NoSymLinks
|
QDir
::
NoDotAndDotDot
);
// we need at least the information file
const
QLatin1String
infoFile
(
"information"
);
const
QLatin1String
infoFile
(
"information"
);
// we need at least the information file and a second one, most likely
if
(
files
.
contains
(
infoFile
))
{
// the image file qemu is going to load
if
(
files
.
contains
(
infoFile
)
&&
files
.
count
()
>
1
)
{
QFile
file
(
runtime
->
m_root
+
QLatin1Char
(
'/'
)
+
infoFile
);
QFile
file
(
runtime
->
m_root
+
QLatin1Char
(
'/'
)
+
infoFile
);
if
(
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
if
(
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
QMap
<
QString
,
QString
>
map
;
QMap
<
QString
,
QString
>
map
;
...
@@ -627,8 +680,8 @@ QString MaemoQemuManager::runtimeForQtVersion(const QString &qmakeCommand) const
...
@@ -627,8 +680,8 @@ QString MaemoQemuManager::runtimeForQtVersion(const QString &qmakeCommand) const
if
(
line
.
startsWith
(
QLatin1String
(
"runtime"
)))
{
if
(
line
.
startsWith
(
QLatin1String
(
"runtime"
)))
{
const
QStringList
&
list
=
line
.
split
(
QLatin1Char
(
' '
));
const
QStringList
&
list
=
line
.
split
(
QLatin1Char
(
' '
));
if
(
list
.
count
()
>
1
)
{
if
(
list
.
count
()
>
1
)
{
return
madRoot
return
QDir
::
fromNativeSeparators
(
madRoot
+
QLatin1String
(
"/runtimes/"
)
+
list
.
at
(
1
).
trimmed
();
+
QLatin1String
(
"/runtimes/"
)
+
list
.
at
(
1
).
trimmed
()
)
;
}
}
break
;
break
;
}
}
...
@@ -639,6 +692,12 @@ QString MaemoQemuManager::runtimeForQtVersion(const QString &qmakeCommand) const
...
@@ -639,6 +692,12 @@ QString MaemoQemuManager::runtimeForQtVersion(const QString &qmakeCommand) const
return
QString
();
return
QString
();
}
}
void
MaemoQemuManager
::
notify
(
const
QList
<
int
>
uniqueIds
)
{
qtVersionsChanged
(
uniqueIds
);
environmentChanged
();
// to toggle the start button
}
void
MaemoQemuManager
::
toggleDeviceConnections
(
MaemoRunConfiguration
*
mrc
,
void
MaemoQemuManager
::
toggleDeviceConnections
(
MaemoRunConfiguration
*
mrc
,
bool
_connect
)
bool
_connect
)
{
{
...
...
This diff is collapsed.
Click to expand it.
src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h
+
11
−
0
View file @
1cb07172
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include
<QtGui/QIcon>
#include
<QtGui/QIcon>
QT_FORWARD_DECLARE_CLASS
(
QAction
);
QT_FORWARD_DECLARE_CLASS
(
QAction
);
QT_FORWARD_DECLARE_CLASS
(
QFileSystemWatcher
)
QT_FORWARD_DECLARE_CLASS
(
QStringList
);
QT_FORWARD_DECLARE_CLASS
(
QStringList
);
namespace
ProjectExplorer
{
namespace
ProjectExplorer
{
...
@@ -59,12 +60,16 @@ struct Runtime
...
@@ -59,12 +60,16 @@ struct Runtime
Runtime
()
{}
Runtime
()
{}
Runtime
(
const
QString
&
root
)
Runtime
(
const
QString
&
root
)
:
m_root
(
root
)
{}
:
m_root
(
root
)
{}
bool
isValid
()
const
{
return
!
m_bin
.
isEmpty
();
}
QString
m_bin
;
QString
m_bin
;
QString
m_root
;
QString
m_root
;
QString
m_args
;
QString
m_args
;
QString
m_libPath
;
QString
m_libPath
;
QString
m_sshPort
;
QString
m_sshPort
;
QString
m_watchPath
;
MaemoPortList
m_freePorts
;
MaemoPortList
m_freePorts
;
};
};
...
@@ -110,6 +115,9 @@ private slots:
...
@@ -110,6 +115,9 @@ private slots:
void
qemuStatusChanged
(
QemuStatus
status
,
const
QString
&
error
);
void
qemuStatusChanged
(
QemuStatus
status
,
const
QString
&
error
);
void
qemuOutput
();
void
qemuOutput
();
void
runtimeRootChanged
(
const
QString
&
directory
);
void
runtimeFolderChanged
(
const
QString
&
directory
);
private:
private:
MaemoQemuManager
(
QObject
*
parent
);
MaemoQemuManager
(
QObject
*
parent
);
~
MaemoQemuManager
();
~
MaemoQemuManager
();
...
@@ -128,6 +136,7 @@ private:
...
@@ -128,6 +136,7 @@ private:
bool
fillRuntimeInformation
(
Runtime
*
runtime
)
const
;
bool
fillRuntimeInformation
(
Runtime
*
runtime
)
const
;
QString
runtimeForQtVersion
(
const
QString
&
qmakeCommand
)
const
;
QString
runtimeForQtVersion
(
const
QString
&
qmakeCommand
)
const
;
void
notify
(
const
QList
<
int
>
uniqueIds
);
void
toggleDeviceConnections
(
MaemoRunConfiguration
*
mrc
,
bool
connect
);
void
toggleDeviceConnections
(
MaemoRunConfiguration
*
mrc
,
bool
connect
);
private:
private:
...
@@ -140,6 +149,8 @@ private:
...
@@ -140,6 +149,8 @@ private:
QIcon
m_qemuStarterIcon
;
QIcon
m_qemuStarterIcon
;
QMap
<
int
,
Runtime
>
m_runtimes
;
QMap
<
int
,
Runtime
>
m_runtimes
;
static
MaemoQemuManager
*
m_instance
;
static
MaemoQemuManager
*
m_instance
;
QFileSystemWatcher
*
m_runtimeRootWatcher
;
QFileSystemWatcher
*
m_runtimeFolderWatcher
;
};
};
}
// namespace Qt4ProjectManager
}
// namespace Qt4ProjectManager
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment