TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
ttkdispatchmanager.h
Go to the documentation of this file.
1 #ifndef TTKDISPATCHMANAGER_H
2 #define TTKDISPATCHMANAGER_H
3 
4 /***************************************************************************
5  * This file is part of the TTK Library Module project
6  * Copyright (C) 2015 - 2024 Greedysky Studio
7 
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17 
18  * You should have received a copy of the GNU Lesser General Public License along
19  * with this program; If not, see <http://www.gnu.org/licenses/>.
20  ***************************************************************************/
21 
22 #include <QMutex>
23 #include "ttksingleton.h"
24 
25 class QTimer;
26 
30 class TTK_MODULE_EXPORT TTKDispatchManager : public QObject
31 {
32  Q_OBJECT
34 public:
35  enum class Module
36  {
37  Null = -1,
38  FileRemove
39  };
40 
44  void dispatch(Module type);
45  void dispatch(Module type, void *funcs);
46  void dispatch(Module type, const TTKVariantList &args);
47 
48 public:
52  void dispatch(Module type, const QVariant &arg1);
53  void dispatch(Module type, const QVariant &arg1, const QVariant &arg2);
54  void dispatch(Module type, const QVariant &arg1, const QVariant &arg2, const QVariant &arg3);
55  void dispatch(Module type, const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4);
56 
57 private Q_SLOTS:
61  void activeFunctions();
62 
63 private:
72 
73 private:
75  {
76  int m_times;
79 
81  : m_times(0),
82  m_type(TTKDispatchManager::Module::Null)
83  {
84 
85  }
86 
87  inline bool isEmpty() const
88  {
89  return m_args.isEmpty();
90  }
91 
92  inline bool isValid() const
93  {
94  return m_times <= 5;
95  }
96  };
97 
98 private:
99  QMutex m_mutex;
100  QTimer *m_timer;
101  QList<TTKDispatchItem*> m_observer;
102 
104 
105 };
106 
107 #endif // TTKDISPATCHMANAGER_H
#define TTK_MODULE_EXPORT
#define TTK_DECLARE_SINGLETON_CLASS(Class)
// Singleton Macro // //
Definition: ttksingleton.h:86
The class of the functions dispatch manager.
QList< TTKDispatchItem * > m_observer
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:152
TTKDispatchManager::Module m_type
QList< QVariant > TTKVariantList
Definition: ttkqtglobal.h:189