Skip to content

Commit

Permalink
Merge commit '302b40eefe6948a7080d1ee87bedafdf48624f69' into autodj_t…
Browse files Browse the repository at this point in the history
…otal_time
  • Loading branch information
ninomp committed Feb 19, 2023
2 parents ef6a67c + 302b40e commit 55485d3
Show file tree
Hide file tree
Showing 52 changed files with 2,160 additions and 1,107 deletions.
1 change: 1 addition & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ technics
sord
doubleClick
sur
jus
779 changes: 460 additions & 319 deletions res/controllers/Denon-MC7000-scripts.js

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions res/controllers/Denon-MC7000.midi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<MixxxControllerPreset mixxxVersion="2.3.1" schemaVersion="1">
<info>
<name>Denon MC7000</name>
<author>OsZ</author>
<author>OsZ, JL</author>
<description>A professional 4-channel DJ controller featuring 2 separate audio interfaces. Please refer to the Mixxx user manual to get the audio interfaces working on Linux.</description>
<forums>https://mixxx.discourse.group/t/denon-mc7000-mapping/18235</forums>
<wiki>https://github.com/mixxxdj/mixxx/wiki/Denon-MC7000</wiki>
Expand Down Expand Up @@ -1355,42 +1355,42 @@
<!-- PLAY / CUE / SYNC -->
<control>
<group>[Channel1]</group>
<key>play</key>
<key>MC7000.play</key>
<description>Play Ch1</description>
<status>0x90</status>
<midino>0x00</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Channel2]</group>
<key>play</key>
<key>MC7000.play</key>
<description>Play Ch2</description>
<status>0x91</status>
<midino>0x00</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Channel3]</group>
<key>play</key>
<key>MC7000.play</key>
<description>Play Ch3</description>
<status>0x92</status>
<midino>0x00</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Channel4]</group>
<key>play</key>
<key>MC7000.play</key>
<description>Play Ch4</description>
<status>0x93</status>
<midino>0x00</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
Expand Down Expand Up @@ -1927,22 +1927,22 @@
<!-- PARAMETER BUTTONS -->
<control>
<group>[Channel1]</group>
<key>stars_down</key>
<key>MC7000.StarsDown</key>
<description></description>
<status>0x94</status>
<midino>0x28</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Channel1]</group>
<key>stars_up</key>
<key>MC7000.StarsUp</key>
<description></description>
<status>0x94</status>
<midino>0x29</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
Expand All @@ -1967,22 +1967,22 @@
</control>
<control>
<group>[Channel2]</group>
<key>stars_down</key>
<key>MC7000.StarsDown</key>
<description></description>
<status>0x95</status>
<midino>0x28</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Channel2]</group>
<key>stars_up</key>
<key>MC7000.StarsUp</key>
<description></description>
<status>0x95</status>
<midino>0x29</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
Expand All @@ -2007,22 +2007,22 @@
</control>
<control>
<group>[Channel3]</group>
<key>stars_down</key>
<key>MC7000.StarsDown</key>
<description></description>
<status>0x96</status>
<midino>0x28</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Channel3]</group>
<key>stars_up</key>
<key>MC7000.StarsUp</key>
<description></description>
<status>0x96</status>
<midino>0x29</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
Expand All @@ -2047,22 +2047,22 @@
</control>
<control>
<group>[Channel4]</group>
<key>stars_down</key>
<key>MC7000.StarsDown</key>
<description></description>
<status>0x97</status>
<midino>0x28</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Channel4]</group>
<key>stars_up</key>
<key>MC7000.StarsUp</key>
<description></description>
<status>0x97</status>
<midino>0x29</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
Expand Down
7 changes: 6 additions & 1 deletion src/dialog/dlgabout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ DlgAbout::DlgAbout()
<< "Somesh Metri"
<< "Maarten de Boer"
<< "Doteya"
<< "olafklingt";
<< "olafklingt"
<< "Bilal Ahmed Karbelkar"
<< "Alice Psykose"
<< "Jakob Leifhelm"
<< "Florian Goth"
<< "Chase Durand";

