File indexing completed on 2024-04-28 15:28:58

0001 /*
0002     This file is part of KNewStuffCore.
0003     SPDX-FileCopyrightText: 2016 Dan Leinir Turthra Jensen <admin@leinir.dk>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-or-later
0006 */
0007 
0008 #include "questionmanager.h"
0009 
0010 using namespace KNSCore;
0011 
0012 class QuestionManagerHelper
0013 {
0014 public:
0015     QuestionManagerHelper()
0016         : q(nullptr)
0017     {
0018     }
0019     ~QuestionManagerHelper()
0020     {
0021         delete q;
0022     }
0023     QuestionManagerHelper(const QuestionManagerHelper &) = delete;
0024     QuestionManagerHelper &operator=(const QuestionManagerHelper &) = delete;
0025     QuestionManager *q;
0026 };
0027 Q_GLOBAL_STATIC(QuestionManagerHelper, s_kns3_questionManager)
0028 
0029 class KNSCore::QuestionManagerPrivate
0030 {
0031 public:
0032     QuestionManagerPrivate() = default;
0033 };
0034 
0035 QuestionManager *QuestionManager::instance()
0036 {
0037     if (!s_kns3_questionManager()->q) {
0038         new QuestionManager;
0039     }
0040     return s_kns3_questionManager()->q;
0041 }
0042 
0043 QuestionManager::QuestionManager()
0044     : QObject(nullptr)
0045     , d(new QuestionManagerPrivate)
0046 {
0047     s_kns3_questionManager()->q = this;
0048 }
0049 
0050 QuestionManager::~QuestionManager() = default;
0051 
0052 #include "moc_questionmanager.cpp"