File indexing completed on 2024-05-12 05:35:40

0001 /*
0002     SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
0003     SPDX-FileCopyrightText: 2023 Jeremy Whiting <jpwhiting@kde.org>
0004     SPDX-FileCopyrightText: 2023 Niccolò Venerandi <niccolo@venerandi.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #include "kcm.h"
0010 
0011 #include <KPluginFactory>
0012 #include <SDL.h>
0013 
0014 #include "axesmodel.h"
0015 #include "buttonmodel.h"
0016 #include "devicemodel.h"
0017 
0018 K_PLUGIN_CLASS_WITH_JSON(KCMGameController, "kcm_gamecontroller.json")
0019 
0020 KCMGameController::KCMGameController(QObject *parent, const KPluginMetaData &metaData)
0021     : KQuickManagedConfigModule(parent, metaData)
0022 {
0023     SDL_Init(SDL_INIT_GAMECONTROLLER);
0024 
0025     setButtons(Help);
0026 
0027     constexpr const char *uri{"org.kde.plasma.gamecontroller.kcm"};
0028 
0029     qmlRegisterType<DeviceModel>(uri, 1, 0, "DeviceModel");
0030     qmlRegisterType<AxesModel>(uri, 1, 0, "AxesModel");
0031     qmlRegisterType<ButtonModel>(uri, 1, 0, "ButtonModel");
0032 }
0033 
0034 KCMGameController::~KCMGameController()
0035 {
0036     SDL_Quit();
0037 }
0038 
0039 #include "kcm.moc"