Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions res/skins/Deere/library.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@

<Library>
<ShowButtonText>false</ShowButtonText>
<TrackTableBackgroundColorOpacity>0.125</TrackTableBackgroundColorOpacity>
</Library>

</Children>
Expand Down
1 change: 1 addition & 0 deletions res/skins/LateNight/library.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<BgColor>#585858</BgColor>
<FgColor>#eece33</FgColor>
<ShowButtonText>false</ShowButtonText>
<TrackTableBackgroundColorOpacity>0.125</TrackTableBackgroundColorOpacity>
</Library>

</Children>
Expand Down
3 changes: 2 additions & 1 deletion res/skins/Shade/skin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
Above the maximized library there are minimal decks which contain overview waveforms.
For the end-of-track warning in those overviews to work instances of scrolling waveforms
are required. We load in the maximzed library view, as well, but they are invisible as
they are 0px tall.
they are 0px tall.
############################################################################################
############################################################################################
-->
Expand Down Expand Up @@ -296,6 +296,7 @@
<Children>
<Library>
<ShowButtonText>false</ShowButtonText>
<TrackTableBackgroundColorOpacity>0.125</TrackTableBackgroundColorOpacity>
</Library>
</Children>
</SingletonDefinition>
Expand Down
1 change: 1 addition & 0 deletions res/skins/Tango/library.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Description:
<BgColor>#585858</BgColor>
<FgColor>#eece33</FgColor>
<ShowButtonText>false</ShowButtonText>
<TrackTableBackgroundColorOpacity>0.125</TrackTableBackgroundColorOpacity>
</Library>
</Children>
</WidgetGroup><!-- /Library Table -->
Expand Down
3 changes: 1 addition & 2 deletions src/library/autodj/autodjfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ void AutoDJFeature::bindLibraryWidget(
m_pConfig,
m_pLibrary,
m_pAutoDJProcessor,
keyboard,
libraryWidget->getShowButtonText());
keyboard);
libraryWidget->registerView(kViewName, m_pAutoDJView);
connect(m_pAutoDJView,
&DlgAutoDJ::loadTrack,
Expand Down
12 changes: 7 additions & 5 deletions src/library/autodj/dlgautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "util/assert.h"
#include "util/compatibility.h"
#include "util/duration.h"
#include "widget/wlibrary.h"
#include "widget/wtracktableview.h"

namespace {
Expand All @@ -15,19 +16,20 @@ const char* kRepeatPlaylistPreference = "Requeue";
} // anonymous namespace

DlgAutoDJ::DlgAutoDJ(
QWidget* parent,
WLibrary* parent,
UserSettingsPointer pConfig,
Library* pLibrary,
AutoDJProcessor* pProcessor,
KeyboardEventFilter* pKeyboard,
bool showButtonText)
KeyboardEventFilter* pKeyboard)
: QWidget(parent),
Ui::DlgAutoDJ(),
m_pConfig(pConfig),
m_pAutoDJProcessor(pProcessor),
m_pTrackTableView(new WTrackTableView(this, m_pConfig,
pLibrary->trackCollections(), /*no sorting*/ false)),
m_bShowButtonText(showButtonText),
pLibrary->trackCollections(),
parent->getTrackTableBackgroundColorOpacity(),
/*no sorting*/ false)),
m_bShowButtonText(parent->getShowButtonText()),
m_pAutoDJTableModel(nullptr) {
setupUi(this);

Expand Down
6 changes: 3 additions & 3 deletions src/library/autodj/dlgautodj.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
#include "controllers/keyboard/keyboardeventfilter.h"

class PlaylistTableModel;
class WLibrary;
class WTrackTableView;

class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView {
Q_OBJECT
public:
DlgAutoDJ(QWidget* parent,
DlgAutoDJ(WLibrary* parent,
UserSettingsPointer pConfig,
Library* pLibrary,
AutoDJProcessor* pProcessor,
KeyboardEventFilter* pKeyboard,
bool showButtonText);
KeyboardEventFilter* pKeyboard);
~DlgAutoDJ() override;

void onShow() override;
Expand Down
16 changes: 9 additions & 7 deletions src/library/basetracktablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
#include "util/assert.h"
#include "util/compatibility.h"
#include "util/logger.h"
#include "widget/wlibrarytableview.h"
#include "widget/wlibrary.h"
#include "widget/wtracktableview.h"

namespace {

const mixxx::Logger kLogger("BaseTrackTableModel");

const QString kEmptyString = QStringLiteral("");

// Alpha value for row color background (range 0 - 255)
constexpr int kTrackColorRowBackgroundOpacity = 0x20; // 12.5% opacity

const QStringList kDefaultTableColumns = {
LIBRARYTABLE_ALBUM,
LIBRARYTABLE_ALBUMARTIST,
Expand Down Expand Up @@ -98,7 +96,8 @@ BaseTrackTableModel::BaseTrackTableModel(
cloneDatabase(pTrackCollectionManager),
settingsNamespace),
m_pTrackCollectionManager(pTrackCollectionManager),
m_previewDeckGroup(PlayerManager::groupForPreviewDeck(0)) {
m_previewDeckGroup(PlayerManager::groupForPreviewDeck(0)),
m_backgroundColorOpacity(WLibrary::kDefaultTrackTableBackgroundColorOpacity) {
connect(&pTrackCollectionManager->internalCollection()->getTrackDAO(),
&TrackDAO::forceModelUpdate,
this,
Expand Down Expand Up @@ -356,10 +355,11 @@ bool BaseTrackTableModel::isColumnHiddenByDefault(

QAbstractItemDelegate* BaseTrackTableModel::delegateForColumn(
const int index, QObject* pParent) {
auto* pTableView = qobject_cast<WLibraryTableView*>(pParent);
auto* pTableView = qobject_cast<WTrackTableView*>(pParent);
VERIFY_OR_DEBUG_ASSERT(pTableView) {
return nullptr;
}
m_backgroundColorOpacity = pTableView->getBackgroundColorOpacity();
if (index == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_RATING)) {
return new StarDelegate(pTableView);
} else if (index == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_BPM)) {
Expand Down Expand Up @@ -411,7 +411,9 @@ QVariant BaseTrackTableModel::data(
}
auto bgColor = mixxx::RgbColor::toQColor(trackColor);
DEBUG_ASSERT(bgColor.isValid());
bgColor.setAlpha(kTrackColorRowBackgroundOpacity);
DEBUG_ASSERT(m_backgroundColorOpacity >= 0.0);
DEBUG_ASSERT(m_backgroundColorOpacity <= 1.0);
bgColor.setAlphaF(m_backgroundColorOpacity);
return QBrush(bgColor);
}

Expand Down
5 changes: 4 additions & 1 deletion src/library/basetracktablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

class BaseCoverArtDelegate;
class TrackCollectionManager;
class WLibraryTableView;

class BaseTrackTableModel : public QAbstractTableModel, public TrackModel {
Q_OBJECT
Expand All @@ -19,7 +20,7 @@ class BaseTrackTableModel : public QAbstractTableModel, public TrackModel {
explicit BaseTrackTableModel(
const char* settingsNamespace,
TrackCollectionManager* const pTrackCollectionManager,
QObject* parent = nullptr);
QObject* parent);
~BaseTrackTableModel() override = default;

///////////////////////////////////////////////////////
Expand Down Expand Up @@ -200,6 +201,8 @@ class BaseTrackTableModel : public QAbstractTableModel, public TrackModel {

const QString m_previewDeckGroup;

double m_backgroundColorOpacity;

ColumnCache m_columnCache;

struct ColumnHeader {
Expand Down
9 changes: 7 additions & 2 deletions src/library/dlganalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
#include "library/trackcollectionmanager.h"
#include "library/dlganalysis.h"
#include "library/library.h"
#include "widget/wlibrary.h"
#include "util/assert.h"

DlgAnalysis::DlgAnalysis(QWidget* parent,
DlgAnalysis::DlgAnalysis(WLibrary* parent,
UserSettingsPointer pConfig,
Library* pLibrary)
: QWidget(parent),
Expand All @@ -20,7 +21,11 @@ DlgAnalysis::DlgAnalysis(QWidget* parent,
m_songsButtonGroup.addButton(radioButtonRecentlyAdded);
m_songsButtonGroup.addButton(radioButtonAllSongs);

m_pAnalysisLibraryTableView = new WAnalysisLibraryTableView(this, pConfig, pLibrary->trackCollections());
m_pAnalysisLibraryTableView = new WAnalysisLibraryTableView(
this,
pConfig,
pLibrary->trackCollections(),
parent->getTrackTableBackgroundColorOpacity());
connect(m_pAnalysisLibraryTableView,
&WAnalysisLibraryTableView::loadTrack,
this,
Expand Down
3 changes: 2 additions & 1 deletion src/library/dlganalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
class AnalysisLibraryTableModel;
class WAnalysisLibraryTableView;
class Library;
class WLibrary;

class DlgAnalysis : public QWidget, public Ui::DlgAnalysis, public virtual LibraryView {
Q_OBJECT
public:
DlgAnalysis(QWidget *parent,
DlgAnalysis(WLibrary *parent,
UserSettingsPointer pConfig,
Library* pLibrary);
~DlgAnalysis() override = default;
Expand Down
22 changes: 15 additions & 7 deletions src/library/dlghidden.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@

#include "library/hiddentablemodel.h"
#include "library/trackcollectionmanager.h"
#include "widget/wlibrary.h"
#include "widget/wtracktableview.h"
#include "util/assert.h"

DlgHidden::DlgHidden(QWidget* parent, UserSettingsPointer pConfig,
Library* pLibrary,
KeyboardEventFilter* pKeyboard)
: QWidget(parent),
Ui::DlgHidden(),
m_pTrackTableView(
new WTrackTableView(this, pConfig, pLibrary->trackCollections(), false)) {
DlgHidden::DlgHidden(
WLibrary* parent,
UserSettingsPointer pConfig,
Library* pLibrary,
KeyboardEventFilter* pKeyboard)
: QWidget(parent),
Ui::DlgHidden(),
m_pTrackTableView(
new WTrackTableView(
this,
pConfig,
pLibrary->trackCollections(),
parent->getTrackTableBackgroundColorOpacity(),
false)) {
setupUi(this);
m_pTrackTableView->installEventFilter(pKeyboard);

Expand Down
3 changes: 2 additions & 1 deletion src/library/dlghidden.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "library/libraryview.h"
#include "controllers/keyboard/keyboardeventfilter.h"

class WLibrary;
class WTrackTableView;
class HiddenTableModel;
class QItemSelection;
Expand All @@ -16,7 +17,7 @@ class DlgHidden : public QWidget, public Ui::DlgHidden, public LibraryView {
Q_OBJECT

public:
DlgHidden(QWidget* parent, UserSettingsPointer pConfig,
DlgHidden(WLibrary* parent, UserSettingsPointer pConfig,
Library* pLibrary,
KeyboardEventFilter* pKeyboard);
~DlgHidden() override;
Expand Down
22 changes: 15 additions & 7 deletions src/library/dlgmissing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@

#include "library/missingtablemodel.h"
#include "library/trackcollectionmanager.h"
#include "widget/wlibrary.h"
#include "widget/wtracktableview.h"
#include "util/assert.h"

DlgMissing::DlgMissing(QWidget* parent, UserSettingsPointer pConfig,
Library* pLibrary,
KeyboardEventFilter* pKeyboard)
: QWidget(parent),
Ui::DlgMissing(),
m_pTrackTableView(
new WTrackTableView(this, pConfig, pLibrary->trackCollections(), false)) {
DlgMissing::DlgMissing(
WLibrary* parent,
UserSettingsPointer pConfig,
Library* pLibrary,
KeyboardEventFilter* pKeyboard)
: QWidget(parent),
Ui::DlgMissing(),
m_pTrackTableView(
new WTrackTableView(
this,
pConfig,
pLibrary->trackCollections(),
parent->getTrackTableBackgroundColorOpacity(),
false)) {
setupUi(this);
m_pTrackTableView->installEventFilter(pKeyboard);

Expand Down
3 changes: 2 additions & 1 deletion src/library/dlgmissing.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
#include "library/libraryview.h"
#include "controllers/keyboard/keyboardeventfilter.h"

class WLibrary;
class WTrackTableView;
class MissingTableModel;

class DlgMissing : public QWidget, public Ui::DlgMissing, public LibraryView {
Q_OBJECT

public:
DlgMissing(QWidget* parent, UserSettingsPointer pConfig,
DlgMissing(WLibrary* parent, UserSettingsPointer pConfig,
Library* pLibrary,
KeyboardEventFilter* pKeyboard);
~DlgMissing() override;
Expand Down
1 change: 1 addition & 0 deletions src/library/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ void Library::bindLibraryWidget(WLibrary* pLibraryWidget,
pLibraryWidget,
m_pConfig,
m_pTrackCollectionManager,
pLibraryWidget->getTrackTableBackgroundColorOpacity(),
true);
pTrackTableView->installEventFilter(pKeyboard);
connect(this,
Expand Down
18 changes: 14 additions & 4 deletions src/library/recording/dlgrecording.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@
#include "library/trackcollectionmanager.h"
#include "widget/wwidget.h"
#include "widget/wskincolor.h"
#include "widget/wlibrary.h"
#include "widget/wtracktableview.h"
#include "util/assert.h"

DlgRecording::DlgRecording(QWidget* parent, UserSettingsPointer pConfig,
Library* pLibrary,
RecordingManager* pRecordingManager, KeyboardEventFilter* pKeyboard)
DlgRecording::DlgRecording(
WLibrary* parent,
UserSettingsPointer pConfig,
Library* pLibrary,
RecordingManager* pRecordingManager,
KeyboardEventFilter* pKeyboard)
: QWidget(parent),
m_pConfig(pConfig),
m_pTrackTableView(new WTrackTableView(this, pConfig, pLibrary->trackCollections(), true)),
m_pTrackTableView(
new WTrackTableView(
this,
pConfig,
pLibrary->trackCollections(),
parent->getTrackTableBackgroundColorOpacity(),
true)),
m_browseModel(this, pLibrary->trackCollections(), pRecordingManager),
m_proxyModel(&m_browseModel),
m_bytesRecordedStr("--"),
Expand Down
3 changes: 2 additions & 1 deletion src/library/recording/dlgrecording.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@

class PlaylistTableModel;
class QSqlTableModel;
class WLibrary;
class WTrackTableView;

class DlgRecording : public QWidget, public Ui::DlgRecording, public virtual LibraryView {
Q_OBJECT
public:
DlgRecording(QWidget *parent, UserSettingsPointer pConfig,
DlgRecording(WLibrary *parent, UserSettingsPointer pConfig,
Library* pLibrary,
RecordingManager* pRecManager, KeyboardEventFilter* pKeyboard);
~DlgRecording() override;
Expand Down
8 changes: 4 additions & 4 deletions src/skin/skincontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ class SkinContext {
return nodeToString(child);
}

inline float selectFloat(const QDomNode& node, const QString& nodeName) const {
inline float selectFloat(const QDomNode& node, const QString& nodeName, float defaultValue = 0.0) const {
bool ok = false;
float conv = nodeToString(selectElement(node, nodeName)).toFloat(&ok);
return ok ? conv : 0.0f;
return ok ? conv : defaultValue;
}

inline double selectDouble(const QDomNode& node, const QString& nodeName) const {
inline double selectDouble(const QDomNode& node, const QString& nodeName, double defaultValue = 0.0) const {
bool ok = false;
double conv = nodeToString(selectElement(node, nodeName)).toDouble(&ok);
return ok ? conv : 0.0;
return ok ? conv : defaultValue;
}

inline int selectInt(const QDomNode& node, const QString& nodeName,
Expand Down
Loading