Fade between podcast info screens a bit more nicely
This commit is contained in:
parent
56cc4a9140
commit
3a88d8fcda
@ -22,6 +22,7 @@
|
|||||||
#include "ui_addpodcastdialog.h"
|
#include "ui_addpodcastdialog.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "ui/iconloader.h"
|
#include "ui/iconloader.h"
|
||||||
|
#include "widgets/widgetfadehelper.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
@ -33,7 +34,10 @@ AddPodcastDialog::AddPodcastDialog(Application* app, QWidget* parent)
|
|||||||
ui_->details->SetApplication(app);
|
ui_->details->SetApplication(app);
|
||||||
ui_->results_stack->setCurrentWidget(ui_->results_page);
|
ui_->results_stack->setCurrentWidget(ui_->results_page);
|
||||||
|
|
||||||
|
fader_ = new WidgetFadeHelper(ui_->details_scroll_area);
|
||||||
|
|
||||||
connect(ui_->provider_list, SIGNAL(currentRowChanged(int)), SLOT(ChangePage(int)));
|
connect(ui_->provider_list, SIGNAL(currentRowChanged(int)), SLOT(ChangePage(int)));
|
||||||
|
connect(ui_->details, SIGNAL(LoadingFinished()), fader_, SLOT(StartFade()));
|
||||||
|
|
||||||
// Create an Add Podcast button
|
// Create an Add Podcast button
|
||||||
add_button_ = new QPushButton(IconLoader::Load("list-add"), tr("Add Podcast"), this);
|
add_button_ = new QPushButton(IconLoader::Load("list-add"), tr("Add Podcast"), this);
|
||||||
@ -85,11 +89,16 @@ void AddPodcastDialog::ChangePodcast(const QModelIndex& current) {
|
|||||||
if (!current.isValid() ||
|
if (!current.isValid() ||
|
||||||
current.data(PodcastDiscoveryModel::Role_Type).toInt() !=
|
current.data(PodcastDiscoveryModel::Role_Type).toInt() !=
|
||||||
PodcastDiscoveryModel::Type_Podcast) {
|
PodcastDiscoveryModel::Type_Podcast) {
|
||||||
ui_->details->hide();
|
ui_->details_scroll_area->hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_->details->show();
|
if (ui_->details_scroll_area->isVisible()) {
|
||||||
|
fader_->StartBlur();
|
||||||
|
} else {
|
||||||
|
ui_->details_scroll_area->show();
|
||||||
|
}
|
||||||
|
|
||||||
ui_->details->SetPodcast(current.data(PodcastDiscoveryModel::Role_Podcast).value<Podcast>());
|
ui_->details->SetPodcast(current.data(PodcastDiscoveryModel::Role_Podcast).value<Podcast>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
class AddPodcastPage;
|
class AddPodcastPage;
|
||||||
class Application;
|
class Application;
|
||||||
|
class WidgetFadeHelper;
|
||||||
class Ui_AddPodcastDialog;
|
class Ui_AddPodcastDialog;
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
@ -49,6 +50,8 @@ private:
|
|||||||
|
|
||||||
QList<AddPodcastPage*> pages_;
|
QList<AddPodcastPage*> pages_;
|
||||||
QList<bool> page_is_busy_;
|
QList<bool> page_is_busy_;
|
||||||
|
|
||||||
|
WidgetFadeHelper* fader_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ADDPODCASTDIALOG_H
|
#endif // ADDPODCASTDIALOG_H
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>887</width>
|
<width>941</width>
|
||||||
<height>447</height>
|
<height>473</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="results_page">
|
<widget class="QWidget" name="results_page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@ -110,13 +110,35 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="PodcastInfoWidget" name="details">
|
<widget class="QScrollArea" name="details_scroll_area">
|
||||||
<property name="frameShape">
|
<property name="minimumSize">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="maximumSize">
|
||||||
<enum>QFrame::Raised</enum>
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="horizontalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
|
</property>
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="PodcastInfoWidget" name="details">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>248</width>
|
||||||
|
<height>418</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -142,7 +164,7 @@
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>PodcastInfoWidget</class>
|
<class>PodcastInfoWidget</class>
|
||||||
<extends>QFrame</extends>
|
<extends>QWidget</extends>
|
||||||
<header>podcasts/podcastinfowidget.h</header>
|
<header>podcasts/podcastinfowidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
@ -57,6 +57,7 @@ void GPodderTopTagsModel::fetchMore(const QModelIndex& parent) {
|
|||||||
}
|
}
|
||||||
setData(parent, true, Role_HasLazyLoaded);
|
setData(parent, true, Role_HasLazyLoaded);
|
||||||
|
|
||||||
|
qLog(Debug) << "Fetching podcasts for" << parent.data().toString();
|
||||||
mygpo::PodcastList* list =
|
mygpo::PodcastList* list =
|
||||||
api_->podcastsOfTag(GPodderTopTagsPage::kMaxTagCount, parent.data().toString());
|
api_->podcastsOfTag(GPodderTopTagsPage::kMaxTagCount, parent.data().toString());
|
||||||
|
|
||||||
@ -68,6 +69,7 @@ void GPodderTopTagsModel::fetchMore(const QModelIndex& parent) {
|
|||||||
void GPodderTopTagsModel::PodcastsOfTagFinished(const QModelIndex& parent,
|
void GPodderTopTagsModel::PodcastsOfTagFinished(const QModelIndex& parent,
|
||||||
mygpo::PodcastList* list) {
|
mygpo::PodcastList* list) {
|
||||||
list->deleteLater();
|
list->deleteLater();
|
||||||
|
qLog(Debug) << "Tag list finished";
|
||||||
|
|
||||||
QStandardItem* parent_item = itemFromIndex(parent);
|
QStandardItem* parent_item = itemFromIndex(parent);
|
||||||
if (!parent_item)
|
if (!parent_item)
|
||||||
|
@ -21,17 +21,14 @@
|
|||||||
#include "covers/albumcoverloader.h"
|
#include "covers/albumcoverloader.h"
|
||||||
|
|
||||||
PodcastInfoWidget::PodcastInfoWidget(QWidget* parent)
|
PodcastInfoWidget::PodcastInfoWidget(QWidget* parent)
|
||||||
: QFrame(parent),
|
: QWidget(parent),
|
||||||
ui_(new Ui_PodcastInfoWidget),
|
ui_(new Ui_PodcastInfoWidget),
|
||||||
app_(NULL),
|
app_(NULL),
|
||||||
image_id_(0)
|
image_id_(0)
|
||||||
{
|
{
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
setFrameShape(QFrame::StyledPanel);
|
cover_options_.desired_height_ = 180;
|
||||||
|
|
||||||
setMaximumWidth(220);
|
|
||||||
cover_options_.desired_height_ = 200;
|
|
||||||
ui_->image->setFixedSize(cover_options_.desired_height_,
|
ui_->image->setFixedSize(cover_options_.desired_height_,
|
||||||
cover_options_.desired_height_);
|
cover_options_.desired_height_);
|
||||||
|
|
||||||
@ -57,9 +54,26 @@ void PodcastInfoWidget::SetApplication(Application* app) {
|
|||||||
SLOT(ImageLoaded(quint64,QImage)));
|
SLOT(ImageLoaded(quint64,QImage)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
template <typename T>
|
||||||
|
void SetText(const QString& value, T* label, QLabel* buddy_label = NULL) {
|
||||||
|
const bool visible = !value.isEmpty();
|
||||||
|
|
||||||
|
label->setVisible(visible);
|
||||||
|
if (buddy_label) {
|
||||||
|
buddy_label->setVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visible) {
|
||||||
|
label->setText(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PodcastInfoWidget::SetPodcast(const Podcast& podcast) {
|
void PodcastInfoWidget::SetPodcast(const Podcast& podcast) {
|
||||||
if (image_id_ != 0) {
|
if (image_id_) {
|
||||||
app_->album_cover_loader()->CancelTask(image_id_);
|
app_->album_cover_loader()->CancelTask(image_id_);
|
||||||
|
image_id_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
podcast_ = podcast;
|
podcast_ = podcast;
|
||||||
@ -78,18 +92,9 @@ void PodcastInfoWidget::SetPodcast(const Podcast& podcast) {
|
|||||||
SetText(podcast.author(), ui_->author, ui_->author_label);
|
SetText(podcast.author(), ui_->author, ui_->author_label);
|
||||||
SetText(podcast.owner_name(), ui_->owner, ui_->owner_label);
|
SetText(podcast.owner_name(), ui_->owner, ui_->owner_label);
|
||||||
SetText(podcast.link().toString(), ui_->website, ui_->website_label);
|
SetText(podcast.link().toString(), ui_->website, ui_->website_label);
|
||||||
}
|
|
||||||
|
|
||||||
void PodcastInfoWidget::SetText(const QString& value, QLabel* label, QLabel* buddy_label) {
|
if (!image_id_) {
|
||||||
const bool visible = !value.isEmpty();
|
emit LoadingFinished();
|
||||||
|
|
||||||
label->setVisible(visible);
|
|
||||||
if (buddy_label) {
|
|
||||||
buddy_label->setVisible(visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (visible) {
|
|
||||||
label->setText(value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,4 +108,6 @@ void PodcastInfoWidget::ImageLoaded(quint64 id, const QImage& image) {
|
|||||||
ui_->image->setPixmap(QPixmap::fromImage(image));
|
ui_->image->setPixmap(QPixmap::fromImage(image));
|
||||||
ui_->image->show();
|
ui_->image->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit LoadingFinished();
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class Ui_PodcastInfoWidget;
|
|||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
|
||||||
class PodcastInfoWidget : public QFrame {
|
class PodcastInfoWidget : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -39,12 +39,12 @@ public:
|
|||||||
|
|
||||||
void SetPodcast(const Podcast& podcast);
|
void SetPodcast(const Podcast& podcast);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void LoadingFinished();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ImageLoaded(quint64 id, const QImage& image);
|
void ImageLoaded(quint64 id, const QImage& image);
|
||||||
|
|
||||||
private:
|
|
||||||
void SetText(const QString& value, QLabel* label, QLabel* buddy_label = NULL);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_PodcastInfoWidget* ui_;
|
Ui_PodcastInfoWidget* ui_;
|
||||||
|
|
||||||
|
@ -20,18 +20,58 @@
|
|||||||
|
|
||||||
#description {
|
#description {
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit {
|
||||||
|
background: transparent;
|
||||||
}</string>
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetMinAndMaxSize</enum>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="image">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="sizePolicy">
|
<property name="spacing">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<number>0</number>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="image">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="title">
|
<widget class="QLabel" name="title">
|
||||||
@ -55,6 +95,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetMinAndMaxSize</enum>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="copyright_label">
|
<widget class="QLabel" name="copyright_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -75,19 +118,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="copyright">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="author_label">
|
<widget class="QLabel" name="author_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -98,32 +128,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLabel" name="author">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLabel" name="owner">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="website_label">
|
<widget class="QLabel" name="website_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -134,10 +138,43 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="copyright">
|
||||||
|
<property name="frame">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="author">
|
||||||
|
<property name="frame">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="owner">
|
||||||
|
<property name="frame">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="website">
|
<widget class="QLineEdit" name="website">
|
||||||
<property name="textInteractionFlags">
|
<property name="frame">
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "songinfofetcher.h"
|
#include "songinfofetcher.h"
|
||||||
|
|
||||||
class PrettyImageView;
|
class PrettyImageView;
|
||||||
class WidgetFadeHelper;
|
|
||||||
|
|
||||||
class QScrollArea;
|
class QScrollArea;
|
||||||
class QTimeLine;
|
class QTimeLine;
|
||||||
|
@ -143,6 +143,7 @@ void WidgetFadeHelper::paintEvent(QPaintEvent* ) {
|
|||||||
|
|
||||||
if (fade_timeline_->state() != QTimeLine::Running) {
|
if (fade_timeline_->state() != QTimeLine::Running) {
|
||||||
// We're fading in the blur
|
// We're fading in the blur
|
||||||
|
p.drawPixmap(0, 0, original_pixmap_);
|
||||||
p.setOpacity(blur_timeline_->currentValue());
|
p.setOpacity(blur_timeline_->currentValue());
|
||||||
} else {
|
} else {
|
||||||
// Fading out the blur into the new image
|
// Fading out the blur into the new image
|
||||||
|
Loading…
x
Reference in New Issue
Block a user