Formatting and remove unused icons

This commit is contained in:
Jonas Kvinge 2018-09-14 23:05:58 +02:00
parent be3862ec40
commit 1a7465ba94
19 changed files with 36 additions and 47 deletions

View File

@ -74,7 +74,6 @@
<file>icons/128x128/go-previous.png</file> <file>icons/128x128/go-previous.png</file>
<file>icons/128x128/go-up.png</file> <file>icons/128x128/go-up.png</file>
<file>icons/128x128/gstreamer.png</file> <file>icons/128x128/gstreamer.png</file>
<file>icons/128x128/guitar.png</file>
<file>icons/128x128/headset.png</file> <file>icons/128x128/headset.png</file>
<file>icons/128x128/help-hint.png</file> <file>icons/128x128/help-hint.png</file>
<file>icons/128x128/intel.png</file> <file>icons/128x128/intel.png</file>
@ -94,7 +93,6 @@
<file>icons/128x128/play2.png</file> <file>icons/128x128/play2.png</file>
<file>icons/128x128/realtek.png</file> <file>icons/128x128/realtek.png</file>
<file>icons/128x128/search.png</file> <file>icons/128x128/search.png</file>
<file>icons/128x128/soundcard2.png</file>
<file>icons/128x128/soundcard.png</file> <file>icons/128x128/soundcard.png</file>
<file>icons/128x128/speaker.png</file> <file>icons/128x128/speaker.png</file>
<file>icons/128x128/star-grey.png</file> <file>icons/128x128/star-grey.png</file>
@ -161,7 +159,6 @@
<file>icons/64x64/go-previous.png</file> <file>icons/64x64/go-previous.png</file>
<file>icons/64x64/go-up.png</file> <file>icons/64x64/go-up.png</file>
<file>icons/64x64/gstreamer.png</file> <file>icons/64x64/gstreamer.png</file>
<file>icons/64x64/guitar.png</file>
<file>icons/64x64/headset.png</file> <file>icons/64x64/headset.png</file>
<file>icons/64x64/help-hint.png</file> <file>icons/64x64/help-hint.png</file>
<file>icons/64x64/intel.png</file> <file>icons/64x64/intel.png</file>
@ -182,7 +179,6 @@
<file>icons/64x64/pulseaudio.png</file> <file>icons/64x64/pulseaudio.png</file>
<file>icons/64x64/realtek.png</file> <file>icons/64x64/realtek.png</file>
<file>icons/64x64/search.png</file> <file>icons/64x64/search.png</file>
<file>icons/64x64/soundcard2.png</file>
<file>icons/64x64/soundcard.png</file> <file>icons/64x64/soundcard.png</file>
<file>icons/64x64/speaker.png</file> <file>icons/64x64/speaker.png</file>
<file>icons/64x64/star-grey.png</file> <file>icons/64x64/star-grey.png</file>
@ -248,7 +244,6 @@
<file>icons/48x48/go-previous.png</file> <file>icons/48x48/go-previous.png</file>
<file>icons/48x48/go-up.png</file> <file>icons/48x48/go-up.png</file>
<file>icons/48x48/gstreamer.png</file> <file>icons/48x48/gstreamer.png</file>
<file>icons/48x48/guitar.png</file>
<file>icons/48x48/headset.png</file> <file>icons/48x48/headset.png</file>
<file>icons/48x48/help-hint.png</file> <file>icons/48x48/help-hint.png</file>
<file>icons/48x48/intel.png</file> <file>icons/48x48/intel.png</file>
@ -272,7 +267,6 @@
<file>icons/48x48/pulseaudio.png</file> <file>icons/48x48/pulseaudio.png</file>
<file>icons/48x48/realtek.png</file> <file>icons/48x48/realtek.png</file>
<file>icons/48x48/search.png</file> <file>icons/48x48/search.png</file>
<file>icons/48x48/soundcard2.png</file>
<file>icons/48x48/soundcard.png</file> <file>icons/48x48/soundcard.png</file>
<file>icons/48x48/speaker.png</file> <file>icons/48x48/speaker.png</file>
<file>icons/48x48/star-grey.png</file> <file>icons/48x48/star-grey.png</file>
@ -338,7 +332,6 @@
<file>icons/32x32/go-previous.png</file> <file>icons/32x32/go-previous.png</file>
<file>icons/32x32/go-up.png</file> <file>icons/32x32/go-up.png</file>
<file>icons/32x32/gstreamer.png</file> <file>icons/32x32/gstreamer.png</file>
<file>icons/32x32/guitar.png</file>
<file>icons/32x32/headset.png</file> <file>icons/32x32/headset.png</file>
<file>icons/32x32/help-hint.png</file> <file>icons/32x32/help-hint.png</file>
<file>icons/32x32/intel.png</file> <file>icons/32x32/intel.png</file>
@ -362,7 +355,6 @@
<file>icons/32x32/pulseaudio.png</file> <file>icons/32x32/pulseaudio.png</file>
<file>icons/32x32/realtek.png</file> <file>icons/32x32/realtek.png</file>
<file>icons/32x32/search.png</file> <file>icons/32x32/search.png</file>
<file>icons/32x32/soundcard2.png</file>
<file>icons/32x32/soundcard.png</file> <file>icons/32x32/soundcard.png</file>
<file>icons/32x32/speaker.png</file> <file>icons/32x32/speaker.png</file>
<file>icons/32x32/star-grey.png</file> <file>icons/32x32/star-grey.png</file>
@ -429,7 +421,6 @@
<file>icons/22x22/go-previous.png</file> <file>icons/22x22/go-previous.png</file>
<file>icons/22x22/go-up.png</file> <file>icons/22x22/go-up.png</file>
<file>icons/22x22/gstreamer.png</file> <file>icons/22x22/gstreamer.png</file>
<file>icons/22x22/guitar.png</file>
<file>icons/22x22/headset.png</file> <file>icons/22x22/headset.png</file>
<file>icons/22x22/help-hint.png</file> <file>icons/22x22/help-hint.png</file>
<file>icons/22x22/intel.png</file> <file>icons/22x22/intel.png</file>
@ -453,7 +444,6 @@
<file>icons/22x22/pulseaudio.png</file> <file>icons/22x22/pulseaudio.png</file>
<file>icons/22x22/realtek.png</file> <file>icons/22x22/realtek.png</file>
<file>icons/22x22/search.png</file> <file>icons/22x22/search.png</file>
<file>icons/22x22/soundcard2.png</file>
<file>icons/22x22/soundcard.png</file> <file>icons/22x22/soundcard.png</file>
<file>icons/22x22/speaker.png</file> <file>icons/22x22/speaker.png</file>
<file>icons/22x22/star-grey.png</file> <file>icons/22x22/star-grey.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@ -109,12 +109,14 @@ void CollectionBackend::ChangeDirPath(int id, const QString &old_path, const QSt
ScopedTransaction t(&db); ScopedTransaction t(&db);
// Do the dirs table // Do the dirs table
QSqlQuery q(db); {
q.prepare(QString("UPDATE %1 SET path=:path WHERE ROWID=:id").arg(dirs_table_)); QSqlQuery q(db);
q.bindValue(":path", new_path); q.prepare(QString("UPDATE %1 SET path=:path WHERE ROWID=:id").arg(dirs_table_));
q.bindValue(":id", id); q.bindValue(":path", new_path);
q.exec(); q.bindValue(":id", id);
if (db_->CheckErrors(q)) return; q.exec();
if (db_->CheckErrors(q)) return;
}
const QByteArray old_url = QUrl::fromLocalFile(old_path).toEncoded(); const QByteArray old_url = QUrl::fromLocalFile(old_path).toEncoded();
const QByteArray new_url = QUrl::fromLocalFile(new_path).toEncoded(); const QByteArray new_url = QUrl::fromLocalFile(new_path).toEncoded();
@ -122,20 +124,24 @@ void CollectionBackend::ChangeDirPath(int id, const QString &old_path, const QSt
const int path_len = old_url.length(); const int path_len = old_url.length();
// Do the subdirs table // Do the subdirs table
q = QSqlQuery(db); {
q.prepare(QString("UPDATE %1 SET path=:path || substr(path, %2) WHERE directory=:id").arg(subdirs_table_).arg(path_len)); QSqlQuery q(db);
q.bindValue(":path", new_url); q.prepare(QString("UPDATE %1 SET path=:path || substr(path, %2) WHERE directory=:id").arg(subdirs_table_).arg(path_len));
q.bindValue(":id", id); q.bindValue(":path", new_url);
q.exec(); q.bindValue(":id", id);
if (db_->CheckErrors(q)) return; q.exec();
if (db_->CheckErrors(q)) return;
}
// Do the songs table // Do the songs table
q = QSqlQuery(db); {
q.prepare(QString("UPDATE %1 SET filename=:path || substr(filename, %2) WHERE directory=:id").arg(songs_table_).arg(path_len)); QSqlQuery q(db);
q.bindValue(":path", new_url); q.prepare(QString("UPDATE %1 SET filename=:path || substr(filename, %2) WHERE directory=:id").arg(songs_table_).arg(path_len));
q.bindValue(":id", id); q.bindValue(":path", new_url);
q.exec(); q.bindValue(":id", id);
if (db_->CheckErrors(q)) return; q.exec();
if (db_->CheckErrors(q)) return;
}
t.Commit(); t.Commit();

View File

@ -182,6 +182,7 @@ void CollectionModel::Init(bool async) {
void CollectionModel::SongsDiscovered(const SongList &songs) { void CollectionModel::SongsDiscovered(const SongList &songs) {
for (const Song &song : songs) { for (const Song &song : songs) {
// Sanity check to make sure we don't add songs that are outside the user's filter // Sanity check to make sure we don't add songs that are outside the user's filter
if (!query_options_.Matches(song)) continue; if (!query_options_.Matches(song)) continue;
@ -256,7 +257,6 @@ void CollectionModel::SongsDiscovered(const SongList &songs) {
// If we just created the damn thing then we don't need to continue into it any further because it'll get lazy-loaded properly later. // If we just created the damn thing then we don't need to continue into it any further because it'll get lazy-loaded properly later.
if (!container->lazy_loaded) break; if (!container->lazy_loaded) break;
} }
if (!container->lazy_loaded) continue; if (!container->lazy_loaded) continue;
// We've gone all the way down to the deepest level and everything was already lazy loaded, so now we have to create the song in the container. // We've gone all the way down to the deepest level and everything was already lazy loaded, so now we have to create the song in the container.
@ -1148,6 +1148,7 @@ CollectionItem *CollectionModel::ItemFromSong(GroupBy type, bool signal, bool cr
FinishItem(type, signal, create_divider, parent, item); FinishItem(type, signal, create_divider, parent, item);
if (s.url().scheme() == "cdda") item->lazy_loaded = true; if (s.url().scheme() == "cdda") item->lazy_loaded = true;
return item; return item;
} }

View File

@ -64,6 +64,7 @@ ConnectedDevice::ConnectedDevice(const QUrl &url, DeviceLister *lister, const QS
// Create the model // Create the model
model_ = new CollectionModel(backend_, app_, this); model_ = new CollectionModel(backend_, app_, this);
model_->Reset();
} }

View File

@ -75,7 +75,7 @@ DeviceItemDelegate::DeviceItemDelegate(QObject *parent)
void DeviceItemDelegate::paint(QPainter *p, const QStyleOptionViewItem &opt, const QModelIndex &index) const { void DeviceItemDelegate::paint(QPainter *p, const QStyleOptionViewItem &opt, const QModelIndex &index) const {
// Is it a device or a collection item? // Is it a device or a collection item?
if (index.data(DeviceManager::Role_State).isNull()) { if (index.data(DeviceManager::Role::Role_State).isNull()) {
CollectionItemDelegate::paint(p, opt, index); CollectionItemDelegate::paint(p, opt, index);
return; return;
} }
@ -203,10 +203,10 @@ void DeviceView::SetApplication(Application *app) {
merged_model_ = new MergedProxyModel(this); merged_model_ = new MergedProxyModel(this);
merged_model_->setSourceModel(sort_model_); merged_model_->setSourceModel(sort_model_);
setModel(merged_model_);
connect(merged_model_, SIGNAL(SubModelReset(QModelIndex, QAbstractItemModel*)), SLOT(RecursivelyExpand(QModelIndex))); connect(merged_model_, SIGNAL(SubModelReset(QModelIndex, QAbstractItemModel*)), SLOT(RecursivelyExpand(QModelIndex)));
setModel(merged_model_);
properties_dialog_->SetDeviceManager(app_->device_manager()); properties_dialog_->SetDeviceManager(app_->device_manager());
#ifdef HAVE_GSTREAMER #ifdef HAVE_GSTREAMER
@ -274,9 +274,7 @@ void DeviceView::contextMenuEvent(QContextMenuEvent *e) {
QModelIndex DeviceView::MapToDevice(const QModelIndex &merged_model_index) const { QModelIndex DeviceView::MapToDevice(const QModelIndex &merged_model_index) const {
QModelIndex sort_model_index = merged_model_->mapToSource(merged_model_index); QModelIndex sort_model_index = merged_model_->mapToSource(merged_model_index);
if (sort_model_index.model() != sort_model_) if (sort_model_index.model() != sort_model_) return QModelIndex();
return QModelIndex();
return sort_model_->mapToSource(sort_model_index); return sort_model_->mapToSource(sort_model_index);
} }
@ -285,7 +283,6 @@ QModelIndex DeviceView::FindParentDevice(const QModelIndex &merged_model_index)
QModelIndex index = merged_model_->FindSourceParent(merged_model_index); QModelIndex index = merged_model_->FindSourceParent(merged_model_index);
if (index.model() != sort_model_) return QModelIndex(); if (index.model() != sort_model_) return QModelIndex();
return sort_model_->mapToSource(index); return sort_model_->mapToSource(index);
} }
@ -296,7 +293,6 @@ QModelIndex DeviceView::MapToCollection(const QModelIndex &merged_model_index) c
if (const QSortFilterProxyModel *sort_model = qobject_cast<const QSortFilterProxyModel*>(sort_model_index.model())) { if (const QSortFilterProxyModel *sort_model = qobject_cast<const QSortFilterProxyModel*>(sort_model_index.model())) {
return sort_model->mapToSource(sort_model_index); return sort_model->mapToSource(sort_model_index);
} }
return QModelIndex(); return QModelIndex();
} }
@ -462,4 +458,3 @@ bool DeviceView::CanRecursivelyExpand(const QModelIndex &index) const {
// Never expand devices // Never expand devices
return index.parent().isValid(); return index.parent().isValid();
} }

View File

@ -50,12 +50,15 @@ class MergedProxyModel;
class OrganiseDialog; class OrganiseDialog;
class DeviceItemDelegate : public CollectionItemDelegate { class DeviceItemDelegate : public CollectionItemDelegate {
Q_OBJECT
public: public:
DeviceItemDelegate(QObject *parent); DeviceItemDelegate(QObject *parent);
static const int kIconPadding; static const int kIconPadding;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
}; };
class DeviceView : public AutoExpandingTreeView { class DeviceView : public AutoExpandingTreeView {

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>391</width> <width>300</width>
<height>396</height> <height>300</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -30,14 +30,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="DeviceView" name="view" native="true"> <widget class="DeviceView" name="view" native="true"/>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>