Fix the height of items in the album cover manager, don't show artists with no albums, and add a status bar (currently unused)
This commit is contained in:
parent
6e73fc19a8
commit
7e1b54a779
@ -334,6 +334,22 @@ QStringList LibraryBackend::GetAllArtists(const QueryOptions& opt) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList LibraryBackend::GetAllArtistsWithAlbums(const QueryOptions& opt) {
|
||||||
|
LibraryQuery query(opt);
|
||||||
|
query.SetColumnSpec("DISTINCT artist");
|
||||||
|
query.AddCompilationRequirement(false);
|
||||||
|
query.AddWhere("album", "", "!=");
|
||||||
|
|
||||||
|
QMutexLocker l(db_->Mutex());
|
||||||
|
if (!ExecQuery(&query)) return QStringList();
|
||||||
|
|
||||||
|
QStringList ret;
|
||||||
|
while (query.Next()) {
|
||||||
|
ret << query.Value(0).toString();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
LibraryBackend::AlbumList LibraryBackend::GetAllAlbums(const QueryOptions &opt) {
|
LibraryBackend::AlbumList LibraryBackend::GetAllAlbums(const QueryOptions &opt) {
|
||||||
return GetAlbums(QString(), false, opt);
|
return GetAlbums(QString(), false, opt);
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ class LibraryBackend : public QObject {
|
|||||||
SubdirectoryList SubdirsInDirectory(int id);
|
SubdirectoryList SubdirsInDirectory(int id);
|
||||||
|
|
||||||
QStringList GetAllArtists(const QueryOptions& opt = QueryOptions());
|
QStringList GetAllArtists(const QueryOptions& opt = QueryOptions());
|
||||||
|
QStringList GetAllArtistsWithAlbums(const QueryOptions& opt = QueryOptions());
|
||||||
SongList GetSongs(const QString& artist, const QString& album, const QueryOptions& opt = QueryOptions());
|
SongList GetSongs(const QString& artist, const QString& album, const QueryOptions& opt = QueryOptions());
|
||||||
|
|
||||||
bool HasCompilations(const QueryOptions& opt = QueryOptions());
|
bool HasCompilations(const QueryOptions& opt = QueryOptions());
|
||||||
|
@ -48,14 +48,14 @@ LibraryQuery::LibraryQuery(const QueryOptions& options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryQuery::AddWhere(const QString& column, const QVariant& value) {
|
void LibraryQuery::AddWhere(const QString& column, const QVariant& value, const QString& op) {
|
||||||
// Do integers inline - sqlite seems to get confused when you pass integers
|
// Do integers inline - sqlite seems to get confused when you pass integers
|
||||||
// to bound parameters
|
// to bound parameters
|
||||||
|
|
||||||
if (value.type() == QVariant::Int)
|
if (value.type() == QVariant::Int)
|
||||||
where_clauses_ << QString("%1 = %2").arg(column, value.toString());
|
where_clauses_ << QString("%1 %2 %3").arg(column, op, value.toString());
|
||||||
else {
|
else {
|
||||||
where_clauses_ << QString("%1 = ?").arg(column);
|
where_clauses_ << QString("%1 %2 ?").arg(column, op);
|
||||||
bound_values_ << value;
|
bound_values_ << value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class LibraryQuery {
|
|||||||
|
|
||||||
void SetColumnSpec(const QString& spec) { column_spec_ = spec; }
|
void SetColumnSpec(const QString& spec) { column_spec_ = spec; }
|
||||||
void SetOrderBy(const QString& order_by) { order_by_ = order_by; }
|
void SetOrderBy(const QString& order_by) { order_by_ = order_by; }
|
||||||
void AddWhere(const QString& column, const QVariant& value);
|
void AddWhere(const QString& column, const QVariant& value, const QString& op = "=");
|
||||||
void AddWhereLike(const QString& column, const QVariant& value);
|
void AddWhereLike(const QString& column, const QVariant& value);
|
||||||
void AddCompilationRequirement(bool compilation);
|
void AddCompilationRequirement(bool compilation);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ const char* AlbumCoverManager::kSettingsGroup = "CoverManager";
|
|||||||
|
|
||||||
AlbumCoverManager::AlbumCoverManager(NetworkAccessManager* network,
|
AlbumCoverManager::AlbumCoverManager(NetworkAccessManager* network,
|
||||||
LibraryBackend* backend, QWidget *parent)
|
LibraryBackend* backend, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QMainWindow(parent),
|
||||||
constructed_(false),
|
constructed_(false),
|
||||||
ui_(new Ui_CoverManager),
|
ui_(new Ui_CoverManager),
|
||||||
backend_(backend),
|
backend_(backend),
|
||||||
@ -173,7 +173,7 @@ void AlbumCoverManager::Reset() {
|
|||||||
new QListWidgetItem(all_artists_icon_, tr("All artists"), ui_->artists, All_Artists);
|
new QListWidgetItem(all_artists_icon_, tr("All artists"), ui_->artists, All_Artists);
|
||||||
new QListWidgetItem(artist_icon_, tr("Various artists"), ui_->artists, Various_Artists);
|
new QListWidgetItem(artist_icon_, tr("Various artists"), ui_->artists, Various_Artists);
|
||||||
|
|
||||||
foreach (const QString& artist, backend_->GetAllArtists()) {
|
foreach (const QString& artist, backend_->GetAllArtistsWithAlbums()) {
|
||||||
if (artist.isEmpty())
|
if (artist.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ void AlbumCoverManager::AlbumCoverFetched(quint64 id, const QImage &image) {
|
|||||||
|
|
||||||
bool AlbumCoverManager::event(QEvent* e) {
|
bool AlbumCoverManager::event(QEvent* e) {
|
||||||
if (constructed_) {
|
if (constructed_) {
|
||||||
// I think KDE styles override these, and ScrollPerItem really confusing
|
// I think KDE styles override these, and ScrollPerItem is really confusing
|
||||||
// when you have huge items.
|
// when you have huge items.
|
||||||
// We seem to have to reset them to sensible values each time the contents
|
// We seem to have to reset them to sensible values each time the contents
|
||||||
// of ui_->albums changes.
|
// of ui_->albums changes.
|
||||||
@ -344,7 +344,7 @@ bool AlbumCoverManager::event(QEvent* e) {
|
|||||||
ui_->albums->verticalScrollBar()->setSingleStep(20);
|
ui_->albums->verticalScrollBar()->setSingleStep(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDialog::event(e);
|
QMainWindow::event(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +369,7 @@ bool AlbumCoverManager::eventFilter(QObject *obj, QEvent *event) {
|
|||||||
context_menu_->popup(e->globalPos());
|
context_menu_->popup(e->globalPos());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return QMainWindow::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlbumCoverManager::ShowFullsize() {
|
void AlbumCoverManager::ShowFullsize() {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#ifndef ALBUMCOVERMANAGER_H
|
#ifndef ALBUMCOVERMANAGER_H
|
||||||
#define ALBUMCOVERMANAGER_H
|
#define ALBUMCOVERMANAGER_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QMainWindow>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
#include "gtest/gtest_prod.h"
|
#include "gtest/gtest_prod.h"
|
||||||
@ -33,7 +33,7 @@ class Ui_CoverManager;
|
|||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
|
||||||
class AlbumCoverManager : public QDialog {
|
class AlbumCoverManager : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AlbumCoverManager(NetworkAccessManager* network, LibraryBackend* backend,
|
AlbumCoverManager(NetworkAccessManager* network, LibraryBackend* backend,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CoverManager</class>
|
<class>CoverManager</class>
|
||||||
<widget class="QDialog" name="CoverManager">
|
<widget class="QMainWindow" name="CoverManager">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -17,129 +17,150 @@
|
|||||||
<iconset resource="../../data/data.qrc">
|
<iconset resource="../../data/data.qrc">
|
||||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<property name="margin">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<number>0</number>
|
<property name="margin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QSplitter" name="splitter">
|
<item>
|
||||||
<property name="orientation">
|
<widget class="QSplitter" name="splitter">
|
||||||
<enum>Qt::Horizontal</enum>
|
<property name="orientation">
|
||||||
</property>
|
<enum>Qt::Horizontal</enum>
|
||||||
<widget class="QListWidget" name="artists">
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QListWidget" name="artists">
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="uniformItemSizes">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="clear">
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="LineEdit" name="filter">
|
||||||
|
<property name="hint" stdset="0">
|
||||||
|
<string>Enter search terms here</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="view">
|
||||||
|
<property name="text">
|
||||||
|
<string>View</string>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="popupMode">
|
||||||
|
<enum>QToolButton::MenuButtonPopup</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="fetch">
|
||||||
|
<property name="text">
|
||||||
|
<string>Fetch Missing Covers</string>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="albums">
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>120</width>
|
||||||
|
<height>120</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="movement">
|
||||||
|
<enum>QListView::Static</enum>
|
||||||
|
</property>
|
||||||
|
<property name="flow">
|
||||||
|
<enum>QListView::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="isWrapping" stdset="0">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="resizeMode">
|
||||||
|
<enum>QListView::Adjust</enum>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="viewMode">
|
||||||
|
<enum>QListView::IconMode</enum>
|
||||||
|
</property>
|
||||||
|
<property name="uniformItemSizes">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
</item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
</layout>
|
||||||
<item>
|
</widget>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="clear">
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="autoRaise">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="LineEdit" name="filter">
|
|
||||||
<property name="hint" stdset="0">
|
|
||||||
<string>Enter search terms here</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="view">
|
|
||||||
<property name="text">
|
|
||||||
<string>View</string>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="popupMode">
|
|
||||||
<enum>QToolButton::MenuButtonPopup</enum>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
|
||||||
</property>
|
|
||||||
<property name="autoRaise">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="fetch">
|
|
||||||
<property name="text">
|
|
||||||
<string>Fetch Missing Covers</string>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="albums">
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>120</width>
|
|
||||||
<height>120</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="movement">
|
|
||||||
<enum>QListView::Static</enum>
|
|
||||||
</property>
|
|
||||||
<property name="flow">
|
|
||||||
<enum>QListView::LeftToRight</enum>
|
|
||||||
</property>
|
|
||||||
<property name="isWrapping" stdset="0">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="resizeMode">
|
|
||||||
<enum>QListView::Adjust</enum>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="viewMode">
|
|
||||||
<enum>QListView::IconMode</enum>
|
|
||||||
</property>
|
|
||||||
<property name="uniformItemSizes">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
<action name="action_show_fullsize">
|
<action name="action_show_fullsize">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show fullsize...</string>
|
<string>Show fullsize...</string>
|
||||||
@ -179,38 +200,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<include location="../../data/data.qrc"/>
|
<include location="../../data/data.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections/>
|
||||||
<connection>
|
|
||||||
<sender>clear</sender>
|
|
||||||
<signal>clicked()</signal>
|
|
||||||
<receiver>filter</receiver>
|
|
||||||
<slot>clear()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>329</x>
|
|
||||||
<y>13</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>367</x>
|
|
||||||
<y>14</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>clear</sender>
|
|
||||||
<signal>clicked()</signal>
|
|
||||||
<receiver>filter</receiver>
|
|
||||||
<slot>setFocus()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>334</x>
|
|
||||||
<y>20</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>401</x>
|
|
||||||
<y>13</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user