| 1 | /***************************************************************************** |
| 2 | ** QNapi |
| 3 | ** Copyright (C) 2008-2017 Piotr KrzemiĆski <[email protected]> |
| 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 2 of the License, or |
| 8 | ** (at your option) any later version. |
| 9 | ** |
| 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 12 | ** |
| 13 | *****************************************************************************/ |
| 14 | |
| 15 | #ifndef CONFIGWRITER_H |
| 16 | #define CONFIGWRITER_H |
| 17 | |
| 18 | #include <QMap> |
| 19 | #include <QSettings> |
| 20 | #include <QString> |
| 21 | |
| 22 | #include <config/engineconfig.h> |
| 23 | #include <config/qnapiconfig.h> |
| 24 | |
| 25 | class ConfigWriter { |
| 26 | public: |
| 27 | ConfigWriter(const QString& qnapiVersion); |
| 28 | |
| 29 | void writeUserConfig(const QNapiConfig& config) const; |
| 30 | void writePortableConfig(const QString& configFilePath, |
| 31 | const QNapiConfig& config) const; |
| 32 | void writeConfig(const QNapiConfig& config, QSettings& settings) const; |
| 33 | |
| 34 | private: |
| 35 | void writeGeneralConfig(const GeneralConfig& generalConfig, |
| 36 | QSettings& settings) const; |
| 37 | void writeEnabledEngines(const QList<QPair<QString, bool>>& enabledEngines, |
| 38 | QSettings& settings) const; |
| 39 | void writeEnginesConfig(const QMap<QString, EngineConfig>& enginesConfig, |
| 40 | QSettings& settings) const; |
| 41 | void writeEngineConfig(QString engineName, const EngineConfig& engineConfig, |
| 42 | QSettings& settings) const; |
| 43 | void writePostProcessingConfig( |
| 44 | const PostProcessingConfig& postProcessingConfig, |
| 45 | QSettings& settings) const; |
| 46 | void writeScanConfig(const ScanConfig& scanConfig, QSettings& settings) const; |
| 47 | |
| 48 | QString qnapiVersion; |
| 49 | }; |
| 50 | |
| 51 | #endif // CONFIGWRITER_H |