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>
16 QApplication
*nsQAppInstance::sQAppInstance
= nullptr;
17 #ifdef MOZ_ENABLE_MEEGOTOUCH
18 MComponentData
* nsQAppInstance::sMComponentData
= nullptr;
20 int nsQAppInstance::sQAppRefCount
= 0;
22 void nsQAppInstance::AddRef(int& aArgc
, char** aArgv
, bool aDefaultProcess
) {
26 #if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
27 const char *graphicsSystem
= getenv("MOZ_QT_GRAPHICSSYSTEM");
29 QApplication::setGraphicsSystem(QString(graphicsSystem
));
32 sQAppInstance
= new QApplication(aArgc
, aArgv
);
37 void nsQAppInstance::Release(void) {
38 if (sQAppInstance
&& !--sQAppRefCount
) {
39 #ifdef MOZ_ENABLE_MEEGOTOUCH
40 delete sMComponentData
;
41 sMComponentData
= nullptr;
44 sQAppInstance
= nullptr;