TTKMusicPlayer
4.1.3.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
TTKModule
TTKCore
musicToolsSetsKits
musicdesktopwallpaperthread.cpp
Go to the documentation of this file.
1
#include "
musicdesktopwallpaperthread.h
"
2
#include "
musicbackgroundconfigmanager.h
"
3
#include "
musicbackgroundmanager.h
"
4
#include "
musicextractwrapper.h
"
5
6
#include <QTimer>
7
#include <QPixmap>
8
9
MusicDesktopWallpaperThread::MusicDesktopWallpaperThread
(QObject *parent)
10
: QObject(parent),
11
m_run(false),
12
m_random(false),
13
m_currentImageIndex(0)
14
{
15
TTK::initRandom
();
16
17
m_timer
=
new
QTimer(
this
);
18
setInterval
(20 *
TTK_DN_S2MS
);
19
connect(
m_timer
, SIGNAL(
timeout
()), SLOT(
timeout
()));
20
}
21
22
MusicDesktopWallpaperThread::~MusicDesktopWallpaperThread
()
23
{
24
stop
();
25
delete
m_timer
;
26
}
27
28
void
MusicDesktopWallpaperThread::setInterval
(
int
msec)
29
{
30
m_timer
->setInterval(msec);
31
}
32
33
bool
MusicDesktopWallpaperThread::isRunning
()
const
34
{
35
return
m_run
;
36
}
37
38
void
MusicDesktopWallpaperThread::setRandom
(
bool
random
)
39
{
40
m_random
=
random
;
41
}
42
void
MusicDesktopWallpaperThread::setImagePath
(
const
QStringList &list)
43
{
44
m_path
= list;
45
}
46
47
#if defined Q_OS_WIN
48
HWND MusicDesktopWallpaperThread::findDesktopIconWnd()
49
{
50
HWND hWorkerW = FindWindowExW(
nullptr
,
nullptr
, L
"WorkerW"
,
nullptr
);
51
HWND hDefView =
nullptr
;
52
53
while
(!hDefView && hWorkerW)
54
{
55
hDefView = FindWindowExW(hWorkerW,
nullptr
, L
"SHELLDLL_DefView"
,
nullptr
);
56
hWorkerW = FindWindowExW(
nullptr
, hWorkerW, L
"WorkerW"
,
nullptr
);
57
}
58
59
ShowWindow(hWorkerW, 0);
60
return
FindWindowW(L
"Progman"
,
nullptr
);
61
}
62
63
void
MusicDesktopWallpaperThread::sendMessageToDesktop()
64
{
65
PDWORD_PTR result =
nullptr
;
66
SendMessageTimeoutW(FindWindowW(L
"Progman"
,
nullptr
), 0x52C, 0, 0, SMTO_NORMAL, 1000, result);
67
}
68
#endif
69
70
void
MusicDesktopWallpaperThread::start
()
71
{
72
m_run
=
true
;
73
timeout
();
74
m_timer
->start();
75
}
76
77
void
MusicDesktopWallpaperThread::stop
()
78
{
79
m_run
=
false
;
80
m_timer
->stop();
81
}
82
83
void
MusicDesktopWallpaperThread::timeout
()
84
{
85
if
(!
m_run
)
86
{
87
return
;
88
}
89
90
if
(!
m_path
.isEmpty())
91
{
92
if
(
m_random
)
93
{
94
m_currentImageIndex
=
TTK::random
(
m_path
.count());
95
}
96
else
if
(++
m_currentImageIndex
>=
m_path
.count())
97
{
98
m_currentImageIndex
= 0;
99
}
100
101
Q_EMIT
updateBackground
(QPixmap(
m_path
[
m_currentImageIndex
]));
102
}
103
else
104
{
105
MusicBackgroundImage
image;
106
MusicExtractWrapper::outputSkin
(&image,
G_BACKGROUND_PTR
->backgroundUrl());
107
Q_EMIT
updateBackground
(image.
m_pix
);
108
}
109
}
MusicDesktopWallpaperThread::m_currentImageIndex
int m_currentImageIndex
Definition:
musicdesktopwallpaperthread.h:102
musicbackgroundconfigmanager.h
G_BACKGROUND_PTR
#define G_BACKGROUND_PTR
Definition:
musicbackgroundmanager.h:141
MusicDesktopWallpaperThread::setRandom
void setRandom(bool random)
Definition:
musicdesktopwallpaperthread.cpp:38
MusicDesktopWallpaperThread::m_run
bool m_run
Definition:
musicdesktopwallpaperthread.h:101
TTK::initRandom
TTK_MODULE_EXPORT void initRandom()
Definition:
ttktime.cpp:7
MusicDesktopWallpaperThread::stop
void stop()
Definition:
musicdesktopwallpaperthread.cpp:77
MusicDesktopWallpaperThread::~MusicDesktopWallpaperThread
~MusicDesktopWallpaperThread()
Definition:
musicdesktopwallpaperthread.cpp:22
musicdesktopwallpaperthread.h
MusicDesktopWallpaperThread::m_timer
QTimer * m_timer
Definition:
musicdesktopwallpaperthread.h:103
TTK::random
TTK_MODULE_EXPORT int random(int value=RAND_MAX)
Definition:
ttktime.cpp:14
MusicDesktopWallpaperThread::isRunning
bool isRunning() const
Definition:
musicdesktopwallpaperthread.cpp:33
MusicBackgroundImage::m_pix
QPixmap m_pix
Definition:
musicbackgroundconfigmanager.h:53
MusicBackgroundImage
The class of the skin backgroud image.
Definition:
musicbackgroundconfigmanager.h:51
MusicDesktopWallpaperThread::timeout
void timeout()
Definition:
musicdesktopwallpaperthread.cpp:83
MusicDesktopWallpaperThread::m_random
bool m_random
Definition:
musicdesktopwallpaperthread.h:101
musicbackgroundmanager.h
MusicDesktopWallpaperThread::setImagePath
void setImagePath(const QStringList &list)
Definition:
musicdesktopwallpaperthread.cpp:42
musicextractwrapper.h
TTK_DN_S2MS
#define TTK_DN_S2MS
Definition:
ttkglobal.h:281
MusicExtractWrapper::outputSkin
static bool outputSkin(MusicBackgroundImage *image, const QString &input)
Definition:
musicextractwrapper.cpp:149
MusicDesktopWallpaperThread::m_path
QStringList m_path
Definition:
musicdesktopwallpaperthread.h:104
MusicDesktopWallpaperThread::setInterval
void setInterval(int msec)
Definition:
musicdesktopwallpaperthread.cpp:28
MusicDesktopWallpaperThread::updateBackground
void updateBackground(const QPixmap &pix)
MusicDesktopWallpaperThread::MusicDesktopWallpaperThread
MusicDesktopWallpaperThread(QObject *parent=nullptr)
Definition:
musicdesktopwallpaperthread.cpp:9
MusicDesktopWallpaperThread::start
void start()
Definition:
musicdesktopwallpaperthread.cpp:70
Generated on Tue Jan 21 2025 21:07:13 for TTKMusicPlayer by
1.8.8