MCPcopy Create free account
hub / github.com/Atarity/Lightpack / main

Function main

Software/src/main.cpp:198–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198int main(int argc, char **argv)
199{
200
201#ifdef Q_OS_MACX
202 id activity;
203 SInt32 version = 0;
204 Gestalt( gestaltSystemVersion, &version );
205 bool endActivityRequired = false;
206 if ( version >= 0x1090 ) {
207 activity = [[NSProcessInfo processInfo] beginActivityWithOptions: NSActivityLatencyCritical reason:@"Prismatik is latency-critical app"];
208 endActivityRequired = true;
209 DEBUG_LOW_LEVEL << "Latency critical activity is started";
210 }
211#endif
212
213# ifdef Q_OS_WIN
214 CreateMutex(NULL, FALSE, L"LightpackAppMutex");
215# endif
216 // Using locale codec for console output in messageHandler(..) function ( cout << qstring.toStdString() )
217 QTextCodec::setCodecForLocale(QTextCodec::codecForLocale());
218
219 QString appDirPath = getApplicationDirectoryPath(argv[0]);
220
221 LightpackApplication lightpackApp(argc, argv);
222
223 if (lightpackApp.isRunning())
224 {
225 lightpackApp.sendMessage("Application already running");
226
227 qWarning() << "Application already running";
228 exit(0);
229 }
230
231 QStringList paths = QStringList() << getApplicationDirectoryPath(argv[0]) + "/plugins";
232 lightpackApp.setLibraryPaths(paths);
233
234 openLogsFile(appDirPath);
235
236 qInstallMessageHandler(messageHandler);
237
238 lightpackApp.initializeAll(appDirPath);
239
240 Q_INIT_RESOURCE(LightpackResources);
241
242 DEBUG_LOW_LEVEL << Q_FUNC_INFO << "thread id: " << lightpackApp.thread()->currentThreadId();
243
244 qDebug() << "Start main event loop: lightpackApp.exec();";
245
246 int returnCode = lightpackApp.exec();
247
248#ifdef Q_OS_MACX
249 if (endActivityRequired)
250 [[NSProcessInfo processInfo] endActivity: activity];
251#endif
252
253 return returnCode;
254}

Callers

nothing calls this directly

Calls 5

openLogsFileFunction · 0.85
initializeAllMethod · 0.80
isRunningMethod · 0.45
sendMessageMethod · 0.45

Tested by

no test coverage detected