Skip to content

Commit 701a6ec

Browse files
authored
Merge pull request #13737 from acolombier/feat/improve-screen-rendering-framework
feat: improve screen rendering framework
2 parents 75a44d6 + 533cedb commit 701a6ec

21 files changed

Lines changed: 211 additions & 235 deletions

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2789,6 +2789,7 @@ if(QML)
27892789
src/qml/qmlvisibleeffectsmodel.cpp
27902790
src/qml/qmlchainpresetmodel.cpp
27912791
src/qml/qmlwaveformoverview.cpp
2792+
src/qml/qmlmixxxcontrollerscreen.cpp
27922793
# The following sources need to be in this target to get QML_ELEMENT properly interpreted
27932794
src/control/controlmodel.cpp
27942795
src/control/controlsortfiltermodel.cpp
@@ -2800,6 +2801,7 @@ if(QML)
28002801
# and :/mixxx.org/imports/Mixxx/Controls are placed into beginning of the binary
28012802
qt_finalize_target(mixxx)
28022803

2804+
28032805
install(
28042806
DIRECTORY
28052807
"${CMAKE_CURRENT_SOURCE_DIR}/res/qml"

res/controllers/DummyDeviceDefaultScreen.qml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Mixxx.Controls 1.0 as MixxxControls
1313

1414
import "." as Skin
1515

16-
Item {
16+
Mixxx.ControllerScreen {
1717
id: root
1818

1919
required property string screenId
@@ -23,7 +23,7 @@ Item {
2323
property string group: "[Channel1]"
2424
property var deckPlayer: Mixxx.PlayerManager.getPlayer(root.group)
2525

26-
function init(controlerName, isDebug) {
26+
init: function(controlerName, isDebug) {
2727
console.log(`Screen ${root.screenId} has started`)
2828
switch (root.screenId) {
2929
case "jog":
@@ -34,13 +34,13 @@ Item {
3434
}
3535
}
3636

37-
function shutdown() {
37+
shutdown: function() {
3838
console.log(`Screen ${root.screenId} is stopping`)
3939
loader.sourceComponent = splash
4040
}
4141

4242
// function transformFrame(input: ArrayBuffer, timestamp: date) {
43-
function transformFrame(input, timestamp) {
43+
transformFrame: function(input, timestamp) {
4444
return new ArrayBuffer(0);
4545
}
4646

src/controllers/bulk/bulkcontroller.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "controllers/bulk/bulksupported.h"
88
#include "controllers/defs_controllers.h"
99
#include "moc_bulkcontroller.cpp"
10+
#include "util/cmdlineargs.h"
1011
#include "util/time.h"
1112
#include "util/trace.h"
1213

@@ -264,13 +265,13 @@ void BulkController::send(const QList<int>& data, unsigned int length) {
264265
sendBytes(temp);
265266
}
266267

267-
void BulkController::sendBytes(const QByteArray& data) {
268+
bool BulkController::sendBytes(const QByteArray& data) {
268269
VERIFY_OR_DEBUG_ASSERT(!m_pMapping ||
269270
m_pMapping->getDeviceDirection() &
270271
LegacyControllerMapping::DeviceDirection::Outgoing) {
271272
qDebug() << "The mapping for the bulk device" << getName()
272273
<< "doesn't require sending data. Ignoring sending request.";
273-
return;
274+
return false;
274275
}
275276

276277
int ret;
@@ -287,8 +288,10 @@ void BulkController::sendBytes(const QByteArray& data) {
287288
if (ret < 0) {
288289
qCWarning(m_logOutput) << "Unable to send data to" << getName()
289290
<< "serial #" << m_sUID << "-" << libusb_error_name(ret);
291+
return false;
290292
} else if (CmdlineArgs::Instance().getControllerDebug()) {
291293
qCDebug(m_logOutput) << transferred << "bytes sent to" << getName()
292294
<< "serial #" << m_sUID;
293295
}
296+
return true;
294297
}

src/controllers/bulk/bulkcontroller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class BulkController : public Controller {
6464
private:
6565
// For devices which only support a single report, reportID must be set to
6666
// 0x0.
67-
void sendBytes(const QByteArray& data) override;
67+
bool sendBytes(const QByteArray& data) override;
6868

6969
bool matchProductInfo(const ProductInfo& product);
7070

src/controllers/controller.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,9 @@ class Controller : public QObject {
141141

142142
public:
143143
// This must be reimplemented by sub-classes desiring to send raw bytes to a
144-
// controller.
145-
virtual void sendBytes(const QByteArray& data) = 0;
144+
// controller. Return true in case of successful completion, false in case
145+
// of partial completion or failure.
146+
virtual bool sendBytes(const QByteArray& data) = 0;
146147

147148
private: // but used by ControllerManager
148149

src/controllers/controllerscreenpreview.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ControllerScreenPreview::ControllerScreenPreview(
2323
setMaximumWidth(screen.size.width());
2424
m_pStat->setAlignment(Qt::AlignRight);
2525
auto pLayout = make_parented<QVBoxLayout>(this);
26+
pLayout->setContentsMargins(0, 0, 0, 0);
2627
auto* pBottomLayout = new QHBoxLayout();
2728
pLayout->addWidget(m_pFrame);
2829
pBottomLayout->addWidget(make_parented<QLabel>(

src/controllers/hid/hidcontroller.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,11 @@ int HidController::close() {
198198
/// This function is only for class compatibility with the (midi)controller
199199
/// and will not do the same as for MIDI devices,
200200
/// because sending of raw bytes is not a supported HIDAPI feature.
201-
void HidController::sendBytes(const QByteArray& data) {
201+
bool HidController::sendBytes(const QByteArray& data) {
202202
// Some HIDAPI backends will fail if the device uses ReportIDs (as practical all DJ controllers),
203203
// because 0 is no valid ReportID for these devices.
204204
m_pHidIoThread->updateCachedOutputReportData(0, data, false);
205+
return true;
205206
}
206207

207208
ControllerJSProxy* HidController::jsProxy() {

src/controllers/hid/hidcontroller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class HidController final : public Controller {
3636
private:
3737
// For devices which only support a single report, reportID must be set to
3838
// 0x0.
39-
void sendBytes(const QByteArray& data) override;
39+
bool sendBytes(const QByteArray& data) override;
4040

4141
const mixxx::hid::DeviceInfo m_deviceInfo;
4242

src/controllers/midi/hss1394controller.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,15 @@ void Hss1394Controller::sendShortMsg(unsigned char status, unsigned char byte1,
185185
}
186186
}
187187

188-
void Hss1394Controller::sendBytes(const QByteArray& data) {
188+
bool Hss1394Controller::sendBytes(const QByteArray& data) {
189189
const int bytesSent = m_pChannel->SendChannelBytes(
190190
reinterpret_cast<const unsigned char*>(data.constData()), data.size());
191191

192192
qCDebug(m_logOutput) << MidiUtils::formatSysexMessage(getName(), data);
193193
if (bytesSent != data.size()) {
194194
qCWarning(m_logOutput) << "Sent" << bytesSent << "of" << data.size() << "bytes (SysEx)";
195195
//m_pChannel->Flush();
196+
return false;
196197
}
198+
return true;
197199
}

src/controllers/midi/hss1394controller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Hss1394Controller : public MidiController {
5353
private:
5454
// The sysex data must already contain the start byte 0xf0 and the end byte
5555
// 0xf7.
56-
void sendBytes(const QByteArray& data) override;
56+
bool sendBytes(const QByteArray& data) override;
5757

5858
hss1394::TNodeInfo m_deviceInfo;
5959
int m_iDeviceIndex;

0 commit comments

Comments
 (0)