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 
38 class GlobalMessage : public QObject
39 {
40  Q_OBJECT
41  SINGLETON_QOBJECT(GlobalMessage)
42 
43  GlobalMessageReceiverInterface* _receiver=nullptr;
44 
45 private slots:
46  void receiver_destroyed();
47 
48 public:
49 
50  enum class Answer : quint8 {
51  Yes=0,
52  No,
53  Ok,
54  Cancel,
55  Undefined
56  };
57 
58  enum class QuestionType : quint8 {
59  YesNo=0,
60  OkCancel
61  };
62 
63 
64  GlobalMessage::Answer info(
65  const QString& info,
66  const QString& sender_name=QString());
67 
68  GlobalMessage::Answer warning(
69  const QString& warning,
70  const QString& sender_name=QString());
71 
72  GlobalMessage::Answer error(
73  const QString& error,
74  const QString& sender_name=QString());
75 
76  GlobalMessage::Answer question(
77  const QString& question,
78  const QString& sender_name=QString(),
79  QuestionType type=GlobalMessage::QuestionType::YesNo);
80 
87 };
88 
89 
90 #endif // GLOBALMESSAGE_H
bool register_receiver(GlobalMessageReceiverInterface *receiver)
register a receiver here, so it is called whenever a message has to be written
The GlobalMessage class.
Definition: GlobalMessage.h:38
The GlobalMessageReceiverInterface class implement this class in order to have the possibility to sho...
Definition: GlobalMessageReceiverInterface.h:35