Merge lp:~mandel/ubuntu-download-manager/remove-process-pimpl into lp:ubuntu-download-manager

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 173
Merged at revision: 194
Proposed branch: lp:~mandel/ubuntu-download-manager/remove-process-pimpl
Merge into: lp:ubuntu-download-manager
Diff against target: 147 lines (+22/-69)
2 files modified
libubuntudownloadmanager/system/process.cpp (+19/-63)
libubuntudownloadmanager/system/process.h (+3/-6)
To merge this branch: bzr merge lp:~mandel/ubuntu-download-manager/remove-process-pimpl
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Diego Sarmentero (community) Approve
Review via email: mp+195207@code.launchpad.net

Commit message

Remove pimpl pattern from the Process class.

Description of the change

Remove pimpl pattern from the Process class.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Manuel de la Peña (mandel) wrote :

Re-approve because it is an error from Jenkins.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Manuel de la Peña (mandel) wrote :

Re-approve because is an issue with Jenkins.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
173. By Manuel de la Peña

Fixed merge issues.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libubuntudownloadmanager/system/process.cpp'
2--- libubuntudownloadmanager/system/process.cpp 2013-11-12 11:27:26 +0000
3+++ libubuntudownloadmanager/system/process.cpp 2013-11-19 10:35:46 +0000
4@@ -26,93 +26,49 @@
5
6 namespace System {
7
8-/*
9- * PRIVATE IMPLEMENTATION
10- */
11-
12-class ProcessPrivate {
13- Q_DECLARE_PUBLIC(Process)
14-
15- public:
16- explicit ProcessPrivate(Process* parent);
17- ~ProcessPrivate();
18-
19- void start(const QString& program,
20- const QStringList& arguments,
21- QProcess::OpenMode mode = QProcess::ReadWrite);
22-
23- void onReadyReadStandardError();
24- void onReadyReadStandardOutput();
25-
26- private:
27- QProcess* _process;
28- Process* q_ptr;
29-};
30-
31-ProcessPrivate::ProcessPrivate(Process* parent)
32- : q_ptr(parent) {
33- Q_Q(Process);
34- _process = new QProcess();
35+
36+Process::Process(QObject* parent)
37+ : QObject(parent) {
38+ _process = new QProcess(this);
39 _process->setProcessChannelMode(QProcess::SeparateChannels);
40
41 // connect so that we foward the signals
42- q->connect(_process, SIGNAL(finished(int, QProcess::ExitStatus)),
43- q, SIGNAL(finished(int, QProcess::ExitStatus)));
44- q->connect(_process, SIGNAL(error(QProcess::ProcessError)),
45- q, SIGNAL(error(QProcess::ProcessError)));
46+ connect(_process, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>
47+ (&QProcess::finished),
48+ this, &Process::finished);
49+ connect(_process, static_cast<void(QProcess::*)(QProcess::ProcessError)>
50+ (&QProcess::error),
51+ this, &Process::error);
52
53 // connect so that we can log the stdout and stderr of the process
54- q->connect(_process, SIGNAL(readyReadStandardError()),
55- q, SLOT(onReadyReadStandardError()));
56- q->connect(_process, SIGNAL(readyReadStandardOutput()),
57- q, SLOT(onReadyReadStandardOutput()));
58-}
59-
60-ProcessPrivate::~ProcessPrivate() {
61- delete _process;
62+ connect(_process, &QProcess::readyReadStandardError,
63+ this, &Process::onReadyReadStandardError);
64+ connect(_process, &QProcess::readyReadStandardOutput,
65+ this, &Process::onReadyReadStandardOutput);
66 }
67
68 void
69-ProcessPrivate::start(const QString& program,
70- const QStringList& arguments,
71- QProcess::OpenMode mode) {
72+Process::start(const QString& program,
73+ const QStringList& arguments,
74+ QProcess::OpenMode mode) {
75 qDebug() << __FUNCTION__ << program << arguments << mode;
76 _process->start(program, arguments, mode);
77 }
78
79 void
80-ProcessPrivate::onReadyReadStandardError() {
81+Process::onReadyReadStandardError() {
82 // use qCritical this is important stuff
83 qCritical() << QString(_process->readAllStandardError());
84 }
85
86 void
87-ProcessPrivate::onReadyReadStandardOutput() {
88+Process::onReadyReadStandardOutput() {
89 // use qDebug
90 qDebug() << QString(_process->readAllStandardOutput());
91 }
92
93-/*
94- * PUBLIC IMPLEMENTATION
95- */
96-
97-Process::Process(QObject *parent)
98- : QObject(parent),
99- d_ptr(new ProcessPrivate(this)) {
100-}
101-
102-void
103-Process::start(const QString& program,
104- const QStringList& arguments,
105- QProcess::OpenMode mode) {
106- Q_D(Process);
107- d->start(program, arguments, mode);
108-}
109-
110 } // System
111
112 } // DownloadManager
113
114 } // Ubuntu
115-
116-#include "moc_process.cpp"
117
118=== modified file 'libubuntudownloadmanager/system/process.h'
119--- libubuntudownloadmanager/system/process.h 2013-10-29 13:42:44 +0000
120+++ libubuntudownloadmanager/system/process.h 2013-11-19 10:35:46 +0000
121@@ -28,10 +28,8 @@
122
123 namespace System {
124
125-class ProcessPrivate;
126 class Process : public QObject {
127 Q_OBJECT
128- Q_DECLARE_PRIVATE(Process)
129
130 public:
131 explicit Process(QObject *parent = 0);
132@@ -45,12 +43,11 @@
133 void finished(int exitCode, QProcess::ExitStatus exitStatus);
134
135 private:
136- Q_PRIVATE_SLOT(d_func(), void onReadyReadStandardError())
137- Q_PRIVATE_SLOT(d_func(), void onReadyReadStandardOutput())
138+ void onReadyReadStandardError();
139+ void onReadyReadStandardOutput();
140
141 private:
142- // use pimpl so that we can mantains ABI compatibility
143- ProcessPrivate* d_ptr;
144+ QProcess* _process;
145 };
146
147 } // System

Subscribers

People subscribed via source and target branches