TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
volume.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2012-2024 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef VOLUME_H
22 #define VOLUME_H
23 
24 #include <QFlags>
25 #include <QObject>
26 #include "qmmp_export.h"
27 
32 {
33  int left = 0;
34  int right = 0;
36 };
37 
38 inline bool operator==(const VolumeSettings &v1, const VolumeSettings &v2)
39 {
40  return v1.left == v2.left && v1.right == v2.right;
41 }
42 
43 inline bool operator!=(const VolumeSettings &v1, const VolumeSettings &v2)
44 {
45  return v1.left != v2.left || v1.right != v2.right;
46 }
47 
51 class QMMP_EXPORT Volume : public QObject
52 {
53  Q_OBJECT
54 public:
59  {
60  IsMuteSupported = 0x1,
61  HasNotifySignal = 0x2,
63  };
64  Q_DECLARE_FLAGS(VolumeFlags, VolumeFlag)
65 
66 
69  virtual ~Volume() = default;
70 
76  virtual void setVolume(const VolumeSettings &volume) = 0;
80  virtual VolumeSettings volume() const = 0;
84  virtual bool isMuted() const;
89  virtual void setMuted(bool mute);
93  virtual VolumeFlags flags() const;
94 
95 signals:
99  void changed();
100 
101 private:
102  bool m_mutedInternal = false;
103 
104 };
105 
106 Q_DECLARE_OPERATORS_FOR_FLAGS(Volume::VolumeFlags)
107 
108 #endif
bool operator==(const VolumeSettings &v1, const VolumeSettings &v2)
Definition: volume.h:38
The VolumeSettings structure stores volume levels.
Definition: volume.h:31
flags
Definition: http_parser.h:135
The Volume class provides asbtract volume interface.
Definition: volume.h:51
VolumeFlag
Definition: volume.h:58
#define QMMP_EXPORT
Definition: qmmp_export.h:29
bool operator!=(const VolumeSettings &v1, const VolumeSettings &v2)
Definition: volume.h:43
#define const
Definition: zconf.h:233