Skip to content
/ mixxx Public
forked from mixxxdj/mixxx

Commit

Permalink
Merge pull request #15 from daschuer/qopenglwidget
Browse files Browse the repository at this point in the history
resolve conflicts, Fix OpenGL status
  • Loading branch information
rryan committed Apr 12, 2020
2 parents d4bdd92 + bd90b75 commit 319d5fd
Show file tree
Hide file tree
Showing 72 changed files with 1,027 additions and 329 deletions.
2 changes: 2 additions & 0 deletions build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ def sources(self, build):
"src/controllers/midi/midioutputhandler.cpp",
"src/controllers/softtakeover.cpp",
"src/controllers/keyboard/keyboardeventfilter.cpp",
"src/controllers/colorjsproxy.cpp",

"src/main.cpp",
"src/mixxx.cpp",
Expand Down Expand Up @@ -1225,6 +1226,7 @@ def sources(self, build):
"src/util/widgetrendertimer.cpp",
"src/util/workerthread.cpp",
"src/util/workerthreadscheduler.cpp",
"src/util/color/predefinedcolor.cpp"
]

proto_args = {
Expand Down
44 changes: 0 additions & 44 deletions res/controllers/Hercules-DJ-Console-Mk4-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,8 @@ HerculesMk4.pfl = function (midino, control, value, status, group) {


HerculesMk4.pitchbend = function (midino, control, value, status, group) {
<<<<<<< HEAD
// Pitch - : set pitch sensitivity
// Pitch +: set jog fast position
=======
// Pitch - : set pitch sensivity
// Pitch +: set jog fast position
>>>>>>> upstream/2.2

//ignore when releasing the button
if(value==0x00) return;
Expand All @@ -240,16 +235,6 @@ HerculesMk4.pitchbend = function (midino, control, value, status, group) {

HerculesMk4.jogFastPosition[HerculesMk4.deck(group)]=newValue;

<<<<<<< HEAD
if(newValue==1){
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,11), 0x7f);
}else{
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,11), 0x00);
}
}
else { // Pitchbend -
HerculesMk4.sensitivityPitch[HerculesMk4.deck(group)]=HerculesMk4.toglePitchSensitivity(group,HerculesMk4.sensitivityPitch[HerculesMk4.deck(group)]);
=======
if(newValue==1){
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,11), 0x7f);
}else{
Expand All @@ -258,34 +243,12 @@ HerculesMk4.pitchbend = function (midino, control, value, status, group) {
}
else { // Pitchbend -
HerculesMk4.sensivityPitch[HerculesMk4.deck(group)]=HerculesMk4.toglePitchSensivity(group,HerculesMk4.sensivityPitch[HerculesMk4.deck(group)]);
>>>>>>> upstream/2.2

}

};


HerculesMk4.toglePitchSensitivity=function (group,sensitivity) {

<<<<<<< HEAD
sensitivity=sensitivity+2;

if(sensitivity>5){
sensitivity=1;
}



if(sensitivity==1){
//pitch very fine
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,10), 0x00); // minus led off
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,58), 0x7F); // Blink minus led

} else if (sensitivity==3){
//pitch fine
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,58), 0x00); // Blink minus led off
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,10), 0x7F); // minus led
=======
sensivity=sensivity+2;

if(sensivity>5){
Expand All @@ -303,20 +266,13 @@ HerculesMk4.toglePitchSensitivity=function (group,sensitivity) {
//pitch fine
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,58), 0x00); // Blink minus led off
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,10), 0x7F); // minus led
>>>>>>> upstream/2.2

} else {
//pitch coarse
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,58), 0x00); // Blink minus led off
midi.sendShortMsg(0x90, HerculesMk4.selectLed(group,10), 0x00); // minus led off
}

<<<<<<< HEAD
return sensitivity;
=======
return sensivity;
>>>>>>> upstream/2.2

}

