Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Merge pull request #4037 from Holzhaus/qml-sidebar" #4414

Merged
merged 1 commit into from
Oct 13, 2021
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
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