Sayonara Player
InstanceThread.h
1 
2 /* Copyright (C) 2011-2016 Lucio Carreras
3  *
4  * This file is part of sayonara player
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15 
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 
22 
23 #ifndef INSTANCETHREAD_H
24 #define INSTANCETHREAD_H
25 
26 #include <QThread>
27 #include <QSharedMemory>
28 #include <QMainWindow>
29 #include "Components/Playlist/Playlist.h"
30 
31 enum InstanceMessage {
32  InstanceMessageNone,
33  InstanceMessageWithoutFiles,
34  InstanceMessageWithFiles
35 };
36 
37 class PlaylistHandler;
38 class GUI_Player;
39 class InstanceThread : public QThread
40 {
41  Q_OBJECT
42 
43 signals:
44  void sig_player_raise();
45  void sig_create_playlist(const QStringList& playlist, const QString& name, bool temporary);
46 
47 public:
48  InstanceThread(InstanceMessage* instance_message, QObject* parent=nullptr);
49  ~InstanceThread();
50 
51  void stop();
52 
53 private:
54  bool _may_run;
55  InstanceMessage* _instance_message=nullptr;
56  QSharedMemory _memory;
57 
58 
59 private:
60  void run() override;
61  void parse_memory();
62 
63 };
64 
65 #endif // INSTANCETHREAD_H
Definition: GUI_Player.h:58
Definition: InstanceThread.h:39
Global handler for playlists.
Definition: PlaylistHandler.h:47