HerculesMk4.cue = function (midino, control, value, status, group) {
Expand Down
File renamed without changes
File renamed without changes
Binary file removed res/skins/Shade/preferences_preview_screenshot.png
Binary file not shown.
Binary file added res/skins/Shade/skin_preview_Classic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/skins/Shade/skin_preview_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/skins/Shade/skin_preview_SummerSunset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added res/skins/Tango/skin_preview_ClubTwist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions src/controllers/colorjsproxy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "controllers/colorjsproxy.h"

ColorJSProxy::ColorJSProxy(QScriptEngine* pScriptEngine)
: m_pScriptEngine(pScriptEngine),
m_predefinedColorsList(makePredefinedColorsList(pScriptEngine)){};

ColorJSProxy::~ColorJSProxy() {};

QScriptValue ColorJSProxy::predefinedColorFromId(int iId) {
PredefinedColorPointer color(Color::predefinedColorSet.predefinedColorFromId(iId));
return jsColorFrom(color);
};

Q_INVOKABLE QScriptValue ColorJSProxy::predefinedColorsList() {
return m_predefinedColorsList;
}

QScriptValue ColorJSProxy::jsColorFrom(PredefinedColorPointer predefinedColor) {
QScriptValue jsColor = m_pScriptEngine->newObject();
jsColor.setProperty("red", predefinedColor->m_defaultRgba.red());
jsColor.setProperty("green", predefinedColor->m_defaultRgba.green());
jsColor.setProperty("blue", predefinedColor->m_defaultRgba.blue());
jsColor.setProperty("alpha", predefinedColor->m_defaultRgba.alpha());
jsColor.setProperty("id", predefinedColor->m_iId);
return jsColor;
}

QScriptValue ColorJSProxy::makePredefinedColorsList(QScriptEngine* pScriptEngine) {
int numColors = Color::predefinedColorSet.allColors.length();
QScriptValue colorList = pScriptEngine->newArray(numColors);
for (int i = 0; i < numColors; ++i) {
PredefinedColorPointer color = Color::predefinedColorSet.allColors.at(i);
colorList.setProperty(i, jsColorFrom(color));
}
return colorList;
}
27 changes: 27 additions & 0 deletions src/controllers/colorjsproxy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef COLORJSPROXY_H
#define COLORJSPROXY_H

#include <QObject>
#include <QScriptEngine>
#include <QScriptValue>

#include "util/color/color.h"

class ColorJSProxy: public QObject {
Q_OBJECT
public:
ColorJSProxy(QScriptEngine* pScriptEngine);

virtual ~ColorJSProxy();

Q_INVOKABLE QScriptValue predefinedColorFromId(int iId);
Q_INVOKABLE QScriptValue predefinedColorsList();

private:
QScriptValue jsColorFrom(PredefinedColorPointer predefinedColor);
QScriptValue makePredefinedColorsList(QScriptEngine* pScriptEngine);
QScriptEngine* m_pScriptEngine;
QScriptValue m_predefinedColorsList;
};

#endif /* COLORJSPROXY_H */
4 changes: 4 additions & 0 deletions src/controllers/controllerengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ void ControllerEngine::gracefulShutdown() {
++it;
}

m_pColorJSProxy.reset();
delete m_pBaClass;
m_pBaClass = nullptr;
}
Expand Down Expand Up @@ -212,6 +213,9 @@ void ControllerEngine::initializeScriptEngine() {
engineGlobalObject.setProperty("midi", m_pEngine->newQObject(m_pController));
}

m_pColorJSProxy = std::make_unique<ColorJSProxy>(m_pEngine);
engineGlobalObject.setProperty("color", m_pEngine->newQObject(m_pColorJSProxy.get()));

m_pBaClass = new ByteArrayClass(m_pEngine);
engineGlobalObject.setProperty("ByteArray", m_pBaClass->constructor());
}
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/controllerengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
#include "bytearrayclass.h"
#include "preferences/usersettings.h"
#include "controllers/controllerpreset.h"
#include "controllers/colorjsproxy.h"
#include "controllers/softtakeover.h"
#include "util/alphabetafilter.h"
#include "util/duration.h"
#include "util/memory.h"

