Bug 948389 - Replace mozilla-banner.gif with a plain blue image in 405577-1.html...
[gecko.git] / toolkit / xre / nsQAppInstance.cpp
blob4be12c96158e33ded28155c2d6201a6d88862fce
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsQAppInstance.h"
8 #include <QApplication>
9 #ifdef MOZ_ENABLE_MEEGOTOUCH
10 #include <MComponentData>
11 #include <MApplicationService>
12 #endif
13 #include "prenv.h"
14 #include <stdlib.h>
16 QApplication *nsQAppInstance::sQAppInstance = nullptr;
17 #ifdef MOZ_ENABLE_MEEGOTOUCH
18 MComponentData* nsQAppInstance::sMComponentData = nullptr;
19 #endif
20 int nsQAppInstance::sQAppRefCount = 0;
22 void nsQAppInstance::AddRef(int& aArgc, char** aArgv, bool aDefaultProcess) {
23 if (qApp)
24 return;
25 if (!sQAppInstance) {
26 #if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
27 const char *graphicsSystem = getenv("MOZ_QT_GRAPHICSSYSTEM");
28 if (graphicsSystem) {
29 QApplication::setGraphicsSystem(QString(graphicsSystem));
31 #endif
32 sQAppInstance = new QApplication(aArgc, aArgv);
34 sQAppRefCount++;
37 void nsQAppInstance::Release(void) {
38 if (sQAppInstance && !--sQAppRefCount) {
39 #ifdef MOZ_ENABLE_MEEGOTOUCH
40 delete sMComponentData;
41 sMComponentData = nullptr;
42 #endif
43 delete sQAppInstance;
44 sQAppInstance = nullptr;