Sayonara Player
LyricServer.h
1 /* LyricServer.h */
2 
3 /* Copyright (C) 2012 Michael Lugmair (Lucio Carreras)
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef LYRICSERVER_H_
22 #define LYRICSERVER_H_
23 
24 #include <QString>
25 #include <QList>
26 #include <QPair>
27 #include <QMap>
28 #include "Utils/Pimpl.h"
29 
30 class QJsonObject;
31 
32 namespace Lyrics
33 {
38  class Server
39  {
40  PIMPL(Server)
41 
42  public:
43  Server();
44  ~Server();
45 
50 
51  bool canFetchDirectly() const;
52  bool canSearch() const;
53 
54  QString name() const;
55  void setName(const QString& name);
56 
57  QString address() const;
58  void setAddress(const QString& address);
59 
60  Replacements replacements() const;
61  void setReplacements(const Replacements& replacements);
62 
63  QString directUrlTemplate() const;
64  void setDirectUrlTemplate(const QString& directUrlTemplate);
65 
66  StartEndTags startEndTag() const;
67  void setStartEndTag(const StartEndTags& startEndTag);
68 
69  bool isStartTagIncluded() const;
70  void setIsStartTagIncluded(bool isStartTagIncluded);
71 
72  bool isEndTagIncluded() const;
73  void setIsEndTagIncluded(bool isEndTagIncluded);
74 
75  bool isNumeric() const;
76  void setIsNumeric(bool isNumeric);
77 
78  bool isLowercase() const;
79  void setIsLowercase(bool isLowercase);
80 
81  QString errorString() const;
82  void setErrorString(const QString& errorString);
83 
84  QString searchResultRegex() const;
85  void setSearchResultRegex(const QString& searchResultRegex);
86 
87  QString searchResultUrlTemplate() const;
88  void setSearchResultUrlTemplate(const QString& searchResultUrlTemplate);
89 
90  QString searchUrlTemplate() const;
91  void setSearchUrlTemplate(const QString& searchUrlTemplate);
92 
93  QJsonObject toJson();
94  static Lyrics::Server* fromJson(const QJsonObject& json);
95 
96  static QString applyReplacements(const QString& str, const Server::Replacements& replacements);
97 
98  private:
99  QString applyReplacements(const QString& str) const;
100  };
101 }
102 
103 
104 
105 #endif /* LYRICSERVER_H_ */
QPair
Definition: typedefs.h:32
QList
Definition: EngineUtils.h:33
Lyrics::Server
The ServerTemplate struct.
Definition: LyricServer.h:39