// Forward declaration(s)
class Controller;
Expand Down Expand Up @@ -204,6 +206,7 @@ class ControllerEngine : public QObject {
QHash<int, TimerInfo> m_timers;
SoftTakeoverCtrl m_st;
ByteArrayClass* m_pBaClass;
std::unique_ptr<ColorJSProxy> m_pColorJSProxy;
// 256 (default) available virtual decks is enough I would think.
// If more are needed at run-time, these will move to the heap automatically
QVarLengthArray<int> m_intervalAccumulator;
Expand Down
14 changes: 14 additions & 0 deletions src/controllers/controlpickermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,20 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
addDeckControl("waveform_zoom", tr("Waveform Zoom"), tr("Waveform zoom"), guiMenu);
addDeckControl("waveform_zoom_down", tr("Waveform Zoom In"), tr("Zoom waveform in"), guiMenu);
addDeckControl("waveform_zoom_up", tr("Waveform Zoom Out"), tr("Zoom waveform out"), guiMenu);

// Controls to change a deck's star rating
QString starsUpTitle = tr("Star Rating Up");
QString starsUpDescription = tr("Increase the track rating by one star");
QString starsDownTitle = tr("Star Rating Down");
QString starsDownDescription = tr("Decrease the track rating by one star");
for (int i = 1; i <= iNumDecks; ++i) {
addControl(QString("[Deck%1]").arg(i), "stars_up",
QString("%1: %2").arg(m_deckStr.arg(i), starsUpTitle),
QString("%1: %2").arg(m_deckStr.arg(i), starsUpDescription), guiMenu);
addControl(QString("[Deck%1]").arg(i), "stars_down",
QString("%1: %2").arg(m_deckStr.arg(i), starsDownTitle),
QString("%1: %2").arg(m_deckStr.arg(i), starsDownDescription), guiMenu);
}
}

