forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmixxxapplication.cpp
84 lines (75 loc) · 2.74 KB
/
mixxxapplication.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <QtDebug>
#include <QTouchEvent>
#include <QThreadPool>
#include "mixxxapplication.h"
#include "control/controlproxy.h"
#include "library/crate/crateid.h"
#include "soundio/soundmanagerutil.h"
#include "track/track.h"
#include "track/trackref.h"
#include "util/cache.h"
#include "util/color/rgbcolor.h"
#include "util/math.h"
// When linking Qt statically on Windows we have to Q_IMPORT_PLUGIN all the
// plugins we link in build/depends.py.
#ifdef QT_NODLL
#include <QtPlugin>
// sqldrivers plugins
Q_IMPORT_PLUGIN(QSQLiteDriverPlugin)
// platform plugins
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
// style plugins
Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
// imageformats plugins
Q_IMPORT_PLUGIN(QSvgPlugin)
Q_IMPORT_PLUGIN(QSvgIconPlugin)
Q_IMPORT_PLUGIN(QICOPlugin)
Q_IMPORT_PLUGIN(QTgaPlugin)
Q_IMPORT_PLUGIN(QJpegPlugin)
Q_IMPORT_PLUGIN(QGifPlugin)
// accessible plugins
// TODO(rryan): This is supposed to exist but does not in our builds.
//Q_IMPORT_PLUGIN(AccessibleFactory)
#endif
MixxxApplication::MixxxApplication(int& argc, char** argv)
: QApplication(argc, argv),
m_fakeMouseSourcePointId(0),
m_fakeMouseWidget(NULL),
m_activeTouchButton(Qt::NoButton),
m_pTouchShift(NULL) {
registerMetaTypes();
// Increase the size of the global thread pool to at least
// 4 threads, even if less cores are available. These threads
// will be used for loading external libraries and other tasks.
QThreadPool::globalInstance()->setMaxThreadCount(
math_max(4, QThreadPool::globalInstance()->maxThreadCount()));
}
MixxxApplication::~MixxxApplication() {
}
void MixxxApplication::registerMetaTypes() {
// Register custom data types for signal processing
qRegisterMetaType<TrackId>();
qRegisterMetaType<QSet<TrackId>>();
qRegisterMetaType<QList<TrackId>>();
qRegisterMetaType<TrackRef>();
qRegisterMetaType<QList<TrackRef>>();
qRegisterMetaType<QList<QPair<TrackRef, TrackRef>>>();
qRegisterMetaType<CrateId>();
qRegisterMetaType<QSet<CrateId>>();
qRegisterMetaType<QList<CrateId>>();
qRegisterMetaType<TrackPointer>();
qRegisterMetaType<mixxx::ReplayGain>("mixxx::ReplayGain");
qRegisterMetaType<mixxx::cache_key_t>("mixxx::cache_key_t");
qRegisterMetaType<mixxx::Bpm>("mixxx::Bpm");
qRegisterMetaType<mixxx::Duration>("mixxx::Duration");
qRegisterMetaType<std::optional<mixxx::RgbColor>>("std::optional<mixxx::RgbColor>");
qRegisterMetaType<SoundDeviceId>("SoundDeviceId");
QMetaType::registerComparators<SoundDeviceId>();
}
bool MixxxApplication::touchIsRightButton() {
if (!m_pTouchShift) {
m_pTouchShift = new ControlProxy(
"[Controls]", "touch_shift", this);
}
return (m_pTouchShift->get() != 0.0);
}