File indexing completed on 2024-05-19 04:55:57

0001 /**
0002  * \file serverimporterconfig.h
0003  * Configuration for server import.
0004  *
0005  * \b Project: Kid3
0006  * \author Urs Fleisch
0007  * \date 09 Oct 2006
0008  *
0009  * Copyright (C) 2006-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 "generalconfig.h"
0030 #include <QString>
0031 #include "kid3api.h"
0032 
0033 /**
0034  * Freedb configuration.
0035  */
0036 class KID3_CORE_EXPORT ServerImporterConfig : public GeneralConfig {
0037   Q_OBJECT
0038   /** server */
0039   Q_PROPERTY(QString server READ server WRITE setServer NOTIFY serverChanged)
0040   /** CGI path used for access */
0041   Q_PROPERTY(QString cgiPath READ cgiPath WRITE setCgiPath
0042              NOTIFY cgiPathChanged)
0043   /** window geometry */
0044   Q_PROPERTY(QByteArray windowGeometry READ windowGeometry
0045              WRITE setWindowGeometry NOTIFY windowGeometryChanged)
0046   /** true if CgiPath configuration is used */
0047   Q_PROPERTY(bool cgiPathUsed READ cgiPathUsed WRITE setCgiPathUsed
0048              NOTIFY cgiPathUsedChanged)
0049   /** true if additional tags configuration is used */
0050   Q_PROPERTY(bool additionalTagsUsed READ additionalTagsUsed
0051              WRITE setAdditionalTagsUsed NOTIFY additionalTagsUsedChanged)
0052   /** standard tags imported */
0053   Q_PROPERTY(bool standardTags READ standardTags WRITE setStandardTags
0054              NOTIFY standardTagsChanged)
0055   /** additional tags imported */
0056   Q_PROPERTY(bool additionalTags READ additionalTags WRITE setAdditionalTags
0057              NOTIFY additionalTagsChanged)
0058   /** cover art imported */
0059   Q_PROPERTY(bool coverArt READ coverArt WRITE setCoverArt
0060              NOTIFY coverArtChanged)
0061 
0062 public:
0063   /**
0064    * Constructor.
0065    * Set default configuration.
0066    *
0067    * @param grp         configuration group
0068    */
0069   explicit ServerImporterConfig(const QString& grp);
0070 
0071   /**
0072    * Constructor.
0073    * Used to create temporary configuration.
0074    */
0075   ServerImporterConfig();
0076 
0077   /**
0078    * Destructor.
0079    */
0080   ~ServerImporterConfig() override = default;
0081 
0082   /**
0083    * Persist configuration.
0084    *
0085    * @param config KDE configuration
0086    */
0087   void writeToConfig(ISettings* config) const override;
0088 
0089   /**
0090    * Read persisted configuration.
0091    *
0092    * @param config KDE configuration
0093    */
0094   void readFromConfig(ISettings* config) override;
0095 
0096   /** Get server. */
0097   QString server() const { return m_server; }
0098 
0099   /** Set server. */
0100   void setServer(const QString& server);
0101 
0102   /** Get CGI path used for access. */
0103   QString cgiPath() const { return m_cgiPath; }
0104 
0105   /** Set CGI path used for access. */
0106   void setCgiPath(const QString& cgiPath);
0107 
0108   /** Get window geometry. */
0109   QByteArray windowGeometry() const { return m_windowGeometry; }
0110 
0111   /** Set window geometry. */
0112   void setWindowGeometry(const QByteArray& windowGeometry);
0113 
0114   /** Check if CgiPath configuration is used. */
0115   bool cgiPathUsed() const { return m_cgiPathUsed; }
0116 
0117   /** Set if CgiPath configuration is used. */
0118   void setCgiPathUsed(bool cgiPathUsed);
0119 
0120   /** Check if additional tags configuration is used. */
0121   bool additionalTagsUsed() const { return m_additionalTagsUsed; }
0122 
0123   /** Set if additional tags configuration is used. */
0124   void setAdditionalTagsUsed(bool additionalTagsUsed);
0125 
0126   /** Check if standard tags are imported. */
0127   bool standardTags() const { return m_standardTags; }
0128 
0129   /** Set if standard tags are imported. */
0130   void setStandardTags(bool standardTags);
0131 
0132   /** Check if additional tags are imported. */
0133   bool additionalTags() const { return m_additionalTags; }
0134 
0135   /** Set if additional tags are imported. */
0136   void setAdditionalTags(bool additionalTags);
0137 
0138   /** Check if cover art is imported. */
0139   bool coverArt() const { return m_coverArt; }
0140 
0141   /** Set if cover art is imported. */
0142   void setCoverArt(bool coverArt);
0143 
0144 signals:
0145   /** Emitted when @a server changed. */
0146   void serverChanged(const QString& server);
0147 
0148   /** Emitted when @a cgiPath changed. */
0149   void cgiPathChanged(const QString& cgiPath);
0150 
0151   /** Emitted when @a windowGeometry changed. */
0152   void windowGeometryChanged(const QByteArray& windowGeometry);
0153 
0154   /** Emitted when @a cgiPathUsed changed. */
0155   void cgiPathUsedChanged(bool cgiPathUsed);
0156 
0157   /** Emitted when @a additionalTagsUsed changed. */
0158   void additionalTagsUsedChanged(bool additionalTagsUsed);
0159 
0160   /** Emitted when @a standardTags changed. */
0161   void standardTagsChanged(bool standardTags);
0162 
0163   /** Emitted when @a additionalTags changed. */
0164   void additionalTagsChanged(bool additionalTags);
0165 
0166   /** Emitted when @a coverArt changed. */
0167   void coverArtChanged(bool coverArt);
0168 
0169 private:
0170   QString m_server;
0171   QString m_cgiPath;
0172   QByteArray m_windowGeometry;
0173   bool m_cgiPathUsed;
0174   bool m_additionalTagsUsed;
0175   bool m_standardTags;
0176   bool m_additionalTags;
0177   bool m_coverArt;
0178 };