ControlPickerMenu::~ControlPickerMenu() {
Expand Down
1 change: 0 additions & 1 deletion src/effects/builtin/balanceeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace {
const double kMaxCornerHz = 500;
const double kMinCornerHz = 16;
const unsigned int kStartupSamplerate = 44100;
} // anonymous namespace

// static
Expand Down
1 change: 0 additions & 1 deletion src/effects/builtin/moogladder4filtereffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

static const double kMinCorner = 0.0003; // 13 Hz @ 44100
static const double kMaxCorner = 0.5; // 22050 Hz @ 44100
static const unsigned int kStartupSamplerate = 44100;

// static
QString MoogLadder4FilterEffect::getId() {
Expand Down
20 changes: 20 additions & 0 deletions src/engine/controls/cuecontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "control/controlindicator.h"
#include "vinylcontrol/defs_vinylcontrol.h"
#include "util/sample.h"
#include "util/color/color.h"

// TODO: Convert these doubles to a standard enum
// and convert elseif logic to switch statements
Expand Down Expand Up @@ -297,6 +298,7 @@ void CueControl::trackCuesUpdated() {
} else {
// If the old hotcue is the same, then we only need to update
pControl->setPosition(pCue->getPosition());
pControl->setColor(pCue->getColor());
}
// Add the hotcue to the list of active hotcues
active_hotcues.insert(hotcue);
Expand Down Expand Up @@ -1036,6 +1038,12 @@ HotcueControl::HotcueControl(QString group, int i)
m_hotcueEnabled = new ControlObject(keyForControl(i, "enabled"));
m_hotcueEnabled->setReadOnly();

// The id of the predefined color assigned to this color.
m_hotcueColor = new ControlObject(keyForControl(i, "color_id"));
connect(m_hotcueColor, SIGNAL(valueChanged(double)),
this, SLOT(slotHotcueColorChanged(double)),
Qt::DirectConnection);

m_hotcueSet = new ControlPushButton(keyForControl(i, "set"));
connect(m_hotcueSet, &ControlObject::valueChanged,
this, &HotcueControl::slotHotcueSet,
Expand Down Expand Up @@ -1075,6 +1083,7 @@ HotcueControl::HotcueControl(QString group, int i)
HotcueControl::~HotcueControl() {
delete m_hotcuePosition;
delete m_hotcueEnabled;
delete m_hotcueColor;
delete m_hotcueSet;
delete m_hotcueGoto;
delete m_hotcueGotoAndPlay;
Expand Down Expand Up @@ -1117,6 +1126,11 @@ void HotcueControl::slotHotcuePositionChanged(double newPosition) {
emit(hotcuePositionChanged(this, newPosition));
}

void HotcueControl::slotHotcueColorChanged(double newColorId) {
m_pCue->setColor(Color::predefinedColorSet.predefinedColorFromId(newColorId));
emit(hotcueColorChanged(this, newColorId));
}

double HotcueControl::getPosition() const {
return m_hotcuePosition->get();
}
Expand All @@ -1127,7 +1141,13 @@ void HotcueControl::setCue(CuePointer pCue) {
// because we have a null check for valid data else where in the code
m_pCue = pCue;
}
PredefinedColorPointer HotcueControl::getColor() const {
return Color::predefinedColorSet.predefinedColorFromId(m_hotcueColor->get());
}

void HotcueControl::setColor(PredefinedColorPointer newColor) {
m_hotcueColor->set(static_cast<double>(newColor->m_iId));
}
void HotcueControl::resetCue() {
// clear pCue first because we have a null check for valid data else where
// in the code
Expand Down
5 changes: 5 additions & 0 deletions src/engine/controls/cuecontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class HotcueControl : public QObject {
void setCue(CuePointer pCue);
void resetCue();
void setPosition(double position);
void setColor(PredefinedColorPointer newColor);
PredefinedColorPointer getColor() const;

// Used for caching the preview state of this hotcue control.
inline bool isPreviewing() {
Expand All @@ -54,6 +56,7 @@ class HotcueControl : public QObject {
void slotHotcueActivatePreview(double v);
void slotHotcueClear(double v);
void slotHotcuePositionChanged(double newPosition);
void slotHotcueColorChanged(double newColorId);

signals:
void hotcueSet(HotcueControl* pHotcue, double v);
Expand All @@ -64,6 +67,7 @@ class HotcueControl : public QObject {
void hotcueActivatePreview(HotcueControl* pHotcue, double v);
void hotcueClear(HotcueControl* pHotcue, double v);
void hotcuePositionChanged(HotcueControl* pHotcue, double newPosition);
void hotcueColorChanged(HotcueControl* pHotcue, double newColorId);
void hotcuePlay(double v);

private:
Expand All @@ -76,6 +80,7 @@ class HotcueControl : public QObject {
// Hotcue state controls
ControlObject* m_hotcuePosition;
ControlObject* m_hotcueEnabled;
ControlObject* m_hotcueColor;
// Hotcue button controls
ControlObject* m_hotcueSet;
ControlObject* m_hotcueGoto;
Expand Down
10 changes: 5 additions & 5 deletions src/library/dao/cue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

#include "library/dao/cue.h"
#include "util/assert.h"
#include "util/color/color.h"

namespace {
const QColor kDefaultColor = QColor("#FF0000");
const QString kDefaultLabel = ""; // empty string, not null
}

Expand All @@ -25,13 +25,13 @@ Cue::Cue(TrackId trackId)
m_length(0.0),
m_iHotCue(-1),
m_label(kDefaultLabel),
m_color(kDefaultColor) {
m_color(Color::predefinedColorSet.noColor) {
DEBUG_ASSERT(!m_label.isNull());
}


Cue::Cue(int id, TrackId trackId, Cue::CueType type, double position, double length,
int hotCue, QString label, QColor color)
int hotCue, QString label, PredefinedColorPointer color)
: m_bDirty(false),
m_iId(id),
m_trackId(trackId),
Expand Down Expand Up @@ -138,12 +138,12 @@ void Cue::setLabel(const QString label) {
emit(updated());
}

QColor Cue::getColor() const {
PredefinedColorPointer Cue::getColor() const {
QMutexLocker lock(&m_mutex);
return m_color;
}

void Cue::setColor(const QColor color) {
void Cue::setColor(const PredefinedColorPointer color) {
QMutexLocker lock(&m_mutex);
m_color = color;
m_bDirty = true;
Expand Down
Loading

0 comments on commit 319d5fd

Please sign in to comment.