File indexing completed on 2024-12-22 05:17:14

0001 /*
0002  * This file is part of the KDE wacomtablet project. For copyright
0003  * information and license terms see the AUTHORS and COPYING files
0004  * in the top-level directory of this distribution.
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU General Public License as
0008  * published by the Free Software Foundation; either version 2 of
0009  * the License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License
0017  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef DEVICEPROFILECONFIGADAPTOR_H
0021 #define DEVICEPROFILECONFIGADAPTOR_H
0022 
0023 #include "configadaptor.h"
0024 #include "deviceprofile.h"
0025 
0026 #include <KConfigGroup>
0027 
0028 namespace Wacom
0029 {
0030 
0031 /**
0032  * A configuration adapter which can read and write device profiles.
0033  */
0034 class DeviceProfileConfigAdaptor : public ConfigAdaptor
0035 {
0036 public:
0037     /**
0038      * Default constructor
0039      */
0040     explicit DeviceProfileConfigAdaptor(DeviceProfile &profile);
0041 
0042     /**
0043      * Default destructor
0044      */
0045     ~DeviceProfileConfigAdaptor() override;
0046 
0047     /**
0048      * Loads the device configuration from the given config group and sets
0049      * it on the managed device profile. The name of the device profile
0050      * will not be changed nor will the old properties be cleared before
0051      * setting the new ones.
0052      *
0053      * @param config The config group to read from.
0054      *
0055      * @return True on success, false on error.
0056      */
0057     bool loadConfig(const KConfigGroup &config) override;
0058 
0059     /**
0060      * Saves the device configuration of the currently managed device profile
0061      * to the given config group. The name of the config group will not be
0062      * changed and it will not be cleared before setting the new values.
0063      *
0064      * @param config The config group to write to.
0065      *
0066      * @return True on success, false on error.
0067      */
0068     bool saveConfig(KConfigGroup &config) const override;
0069 };
0070 
0071 }
0072 #endif // HEADER PROTECTION