Sayonara Player
GlobalMessage.h
1 /* GlobalMessage.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef GLOBALMESSAGE_H
24 #define GLOBALMESSAGE_H
25 
26 #include "Helper/globals.h"
27 
28 #include <QString>
29 #include <QObject>
30 
31 
33 
34 class GlobalMessage : public QObject
35 {
36  Q_OBJECT
37  SINGLETON_QOBJECT(GlobalMessage)
38 
39  GlobalMessageReceiverInterface* _receiver=nullptr;
40 
41 private slots:
42  void receiver_destroyed();
43 
44 public:
45 
46  enum class Answer : quint8 {
47  Yes=0,
48  No,
49  Ok,
50  Cancel,
51  Undefined
52  };
53 
54  enum class QuestionType : quint8 {
55  YesNo=0,
56  OkCancel
57  };
58 
59 
60  GlobalMessage::Answer info(
61  const QString& info,
62  const QString& sender_name=QString());
63 
64  GlobalMessage::Answer warning(
65  const QString& warning,
66  const QString& sender_name=QString());
67 
68  GlobalMessage::Answer error(
69  const QString& error,
70  const QString& sender_name=QString());
71 
72  GlobalMessage::Answer question(
73  const QString& question,
74  const QString& sender_name=QString(),
75  QuestionType type=GlobalMessage::QuestionType::YesNo);
76 
83 };
84 
85 
86 #endif // GLOBALMESSAGE_H
bool register_receiver(GlobalMessageReceiverInterface *receiver)
register a receiver here, so it is called whenever a message has to be written
Definition: GlobalMessage.h:34
The GlobalMessageReceiverInterface class implement this class in order to have the possibility to sho...
Definition: GlobalMessageReceiverInterface.h:33