QStringList specialThanks;
specialThanks
Expand Down
9 changes: 5 additions & 4 deletions src/library/autodj/autodjfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,12 @@ void AutoDJFeature::slotCrateChanged(CrateId crateId) {
}
// No child item for crate found
// -> Create and append a new child item for this crate
QList<TreeItem*> rows;
rows.append(new TreeItem(crate.getName(), crate.getId().toVariant()));
// TODO() Use here std::span to get around the heap alloctaion of
// std::vector for a single element.
std::vector<std::unique_ptr<TreeItem>> rows;
rows.push_back(std::make_unique<TreeItem>(crate.getName(), crate.getId().toVariant()));
QModelIndex parentIndex = m_pSidebarModel->index(0, 0);
m_pSidebarModel->insertTreeItemRows(rows, m_crateList.length(), parentIndex);
DEBUG_ASSERT(rows.isEmpty()); // ownership passed to m_pSidebarModel
m_pSidebarModel->insertTreeItemRows(std::move(rows), m_crateList.length(), parentIndex);
m_crateList.append(crate);
} else {
// Crate does not exist or is not a source for AutoDJ
Expand Down
103 changes: 68 additions & 35 deletions src/library/banshee/bansheeplaylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,34 @@
#define CLM_PLAYCOUNT "timesplayed"
#define CLM_COMPOSER "composer"
#define CLM_PREVIEW "preview"
#define CLM_CRATE "crate"

namespace {

QAtomicInt sTableNumber;

const QString kTrackId = QStringLiteral(CLM_TRACK_ID);
const QString kViewOrder = QStringLiteral(CLM_VIEW_ORDER);
const QString kArtist = QStringLiteral(CLM_ARTIST);
const QString kTitle = QStringLiteral(CLM_TITLE);
const QString kDuration = QStringLiteral(CLM_DURATION);
const QString kUri = QStringLiteral(CLM_URI);
const QString kAlbum = QStringLiteral(CLM_ALBUM);
const QString kAlbumArtist = QStringLiteral(CLM_ALBUM_ARTIST);
const QString kYear = QStringLiteral(CLM_YEAR);
const QString kRating = QStringLiteral(CLM_RATING);
const QString kGenre = QStringLiteral(CLM_GENRE);
const QString kGrouping = QStringLiteral(CLM_GROUPING);
const QString kTracknumber = QStringLiteral(CLM_TRACKNUMBER);
const QString kDateadded = QStringLiteral(CLM_DATEADDED);
const QString kBpm = QStringLiteral(CLM_BPM);
const QString kBitrate = QStringLiteral(CLM_BITRATE);
const QString kComment = QStringLiteral(CLM_COMMENT);
const QString kPlaycount = QStringLiteral(CLM_PLAYCOUNT);
const QString kComposer = QStringLiteral(CLM_COMPOSER);
const QString kPreview = QStringLiteral(CLM_PREVIEW);
const QString kCrate = QStringLiteral(CLM_CRATE);

} // namespace

BansheePlaylistModel::BansheePlaylistModel(QObject* pParent, TrackCollectionManager* pTrackCollectionManager, BansheeDbConnection* pConnection)
Expand Down Expand Up @@ -169,41 +192,51 @@ void BansheePlaylistModel::setTableModel(int playlistId) {
}
}

QStringList tableColumns;
tableColumns
<< CLM_TRACK_ID // 0
<< CLM_VIEW_ORDER
<< CLM_PREVIEW; // 3

QStringList trackSourceColumns;
trackSourceColumns
<< CLM_TRACK_ID // 0
<< CLM_ARTIST
<< CLM_TITLE
<< CLM_DURATION
<< CLM_URI
<< CLM_ALBUM
<< CLM_ALBUM_ARTIST
<< CLM_YEAR
<< CLM_RATING
<< CLM_GENRE
<< CLM_GROUPING
<< CLM_TRACKNUMBER
<< CLM_DATEADDED
<< CLM_BPM
<< CLM_BITRATE
<< CLM_COMMENT
<< CLM_PLAYCOUNT
<< CLM_COMPOSER;

QSharedPointer<BaseTrackCache> trackSource(
new BaseTrackCache(m_pTrackCollectionManager->internalCollection(),
m_tempTableName,
CLM_TRACK_ID,
trackSourceColumns,
false));

setTable(m_tempTableName, CLM_TRACK_ID, tableColumns, trackSource);
const QString idColumn = kTrackId;

