| 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 QNAPICONFIG_H |
| 16 | #define QNAPICONFIG_H |
| 17 | |
| 18 | #include <config/engineconfig.h> |
| 19 | #include <config/generalconfig.h> |
| 20 | #include <config/postprocessingconfig.h> |
| 21 | #include <config/scanconfig.h> |
| 22 | #include <QMap> |
| 23 | #include <QString> |
| 24 | |
| 25 | class QNapiConfig { |
| 26 | private: |
| 27 | bool firstrun_; |
| 28 | QString version_; |
| 29 | GeneralConfig generalConfig_; |
| 30 | QList<QPair<QString, bool>> enabledEngines_; |
| 31 | QMap<QString, EngineConfig> enginesConfig_; |
| 32 | PostProcessingConfig postProcessingConfig_; |
| 33 | ScanConfig scanConfig_; |
| 34 | QString lastOpenedDir_; |
| 35 | |
| 36 | public: |
| 37 | QNapiConfig(const bool& firstrun, const QString& version, |
| 38 | const GeneralConfig& generalConfig, |
| 39 | const QList<QPair<QString, bool>>& enabledEngines, |
| 40 | const QMap<QString, EngineConfig>& enginesConfig, |
| 41 | const PostProcessingConfig& postProcessingConfig, |
| 42 | const ScanConfig& scanConfig, const QString& lastOpenedDir) |
| 43 | : firstrun_(firstrun), |
| 44 | version_(version), |
| 45 | generalConfig_(generalConfig), |
| 46 | enabledEngines_(enabledEngines), |
| 47 | enginesConfig_(enginesConfig), |
| 48 | postProcessingConfig_(postProcessingConfig), |
| 49 | scanConfig_(scanConfig), |
| 50 | lastOpenedDir_(lastOpenedDir) {} |
| 51 | |
| 52 | bool firstrun() const { return firstrun_; } |
| 53 | QString version() const { return version_; } |
| 54 | GeneralConfig generalConfig() const { return generalConfig_; } |
| 55 | QList<QPair<QString, bool>> enabledEngines() const { return enabledEngines_; } |
| 56 | QMap<QString, EngineConfig> enginesConfig() const { return enginesConfig_; } |
| 57 | PostProcessingConfig postProcessingConfig() const { |
| 58 | return postProcessingConfig_; |
| 59 | } |
| 60 | ScanConfig scanConfig() const { return scanConfig_; } |
| 61 | QString lastOpenedDir() const { return lastOpenedDir_; } |
| 62 | |
| 63 | const QNapiConfig setFirstrun(const bool& firstrun) const { |
| 64 | return QNapiConfig(firstrun, version_, generalConfig_, enabledEngines_, |
| 65 | enginesConfig_, postProcessingConfig_, scanConfig_, |
| 66 | lastOpenedDir_); |
| 67 | } |
| 68 | const QNapiConfig setVersion(const QString& version) const { |
| 69 | return QNapiConfig(firstrun_, version, generalConfig_, enabledEngines_, |
| 70 | enginesConfig_, postProcessingConfig_, scanConfig_, |
| 71 | lastOpenedDir_); |
| 72 | } |
| 73 | const QNapiConfig setGeneralConfig(const GeneralConfig& generalConfig) const { |
| 74 | return QNapiConfig(firstrun_, version_, generalConfig, enabledEngines_, |
| 75 | enginesConfig_, postProcessingConfig_, scanConfig_, |
| 76 | lastOpenedDir_); |
| 77 | } |
| 78 | const QNapiConfig setEnabledEngines( |
| 79 | const QList<QPair<QString, bool>>& enabledEngines) const { |
| 80 | return QNapiConfig(firstrun_, version_, generalConfig_, enabledEngines, |
| 81 | enginesConfig_, postProcessingConfig_, scanConfig_, |
| 82 | lastOpenedDir_); |
| 83 | } |
| 84 | const QNapiConfig setEnginesConfig( |
| 85 | const QMap<QString, EngineConfig>& enginesConfig) const { |
| 86 | return QNapiConfig(firstrun_, version_, generalConfig_, enabledEngines_, |
| 87 | enginesConfig, postProcessingConfig_, scanConfig_, |
| 88 | lastOpenedDir_); |
| 89 | } |
| 90 | const QNapiConfig setPostProcessingConfig( |
| 91 | const PostProcessingConfig& postProcessingConfig) const { |
| 92 | return QNapiConfig(firstrun_, version_, generalConfig_, enabledEngines_, |
| 93 | enginesConfig_, postProcessingConfig, scanConfig_, |
| 94 | lastOpenedDir_); |
| 95 | } |
| 96 | const QNapiConfig setScanConfig(const ScanConfig& scanConfig) const { |
| 97 | return QNapiConfig(firstrun_, version_, generalConfig_, enabledEngines_, |
| 98 | enginesConfig_, postProcessingConfig_, scanConfig, |
| 99 | lastOpenedDir_); |
| 100 | } |
| 101 | const QNapiConfig setLastOpenedDir(const QString& lastOpenedDir) const { |
| 102 | return QNapiConfig(firstrun_, version_, generalConfig_, enabledEngines_, |
| 103 | enginesConfig_, postProcessingConfig_, scanConfig_, |
| 104 | lastOpenedDir); |
| 105 | } |
| 106 | |
| 107 | QString toString() const; |
| 108 | }; |
| 109 | |
| 110 | #endif |