File indexing completed on 2024-11-10 05:11:09
0001 /* 0002 * Copyright 2018 by Aditya Mehra <aix.m@outlook.com> 0003 * 0004 * Licensed under the Apache License, Version 2.0 (the "License"); 0005 * you may not use this file except in compliance with the License. 0006 * You may obtain a copy of the License at 0007 * 0008 * http://www.apache.org/licenses/LICENSE-2.0 0009 * 0010 * Unless required by applicable law or agreed to in writing, software 0011 * distributed under the License is distributed on an "AS IS" BASIS, 0012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0013 * See the License for the specific language governing permissions and 0014 * limitations under the License. 0015 * 0016 */ 0017 0018 #include <QDebug> 0019 #include <QFile> 0020 #include "globalsettings.h" 0021 #include "controllerconfig.h" 0022 0023 GlobalSettings::GlobalSettings(QObject *parent) : 0024 QObject(parent) 0025 { 0026 } 0027 0028 bool GlobalSettings::autoConnect() const 0029 { 0030 return m_settings.value(QStringLiteral("autoConnect"), true).toBool(); 0031 } 0032 0033 void GlobalSettings::setAutoConnect(bool autoConnect) 0034 { 0035 if (GlobalSettings::autoConnect() == autoConnect) { 0036 return; 0037 } 0038 0039 m_settings.setValue(QStringLiteral("autoConnect"), autoConnect); 0040 emit autoConnectChanged(); 0041 } 0042 0043 bool GlobalSettings::usesRemoteTTS() const 0044 { 0045 return m_settings.value(QStringLiteral("usesRemoteTTS"), false).toBool(); 0046 } 0047 0048 void GlobalSettings::setUsesRemoteTTS(bool usesRemoteTTS) 0049 { 0050 if (GlobalSettings::usesRemoteTTS() == usesRemoteTTS) { 0051 return; 0052 } 0053 0054 m_settings.setValue(QStringLiteral("usesRemoteTTS"), usesRemoteTTS); 0055 emit usesRemoteTTSChanged(); 0056 } 0057 0058 bool GlobalSettings::displayRemoteConfig() const 0059 { 0060 #ifndef Q_OS_ANDROID 0061 return m_settings.value(QStringLiteral("displayRemoteConfig"), true).toBool(); 0062 #else 0063 return m_settings.value(QStringLiteral("displayRemoteConfig"), false).toBool(); 0064 #endif 0065 } 0066 0067 void GlobalSettings::setDisplayRemoteConfig(bool displayRemoteConfig) 0068 { 0069 if (GlobalSettings::displayRemoteConfig() == displayRemoteConfig) { 0070 return; 0071 } 0072 0073 m_settings.setValue(QStringLiteral("displayRemoteConfig"), displayRemoteConfig); 0074 emit displayRemoteConfigChanged(); 0075 } 0076 0077 bool GlobalSettings::usePTTClient() const 0078 { 0079 return m_settings.value(QStringLiteral("usePTTClient"), false).toBool(); 0080 } 0081 0082 void GlobalSettings::setUsePTTClient(bool usePTTClient) 0083 { 0084 if (GlobalSettings::usePTTClient() == usePTTClient) { 0085 return; 0086 } 0087 0088 m_settings.setValue(QStringLiteral("usePTTClient"), usePTTClient); 0089 emit usePTTClientChanged(); 0090 } 0091 0092 bool GlobalSettings::useHivemindProtocol() const 0093 { 0094 return m_settings.value(QStringLiteral("useHivemindProtocol"), false).toBool(); 0095 } 0096 0097 void GlobalSettings::setUseHivemindProtocol(bool useHivemindProtocol) 0098 { 0099 if (GlobalSettings::useHivemindProtocol() == useHivemindProtocol) { 0100 return; 0101 } 0102 0103 m_settings.setValue(QStringLiteral("useHivemindProtocol"), useHivemindProtocol); 0104 emit useHivemindProtocolChanged(); 0105 } 0106 0107 bool GlobalSettings::useEntryNameSpaceAnimation() const 0108 { 0109 return m_settings.value(QStringLiteral("useEntryNameSpaceAnimation"), true).toBool(); 0110 } 0111 0112 void GlobalSettings::setUseEntryNameSpaceAnimation(bool useEntryNameSpaceAnimation) 0113 { 0114 if (GlobalSettings::useEntryNameSpaceAnimation() == useEntryNameSpaceAnimation) { 0115 return; 0116 } 0117 0118 m_settings.setValue(QStringLiteral("useEntryNameSpaceAnimation"), useEntryNameSpaceAnimation); 0119 emit useEntryNameSpaceAnimationChanged(); 0120 } 0121 0122 bool GlobalSettings::useExitNameSpaceAnimation() const 0123 { 0124 return m_settings.value(QStringLiteral("useExitNameSpaceAnimation"), true).toBool(); 0125 } 0126 0127 void GlobalSettings::setUseExitNameSpaceAnimation(bool useExitNameSpaceAnimation) 0128 { 0129 if (GlobalSettings::useExitNameSpaceAnimation() == useExitNameSpaceAnimation) { 0130 return; 0131 } 0132 0133 m_settings.setValue(QStringLiteral("useExitNameSpaceAnimation"), useExitNameSpaceAnimation); 0134 emit useExitNameSpaceAnimationChanged(); 0135 } 0136 0137 bool GlobalSettings::useFocusAnimation() const 0138 { 0139 return m_settings.value(QStringLiteral("useFocusAnimation"), true).toBool(); 0140 } 0141 0142 void GlobalSettings::setUseFocusAnimation(bool useFocusAnimation) 0143 { 0144 if (GlobalSettings::useFocusAnimation() == useFocusAnimation) { 0145 return; 0146 } 0147 0148 m_settings.setValue(QStringLiteral("useFocusAnimation"), useFocusAnimation); 0149 emit useFocusAnimationChanged(); 0150 } 0151 0152 bool GlobalSettings::useDelegateAnimation() const 0153 { 0154 return m_settings.value(QStringLiteral("useDelegateAnimation"), true).toBool(); 0155 } 0156 0157 void GlobalSettings::setUseDelegateAnimation(bool useDelegateAnimation) 0158 { 0159 if (GlobalSettings::useDelegateAnimation() == useDelegateAnimation) { 0160 return; 0161 } 0162 0163 m_settings.setValue(QStringLiteral("useDelegateAnimation"), useDelegateAnimation); 0164 emit useDelegateAnimationChanged(); 0165 }