File indexing completed on 2024-05-05 04:55:40
0001 /** 0002 * \file dummysettings.h 0003 * Application settings stub for tests. 0004 * 0005 * \b Project: Kid3 0006 * \author Urs Fleisch 0007 * \date 03 Jun 2013 0008 * 0009 * Copyright (C) 2013-2024 Urs Fleisch 0010 * 0011 * This file is part of Kid3. 0012 * 0013 * Kid3 is free software; you can redistribute it and/or modify 0014 * it under the terms of the GNU General Public License as published by 0015 * the Free Software Foundation; either version 2 of the License, or 0016 * (at your option) any later version. 0017 * 0018 * Kid3 is distributed in the hope that it will be useful, 0019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0021 * GNU General Public License for more details. 0022 * 0023 * You should have received a copy of the GNU General Public License 0024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0025 */ 0026 0027 #pragma once 0028 0029 #include "isettings.h" 0030 0031 class QString; 0032 0033 /** 0034 * Application settings stub for tests. 0035 */ 0036 class DummySettings : public ISettings { 0037 public: 0038 /** 0039 * Constructor. 0040 */ 0041 DummySettings(); 0042 0043 /** 0044 * Destructor. 0045 */ 0046 ~DummySettings() override = default; 0047 0048 DummySettings(const DummySettings& other) = delete; 0049 DummySettings &operator=(const DummySettings& other) = delete; 0050 0051 /** 0052 * Use settings subgroup. 0053 * @param prefix group name 0054 * @param forState true if this group stores state information 0055 */ 0056 void beginGroup(const QString& prefix, bool forState = false) override; 0057 0058 /** 0059 * Finnish using settings subgroup. 0060 */ 0061 void endGroup() override; 0062 0063 /** 0064 * Set value for setting. 0065 * @param key name of setting 0066 * @param value value for setting 0067 */ 0068 void setValue(const QString& key, const QVariant& value) override; 0069 0070 /** 0071 * Get value for setting. 0072 * @param key name of setting 0073 * @param defaultValue default value 0074 * @return value of setting as variant. 0075 */ 0076 QVariant value(const QString& key, 0077 const QVariant& defaultValue) const override; 0078 0079 /** 0080 * Remove setting. 0081 * @param key name of setting 0082 */ 0083 void remove(const QString& key) override; 0084 0085 /** 0086 * Check if setting exists. 0087 * @param key name of setting 0088 * @return true if setting exists. 0089 */ 0090 bool contains(const QString& key) const override; 0091 0092 /** 0093 * Write unsaved changes to permanent storage. 0094 */ 0095 void sync() override; 0096 };