Rewrite collection model and search

Fixes #392
This commit is contained in:
Jonas Kvinge
2021-06-27 22:54:08 +02:00
parent ea1e4541c0
commit e477449cd4
52 changed files with 2321 additions and 2637 deletions

View File

@@ -55,13 +55,14 @@ class ConnectedDevice;
class DeviceInfo : public SimpleTreeItem<DeviceInfo> {
public:
enum Type {
Type_Root,
Type_Device,
enum class Type {
Root,
Device,
};
explicit DeviceInfo(SimpleTreeModel<DeviceInfo> *_model)
: SimpleTreeItem<DeviceInfo>(Type_Root, _model),
: SimpleTreeItem<DeviceInfo>(_model),
type_(Type::Root),
database_id_(-1),
size_(0),
transcode_mode_(MusicStorage::TranscodeMode::Transcode_Unsupported),
@@ -71,7 +72,8 @@ class DeviceInfo : public SimpleTreeItem<DeviceInfo> {
forget_(false) {}
explicit DeviceInfo(const Type _type, DeviceInfo *_parent = nullptr)
: SimpleTreeItem<DeviceInfo>(_type, _parent),
: SimpleTreeItem<DeviceInfo>(_parent),
type_(_type),
database_id_(-1),
size_(0),
transcode_mode_(MusicStorage::TranscodeMode::Transcode_Unsupported),
@@ -101,6 +103,7 @@ class DeviceInfo : public SimpleTreeItem<DeviceInfo> {
// Gets the best backend available (the one with the highest priority)
const Backend *BestBackend() const;
Type type_;
int database_id_; // -1 if not remembered in the database
SharedPtr<ConnectedDevice> device_; // nullptr if not connected
QList<Backend> backends_;
@@ -122,4 +125,6 @@ class DeviceInfo : public SimpleTreeItem<DeviceInfo> {
Q_DISABLE_COPY(DeviceInfo)
};
Q_DECLARE_METATYPE(DeviceInfo::Type)
#endif // DEVICEINFO_H