Sayonara Player
LyricServer.h
1 /* LyricServer.h */
2 
3 /* Copyright (C) 2012 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 can_fetch_directly() const;
52  bool can_search() const;
53 
54  QString name() const;
55  void set_name(const QString& name);
56 
57  QString address() const;
58  void set_address(const QString& address);
59 
60  Replacements replacements() const;
61  void set_replacements(const Replacements& replacements);
62 
63  QString direct_url_template() const;
64  void set_direct_url_template(const QString& direct_url_template);
65 
66  StartEndTags start_end_tag() const;
67  void set_start_end_tag(const StartEndTags& start_end_tag);
68 
69  bool is_start_tag_included() const;
70  void set_is_start_tag_included(bool is_start_tag_included);
71 
72  bool is_end_tag_included() const;
73  void set_is_end_tag_included(bool is_end_tag_included);
74 
75  bool is_numeric() const;
76  void set_is_numeric(bool is_numeric);
77 
78  bool is_lowercase() const;
79  void set_is_lowercase(bool is_lowercase);
80 
81  QString error_string() const;
82  void set_error_string(const QString& error_string);
83 
84  QString search_result_regex() const;
85  void set_search_result_regex(const QString& search_result_regex);
86 
87  QString search_result_url_template() const;
88  void set_search_result_url_template(const QString& search_result_url_template);
89 
90  QString search_url_template() const;
91  void set_search_url_template(const QString& search_url_template);
92 
93  QJsonObject to_json();
94  static Lyrics::Server* from_json(const QJsonObject& json);
95 
96  static QString apply_replacements(const QString& str, const Server::Replacements& replacements);
97 
98  private:
99  QString apply_replacements(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:38