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
3 changes: 1 addition & 2 deletions src/library/autodj/dlgautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent,
m_pTrackTableView(new WTrackTableView(this,
m_pConfig,
pLibrary,
parent->getTrackTableBackgroundColorOpacity(),
/*no sorting*/ false)),
parent->getTrackTableBackgroundColorOpacity())),
m_bShowButtonText(parent->getShowButtonText()),
m_pAutoDJTableModel(nullptr) {
setupUi(this);
Expand Down
3 changes: 2 additions & 1 deletion src/library/baseexternalplaylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ TrackModel::Capabilities BaseExternalPlaylistModel::getCapabilities() const {
Capability::AddToAutoDJ |
Capability::LoadToDeck |
Capability::LoadToPreviewDeck |
Capability::LoadToSampler;
Capability::LoadToSampler |
Capability::Sorting;
}

QString BaseExternalPlaylistModel::modelKey(bool noSearch) const {
Expand Down
3 changes: 2 additions & 1 deletion src/library/baseexternaltrackmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,6 @@ TrackModel::Capabilities BaseExternalTrackModel::getCapabilities() const {
Capability::AddToAutoDJ |
Capability::LoadToDeck |
Capability::LoadToPreviewDeck |
Capability::LoadToSampler;
Capability::LoadToSampler |
Capability::Sorting;
}
3 changes: 2 additions & 1 deletion src/library/browse/browsetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ TrackModel::Capabilities BrowseTableModel::getCapabilities() const {
Capability::LoadToDeck |
Capability::LoadToPreviewDeck |
Capability::LoadToSampler |
Capability::RemoveFromDisk;
Capability::RemoveFromDisk |
Capability::Sorting;
}

QString BrowseTableModel::modelKey(bool noSearch) const {
Expand Down
3 changes: 1 addition & 2 deletions src/library/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,7 @@ void Library::bindLibraryWidget(
WTrackTableView* pTrackTableView = new WTrackTableView(m_pLibraryWidget,
m_pConfig,
this,
m_pLibraryWidget->getTrackTableBackgroundColorOpacity(),
true);
m_pLibraryWidget->getTrackTableBackgroundColorOpacity());
pTrackTableView->installEventFilter(pKeyboard);
connect(this,
&Library::showTrackModel,
Expand Down
3 changes: 2 additions & 1 deletion src/library/librarytablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,6 @@ TrackModel::Capabilities LibraryTableModel::getCapabilities() const {
Capability::ResetPlayed |
Capability::RemoveFromDisk |
Capability::Analyze |
Capability::Properties;
Capability::Properties |
Capability::Sorting;
}
3 changes: 1 addition & 2 deletions src/library/missing_hidden/dlghidden.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ DlgHidden::DlgHidden(
this,
pConfig,
pLibrary,
parent->getTrackTableBackgroundColorOpacity(),
true)) {
parent->getTrackTableBackgroundColorOpacity())) {
setupUi(this);
m_pTrackTableView->installEventFilter(pKeyboard);

Expand Down
3 changes: 1 addition & 2 deletions src/library/missing_hidden/dlgmissing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ DlgMissing::DlgMissing(
this,
pConfig,
pLibrary,
parent->getTrackTableBackgroundColorOpacity(),
true)) {
parent->getTrackTableBackgroundColorOpacity())) {
setupUi(this);
m_pTrackTableView->installEventFilter(pKeyboard);

Expand Down
3 changes: 2 additions & 1 deletion src/library/missing_hidden/hiddentablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ TrackModel::Capabilities HiddenTableModel::getCapabilities() const {
Capability::LoadToPreviewDeck |
Capability::ResetPlayed |
Capability::Analyze |
Capability::Properties;
Capability::Properties |
Capability::Sorting;
}

QString HiddenTableModel::modelKey(bool noSearch) const {
Expand Down
4 changes: 3 additions & 1 deletion src/library/missing_hidden/missingtablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ Qt::ItemFlags MissingTableModel::flags(const QModelIndex &index) const {
}

TrackModel::Capabilities MissingTableModel::getCapabilities() const {
return Capability::Purge | Capability::Properties;
return Capability::Purge |
Capability::Properties |
Capability::Sorting;
}

QString MissingTableModel::modelKey(bool noSearch) const {
Expand Down
5 changes: 3 additions & 2 deletions src/library/playlisttablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,9 @@ TrackModel::Capabilities PlaylistTableModel::getCapabilities() const {
m_pTrackCollectionManager->internalCollection()
->getPlaylistDAO()
.getPlaylistIdFromName(AUTODJ_TABLE)) {
// Only allow Add to AutoDJ if we aren't currently showing the AutoDJ queue.
caps |= Capability::AddToAutoDJ | Capability::RemovePlaylist;
// Only allow Add to AutoDJ and sorting if we aren't currently showing
// the AutoDJ queue.
caps |= Capability::AddToAutoDJ | Capability::RemovePlaylist | Capability::Sorting;
} else {
caps |= Capability::Remove;
}
Expand Down
3 changes: 1 addition & 2 deletions src/library/recording/dlgrecording.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ DlgRecording::DlgRecording(
this,
pConfig,
pLibrary,
parent->getTrackTableBackgroundColorOpacity(),
true)),
parent->getTrackTableBackgroundColorOpacity())),
m_browseModel(this, pLibrary->trackCollectionManager(), pRecordingManager),
m_proxyModel(&m_browseModel, true),
m_bytesRecordedStr("--"),
Expand Down
1 change: 1 addition & 0 deletions src/library/trackmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class TrackModel {
RemoveFromDisk = 1u << 16u,
Analyze = 1u << 17u,
Properties = 1u << 18u,
Sorting = 1u << 19u,
};
Q_DECLARE_FLAGS(Capabilities, Capability)

Expand Down
3 changes: 2 additions & 1 deletion src/library/trackset/crate/cratetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ TrackModel::Capabilities CrateTableModel::getCapabilities() const {
Capability::Hide |
Capability::RemoveFromDisk |
Capability::Analyze |
Capability::Properties;
Capability::Properties |
Capability::Sorting;

if (m_selectedCrate.isValid()) {
Crate crate;
Expand Down
3 changes: 1 addition & 2 deletions src/widget/wanalysislibrarytableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ WAnalysisLibraryTableView::WAnalysisLibraryTableView(
: WTrackTableView(parent,
pConfig,
pLibrary,
trackTableBackgroundColorOpacity,
true) {
trackTableBackgroundColorOpacity) {
setDragDropMode(QAbstractItemView::DragOnly);
setDragEnabled(true); //Always enable drag for now (until we have a model that doesn't support this.)
}
Expand Down
11 changes: 6 additions & 5 deletions src/widget/wtracktableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,19 @@ const ConfigKey kVScrollBarPosConfigKey{

} // anonymous namespace

WTrackTableView::WTrackTableView(QWidget* parent,
WTrackTableView::WTrackTableView(QWidget* pParent,
UserSettingsPointer pConfig,
Library* pLibrary,
double backgroundColorOpacity,
bool sorting)
: WLibraryTableView(parent, pConfig),
double backgroundColorOpacity)
: WLibraryTableView(pParent, pConfig),
m_pConfig(pConfig),
m_pLibrary(pLibrary),
m_backgroundColorOpacity(backgroundColorOpacity),
// Default color for the focus border of TableItemDelegates
m_focusBorderColor(Qt::white),
m_trackPlayedColor(QColor(kDefaultTrackPlayedColor)),
m_trackMissingColor(QColor(kDefaultTrackMissingColor)),
m_sorting(sorting),
m_sorting(false),
m_selectionChangedSinceLastGuiTick(true),
m_loadCachedOnly(false) {
// Connect slots and signals to make the world go 'round.
Expand Down Expand Up @@ -175,6 +174,8 @@ void WTrackTableView::loadTrackModel(QAbstractItemModel* model, bool restoreStat
return;
}

m_sorting = pTrackModel->hasCapabilities(TrackModel::Capability::Sorting);

// If the model has not changed there's no need to exchange the headers
// which would cause a small GUI freeze
if (getTrackModel() == pTrackModel) {
Expand Down
5 changes: 2 additions & 3 deletions src/widget/wtracktableview.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ class WTrackTableView : public WLibraryTableView {
Q_OBJECT
public:
WTrackTableView(
QWidget* parent,
QWidget* pParent,
UserSettingsPointer pConfig,
Library* pLibrary,
double backgroundColorOpacity,
bool sorting);
double backgroundColorOpacity);
~WTrackTableView() override;
void contextMenuEvent(QContextMenuEvent * event) override;
QString columnNameOfIndex(const QModelIndex& index) const;
Expand Down