1 /**
2  * \file serverimporterconfig.h
3  * Configuration for server import.
4  *
5  * \b Project: Kid3
6  * \author Urs Fleisch
7  * \date 09 Oct 2006
8  *
9  * Copyright (C) 2006-2018  Urs Fleisch
10  *
11  * This file is part of Kid3.
12  *
13  * Kid3 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * Kid3 is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 #pragma once
28 
29 #include "generalconfig.h"
30 #include <QString>
31 #include "kid3api.h"
32 
33 /**
34  * Freedb configuration.
35  */
36 class KID3_CORE_EXPORT ServerImporterConfig : public GeneralConfig {
37   Q_OBJECT
38   /** server */
39   Q_PROPERTY(QString server READ server WRITE setServer NOTIFY serverChanged)
40   /** CGI path used for access */
41   Q_PROPERTY(QString cgiPath READ cgiPath WRITE setCgiPath
42              NOTIFY cgiPathChanged)
43   /** window geometry */
44   Q_PROPERTY(QByteArray windowGeometry READ windowGeometry
45              WRITE setWindowGeometry NOTIFY windowGeometryChanged)
46   /** true if CgiPath configuration is used */
47   Q_PROPERTY(bool cgiPathUsed READ cgiPathUsed WRITE setCgiPathUsed
48              NOTIFY cgiPathUsedChanged)
49   /** true if additional tags configuration is used */
50   Q_PROPERTY(bool additionalTagsUsed READ additionalTagsUsed
51              WRITE setAdditionalTagsUsed NOTIFY additionalTagsUsedChanged)
52   /** standard tags imported */
53   Q_PROPERTY(bool standardTags READ standardTags WRITE setStandardTags
54              NOTIFY standardTagsChanged)
55   /** additional tags imported */
56   Q_PROPERTY(bool additionalTags READ additionalTags WRITE setAdditionalTags
57              NOTIFY additionalTagsChanged)
58   /** cover art imported */
59   Q_PROPERTY(bool coverArt READ coverArt WRITE setCoverArt
60              NOTIFY coverArtChanged)
61 
62 public:
63   /**
64    * Constructor.
65    * Set default configuration.
66    *
67    * @param grp         configuration group
68    */
69   explicit ServerImporterConfig(const QString& grp);
70 
71   /**
72    * Constructor.
73    * Used to create temporary configuration.
74    */
75   ServerImporterConfig();
76 
77   /**
78    * Destructor.
79    */
80   virtual ~ServerImporterConfig() override = default;
81 
82   /**
83    * Persist configuration.
84    *
85    * @param config KDE configuration
86    */
87   virtual void writeToConfig(ISettings* config) const override;
88 
89   /**
90    * Read persisted configuration.
91    *
92    * @param config KDE configuration
93    */
94   virtual void readFromConfig(ISettings* config) override;
95 
96   /** Get server. */
server()97   QString server() const { return m_server; }
98 
99   /** Set server. */
100   void setServer(const QString& server);
101 
102   /** Get CGI path used for access. */
cgiPath()103   QString cgiPath() const { return m_cgiPath; }
104 
105   /** Set CGI path used for access. */
106   void setCgiPath(const QString& cgiPath);
107 
108   /** Get window geometry. */
windowGeometry()109   QByteArray windowGeometry() const { return m_windowGeometry; }
110 
111   /** Set window geometry. */
112   void setWindowGeometry(const QByteArray& windowGeometry);
113 
114   /** Check if CgiPath configuration is used. */
cgiPathUsed()115   bool cgiPathUsed() const { return m_cgiPathUsed; }
116 
117   /** Set if CgiPath configuration is used. */
118   void setCgiPathUsed(bool cgiPathUsed);
119 
120   /** Check if additional tags configuration is used. */
additionalTagsUsed()121   bool additionalTagsUsed() const { return m_additionalTagsUsed; }
122 
123   /** Set if additional tags configuration is used. */
124   void setAdditionalTagsUsed(bool additionalTagsUsed);
125 
126   /** Check if standard tags are imported. */
standardTags()127   bool standardTags() const { return m_standardTags; }
128 
129   /** Set if standard tags are imported. */
130   void setStandardTags(bool standardTags);
131 
132   /** Check if additional tags are imported. */
additionalTags()133   bool additionalTags() const { return m_additionalTags; }
134 
135   /** Set if additional tags are imported. */
136   void setAdditionalTags(bool additionalTags);
137 
138   /** Check if cover art is imported. */
coverArt()139   bool coverArt() const { return m_coverArt; }
140 
141   /** Set if cover art is imported. */
142   void setCoverArt(bool coverArt);
143 
144 signals:
145   /** Emitted when @a server changed. */
146   void serverChanged(const QString& server);
147 
148   /** Emitted when @a cgiPath changed. */
149   void cgiPathChanged(const QString& cgiPath);
150 
151   /** Emitted when @a windowGeometry changed. */
152   void windowGeometryChanged(const QByteArray& windowGeometry);
153 
154   /** Emitted when @a cgiPathUsed changed. */
155   void cgiPathUsedChanged(bool cgiPathUsed);
156 
157   /** Emitted when @a additionalTagsUsed changed. */
158   void additionalTagsUsedChanged(bool additionalTagsUsed);
159 
160   /** Emitted when @a standardTags changed. */
161   void standardTagsChanged(bool standardTags);
162 
163   /** Emitted when @a additionalTags changed. */
164   void additionalTagsChanged(bool additionalTags);
165 
166   /** Emitted when @a coverArt changed. */
167   void coverArtChanged(bool coverArt);
168 
169 private:
170   QString m_server;
171   QString m_cgiPath;
172   QByteArray m_windowGeometry;
173   bool m_cgiPathUsed;
174   bool m_additionalTagsUsed;
175   bool m_standardTags;
176   bool m_additionalTags;
177   bool m_coverArt;
178 };
179