Skip to content

Commit

Permalink
Merge pull request #4414 from Holzhaus/qml-sidebar-revert
Browse files Browse the repository at this point in the history
Revert "Merge pull request #4037 from Holzhaus/qml-sidebar"
  • Loading branch information
Be-ing authored Oct 13, 2021
2 parents 8bdaae6 + da5c7df commit 730d057
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 61 deletions.
35 changes: 1 addition & 34 deletions res/qml/Library.qml
Original file line number Diff line number Diff line change
@@ -1,48 +1,15 @@
import "." as Skin
import Mixxx 0.1 as Mixxx
import QtQuick 2.12
import QtQuick.Controls 1.4
import "Theme"

Item {
Rectangle {
color: Theme.deckBackgroundColor
anchors.fill: parent

TreeView {
id: sidebar

anchors.top: parent.top
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.margins: 10
width: 250
model: Mixxx.Library.getSidebarModel()

TableViewColumn {
title: "Icon"
role: "iconName"
width: 50

delegate: Image {
fillMode: Image.PreserveAspectFit
source: styleData.value ? "qrc:///images/library/ic_library_" + styleData.value + ".svg" : ""
}

}

TableViewColumn {
title: "Title"
role: "display"
}

}

ListView {
anchors.top: parent.top
anchors.left: sidebar.right
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.fill: parent
anchors.margins: 10
clip: true
model: Mixxx.Library.model
Expand Down
5 changes: 0 additions & 5 deletions src/library/library.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ class Library: public QObject {
/// Needed for exposing models to QML
LibraryTableModel* trackTableModel() const;

/// Needed for exposing sidebar to QML
SidebarModel* sidebarModel() const {
return m_pSidebarModel.get();
}

int getTrackTableRowHeight() const {
return m_iTrackTableRowHeight;
}
Expand Down
11 changes: 0 additions & 11 deletions src/library/sidebarmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ namespace {
// been chosen as a compromise between usability and responsiveness.
constexpr int kPressedUntilClickedTimeoutMillis = 300;

const QHash<int, QByteArray> kRoleNames = {
// Only roles that are useful in QML are added here.
{Qt::DisplayRole, "display"},
{Qt::ToolTipRole, "tooltip"},
{SidebarModel::IconNameRole, "iconName"},
};

} // anonymous namespace

SidebarModel::SidebarModel(
Expand Down Expand Up @@ -279,10 +272,6 @@ QVariant SidebarModel::data(const QModelIndex& index, int role) const {
}
}

QHash<int, QByteArray> SidebarModel::roleNames() const {
return kRoleNames;
}

void SidebarModel::startPressedUntilClickedTimer(const QModelIndex& pressedIndex) {
m_pressedIndex = pressedIndex;
m_pressedUntilClickedTimer->start(kPressedUntilClickedTimeoutMillis);
Expand Down
1 change: 0 additions & 1 deletion src/library/sidebarmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class SidebarModel : public QAbstractItemModel {
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index,
int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
bool dropAccept(const QModelIndex& index, const QList<QUrl>& urls, QObject* pSource);
bool dragMoveAccept(const QModelIndex& index, const QUrl& url);
bool hasChildren(const QModelIndex& parent = QModelIndex()) const override;
Expand Down
5 changes: 0 additions & 5 deletions src/qml/qmllibraryproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <QAbstractItemModel>

#include "library/library.h"
#include "library/sidebarmodel.h"

namespace mixxx {
namespace qml {
Expand All @@ -14,9 +13,5 @@ QmlLibraryProxy::QmlLibraryProxy(std::shared_ptr<Library> pLibrary, QObject* par
m_pModel(make_parented<QmlLibraryTrackListModel>(m_pLibrary->trackTableModel(), this)) {
}

QAbstractItemModel* QmlLibraryProxy::getSidebarModel() {
return m_pLibrary->sidebarModel();
}

} // namespace qml
} // namespace mixxx
5 changes: 0 additions & 5 deletions src/qml/qmllibraryproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
#include "util/parented_ptr.h"

class Library;
class SidebarModel;

QT_FORWARD_DECLARE_CLASS(QAbstractItemModel);

namespace mixxx {
namespace qml {
Expand All @@ -22,8 +19,6 @@ class QmlLibraryProxy : public QObject {
public:
explicit QmlLibraryProxy(std::shared_ptr<Library> pLibrary, QObject* parent = nullptr);

Q_INVOKABLE QAbstractItemModel* getSidebarModel();

private:
std::shared_ptr<Library> m_pLibrary;
parented_ptr<QmlLibraryTrackListModel> m_pModel;
Expand Down

0 comments on commit 730d057

Please sign in to comment.