QStringList tableColumns = {
kTrackId,
kViewOrder,
kPreview};

QStringList trackSourceColumns = {
kTrackId,
kArtist,
kTitle,
kDuration,
kUri,
kAlbum,
kAlbumArtist,
kYear,
kRating,
kGenre,
kGrouping,
kTracknumber,
kDateadded,
kBpm,
kBitrate,
kComment,
kPlaycount,
kComposer};
QStringList searchColumns = {
kArtist,
kAlbum,
kAlbumArtist,
kUri,
kGrouping,
kComment,
kTitle,
kGenre};

auto trackSource = QSharedPointer<BaseTrackCache>::create(
m_pTrackCollectionManager->internalCollection(),
m_tempTableName,
idColumn,
std::move(trackSourceColumns),
std::move(searchColumns),
false);

setTable(m_tempTableName, idColumn, std::move(tableColumns), trackSource);
setSearch("");
setDefaultSort(fieldIndex(PLAYLISTTRACKSTABLE_POSITION), Qt::AscendingOrder);
setSort(defaultSortColumn(), defaultSortOrder());
Expand Down
7 changes: 4 additions & 3 deletions src/library/baseexternallibraryfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ void BaseExternalLibraryFeature::onRightClick(const QPoint& globalPos) {

void BaseExternalLibraryFeature::onRightClickChild(
const QPoint& globalPos, const QModelIndex& index) {
//Save the model index so we can get it in the action slots...
// Save the model index so we can get it in the action slots...
// Make sure that this is reset when the related TreeItem is deleted.
m_lastRightClickedIndex = index;
QMenu menu(m_pSidebarWidget);
menu.addAction(m_pAddToAutoDJAction);
Expand Down Expand Up @@ -133,8 +134,8 @@ void BaseExternalLibraryFeature::appendTrackIdsFromRightClickIndex(

DEBUG_ASSERT(pPlaylist);
*pPlaylist = m_lastRightClickedIndex.data().toString();
QScopedPointer<BaseSqlTableModel> pPlaylistModelToAdd(
getPlaylistModelForPlaylist(*pPlaylist));
std::unique_ptr<BaseSqlTableModel> pPlaylistModelToAdd(
createPlaylistModelForPlaylist(*pPlaylist));

if (!pPlaylistModelToAdd || !pPlaylistModelToAdd->initialized()) {
qDebug() << "BaseExternalLibraryFeature::appendTrackIdsFromRightClickIndex "
Expand Down
13 changes: 10 additions & 3 deletions src/library/baseexternallibraryfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
#include <QAction>
#include <QModelIndex>
#include <QPointer>
#include <memory>

#include "library/libraryfeature.h"
#include "library/dao/playlistdao.h"
#include "library/libraryfeature.h"
#include "util/parented_ptr.h"

class BaseSqlTableModel;
Expand All @@ -27,9 +28,10 @@ class BaseExternalLibraryFeature : public LibraryFeature {

protected:
// Must be implemented by external Libraries copied to Mixxx DB
virtual BaseSqlTableModel* getPlaylistModelForPlaylist(const QString& playlist) {
virtual std::unique_ptr<BaseSqlTableModel> createPlaylistModelForPlaylist(
const QString& playlist) {
Q_UNUSED(playlist);
return nullptr;
return {};
}
// Must be implemented by external Libraries not copied to Mixxx DB
virtual void appendTrackIdsFromRightClickIndex(QList<TrackId>* trackIds, QString* pPlaylist);
Expand All @@ -44,12 +46,17 @@ class BaseExternalLibraryFeature : public LibraryFeature {
QModelIndex lastRightClickedIndex() const {
return m_lastRightClickedIndex;
}
void clearLastRightClickedIndex() {
m_lastRightClickedIndex = QModelIndex();
};

TrackCollection* const m_pTrackCollection;

private:
void addToAutoDJ(PlaylistDAO::AutoDJSendLoc loc);

// Caution: Make sure this is reset whenever the library tree is updated,
// so that the internalPointer() does not become dangling
QModelIndex m_lastRightClickedIndex;

parented_ptr<QAction> m_pAddToAutoDJAction;
Expand Down
Loading

0 comments on commit 55485d3

Please sign in to comment.