AntiMicroX
antimicrosettings.h
Go to the documentation of this file.
1 /* antimicrox Gamepad to KB+M event mapper
2  * Copyright (C) 2015 Travis Nickles <nickles.travis@gmail.com>
3  * Copyright (C) 2020 Jagoda Górska <juliagoda.pl@protonmail>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14 
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef ANTIMICROSETTINGS_H
20 #define ANTIMICROSETTINGS_H
21 
22 #include "commandlineutility.h"
23 
24 #include <QSettings>
25 
26 class AntiMicroSettings : public QSettings
27 {
28  Q_OBJECT
29 
30  public:
31  explicit AntiMicroSettings(const QString &fileName, Format format, QObject *parent = nullptr);
32 
33  QVariant runtimeValue(const QString &key, const QVariant &defaultValue = QVariant()) const;
34  void importFromCommandLine(CommandLineUtility &cmdutility);
35  QMutex *getLock();
36  QSettings &getCmdSettings();
37 
38  static const bool defaultDisabledWinEnhanced;
39 
40  void applySettingsToLogger(CommandLineUtility &cmdutility, Logger *logger = nullptr);
41 
42  protected:
43  QSettings cmdSettings;
44  QMutex lock;
45 };
46 
47 #endif // ANTIMICROSETTINGS_H
CommandLineUtility
Definition: commandlineutility.h:81
Logger::getInstance
static Logger * getInstance(bool raiseExceptionForNull=true)
Get the Instance of logger.
Definition: logger.h:94
Logger::setLogLevel
static void setLogLevel(LogLevel level)
Set the highest logging level. Determines which messages are output to the output stream.
Definition: logger.cpp:76
CommandLineUtility::isLaunchInTrayEnabled
bool isLaunchInTrayEnabled()
Definition: commandlineutility.cpp:373
AntiMicroSettings::applySettingsToLogger
void applySettingsToLogger(CommandLineUtility &cmdutility, Logger *logger=nullptr)
applies settings from command line to logger
Definition: antimicrosettings.cpp:73
AntiMicroSettings::importFromCommandLine
void importFromCommandLine(CommandLineUtility &cmdutility)
Import relevant options given on the command line into a QSettings instance. Used to override any opt...
Definition: antimicrosettings.cpp:58
AntiMicroSettings::getLock
QMutex * getLock()
Definition: antimicrosettings.cpp:95
AntiMicroSettings
Definition: antimicrosettings.h:26
AntiMicroSettings::getCmdSettings
QSettings & getCmdSettings()
Definition: antimicrosettings.cpp:97
CommandLineUtility::getCurrentLogFile
QString getCurrentLogFile()
Definition: commandlineutility.cpp:405
Logger::LogLevel
LogLevel
Definition: logger.h:63
AntiMicroSettings::defaultDisabledWinEnhanced
static const bool defaultDisabledWinEnhanced
Definition: antimicrosettings.h:38
CommandLineUtility::getCurrentLogLevel
Logger::LogLevel getCurrentLogLevel()
Definition: commandlineutility.cpp:403
AntiMicroSettings::lock
QMutex lock
Definition: antimicrosettings.h:44
Logger
Custom singleton class used for logging across application.
Definition: logger.h:57
AntiMicroSettings::runtimeValue
QVariant runtimeValue(const QString &key, const QVariant &defaultValue=QVariant()) const
Get the currently used value such as an setting overridden with a command line argument.
Definition: antimicrosettings.cpp:37
AntiMicroSettings::cmdSettings
QSettings cmdSettings
Definition: antimicrosettings.h:43
commandlineutility.h
Logger::LOG_NONE
@ LOG_NONE
Definition: logger.h:65
antimicrosettings.h
AntiMicroSettings::AntiMicroSettings
AntiMicroSettings(const QString &fileName, Format format, QObject *parent=nullptr)
Definition: antimicrosettings.cpp:25
Logger::setCurrentLogFile
static void setCurrentLogFile(QString filename)
Definition: logger.cpp:172