download only large covers from google

add cover size tooltip (see issue #1704)
cover search window is now a grid and not a long list with vertical scrollbar
This commit is contained in:
Paweł Bara 2011-04-06 15:24:56 +00:00
parent 41ef30151a
commit 2b22dfaaee
3 changed files with 16 additions and 8 deletions

View File

@ -13,9 +13,11 @@ class GoogleImagesCoversScript(clementine.CoverProvider):
self.api_url = 'https://ajax.googleapis.com/ajax/services/search/images?{0}'
self.api_args = {
'v' : '1.0',
'v' : '1.0',
# at most five results
'rsz' : '5'
'rsz' : '5',
# only larger sizes
'imgsz' : 'large|xlarge'
}
self.network = clementine.NetworkAccessManager(self)
self.queries = {}

View File

@ -81,6 +81,9 @@ void AlbumCoverSearcher::Search() {
ui_->query->setEnabled(false);
ui_->covers->setEnabled(false);
ui_->covers->clear();
cover_loading_tasks_.clear();
id_ = fetcher_->SearchForCovers(ui_->query->text());
}
@ -93,8 +96,6 @@ void AlbumCoverSearcher::SearchFinished(quint64 id, const CoverSearchResults& re
ui_->covers->setEnabled(true);
id_ = 0;
ui_->covers->clear();
cover_loading_tasks_.clear();
foreach (const CoverSearchResult& result, results) {
if (result.image_url.isEmpty())
continue;
@ -127,6 +128,8 @@ void AlbumCoverSearcher::ImageLoaded(quint64 id, const QImage& image) {
QListWidgetItem* item = cover_loading_tasks_.take(id);
item->setIcon(icon);
item->setToolTip(item->text() + " (" + QString::number(image.width()) + "x" +
QString::number(image.height()) + ")");
if (cover_loading_tasks_.isEmpty())
ui_->busy->hide();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>624</width>
<height>330</height>
<width>556</width>
<height>354</height>
</rect>
</property>
<property name="windowTitle">
@ -47,10 +47,10 @@
</size>
</property>
<property name="movement">
<enum>QListView::Static</enum>
<enum>QListView::Free</enum>
</property>
<property name="flow">
<enum>QListView::TopToBottom</enum>
<enum>QListView::LeftToRight</enum>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
@ -61,6 +61,9 @@
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>