Add tidal support
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -59,7 +59,6 @@ FileViewList::FileViewList(QWidget *parent)
|
||||
|
||||
void FileViewList::contextMenuEvent(QContextMenuEvent *e) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
menu_selection_ = selectionModel()->selection();
|
||||
|
||||
menu_->popup(e->globalPos());
|
||||
@@ -69,7 +68,6 @@ void FileViewList::contextMenuEvent(QContextMenuEvent *e) {
|
||||
|
||||
QList<QUrl> FileViewList::UrlListFromSelection() const {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
QList<QUrl> urls;
|
||||
for (const QModelIndex& index : menu_selection_.indexes()) {
|
||||
if (index.column() == 0)
|
||||
@@ -81,7 +79,6 @@ QList<QUrl> FileViewList::UrlListFromSelection() const {
|
||||
|
||||
MimeData *FileViewList::MimeDataFromSelection() const {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
MimeData *data = new MimeData;
|
||||
data->setUrls(UrlListFromSelection());
|
||||
|
||||
@@ -101,7 +98,6 @@ MimeData *FileViewList::MimeDataFromSelection() const {
|
||||
|
||||
QStringList FileViewList::FilenamesFromSelection() const {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
QStringList filenames;
|
||||
for (const QModelIndex& index : menu_selection_.indexes()) {
|
||||
if (index.column() == 0)
|
||||
@@ -112,14 +108,12 @@ QStringList FileViewList::FilenamesFromSelection() const {
|
||||
}
|
||||
|
||||
void FileViewList::LoadSlot() {
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
MimeData *data = MimeDataFromSelection();
|
||||
data->clear_first_ = true;
|
||||
emit AddToPlaylist(data);
|
||||
}
|
||||
|
||||
void FileViewList::AddToPlaylistSlot() {
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
emit AddToPlaylist(MimeDataFromSelection());
|
||||
}
|
||||
|
||||
@@ -143,18 +137,15 @@ void FileViewList::CopyToDeviceSlot() {
|
||||
}
|
||||
|
||||
void FileViewList::DeleteSlot() {
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
emit Delete(FilenamesFromSelection());
|
||||
}
|
||||
|
||||
void FileViewList::EditTagsSlot() {
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
emit EditTags(UrlListFromSelection());
|
||||
}
|
||||
|
||||
void FileViewList::mousePressEvent(QMouseEvent *e) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
switch (e->button()) {
|
||||
case Qt::XButton1:
|
||||
emit Back();
|
||||
@@ -183,6 +174,5 @@ void FileViewList::mousePressEvent(QMouseEvent *e) {
|
||||
}
|
||||
|
||||
void FileViewList::ShowInBrowser() {
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
Utilities::OpenInFileBrowser(UrlListFromSelection());
|
||||
}
|
||||
|
||||
148
src/widgets/loginstatewidget.cpp
Normal file
148
src/widgets/loginstatewidget.cpp
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
This file was part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Strawberry is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Strawberry is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "loginstatewidget.h"
|
||||
#include "ui_loginstatewidget.h"
|
||||
#include "core/iconloader.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
#include <QDate>
|
||||
#include <QString>
|
||||
#include <QLineEdit>
|
||||
#include <QtEvents>
|
||||
|
||||
LoginStateWidget::LoginStateWidget(QWidget *parent)
|
||||
: QWidget(parent), ui_(new Ui_LoginStateWidget), state_(LoggedOut) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
ui_->signed_in->hide();
|
||||
ui_->expires->hide();
|
||||
ui_->account_type->hide();
|
||||
ui_->busy->hide();
|
||||
|
||||
ui_->sign_out->setIcon(IconLoader::Load("list-remove"));
|
||||
ui_->signed_in_icon_label->setPixmap(IconLoader::Load("dialog-ok-apply").pixmap(22));
|
||||
ui_->expires_icon_label->setPixmap(IconLoader::Load("user-away").pixmap(22));
|
||||
ui_->account_type_icon_label->setPixmap(IconLoader::Load("dialog-warning").pixmap(22));
|
||||
|
||||
QFont bold_font(font());
|
||||
bold_font.setBold(true);
|
||||
ui_->signed_out_label->setFont(bold_font);
|
||||
|
||||
connect(ui_->sign_out, SIGNAL(clicked()), SLOT(Logout()));
|
||||
|
||||
}
|
||||
|
||||
LoginStateWidget::~LoginStateWidget() { delete ui_; }
|
||||
|
||||
void LoginStateWidget::Logout() {
|
||||
SetLoggedIn(LoggedOut);
|
||||
emit LogoutClicked();
|
||||
}
|
||||
|
||||
void LoginStateWidget::SetAccountTypeText(const QString &text) {
|
||||
ui_->account_type_label->setText(text);
|
||||
}
|
||||
|
||||
void LoginStateWidget::SetAccountTypeVisible(bool visible) {
|
||||
ui_->account_type->setVisible(visible);
|
||||
}
|
||||
|
||||
void LoginStateWidget::SetLoggedIn(State state, const QString &account_name) {
|
||||
|
||||
State last_state = state_;
|
||||
state_ = state;
|
||||
|
||||
ui_->signed_in->setVisible(state == LoggedIn);
|
||||
ui_->signed_out->setVisible(state != LoggedIn);
|
||||
ui_->busy->setVisible(state == LoginInProgress);
|
||||
|
||||
if (account_name.isEmpty()) ui_->signed_in_label->setText("<b>" + tr("You are signed in.") + "</b>");
|
||||
else ui_->signed_in_label->setText(tr("You are signed in as %1.").arg("<b>" + account_name + "</b>"));
|
||||
|
||||
for (QWidget *widget : credential_groups_) {
|
||||
widget->setVisible(state != LoggedIn);
|
||||
widget->setEnabled(state != LoginInProgress);
|
||||
}
|
||||
|
||||
if (state == LoggedOut && last_state == LoginInProgress) {
|
||||
// A login just failed - give focus back to the last crediental field (usually password).
|
||||
// We have to do this after control gets back to the
|
||||
// event loop because the user might have just closed a dialog and our widget might not be active yet.
|
||||
QTimer::singleShot(0, this, SLOT(FocusLastCredentialField()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LoginStateWidget::FocusLastCredentialField() {
|
||||
|
||||
if (!credential_fields_.isEmpty()) {
|
||||
QObject *object = credential_fields_.last();
|
||||
QWidget *widget = qobject_cast<QWidget*>(object);
|
||||
QLineEdit *line_edit = qobject_cast<QLineEdit*>(object);
|
||||
|
||||
if (widget) {
|
||||
widget->setFocus();
|
||||
}
|
||||
|
||||
if (line_edit) {
|
||||
line_edit->selectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoginStateWidget::HideLoggedInState() {
|
||||
ui_->signed_in->hide();
|
||||
ui_->signed_out->hide();
|
||||
}
|
||||
|
||||
void LoginStateWidget::AddCredentialField(QWidget *widget) {
|
||||
widget->installEventFilter(this);
|
||||
credential_fields_ << widget;
|
||||
}
|
||||
|
||||
void LoginStateWidget::AddCredentialGroup(QWidget *widget) {
|
||||
credential_groups_ << widget;
|
||||
}
|
||||
|
||||
bool LoginStateWidget::eventFilter(QObject *object, QEvent *event) {
|
||||
if (!credential_fields_.contains(object))
|
||||
return QWidget::eventFilter(object, event);
|
||||
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *key_event = static_cast<QKeyEvent*>(event);
|
||||
if (key_event->key() == Qt::Key_Enter || key_event->key() == Qt::Key_Return) {
|
||||
emit LoginClicked();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(object, event);
|
||||
}
|
||||
|
||||
void LoginStateWidget::SetExpires(const QDate &expires) {
|
||||
|
||||
ui_->expires->setVisible(expires.isValid());
|
||||
|
||||
if (expires.isValid()) {
|
||||
const QString expires_text = expires.toString(Qt::SystemLocaleLongDate);
|
||||
ui_->expires_label->setText(tr("Expires on %1").arg("<b>" + expires_text + "</b>"));
|
||||
}
|
||||
}
|
||||
80
src/widgets/loginstatewidget.h
Normal file
80
src/widgets/loginstatewidget.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
This file was part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Strawberry is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Strawberry is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef LOGINSTATEWIDGET_H
|
||||
#define LOGINSTATEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QDate>
|
||||
#include <QtEvents>
|
||||
|
||||
class Ui_LoginStateWidget;
|
||||
|
||||
class LoginStateWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LoginStateWidget(QWidget *parent = nullptr);
|
||||
~LoginStateWidget();
|
||||
|
||||
enum State { LoggedIn, LoginInProgress, LoggedOut };
|
||||
|
||||
// Installs an event handler on the field so that pressing enter will emit
|
||||
// LoginClicked() instead of doing the default action (closing the dialog).
|
||||
void AddCredentialField(QWidget *widget);
|
||||
|
||||
// This widget (usually a QGroupBox) will be hidden when SetLoggedIn(true) is called.
|
||||
void AddCredentialGroup(QWidget *widget);
|
||||
|
||||
// QObject
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
|
||||
public slots:
|
||||
// Changes the "You are logged in/out" label, shows/hides any QGroupBoxes added with AddCredentialGroup.
|
||||
void SetLoggedIn(State state, const QString &account_name = QString::null);
|
||||
|
||||
// Hides the "You are logged in/out" label completely.
|
||||
void HideLoggedInState();
|
||||
|
||||
void SetAccountTypeText(const QString &text);
|
||||
void SetAccountTypeVisible(bool visible);
|
||||
|
||||
void SetExpires(const QDate &expires);
|
||||
|
||||
signals:
|
||||
void LogoutClicked();
|
||||
void LoginClicked();
|
||||
|
||||
private slots:
|
||||
void Logout();
|
||||
void FocusLastCredentialField();
|
||||
|
||||
private:
|
||||
Ui_LoginStateWidget *ui_;
|
||||
|
||||
State state_;
|
||||
|
||||
QList<QObject*> credential_fields_;
|
||||
QList<QWidget*> credential_groups_;
|
||||
};
|
||||
|
||||
#endif // LOGINSTATEWIDGET_H
|
||||
182
src/widgets/loginstatewidget.ui
Normal file
182
src/widgets/loginstatewidget.ui
Normal file
@@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LoginStateWidget</class>
|
||||
<widget class="QWidget" name="LoginStateWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>526</width>
|
||||
<height>187</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="signed_out" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="signed_out_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>You are not signed in.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="signed_in" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="signed_in_icon_label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="signed_in_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="sign_out">
|
||||
<property name="text">
|
||||
<string>Sign out</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="expires" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="expires_icon_label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="expires_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="account_type" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="account_type_icon_label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="account_type_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BusyIndicator" name="busy" native="true">
|
||||
<property name="text" stdset="0">
|
||||
<string>Signing in...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BusyIndicator</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/busyindicator.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -84,7 +84,6 @@ StatusView::StatusView(CollectionViewContainer *collectionviewcontainer, QWidget
|
||||
label_playing_text_(nullptr),
|
||||
|
||||
album_cover_choice_controller_(new AlbumCoverChoiceController(this)),
|
||||
show_hide_animation_(new QTimeLine(500, this)),
|
||||
fade_animation_(new QTimeLine(1000, this)),
|
||||
image_blank_(""),
|
||||
image_nosong_(":/pictures/strawberry.png"),
|
||||
@@ -92,8 +91,6 @@ StatusView::StatusView(CollectionViewContainer *collectionviewcontainer, QWidget
|
||||
menu_(new QMenu(this))
|
||||
{
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
collectionview_ = collectionviewcontainer->view();
|
||||
connect(collectionview_, SIGNAL(TotalSongCountUpdated_()), this, SLOT(UpdateNoSong()));
|
||||
connect(collectionview_, SIGNAL(TotalArtistCountUpdated_()), this, SLOT(UpdateNoSong()));
|
||||
@@ -125,8 +122,6 @@ StatusView::~StatusView() {
|
||||
|
||||
void StatusView::AddActions() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QList<QAction*> actions = album_cover_choice_controller_->GetAllActions();
|
||||
|
||||
// Here we add the search automatically action, too!
|
||||
@@ -147,8 +142,6 @@ void StatusView::AddActions() {
|
||||
|
||||
void StatusView::CreateWidget() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
setLayout(layout_);
|
||||
|
||||
layout_->setSizeConstraint(QLayout::SetMinAndMaxSize);
|
||||
@@ -174,8 +167,6 @@ void StatusView::CreateWidget() {
|
||||
|
||||
void StatusView::SetApplication(Application *app) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
app_ = app;
|
||||
|
||||
album_cover_choice_controller_->SetApplication(app_);
|
||||
@@ -185,8 +176,6 @@ void StatusView::SetApplication(Application *app) {
|
||||
|
||||
void StatusView::NoSongWidget() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
if (widgetstate_ == Playing) {
|
||||
container_layout_->removeWidget(widget_playing_);
|
||||
widget_playing_->setVisible(false);
|
||||
@@ -221,8 +210,6 @@ void StatusView::NoSongWidget() {
|
||||
|
||||
void StatusView::SongWidget() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
if (widgetstate_ == Stopped) {
|
||||
container_layout_->removeWidget(widget_stopped_);
|
||||
widget_stopped_->setVisible(false);
|
||||
@@ -275,8 +262,6 @@ void StatusView::SongWidget() {
|
||||
|
||||
void StatusView::SwitchWidgets(WidgetState state) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
if (widgetstate_ == None) NoSongWidget();
|
||||
|
||||
if ((state == Stopped) && (widgetstate_ != Stopped)) {
|
||||
@@ -291,8 +276,6 @@ void StatusView::SwitchWidgets(WidgetState state) {
|
||||
|
||||
void StatusView::UpdateSong() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
SwitchWidgets(Playing);
|
||||
|
||||
const QueryOptions opt;
|
||||
@@ -342,8 +325,6 @@ void StatusView::UpdateSong() {
|
||||
|
||||
void StatusView::NoSong() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QString html;
|
||||
QImage image_logo(":/pictures/strawberry.png");
|
||||
QImage image_logo_scaled = image_logo.scaled(300, 300, Qt::KeepAspectRatio);
|
||||
@@ -377,8 +358,6 @@ void StatusView::NoSong() {
|
||||
|
||||
void StatusView::SongChanged(const Song &song) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
stopped_ = false;
|
||||
metadata_ = song;
|
||||
|
||||
@@ -390,8 +369,6 @@ void StatusView::SongChanged(const Song &song) {
|
||||
|
||||
void StatusView::SongFinished() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
stopped_ = true;
|
||||
SetImage(image_blank_);
|
||||
|
||||
@@ -399,8 +376,6 @@ void StatusView::SongFinished() {
|
||||
|
||||
bool StatusView::eventFilter(QObject *object, QEvent *event) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
switch(event->type()) {
|
||||
case QEvent::Paint:{
|
||||
handlePaintEvent(object, event);
|
||||
@@ -416,8 +391,6 @@ bool StatusView::eventFilter(QObject *object, QEvent *event) {
|
||||
|
||||
void StatusView::handlePaintEvent(QObject *object, QEvent *event) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__ << object->objectName();
|
||||
|
||||
if (object == label_playing_album_) {
|
||||
paintEvent_album(event);
|
||||
}
|
||||
@@ -428,8 +401,6 @@ void StatusView::handlePaintEvent(QObject *object, QEvent *event) {
|
||||
|
||||
void StatusView::paintEvent_album(QEvent *event) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QPainter p(label_playing_album_);
|
||||
|
||||
DrawImage(&p);
|
||||
@@ -443,8 +414,6 @@ void StatusView::paintEvent_album(QEvent *event) {
|
||||
|
||||
void StatusView::DrawImage(QPainter *p) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
p->drawPixmap(0, 0, 300, 300, pixmap_current_);
|
||||
if ((downloading_covers_) && (spinner_animation_ != nullptr)) {
|
||||
p->drawPixmap(50, 50, 16, 16, spinner_animation_->currentPixmap());
|
||||
@@ -454,8 +423,6 @@ void StatusView::DrawImage(QPainter *p) {
|
||||
|
||||
void StatusView::FadePreviousTrack(qreal value) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
pixmap_previous_opacity_ = value;
|
||||
if (qFuzzyCompare(pixmap_previous_opacity_, qreal(0.0))) {
|
||||
pixmap_previous_ = QPixmap();
|
||||
@@ -477,31 +444,22 @@ void StatusView::contextMenuEvent(QContextMenuEvent *e) {
|
||||
}
|
||||
|
||||
void StatusView::mouseReleaseEvent(QMouseEvent *) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
}
|
||||
|
||||
void StatusView::dragEnterEvent(QDragEnterEvent *e) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QWidget::dragEnterEvent(e);
|
||||
|
||||
}
|
||||
|
||||
void StatusView::dropEvent(QDropEvent *e) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
QWidget::dropEvent(e);
|
||||
|
||||
}
|
||||
|
||||
void StatusView::ScaleCover() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
pixmap_current_ = QPixmap::fromImage(AlbumCoverLoader::ScaleAndPad(cover_loader_options_, original_));
|
||||
update();
|
||||
|
||||
@@ -509,8 +467,6 @@ void StatusView::ScaleCover() {
|
||||
|
||||
void StatusView::AlbumArtLoaded(const Song &metadata, const QString&, const QImage &image) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
SwitchWidgets(Playing);
|
||||
|
||||
label_playing_album_->clear();
|
||||
@@ -527,8 +483,6 @@ void StatusView::AlbumArtLoaded(const Song &metadata, const QString&, const QIma
|
||||
|
||||
void StatusView::SetImage(const QImage &image) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
// Cache the current pixmap so we can fade between them
|
||||
pixmap_previous_ = QPixmap(size());
|
||||
pixmap_previous_.fill(palette().background().color());
|
||||
@@ -543,7 +497,7 @@ void StatusView::SetImage(const QImage &image) {
|
||||
ScaleCover();
|
||||
|
||||
// Were we waiting for this cover to load before we started fading?
|
||||
if (!pixmap_previous_.isNull() && fade_animation_ != nullptr) {
|
||||
if (!pixmap_previous_.isNull() && fade_animation_) {
|
||||
fade_animation_->start();
|
||||
}
|
||||
|
||||
@@ -551,8 +505,6 @@ void StatusView::SetImage(const QImage &image) {
|
||||
|
||||
bool StatusView::GetCoverAutomatically() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
SwitchWidgets(Playing);
|
||||
|
||||
// Search for cover automatically?
|
||||
@@ -581,8 +533,6 @@ bool StatusView::GetCoverAutomatically() {
|
||||
|
||||
void StatusView::AutomaticCoverSearchDone() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
downloading_covers_ = false;
|
||||
spinner_animation_.reset();
|
||||
update();
|
||||
@@ -591,8 +541,6 @@ void StatusView::AutomaticCoverSearchDone() {
|
||||
|
||||
void StatusView::UpdateNoSong() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
if (widgetstate_ == Playing) return;
|
||||
|
||||
NoSong();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STATUSVIEW_H
|
||||
@@ -131,7 +131,6 @@ private:
|
||||
int small_ideal_height_;
|
||||
int total_height_;
|
||||
bool fit_width_;
|
||||
QTimeLine *show_hide_animation_;
|
||||
QTimeLine *fade_animation_;
|
||||
QImage image_blank_;
|
||||
QImage image_nosong_;
|
||||
@@ -175,3 +174,4 @@ protected:
|
||||
};
|
||||
|
||||
#endif // STATUSVIEW_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user