Includes, comments and bugfixes

- Fix includes
- Use common regex (Song::kCoverRemoveDisc) for removing Disc/CD from album
- Remove Disc/CD from album when creating hash
- Make imobiledevice support compile
- Fix setting device on windows
This commit is contained in:
Jonas Kvinge
2018-05-01 00:41:33 +02:00
parent fccbd6790c
commit e337b7933b
518 changed files with 7003 additions and 4693 deletions

View File

@@ -24,10 +24,21 @@
#include "config.h"
#include <memory>
#include <cstddef>
#include <stdbool.h>
#include <QObject>
#include <QMimeData>
#include <QModelIndex>
#include <QAbstractItemModel>
#include <QAbstractProxyModel>
#include <QPersistentModelIndex>
#include <QMap>
#include <QVariant>
#include <QString>
#include <QStringList>
std::size_t hash_value(const QModelIndex& index);
std::size_t hash_value(const QModelIndex &index);
class MergedProxyModelPrivate;
@@ -35,71 +46,68 @@ class MergedProxyModel : public QAbstractProxyModel {
Q_OBJECT
public:
explicit MergedProxyModel(QObject* parent = nullptr);
explicit MergedProxyModel(QObject *parent = nullptr);
~MergedProxyModel();
// Make another model appear as a child of the given item in the source model.
void AddSubModel(const QModelIndex& source_parent, QAbstractItemModel* submodel);
void RemoveSubModel(const QModelIndex& source_parent);
void AddSubModel(const QModelIndex &source_parent, QAbstractItemModel *submodel);
void RemoveSubModel(const QModelIndex &source_parent);
// Find the item in the source model that is the parent of the model
// containing proxy_index. If proxy_index is in the source model, then
// this just returns mapToSource(proxy_index).
QModelIndex FindSourceParent(const QModelIndex& proxy_index) const;
// Find the item in the source model that is the parent of the model containing proxy_index.
// If proxy_index is in the source model, then this just returns mapToSource(proxy_index).
QModelIndex FindSourceParent(const QModelIndex &proxy_index) const;
// QAbstractItemModel
QModelIndex index(int row, int column, const QModelIndex& parent) const;
QModelIndex parent(const QModelIndex& child) const;
int rowCount(const QModelIndex& parent) const;
int columnCount(const QModelIndex& parent) const;
QModelIndex index(int row, int column, const QModelIndex &parent) const;
QModelIndex parent(const QModelIndex &child) const;
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const;
bool hasChildren(const QModelIndex& parent) const;
QMap<int, QVariant> itemData(const QModelIndex& proxyIndex) const;
Qt::ItemFlags flags(const QModelIndex& index) const;
bool setData(const QModelIndex& index, const QVariant& value, int role);
bool hasChildren(const QModelIndex &parent) const;
QMap<int, QVariant> itemData(const QModelIndex &proxyIndex) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
QStringList mimeTypes() const;
QMimeData* mimeData(const QModelIndexList& indexes) const;
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
bool canFetchMore(const QModelIndex& parent) const;
void fetchMore(const QModelIndex& parent);
QMimeData *mimeData(const QModelIndexList &indexes) const;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
bool canFetchMore(const QModelIndex &parent) const;
void fetchMore(const QModelIndex &parent);
// QAbstractProxyModel
// Note that these implementations of map{To,From}Source will not always
// give you an index in sourceModel(), you might get an index in one of the
// child models instead.
QModelIndex mapFromSource(const QModelIndex& sourceIndex) const;
QModelIndex mapToSource(const QModelIndex& proxyIndex) const;
void setSourceModel(QAbstractItemModel* sourceModel);
// Note that these implementations of map{To,From}Source will not always give you an index in sourceModel(),
// you might get an index in one of the child models instead.
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
void setSourceModel(QAbstractItemModel *sourceModel);
// Convenience functions that call map{To,From}Source multiple times.
QModelIndexList mapFromSource(const QModelIndexList& source_indexes) const;
QModelIndexList mapToSource(const QModelIndexList& proxy_indexes) const;
QModelIndexList mapFromSource(const QModelIndexList &source_indexes) const;
QModelIndexList mapToSource(const QModelIndexList &proxy_indexes) const;
signals:
void SubModelReset(const QModelIndex& root, QAbstractItemModel* model);
void SubModelReset(const QModelIndex &root, QAbstractItemModel *model);
private slots:
void SourceModelReset();
void SubModelReset();
void RowsAboutToBeInserted(const QModelIndex& source_parent, int start, int end);
void RowsInserted(const QModelIndex& source_parent, int start, int end);
void RowsAboutToBeRemoved(const QModelIndex& source_parent, int start, int end);
void RowsRemoved(const QModelIndex& source_parent, int start, int end);
void DataChanged(const QModelIndex& top_left, const QModelIndex& bottom_right);
void RowsAboutToBeInserted(const QModelIndex &source_parent, int start, int end);
void RowsInserted(const QModelIndex &source_parent, int start, int end);
void RowsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end);
void RowsRemoved(const QModelIndex &source_parent, int start, int end);
void DataChanged(const QModelIndex &top_left, const QModelIndex &bottom_right);
void LayoutAboutToBeChanged();
void LayoutChanged();
private:
QModelIndex GetActualSourceParent(const QModelIndex& source_parent,
QAbstractItemModel* model) const;
QAbstractItemModel* GetModel(const QModelIndex& source_index) const;
QModelIndex GetActualSourceParent(const QModelIndex &source_parent, QAbstractItemModel *model) const;
QAbstractItemModel *GetModel(const QModelIndex &source_index) const;
void DeleteAllMappings();
bool IsKnownModel(const QAbstractItemModel* model) const;
bool IsKnownModel(const QAbstractItemModel *model) const;
QMap<QAbstractItemModel*, QPersistentModelIndex> merge_points_;
QAbstractItemModel* resetting_model_;
QAbstractItemModel *resetting_model_;
QMap<QAbstractItemModel*, QModelIndex> old_merge_points_;