Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
4d4ae95b
Commit
4d4ae95b
authored
Feb 04, 2011
by
Christian Kandeler
Browse files
Maemo: Nicer process list for non-Fremantle systems.
parent
aa2ab949
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.cpp
View file @
4d4ae95b
...
...
@@ -340,7 +340,7 @@ void MaemoDeviceConfigurationsSettingsWidget::showGenerateSshKeyDialog()
void
MaemoDeviceConfigurationsSettingsWidget
::
showRemoteProcesses
()
{
MaemoRemoteProcessesDialog
dlg
(
currentConfig
()
->
sshParameters
()
,
this
);
MaemoRemoteProcessesDialog
dlg
(
currentConfig
(),
this
);
dlg
.
exec
();
}
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.cpp
View file @
4d4ae95b
...
...
@@ -41,6 +41,7 @@
#include
"maemoremoteprocessesdialog.h"
#include
"ui_maemoremoteprocessesdialog.h"
#include
"maemodeviceconfigurations.h"
#include
"maemoremoteprocesslist.h"
#include
<QtGui/QMessageBox>
...
...
@@ -49,11 +50,11 @@
namespace
Qt4ProjectManager
{
namespace
Internal
{
MaemoRemoteProcessesDialog
::
MaemoRemoteProcessesDialog
(
const
Core
::
SshConnectionParameters
&
params
,
QWidget
*
parent
)
:
MaemoRemoteProcessesDialog
::
MaemoRemoteProcessesDialog
(
const
MaemoDeviceConfig
::
ConstPtr
&
devConfig
,
QWidget
*
parent
)
:
QDialog
(
parent
),
m_ui
(
new
Ui
::
MaemoRemoteProcessesDialog
),
m_processList
(
new
MaemoRemoteProcessList
(
params
,
this
)),
m_processList
(
new
MaemoRemoteProcessList
(
devConfig
,
this
)),
m_proxyModel
(
new
QSortFilterProxyModel
(
this
))
{
m_ui
->
setupUi
(
this
);
...
...
@@ -64,7 +65,12 @@ MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const Core::SshConnection
m_ui
->
tableView
->
setModel
(
m_proxyModel
);
connect
(
m_ui
->
processFilterLineEdit
,
SIGNAL
(
textChanged
(
QString
)),
m_proxyModel
,
SLOT
(
setFilterRegExp
(
QString
)));
m_ui
->
processFilterLineEdit
->
setText
(
QLatin1String
(
"[^ ]+"
));
// Manually gathered process information is missing the command line for
// some system processes. Dont's show these lines by default.
if
(
devConfig
->
osVersion
()
==
MaemoGlobal
::
Maemo5
)
m_ui
->
processFilterLineEdit
->
setText
(
QLatin1String
(
"[^ ]+"
));
connect
(
m_ui
->
tableView
->
selectionModel
(),
SIGNAL
(
selectionChanged
(
QItemSelection
,
QItemSelection
)),
SLOT
(
handleSelectionChanged
()));
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.h
View file @
4d4ae95b
...
...
@@ -41,8 +41,8 @@
#ifndef MAEMOREMOTEPROCESSDIALOG_H
#define MAEMOREMOTEPROCESSDIALOG_H
#include
<QtCore/QSharedPointer>
#include
<QtGui/QDialog>
#include
<coreplugin/ssh/sshconnection.h>
QT_BEGIN_NAMESPACE
namespace
Ui
{
...
...
@@ -53,6 +53,7 @@ QT_END_NAMESPACE
namespace
Qt4ProjectManager
{
namespace
Internal
{
class
MaemoDeviceConfig
;
class
MaemoRemoteProcessList
;
class
MaemoRemoteProcessesDialog
:
public
QDialog
...
...
@@ -60,7 +61,7 @@ class MaemoRemoteProcessesDialog : public QDialog
Q_OBJECT
public:
explicit
MaemoRemoteProcessesDialog
(
const
Core
::
SshConnectionParameters
&
params
,
explicit
MaemoRemoteProcessesDialog
(
const
QSharedPointer
<
const
MaemoDeviceConfig
>
&
devConfig
,
QWidget
*
parent
=
0
);
~
MaemoRemoteProcessesDialog
();
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocesslist.cpp
View file @
4d4ae95b
...
...
@@ -41,6 +41,8 @@
#include
"maemoremoteprocesslist.h"
#include
"maemodeviceconfigurations.h"
#include
<coreplugin/ssh/sshremoteprocessrunner.h>
#include
<QtCore/QStringList>
...
...
@@ -55,11 +57,12 @@ const QByteArray LineSeparator2("QTCENDOFLINE---");
const
QByteArray
LineSeparator
=
LineSeparator1
+
LineSeparator2
;
}
// anonymous namespace
MaemoRemoteProcessList
::
MaemoRemoteProcessList
(
const
Core
::
SshConnectionParameters
&
params
,
MaemoRemoteProcessList
::
MaemoRemoteProcessList
(
const
MaemoDeviceConfig
::
ConstPtr
&
devConfig
,
QObject
*
parent
)
:
QAbstractTableModel
(
parent
),
m_process
(
SshRemoteProcessRunner
::
create
(
params
)),
m_state
(
Inactive
)
:
QAbstractTableModel
(
parent
),
m_process
(
SshRemoteProcessRunner
::
create
(
devConfig
->
sshParameters
())),
m_state
(
Inactive
),
m_devConfig
(
devConfig
)
{
}
...
...
@@ -73,17 +76,25 @@ void MaemoRemoteProcessList::update()
}
beginResetModel
();
m_remoteProcs
.
clear
();
const
QByteArray
command
=
QByteArray
()
+
"sep1="
+
LineSeparator1
+
'\n'
+
"sep2="
+
LineSeparator2
+
'\n'
+
"pidlist=`ls /proc |grep -E '^[[:digit:]]+$' |sort -n`; "
+
"for pid in $pidlist
\n
"
+
"do
\n
"
+
" echo -n
\"
$pid
\"\n
"
+
" tr '
\\
0' ' ' < /proc/$pid/cmdline
\n
"
+
" echo -n
\"
$sep1$sep2
\"\n
"
+
"done
\n
"
+
"echo ''"
;
QByteArray
command
;
// The ps command on Fremantle ignores all command line options, so
// we have to collect the information in /proc manually.
if
(
m_devConfig
->
osVersion
()
==
MaemoGlobal
::
Maemo5
)
{
command
=
"sep1="
+
LineSeparator1
+
'\n'
+
"sep2="
+
LineSeparator2
+
'\n'
+
"pidlist=`ls /proc |grep -E '^[[:digit:]]+$' |sort -n`; "
+
"for pid in $pidlist
\n
"
+
"do
\n
"
+
" echo -n
\"
$pid
\"\n
"
+
" tr '
\\
0' ' ' < /proc/$pid/cmdline
\n
"
+
" echo -n
\"
$sep1$sep2
\"\n
"
+
"done
\n
"
+
"echo ''"
;
}
else
{
command
=
"ps -eo pid,args"
;
}
startProcess
(
command
,
Listing
);
}
...
...
@@ -191,21 +202,25 @@ void MaemoRemoteProcessList::stop()
void
MaemoRemoteProcessList
::
buildProcessList
()
{
const
bool
isFremantle
=
m_devConfig
->
osVersion
()
==
MaemoGlobal
::
Maemo5
;
const
QString
remoteOutput
=
QString
::
fromUtf8
(
m_remoteStdout
);
const
QStringList
&
lines
=
remoteOutput
.
split
(
QString
::
fromUtf8
(
LineSeparator
));
const
QByteArray
lineSeparator
=
isFremantle
?
LineSeparator
:
"
\n
"
;
QStringList
lines
=
remoteOutput
.
split
(
QString
::
fromUtf8
(
lineSeparator
));
if
(
!
isFremantle
)
lines
.
removeFirst
();
// column headers
foreach
(
const
QString
&
line
,
lines
)
{
const
int
pidEndPos
=
line
.
indexOf
(
' '
);
const
QString
&
trimmedLine
=
line
.
trimmed
();
const
int
pidEndPos
=
trimmedLine
.
indexOf
(
' '
);
if
(
pidEndPos
==
-
1
)
continue
;
bool
isNumber
;
const
int
pid
=
l
ine
.
left
(
pidEndPos
).
toInt
(
&
isNumber
);
const
int
pid
=
trimmedL
ine
.
left
(
pidEndPos
).
toInt
(
&
isNumber
);
if
(
!
isNumber
)
{
qDebug
(
"%s: Non-integer value where pid was expected. Line was: '%s'"
,
Q_FUNC_INFO
,
qPrintable
(
l
ine
));
Q_FUNC_INFO
,
qPrintable
(
trimmedL
ine
));
continue
;
}
m_remoteProcs
<<
RemoteProc
(
pid
,
l
ine
.
mid
(
pidEndPos
));
m_remoteProcs
<<
RemoteProc
(
pid
,
trimmedL
ine
.
mid
(
pidEndPos
));
}
}
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocesslist.h
View file @
4d4ae95b
...
...
@@ -47,17 +47,17 @@
#include
<QtCore/QList>
#include
<QtCore/QSharedPointer>
#include
<QtCore/QString>
#include
<coreplugin/ssh/sshconnection.h>
#include
<coreplugin/ssh/sshremoteprocessrunner.h>
namespace
Qt4ProjectManager
{
namespace
Internal
{
class
MaemoDeviceConfig
;
class
MaemoRemoteProcessList
:
public
QAbstractTableModel
{
Q_OBJECT
public:
explicit
MaemoRemoteProcessList
(
const
Core
::
SshConnectionParameters
&
params
,
explicit
MaemoRemoteProcessList
(
const
QSharedPointer
<
const
MaemoDeviceConfig
>
&
devConfig
,
QObject
*
parent
=
0
);
~
MaemoRemoteProcessList
();
void
update
();
...
...
@@ -100,6 +100,7 @@ private:
QString
cmdLine
;
};
QList
<
RemoteProc
>
m_remoteProcs
;
const
QSharedPointer
<
const
MaemoDeviceConfig
>
m_devConfig
;
};
}
// namespace Internal
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment