Debian Codegraph @

gui/src/qcumber/qsingleapplication.cpp

raw symbols SCIP
1 /****************************************************************************
2 **
3 ** Copyright (C) 2006-2008 fullmetalcoder <[email protected]>
4 **
5 ** This file is part of the Edyuk project <http://edyuk.org>
6 **
7 ** This file may be used under the terms of the GNU General Public License
8 ** version 2 as published by the Free Software Foundation and appearing in the
9 ** file GPL.txt included in the packaging of this file.
10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 **
14 ****************************************************************************/
15
16 #include "qsingleapplication.h"cxx . . $ `<file>/gui/src/qcumber/qsingleapplication.h`/
17
18 #include "qinterprocesschannel.h"cxx . . $ `<file>/gui/src/qcumber/qinterprocesschannel.h`/
19 #include "qmanagedrequest.h"cxx . . $ `<file>/gui/src/qcumber/qmanagedrequest.h`/
20
21 #include <QStringList>
22
23 /*!
24 \brief Constructor
25 */
26 QSingleApplicationcxx . . $ QSingleApplication#::QSingleApplicationcxx . . $ QSingleApplication#QSingleApplication(75dd2bf67067255f).(int& argc, char** argv, bool useGui,
27 const QStringcxx . . $ QString#& appName)
28 : QApplicationcxx . . $ QApplication#QApplication(6e9b1c7df49e191d).(argc, argv, useGui) {
29 setApplicationNamecxx . . $ QCoreApplication#setApplicationName(3520e46b33348bf6).(appName);
30
31 pChannelcxx . . $ QSingleApplication#pChannel. = new QInterProcessChannelcxx . . $ QInterProcessChannel#QInterProcessChannel(749de1b6ae65bddd).(this);
32
33 connectcxx . . $ QObject#connect(158df1d9a01a3410).(pChannelcxx . . $ QSingleApplication#pChannel., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(message(QString)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(message(QString)));
34
35 connectcxx . . $ QObject#connect(158df1d9a01a3410).(pChannelcxx . . $ QSingleApplication#pChannel., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(request(QStringList)), this,
36 SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(request(QStringList)));
37
38 setMessagingPolicycxx . . $ QSingleApplication#setMessagingPolicy(6cf37042f7b77ecb).(Signalscxx . . $ QSingleApplication#Signals.);
39 setInstanciationPolicycxx . . $ QSingleApplication#setInstanciationPolicy(8bc40f5d94cff0bf).(Nonecxx . . $ QSingleApplication#None.);
40 }
41
42 /*!
43 \brief Destructor
44 */
45 QSingleApplicationcxx . . $ QSingleApplication#::~cxx . . $ QSingleApplication#`~QSingleApplication`(49f6e7a06ebc5aa8).QSingleApplicationcxx . . $ QSingleApplication#() { pChannelcxx . . $ QSingleApplication#pChannel.->closecxx . . $ QInterProcessChannel#close(49f6e7a06ebc5aa8).(); }
46
47 /*!
48 \return Wheter the creation of an instance is allowed.
49 */
50 bool QSingleApplicationcxx . . $ QSingleApplication#::isInstanceAllowedcxx . . $ QSingleApplication#isInstanceAllowed(50ce9a9e25b4a850).() const {
51 return pChannelcxx . . $ QSingleApplication#pChannel.->isServercxx . . $ QInterProcessChannel#isServer(50ce9a9e25b4a850).();
52 }
53
54 /*!
55 \return The current messaging policy
56 */
57 QSingleApplicationcxx . . $ QSingleApplication#::MessagingPolicycxx . . $ QSingleApplication#MessagingPolicy# QSingleApplicationcxx . . $ QSingleApplication#::messagingPolicycxx . . $ QSingleApplication#messagingPolicy(f8827169ed3197aa).()
58 const {
59 return m_messagingcxx . . $ QSingleApplication#m_messaging.;
60 }
61
62 /*!
63 \brief Sets the messaging policy
64
65 \see messagingPolicy()
66 */
67 void QSingleApplicationcxx . . $ QSingleApplication#::setMessagingPolicycxx . . $ QSingleApplication#setMessagingPolicy(6cf37042f7b77ecb).(MessagingPolicycxx . . $ QSingleApplication#MessagingPolicy# p) {
68 m_messagingcxx . . $ QSingleApplication#m_messaging. = p;
69 }
70
71 /*!
72 \return The current instanciation policy
73 */
74 QSingleApplicationcxx . . $ QSingleApplication#::InstanciationPolicycxx . . $ QSingleApplication#InstanciationPolicy#
75 QSingleApplicationcxx . . $ QSingleApplication#::instanciationPolicycxx . . $ QSingleApplication#instanciationPolicy(b4b68f5a20f4fdae).() const {
76 return m_instanciationcxx . . $ QSingleApplication#m_instanciation.;
77 }
78
79 /*!
80 \brief Sets the instanciation policy
81
82 \see instanciationPolicy()
83 */
84 void QSingleApplicationcxx . . $ QSingleApplication#::setInstanciationPolicycxx . . $ QSingleApplication#setInstanciationPolicy(8bc40f5d94cff0bf).(InstanciationPolicycxx . . $ QSingleApplication#InstanciationPolicy# p) {
85 m_instanciationcxx . . $ QSingleApplication#m_instanciation. = p;
86 }
87
88 /*!
89 \brief Launchs the application if allowed
90
91 \see instanciationPolicy()
92 */
93 int QSingleApplicationcxx . . $ QSingleApplication#::execcxx . . $ QSingleApplication#exec(b126dc7c1de90089).() {
94 int ret = -1;
95
96 if (isInstanceAllowedcxx . . $ QSingleApplication#isInstanceAllowed(50ce9a9e25b4a850).()) {
97 ret = QApplicationcxx . . $ QApplication#::execcxx . . $ QApplication#exec(b126dc7c1de90089).();
98
99 } else {
100 switch (instanciationPolicycxx . . $ QSingleApplication#instanciationPolicy(b4b68f5a20f4fdae).()) {
101 case ForwardArgumentscxx . . $ QSingleApplication#ForwardArguments.:
102 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("QSingleApplication : forwarding parameters");
103 sendRequestcxx . . $ QSingleApplication#sendRequest(631c0101495f0328).(argumentscxx . . $ QCoreApplication#arguments(669a05bc42dd57cc).());
104 break;
105
106 default:
107 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("QSingleApplication : all instances already occupied");
108 break;
109 }
110 }
111
112 return ret;
113 }
114
115 /*!
116 \overload
117 */
118 void QSingleApplicationcxx . . $ QSingleApplication#::sendRequestcxx . . $ QSingleApplication#sendRequest(3520e46b33348bf6).(const QStringcxx . . $ QString#& s) {
119 sendRequestcxx . . $ QSingleApplication#sendRequest(631c0101495f0328).(QStringListcxx . . $ QStringList#QStringList(3520e46b33348bf6).(s));
120 }
121
122 /*!
123 \brief sends a message to the running instance of the application
124
125 \param l A list of arguments that make up a request to be sent.
126 */
127 void QSingleApplicationcxx . . $ QSingleApplication#::sendRequestcxx . . $ QSingleApplication#sendRequest(631c0101495f0328).(const QStringListcxx . . $ QStringList#& l) {
128 if (!pChannelcxx . . $ QSingleApplication#pChannel. || l.isEmptycxx . . $ QList#isEmpty(50ce9a9e25b4a850).()) return;
129
130 /*
131 qDebug("sending message to %s:%i over TCP/IP : \"%s\"",
132 qPrintable(pManager->address().toString()),
133 pManager->port(),
134 msg.constData());
135 */
136
137 pChannelcxx . . $ QSingleApplication#pChannel.->sendMessagecxx . . $ QInterProcessChannel#sendMessage(45672f3c6961a244).(QManagedRequestcxx . . $ QManagedRequest#::joinArgumentscxx . . $ QManagedRequest#joinArguments(8efabc1b7032f324).("--request"cxx . . $ QString#QString(85c52e162fed56f9)., l));
138 }
139
140 /*!
141 \internal
142 */
143 void QSingleApplicationcxx . . $ QSingleApplication#::messagecxx . . $ QSingleApplication#message(3520e46b33348bf6).(const QStringcxx . . $ QString#& s) {
144 if (s.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) return;
145
146 switch (messagingPolicycxx . . $ QSingleApplication#messagingPolicy(f8827169ed3197aa).()) {
147 case Eventscxx . . $ QSingleApplication#Events.:
148
149 /*
150 QRequestEvent *e = new QRequestEvent(s);
151 postEvent(s);
152 */
153
154 break;
155
156 case Signalscxx . . $ QSingleApplication#Signals.:
157 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! requestcxx . . $ QSingleApplication#request(3520e46b33348bf6).(s);
158 break;
159
160 default:
161 break;
162 }
163 }
164
165 /*!
166 \internal
167 */
168 void QSingleApplicationcxx . . $ QSingleApplication#::requestcxx . . $ QSingleApplication#request(631c0101495f0328).(const QStringListcxx . . $ QStringList#& l) {
169 if (l.isEmptycxx . . $ QList#isEmpty(50ce9a9e25b4a850).()) return;
170
171 switch (messagingPolicycxx . . $ QSingleApplication#messagingPolicy(f8827169ed3197aa).()) {
172 case Eventscxx . . $ QSingleApplication#Events.:
173
174 /*
175 QRequestEvent *e = new QRequestEvent(s);
176 postEvent(s);
177 */
178
179 break;
180
181 case Signalscxx . . $ QSingleApplication#Signals.:
182 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! requestcxx . . $ QSingleApplication#request(3520e46b33348bf6).(l.joincxx . . $ QListSpecialMethods#join(5555d9024dcf93fb).(" | "cxx . . $ QString#QString(85c52e162fed56f9).));
183 break;
184
185 default:
186 break;
187 }
188 }
189
190 /*!
191 \internal
192 */
193 bool QSingleApplicationcxx . . $ QSingleApplication#::eventcxx . . $ QSingleApplication#event(f123fa2ce489f0bd).(QEventcxx . . $ QEvent#* e) { return QApplicationcxx . . $ QApplication#::eventcxx . . $ QApplication#event(f123fa2ce489f0bd).(e); }