Includes, comments and bugfixes
- Fix includes - Use common regex (Song::kCoverRemoveDisc) for removing Disc/CD from album - Remove Disc/CD from album when creating hash - Make imobiledevice support compile - Fix setting device on windows
This commit is contained in:
@@ -20,8 +20,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QtDebug>
|
||||
#include <QWidget>
|
||||
#include <QMimeData>
|
||||
#include <QTreeView>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractItemView>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "autoexpandingtreeview.h"
|
||||
#include "core/mimedata.h"
|
||||
@@ -129,8 +133,7 @@ void AutoExpandingTreeView::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||
QTreeView::mouseDoubleClickEvent(event);
|
||||
|
||||
// If the p_state was the "AnimatingState", then the base class's
|
||||
// "mouseDoubleClickEvent" method just did nothing, hence the
|
||||
// "doubleClicked" signal is not emitted. So let's do it ourselves.
|
||||
// "mouseDoubleClickEvent" method just did nothing, hence the "doubleClicked" signal is not emitted. So let's do it ourselves.
|
||||
if (index.isValid() && p_state == AnimatingState) {
|
||||
emit doubleClicked(index);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,16 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QMimeData>
|
||||
#include <QTreeView>
|
||||
#include <QtEvents>
|
||||
|
||||
class QModelIndex;
|
||||
|
||||
class AutoExpandingTreeView : public QTreeView {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -20,13 +20,21 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QMovie>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QMovie>
|
||||
#include <QLabel>
|
||||
#include <QSizePolicy>
|
||||
#include <QBoxLayout>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "busyindicator.h"
|
||||
|
||||
class QHideEvent;
|
||||
class QShowEvent;
|
||||
|
||||
BusyIndicator::BusyIndicator(const QString &text, QWidget* parent)
|
||||
: QWidget(parent) {
|
||||
Init(text);
|
||||
@@ -39,8 +47,6 @@ BusyIndicator::BusyIndicator(QWidget* parent)
|
||||
|
||||
void BusyIndicator::Init(const QString &text) {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
movie_ = new QMovie(":pictures/spinner.gif"),
|
||||
label_ = new QLabel;
|
||||
|
||||
|
||||
@@ -23,9 +23,14 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QMovie>
|
||||
#include <QLabel>
|
||||
#include <QtEvents>
|
||||
|
||||
class QMovie;
|
||||
class QShowEvent;
|
||||
class QHideEvent;
|
||||
|
||||
class BusyIndicator : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "clickablelabel.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
|
||||
ClickableLabel::ClickableLabel(QWidget *parent)
|
||||
: QLabel(parent)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,13 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QLabel>
|
||||
#include <QtEvents>
|
||||
|
||||
class QMouseEvent;
|
||||
|
||||
class ClickableLabel : public QLabel {
|
||||
Q_OBJECT
|
||||
@@ -32,7 +38,7 @@ signals:
|
||||
void Clicked();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
};
|
||||
|
||||
#endif // CLICKABLELABEL_H
|
||||
|
||||
@@ -20,15 +20,23 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QFlags>
|
||||
#include <QFontMetrics>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QIcon>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QColor>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QToolButton>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "didyoumean.h"
|
||||
|
||||
#include "core/logging.h"
|
||||
|
||||
const int DidYouMean::kPadding = 3;
|
||||
|
||||
DidYouMean::DidYouMean(QWidget *buddy, QWidget *parent)
|
||||
@@ -68,7 +76,7 @@ DidYouMean::DidYouMean(QWidget *buddy, QWidget *parent)
|
||||
}
|
||||
|
||||
bool DidYouMean::eventFilter(QObject *object, QEvent *event) {
|
||||
|
||||
|
||||
if (object != buddy_) {
|
||||
return QObject::eventFilter(object, event);
|
||||
}
|
||||
@@ -122,8 +130,7 @@ void DidYouMean::UpdateGeometry() {
|
||||
const int height = text_height + kPadding * 2;
|
||||
|
||||
move(buddy_->mapToGlobal(buddy_->rect().bottomLeft()));
|
||||
// Resize to len(text to display) + total number of padding added +
|
||||
// size(close button), so the "Did you mean" widget is always fully displayed
|
||||
// Resize to len(text to display) + total number of padding added + size(close button), so the "Did you mean" widget is always fully displayed
|
||||
|
||||
resize(QSize(did_you_mean_size_ + QFontMetrics(correction_font_).width(correction_ + " ") + press_enter_size_ + kPadding * 6 + close_->width(), height));
|
||||
|
||||
|
||||
@@ -23,9 +23,19 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <stdbool.h>
|
||||
|
||||
class QToolButton;
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QFont>
|
||||
#include <QString>
|
||||
#include <QToolButton>
|
||||
#include <QtEvents>
|
||||
|
||||
class QEvent;
|
||||
class QMouseEvent;
|
||||
class QPaintEvent;
|
||||
class QShowEvent;
|
||||
|
||||
class DidYouMean : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -20,8 +20,16 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QLabel>
|
||||
#include <QFontMetrics>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "elidedlabel.h"
|
||||
|
||||
class QResizeEvent;
|
||||
|
||||
ElidedLabel::ElidedLabel(QWidget *parent) : QLabel(parent) {}
|
||||
|
||||
void ElidedLabel::SetText(const QString& text) {
|
||||
|
||||
@@ -23,7 +23,13 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QLabel>
|
||||
#include <QtEvents>
|
||||
|
||||
class QResizeEvent;
|
||||
|
||||
class ElidedLabel : public QLabel {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -27,27 +27,54 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "fancytabwidget.h"
|
||||
#include "stylehelper.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <QAnimationGroup>
|
||||
#include <QColorDialog>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QProxyStyle>
|
||||
#include <QApplication>
|
||||
#include <QByteArray>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QIcon>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QColor>
|
||||
#include <QColorDialog>
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QAction>
|
||||
#include <QActionGroup>
|
||||
#include <QCommonStyle>
|
||||
#include <QMenu>
|
||||
#include <QAbstractAnimation>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QSignalMapper>
|
||||
#include <QSplitter>
|
||||
#include <QSizePolicy>
|
||||
#include <QLayout>
|
||||
#include <QBoxLayout>
|
||||
#include <QLayoutItem>
|
||||
#include <QStackedLayout>
|
||||
#include <QStyleOptionTabV3>
|
||||
#include <QToolButton>
|
||||
#include <QStyleOption>
|
||||
#include <QToolTip>
|
||||
#include <QVBoxLayout>
|
||||
#include <QCommonStyle>
|
||||
#include <QTransform>
|
||||
#include <QLinearGradient>
|
||||
#include <QTabBar>
|
||||
#include <QSpacerItem>
|
||||
#include <QtEvents>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "stylehelper.h"
|
||||
|
||||
using namespace Core;
|
||||
using namespace Internal;
|
||||
@@ -146,7 +173,8 @@ void FancyTabProxyStyle::drawControl(ControlElement element, const QStyleOption*
|
||||
animation->setEndValue(40);
|
||||
animation->start();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (animation->state() != QAbstractAnimation::Running && fader != 0) {
|
||||
animation->stop();
|
||||
animation->setDuration(160);
|
||||
@@ -239,8 +267,7 @@ void FancyTab::setFader(float value)
|
||||
}
|
||||
|
||||
FancyTabBar::FancyTabBar(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
: QWidget(parent) {
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
|
||||
setStyle(new QCommonStyle);
|
||||
setMinimumWidth(qMax(2 * m_rounding, 40));
|
||||
@@ -250,7 +277,7 @@ FancyTabBar::FancyTabBar(QWidget *parent)
|
||||
m_triggerTimer.setSingleShot(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
layout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding));
|
||||
layout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding));
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
setLayout(layout);
|
||||
@@ -276,8 +303,7 @@ QSize FancyTab::sizeHint() const {
|
||||
return ret;
|
||||
}
|
||||
|
||||
QSize FancyTabBar::tabSizeHint(bool minimum) const
|
||||
{
|
||||
QSize FancyTabBar::tabSizeHint(bool minimum) const {
|
||||
QFont boldFont(font());
|
||||
boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
|
||||
boldFont.setBold(true);
|
||||
@@ -355,9 +381,7 @@ void FancyTabBar::setTabToolTip(int index, const QString& toolTip) {
|
||||
m_tabs[index]->setToolTip(toolTip);
|
||||
}
|
||||
|
||||
// This keeps the sidebar responsive since
|
||||
// we get a repaint before loading the
|
||||
// mode itself
|
||||
// This keeps the sidebar responsive since we get a repaint before loading the mode itself
|
||||
void FancyTabBar::emitCurrentIndex()
|
||||
{
|
||||
emit currentChanged(m_currentIndex);
|
||||
@@ -427,7 +451,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
|
||||
painter->drawLine(rect.bottomLeft() + QPoint(0,-1), rect.bottomRight()-QPoint(0,1));
|
||||
}
|
||||
|
||||
QString tabText(painter->fontMetrics().elidedText(this->tabText(tabIndex), Qt::ElideRight, width()));
|
||||
QString tabText(painter->fontMetrics().elidedText(this->tabText(tabIndex), Qt::ElideRight, width()));
|
||||
QRect tabTextRect(tabRect(tabIndex));
|
||||
QRect tabIconRect(tabTextRect);
|
||||
tabIconRect.adjust(+4, +4, -4, -4);
|
||||
@@ -675,8 +699,7 @@ void FancyTabWidget::contextMenuEvent(QContextMenuEvent* e) {
|
||||
menu_->popup(e->globalPos());
|
||||
}
|
||||
|
||||
void FancyTabWidget::AddMenuItem(QSignalMapper* mapper, QActionGroup* group,
|
||||
const QString& text, Mode mode) {
|
||||
void FancyTabWidget::AddMenuItem(QSignalMapper* mapper, QActionGroup* group, const QString& text, Mode mode) {
|
||||
QAction* action = group->addAction(text);
|
||||
action->setCheckable(true);
|
||||
mapper->setMapping(action, mode);
|
||||
|
||||
@@ -30,22 +30,40 @@
|
||||
#ifndef FANCYTABWIDGET_H
|
||||
#define FANCYTABWIDGET_H
|
||||
|
||||
#include <memory>
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QIcon>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QProxyStyle>
|
||||
#include <QList>
|
||||
#include <QMetaType>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QStyle>
|
||||
#include <QTabBar>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QProxyStyle>
|
||||
#include <QActionGroup>
|
||||
#include <QApplication>
|
||||
#include <QSignalMapper>
|
||||
#include <QStackedLayout>
|
||||
#include <QStyleOption>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMenu>
|
||||
#include <QtEvents>
|
||||
|
||||
class QActionGroup;
|
||||
class QMenu;
|
||||
class QPainter;
|
||||
class QSignalMapper;
|
||||
class QStackedLayout;
|
||||
class QStatusBar;
|
||||
class QVBoxLayout;
|
||||
class QEvent;
|
||||
class QMouseEvent;
|
||||
class QPaintEvent;
|
||||
class QContextMenuEvent;
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
@@ -54,14 +72,13 @@ class FancyTabProxyStyle : public QProxyStyle {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void drawControl(ControlElement element, const QStyleOption* option,
|
||||
QPainter* painter, const QWidget* widget) const;
|
||||
void polish(QWidget* widget);
|
||||
void polish(QApplication* app);
|
||||
void polish(QPalette& palette);
|
||||
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
|
||||
void polish(QWidget *widget);
|
||||
void polish(QApplication *app);
|
||||
void polish(QPalette &palette);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* o, QEvent* e);
|
||||
bool eventFilter(QObject *o, QEvent *e);
|
||||
};
|
||||
|
||||
class FancyTab : public QWidget {
|
||||
@@ -88,7 +105,7 @@ protected:
|
||||
|
||||
private:
|
||||
QPropertyAnimation animator;
|
||||
QWidget *tabbar;
|
||||
QWidget *tabbar;
|
||||
float m_fader;
|
||||
};
|
||||
|
||||
@@ -97,32 +114,32 @@ class FancyTabBar : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FancyTabBar(QWidget* parent = nullptr);
|
||||
FancyTabBar(QWidget *parent = nullptr);
|
||||
~FancyTabBar();
|
||||
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void paintTab(QPainter *painter, int tabIndex) const;
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
bool validIndex(int index) const { return index >= 0 && index < m_tabs.count(); }
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void paintTab(QPainter *painter, int tabIndex) const;
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
bool validIndex(int index) const { return index >= 0 && index < m_tabs.count(); }
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
|
||||
void addTab(const QIcon &icon, const QString &label);
|
||||
void addTab(const QIcon &icon, const QString &label);
|
||||
void addSpacer(int size = 40);
|
||||
void removeTab(int index) {
|
||||
FancyTab *tab = m_tabs.takeAt(index);
|
||||
FancyTab *tab = m_tabs.takeAt(index);
|
||||
delete tab;
|
||||
}
|
||||
void setCurrentIndex(int index);
|
||||
int currentIndex() const { return m_currentIndex; }
|
||||
|
||||
void setTabToolTip(int index, const QString& toolTip);
|
||||
void setTabToolTip(int index, const QString &toolTip);
|
||||
QString tabToolTip(int index) const;
|
||||
|
||||
QIcon tabIcon(int index) const {return m_tabs.at(index)->icon; }
|
||||
QIcon tabIcon(int index) const {return m_tabs.at(index)->icon; }
|
||||
QString tabText(int index) const { return m_tabs.at(index)->text; }
|
||||
int count() const {return m_tabs.count(); }
|
||||
int count() const {return m_tabs.count(); }
|
||||
QRect tabRect(int index) const;
|
||||
|
||||
signals:
|
||||
@@ -145,7 +162,7 @@ class FancyTabWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FancyTabWidget(QWidget* parent = nullptr);
|
||||
FancyTabWidget(QWidget *parent = nullptr);
|
||||
|
||||
// Values are persisted - only add to the end
|
||||
enum Mode {
|
||||
@@ -159,7 +176,7 @@ class FancyTabWidget : public QWidget {
|
||||
};
|
||||
|
||||
struct Item {
|
||||
Item(const QIcon& icon, const QString& label)
|
||||
Item(const QIcon &icon, const QString &label)
|
||||
: type_(Type_Tab), tab_label_(label), tab_icon_(icon), spacer_size_(0) {}
|
||||
Item(int size) : type_(Type_Spacer), spacer_size_(size) {}
|
||||
|
||||
@@ -176,16 +193,16 @@ class FancyTabWidget : public QWidget {
|
||||
|
||||
void AddTab(QWidget *tab, const QIcon &icon, const QString &label);
|
||||
void AddSpacer(int size = 40);
|
||||
void SetBackgroundPixmap(const QPixmap& pixmap);
|
||||
void SetBackgroundPixmap(const QPixmap &pixmap);
|
||||
|
||||
void AddBottomWidget(QWidget* widget);
|
||||
void AddBottomWidget(QWidget *widget);
|
||||
|
||||
int current_index() const;
|
||||
Mode mode() const { return mode_; }
|
||||
|
||||
public slots:
|
||||
void SetCurrentIndex(int index);
|
||||
void SetCurrentWidget(QWidget* widget);
|
||||
void SetCurrentWidget(QWidget *widget);
|
||||
void SetMode(Mode mode);
|
||||
void SetMode(int mode) { SetMode(Mode(mode)); }
|
||||
|
||||
@@ -195,29 +212,28 @@ signals:
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void contextMenuEvent(QContextMenuEvent* e);
|
||||
void contextMenuEvent(QContextMenuEvent *e);
|
||||
|
||||
private slots:
|
||||
void ShowWidget(int index);
|
||||
|
||||
private:
|
||||
void MakeTabBar(QTabBar::Shape shape, bool text, bool icons, bool fancy);
|
||||
void AddMenuItem(QSignalMapper* mapper, QActionGroup* group,
|
||||
const QString& text, Mode mode);
|
||||
void AddMenuItem(QSignalMapper *mapper, QActionGroup *group, const QString &text, Mode mode);
|
||||
|
||||
Mode mode_;
|
||||
QList<Item> items_;
|
||||
|
||||
QWidget* tab_bar_;
|
||||
QStackedLayout* stack_;
|
||||
QWidget *tab_bar_;
|
||||
QStackedLayout *stack_;
|
||||
QPixmap background_pixmap_;
|
||||
QWidget* side_widget_;
|
||||
QVBoxLayout* side_layout_;
|
||||
QVBoxLayout* top_layout_;
|
||||
QWidget *side_widget_;
|
||||
QVBoxLayout *side_layout_;
|
||||
QVBoxLayout *top_layout_;
|
||||
|
||||
bool use_background_;
|
||||
|
||||
QMenu* menu_;
|
||||
QMenu *menu_;
|
||||
|
||||
std::unique_ptr<FancyTabProxyStyle> proxy_style_;
|
||||
};
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "favoritewidget.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QPaintEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QWidget>
|
||||
#include <QSize>
|
||||
#include <QStyle>
|
||||
#include <QStylePainter>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "favoritewidget.h"
|
||||
|
||||
const int FavoriteWidget::kStarSize = 15;
|
||||
|
||||
|
||||
@@ -20,10 +20,18 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QtEvents>
|
||||
|
||||
class QPaintEvent;
|
||||
class QMouseEvent;
|
||||
class QPaintEvent;
|
||||
|
||||
class FavoriteWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
@@ -31,8 +39,7 @@ class FavoriteWidget : public QWidget {
|
||||
public:
|
||||
FavoriteWidget(int tab_id, bool favorite = false, QWidget *parent = nullptr);
|
||||
|
||||
// Change the value if different from the current one and then update display
|
||||
// and emit FavoriteStateChanged signal
|
||||
// Change the value if different from the current one and then update display and emit FavoriteStateChanged signal
|
||||
void SetFavorite(bool favorite);
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
@@ -20,21 +20,31 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QUndoStack>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QFileSystemModel>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#include <QMessageBox>
|
||||
#include <QScrollBar>
|
||||
#include <QLineEdit>
|
||||
#include <QToolButton>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "fileview.h"
|
||||
|
||||
#include "ui_fileview.h"
|
||||
#include "core/deletefiles.h"
|
||||
#include "core/filesystemmusicstorage.h"
|
||||
#include "core/mimedata.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "core/mainwindow.h" // for filter information
|
||||
#include "core/mimedata.h"
|
||||
#include "fileview.h"
|
||||
#include "fileviewlist.h"
|
||||
#include "ui_fileview.h"
|
||||
#ifdef HAVE_GSTREAMER
|
||||
#include "dialogs/organiseerrordialog.h"
|
||||
# include "dialogs/organiseerrordialog.h"
|
||||
#endif
|
||||
|
||||
const char *FileView::kFileFilter =
|
||||
@@ -105,8 +115,7 @@ void FileView::FileUp() {
|
||||
QDir dir(model_->rootDirectory());
|
||||
dir.cdUp();
|
||||
|
||||
// Is this the same as going back? If so just go back, so we can keep the
|
||||
// view scroll position.
|
||||
// Is this the same as going back? If so just go back, so we can keep the view scroll position.
|
||||
if (undo_stack_->canUndo()) {
|
||||
const UndoCommand *last_dir = static_cast<const UndoCommand*>(undo_stack_->command(undo_stack_->index()-1));
|
||||
if (last_dir->undo_path() == dir.path()) {
|
||||
|
||||
@@ -25,21 +25,29 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QUndoCommand>
|
||||
#include <QFileSystemModel>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#include <QModelIndex>
|
||||
#include <QMimeData>
|
||||
#include <QUndoStack>
|
||||
#include <QUndoCommand>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/song.h"
|
||||
|
||||
class FilesystemMusicStorage;
|
||||
class QModelIndex;
|
||||
class QKeyEvent;
|
||||
class QShowEvent;
|
||||
|
||||
class MusicStorage;
|
||||
class TaskManager;
|
||||
class Ui_FileView;
|
||||
|
||||
class QFileSystemModel;
|
||||
class QUndoStack;
|
||||
|
||||
class FileView : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -20,24 +20,26 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QFileInfo>
|
||||
#include <QFileSystemModel>
|
||||
#include <QMenu>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "fileviewlist.h"
|
||||
#include <QUrl>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/iconloader.h"
|
||||
#include "core/mimedata.h"
|
||||
#include "core/utilities.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "fileviewlist.h"
|
||||
|
||||
FileViewList::FileViewList(QWidget *parent)
|
||||
: QListView(parent),
|
||||
menu_(new QMenu(this))
|
||||
{
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
menu_->addAction(IconLoader::Load("media-play"), tr("Append to current playlist"), this, SLOT(AddToPlaylistSlot()));
|
||||
menu_->addAction(IconLoader::Load("media-play"), tr("Replace current playlist"), this, SLOT(LoadSlot()));
|
||||
menu_->addAction(IconLoader::Load("document-new"), tr("Open in new playlist"), this, SLOT(OpenInNewPlaylistSlot()));
|
||||
|
||||
@@ -23,8 +23,20 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QMimeData>
|
||||
#include <QListView>
|
||||
#include <QList>
|
||||
#include <QUrl>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QMenu>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QtEvents>
|
||||
|
||||
class QMouseEvent;
|
||||
class QContextMenuEvent;
|
||||
|
||||
class MimeData;
|
||||
|
||||
@@ -32,7 +44,7 @@ class FileViewList : public QListView {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FileViewList(QWidget* parent = nullptr);
|
||||
FileViewList(QWidget *parent = nullptr);
|
||||
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "forcescrollperpixel.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractItemView>
|
||||
#include <QEvent>
|
||||
#include <QScrollBar>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "forcescrollperpixel.h"
|
||||
|
||||
ForceScrollPerPixel::ForceScrollPerPixel(QAbstractItemView *item_view, QObject *parent)
|
||||
: QObject(parent), item_view_(item_view) {
|
||||
@@ -33,9 +33,7 @@ ForceScrollPerPixel::ForceScrollPerPixel(QAbstractItemView *item_view, QObject *
|
||||
}
|
||||
|
||||
bool ForceScrollPerPixel::eventFilter(QObject *object, QEvent *event) {
|
||||
if (object == item_view_ &&
|
||||
event->type() != QEvent::Destroy &&
|
||||
event->type() != QEvent::WinIdChange) {
|
||||
if (object == item_view_ && event->type() != QEvent::Destroy && event->type() != QEvent::WinIdChange) {
|
||||
//event->type() != QEvent::AccessibilityPrepare)
|
||||
item_view_->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
item_view_->verticalScrollBar()->setSingleStep(20);
|
||||
|
||||
@@ -23,9 +23,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <QObject>
|
||||
#include <QtEvents>
|
||||
#include <QAbstractItemView>
|
||||
|
||||
class QAbstractItemView;
|
||||
class QEvent;
|
||||
|
||||
// Some KDE styles override the ScrollMode property of QAbstractItemViews.
|
||||
// This helper class forces the mode back to ScrollPerPixel.
|
||||
|
||||
@@ -20,11 +20,32 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QLinearGradient>
|
||||
#include <QPainter>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QPalette>
|
||||
#include <QColor>
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QTransform>
|
||||
#include <QLinearGradient>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "freespacebar.h"
|
||||
#include "core/utilities.h"
|
||||
#include "freespacebar.h"
|
||||
|
||||
class QPaintEvent;
|
||||
|
||||
const int FreeSpaceBar::kBarHeight = 20;
|
||||
const int FreeSpaceBar::kBarBorderRadius = 8;
|
||||
|
||||
@@ -23,7 +23,17 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QPainter>
|
||||
#include <QColor>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QtEvents>
|
||||
|
||||
class QPaintEvent;
|
||||
|
||||
class FreeSpaceBar : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -18,16 +18,40 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QListView>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractItemView>
|
||||
#include <QAbstractItemDelegate>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QList>
|
||||
#include <QArrayData>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QLocale>
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#include <QPalette>
|
||||
#include <QVector>
|
||||
#include <QRect>
|
||||
#include <QPen>
|
||||
#include <QPoint>
|
||||
#include <QScrollBar>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QtDebug>
|
||||
#include <QSize>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QFlags>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "groupediconview.h"
|
||||
#include "core/multisortfilterproxy.h"
|
||||
#include "groupediconview.h"
|
||||
|
||||
class QModelIndex;
|
||||
class QResizeEvent;
|
||||
|
||||
const int GroupedIconView::kBarThickness = 2;
|
||||
const int GroupedIconView::kBarMarginTop = 3;
|
||||
@@ -94,8 +118,7 @@ void GroupedIconView::DrawHeader(QPainter *painter, const QRect &rect, const QFo
|
||||
const QPoint end(rect.right(), start.y());
|
||||
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
painter->setPen(QPen(palette.color(QPalette::Disabled, QPalette::Text),
|
||||
kBarThickness, Qt::SolidLine, Qt::RoundCap));
|
||||
painter->setPen(QPen(palette.color(QPalette::Disabled, QPalette::Text), kBarThickness, Qt::SolidLine, Qt::RoundCap));
|
||||
painter->setOpacity(0.5);
|
||||
painter->drawLine(start, end);
|
||||
|
||||
@@ -208,8 +231,7 @@ QModelIndex GroupedIconView::indexAt(const QPoint &p) const {
|
||||
}
|
||||
|
||||
void GroupedIconView::paintEvent(QPaintEvent *e) {
|
||||
// This code was adapted from QListView::paintEvent(), changed to use the
|
||||
// visualRect() of items, and to draw headers.
|
||||
// This code was adapted from QListView::paintEvent(), changed to use the visualRect() of items, and to draw headers.
|
||||
|
||||
QStyleOptionViewItemV4 option(viewOptions());
|
||||
if (isWrapping())
|
||||
|
||||
@@ -23,11 +23,27 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QListView>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractItemView>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QString>
|
||||
#include <QFont>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QRegion>
|
||||
#include <QVector>
|
||||
#include <QtEvents>
|
||||
|
||||
class QModelIndex;
|
||||
class QPaintEvent;
|
||||
class QResizeEvent;
|
||||
class MultiSortFilterProxy;
|
||||
|
||||
|
||||
class GroupedIconView : public QListView {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -20,15 +20,31 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#include <QPalette>
|
||||
#include <QPaintDevice>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QToolButton>
|
||||
#include <QtDebug>
|
||||
#include <QLineEdit>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QFlags>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/iconloader.h"
|
||||
#include "lineedit.h"
|
||||
|
||||
class QPaintEvent;
|
||||
class QResizeEvent;
|
||||
|
||||
ExtendedEditor::ExtendedEditor(QWidget *widget, int extra_right_padding, bool draw_hint)
|
||||
: LineEditInterface(widget),
|
||||
has_clear_button_(true),
|
||||
@@ -88,8 +104,7 @@ void ExtendedEditor::UpdateButtonGeometry() {
|
||||
const int left = frame_width + 1 + (has_clear_button() ? clear_button_->sizeHint().width() : 0);
|
||||
const int right = frame_width + 1 + (has_reset_button() ? reset_button_->sizeHint().width() : 0);
|
||||
|
||||
widget_->setStyleSheet(
|
||||
QString("QLineEdit { padding-left: %1px; padding-right: %2px; }").arg(left).arg(right));
|
||||
widget_->setStyleSheet(QString("QLineEdit { padding-left: %1px; padding-right: %2px; }").arg(left).arg(right));
|
||||
|
||||
QSize msz = widget_->minimumSizeHint();
|
||||
widget_->setMinimumSize(msz.width() + (clear_button_->sizeHint().width() + frame_width + 1) * 2 + extra_right_padding_, qMax(msz.height(), clear_button_->sizeHint().height() + frame_width * 2 + 2));
|
||||
@@ -153,9 +168,7 @@ void LineEdit::text_changed(const QString& text) {
|
||||
set_rtl(false);
|
||||
}
|
||||
else {
|
||||
// For some reason Qt will detect any text with LTR at the end as LTR, so
|
||||
// instead
|
||||
// compare only the first character
|
||||
// For some reason Qt will detect any text with LTR at the end as LTR, so instead compare only the first character
|
||||
set_rtl(QString(text.at(0)).isRightToLeft());
|
||||
}
|
||||
Resize();
|
||||
|
||||
@@ -23,13 +23,21 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QLineEdit>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QToolButton>
|
||||
#include <QPaintDevice>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/iconloader.h"
|
||||
|
||||
class QToolButton;
|
||||
class QPaintEvent;
|
||||
class QResizeEvent;
|
||||
|
||||
class LineEditInterface {
|
||||
public:
|
||||
|
||||
@@ -20,7 +20,16 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QSize>
|
||||
#include <QTextEdit>
|
||||
#include <QTextOption>
|
||||
#include <QFontMetrics>
|
||||
#include <QSizePolicy>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "linetextedit.h"
|
||||
|
||||
@@ -51,7 +60,8 @@ QSize LineTextEdit::minimumSizeHint() const {
|
||||
void LineTextEdit::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||
e->ignore();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QTextEdit::keyPressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,14 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QTextEdit>
|
||||
#include <QtEvents>
|
||||
|
||||
class QKeyEvent;
|
||||
|
||||
class LineTextEdit : public QTextEdit {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -20,12 +20,24 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "multiloadingindicator.h"
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QPainter>
|
||||
#include <QSize>
|
||||
#include <QRect>
|
||||
#include <QSizePolicy>
|
||||
#include <QStringList>
|
||||
#include <QFontMetrics>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/taskmanager.h"
|
||||
#include "multiloadingindicator.h"
|
||||
#include "widgets/busyindicator.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QPainter>
|
||||
class QPaintEvent;
|
||||
|
||||
const int MultiLoadingIndicator::kVerticalPadding = 4;
|
||||
const int MultiLoadingIndicator::kHorizontalPadding = 6;
|
||||
|
||||
@@ -23,7 +23,13 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QtEvents>
|
||||
|
||||
class QPaintEvent;
|
||||
|
||||
class BusyIndicator;
|
||||
class TaskManager;
|
||||
|
||||
@@ -20,17 +20,26 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QCoreApplication>
|
||||
#include <QtDebug>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
#include <QImage>
|
||||
#include <QSettings>
|
||||
#ifdef HAVE_DBUS
|
||||
# include <QDBusPendingCall>
|
||||
#endif
|
||||
|
||||
#include "osd.h"
|
||||
#include "osdpretty.h"
|
||||
|
||||
#include "core/application.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/systemtrayicon.h"
|
||||
#include "covermanager/currentartloader.h"
|
||||
#include "osdpretty.h"
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
# include "dbus/notification.h"
|
||||
@@ -54,12 +63,13 @@ OSD::OSD(SystemTrayIcon *tray_icon, Application *app, QObject *parent)
|
||||
preview_mode_(false),
|
||||
force_show_next_(false),
|
||||
ignore_next_stopped_(false),
|
||||
pretty_popup_(new OSDPretty(OSDPretty::Mode_Popup))
|
||||
{
|
||||
connect(app_->current_art_loader(), SIGNAL(ThumbnailLoaded(Song,QString,QImage)), SLOT(AlbumArtLoaded(Song,QString,QImage)));
|
||||
pretty_popup_(new OSDPretty(OSDPretty::Mode_Popup)) {
|
||||
|
||||
connect(app_->current_art_loader(), SIGNAL(ThumbnailLoaded(Song, QString, QImage)), SLOT(AlbumArtLoaded(Song, QString, QImage)));
|
||||
|
||||
ReloadSettings();
|
||||
Init();
|
||||
|
||||
}
|
||||
|
||||
OSD::~OSD() {
|
||||
@@ -179,9 +189,7 @@ void OSD::Stopped() {
|
||||
}
|
||||
|
||||
void OSD::StopAfterToggle(bool stop) {
|
||||
ShowMessage(
|
||||
QCoreApplication::applicationName(),
|
||||
tr("Stop playing after track: %1").arg(stop ? tr("On") : tr("Off")));
|
||||
ShowMessage(QCoreApplication::applicationName(), tr("Stop playing after track: %1").arg(stop ? tr("On") : tr("Off")));
|
||||
}
|
||||
|
||||
void OSD::PlaylistFinished() {
|
||||
|
||||
@@ -24,25 +24,30 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
#include <QImage>
|
||||
#include <QObject>
|
||||
#ifdef HAVE_DBUS
|
||||
# include <QDBusArgument>
|
||||
# include <QDBusPendingCall>
|
||||
#endif
|
||||
|
||||
#include "engine/engine_fwd.h"
|
||||
#include "core/song.h"
|
||||
#include "engine/engine_fwd.h"
|
||||
#include "playlist/playlistsequence.h"
|
||||
|
||||
class Application;
|
||||
class OrgFreedesktopNotificationsInterface;
|
||||
class OSDPretty;
|
||||
class OrgFreedesktopNotificationsInterface;
|
||||
class SystemTrayIcon;
|
||||
|
||||
class QDBusPendingCallWatcher;
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
#include <QDBusArgument>
|
||||
|
||||
QDBusArgument& operator<< (QDBusArgument &arg, const QImage &image);
|
||||
const QDBusArgument &operator>> (const QDBusArgument &arg, QImage &image);
|
||||
#endif
|
||||
|
||||
@@ -57,8 +57,7 @@ bool OSD::SupportsNativeNotifications() {
|
||||
bool OSD::SupportsTrayPopups() { return false; }
|
||||
|
||||
|
||||
void OSD::ShowMessageNative(const QString& summary, const QString& message,
|
||||
const QString& icon, const QImage& image) {
|
||||
void OSD::ShowMessageNative(const QString& summary, const QString& message, const QString& icon, const QImage& image) {
|
||||
Q_UNUSED(icon);
|
||||
if (NotificationCenterSupported()) {
|
||||
scoped_nsobject<NSString> mac_message(
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "osd.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QtDebug>
|
||||
|
||||
void OSD::Init() {
|
||||
|
||||
@@ -20,19 +20,35 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "osd.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <memory>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QImage>
|
||||
#include <QColor>
|
||||
#ifdef HAVE_DBUS
|
||||
# include <QCoreApplication>
|
||||
# include <QDBusArgument>
|
||||
# include <QDBusConnection>
|
||||
# include <QDBusError>
|
||||
# include <QDBusPendingCall>
|
||||
# include <QDBusPendingReply>
|
||||
#endif
|
||||
#include <QJsonObject>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "config.h"
|
||||
#include "core/logging.h"
|
||||
#include "osd.h"
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
#include "dbus/notification.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QTextDocument>
|
||||
# include "dbus/notification.h"
|
||||
|
||||
QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) {
|
||||
|
||||
@@ -123,8 +139,7 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message, cons
|
||||
int id = 0;
|
||||
if (last_notification_time_.secsTo(QDateTime::currentDateTime()) * 1000 < timeout_msec_) {
|
||||
// Reuse the existing popup if it's still open. The reason we don't always
|
||||
// reuse the popup is because the notification daemon on KDE4 won't re-show
|
||||
// the bubble if it's already gone to the tray. See issue #118
|
||||
// reuse the popup is because the notification daemon on KDE4 won't re-show the bubble if it's already gone to the tray. See issue #118
|
||||
id = notification_id_;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,29 +20,45 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QBitmap>
|
||||
#include <QLabel>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QPalette>
|
||||
#include <QColor>
|
||||
#include <QBrush>
|
||||
#include <QCursor>
|
||||
#include <QPen>
|
||||
#include <QRect>
|
||||
#include <QPoint>
|
||||
#include <QFont>
|
||||
#include <QTimer>
|
||||
#include <QTimeLine>
|
||||
#include <QTransform>
|
||||
#include <QLayout>
|
||||
#include <QBoxLayout>
|
||||
#include <QDesktopWidget>
|
||||
#include <QLinearGradient>
|
||||
#include <QSettings>
|
||||
#include <QFlags>
|
||||
#include <QtEvents>
|
||||
#ifdef Q_WS_X11
|
||||
# include <QX11Info>
|
||||
#endif
|
||||
|
||||
#include "osdpretty.h"
|
||||
#include "ui_osdpretty.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QBitmap>
|
||||
#include <QColor>
|
||||
#include <QDesktopWidget>
|
||||
#include <QLayout>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QSettings>
|
||||
#include <QTimer>
|
||||
#include <QTimeLine>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
# include <QX11Info>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
# include "qtwin.h"
|
||||
# include <windows.h>
|
||||
# include "qtwin.h"
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
const char *OSDPretty::kSettingsGroup = "OSDPretty";
|
||||
@@ -324,8 +340,7 @@ void OSDPretty::Reposition() {
|
||||
layout()->activate();
|
||||
resize(sizeHint());
|
||||
|
||||
// Work out where to place the OSD. -1 for x or y means "on the right or
|
||||
// bottom edge".
|
||||
// Work out where to place the OSD. -1 for x or y means "on the right or bottom edge".
|
||||
QRect geometry(desktop->availableGeometry(popup_display_));
|
||||
|
||||
int x = popup_pos_.x() < 0 ? geometry.right() - width() : geometry.left() + popup_pos_.x();
|
||||
@@ -342,8 +357,7 @@ void OSDPretty::Reposition() {
|
||||
p.drawRoundedRect(BoxBorder().adjusted(-1, -1, 0, 0), kBorderRadius, kBorderRadius);
|
||||
p.end();
|
||||
|
||||
// If there's no compositing window manager running then we have to set an
|
||||
// XShape mask.
|
||||
// If there's no compositing window manager running then we have to set an XShape mask.
|
||||
if (IsTransparencyAvailable())
|
||||
clearMask();
|
||||
else {
|
||||
|
||||
@@ -23,12 +23,29 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QTimeLine>
|
||||
#include <QtEvents>
|
||||
|
||||
class QEvent;
|
||||
class QMouseEvent;
|
||||
class QPaintEvent;
|
||||
class QShowEvent;
|
||||
|
||||
class Ui_OSDPretty;
|
||||
|
||||
class QTimeLine;
|
||||
|
||||
class OSDPretty : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -77,9 +94,8 @@ class OSDPretty : public QWidget {
|
||||
QFont font() const { return font_; }
|
||||
bool disable_duration() const { return disable_duration_; }
|
||||
|
||||
// When the user has been moving the popup, use these to get its current
|
||||
// position and screen. Note that these return invalid values if the popup
|
||||
// is hidden.
|
||||
// When the user has been moving the popup, use these to get its current position and screen.
|
||||
// Note that these return invalid values if the popup is hidden.
|
||||
int current_display() const;
|
||||
QPoint current_pos() const;
|
||||
|
||||
|
||||
@@ -21,26 +21,33 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include <QByteArray>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QSize>
|
||||
#include <QMenu>
|
||||
#include <QMovie>
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#include <QSettings>
|
||||
#include <QPalette>
|
||||
#include <QBrush>
|
||||
#include <QSignalMapper>
|
||||
#include <QTextDocument>
|
||||
#include <QTimeLine>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "playingwidget.h"
|
||||
#include <QAction>
|
||||
#include <QActionGroup>
|
||||
#include <QSettings>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/application.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "covermanager/albumcoverloader.h"
|
||||
#include "covermanager/coverproviders.h"
|
||||
#include "covermanager/currentartloader.h"
|
||||
#include "covermanager/albumcoverchoicecontroller.h"
|
||||
#include "covermanager/albumcoverloader.h"
|
||||
#include "covermanager/currentartloader.h"
|
||||
#include "playingwidget.h"
|
||||
|
||||
const char *PlayingWidget::kSettingsGroup = "PlayingWidget";
|
||||
|
||||
|
||||
@@ -24,23 +24,38 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QSize>
|
||||
#include <QSignalMapper>
|
||||
#include <QTextDocument>
|
||||
#include <QTimeLine>
|
||||
#include <QAction>
|
||||
#include <QActionGroup>
|
||||
#include <QMenu>
|
||||
#include <QMovie>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/song.h"
|
||||
#include "covermanager/albumcoverloaderoptions.h"
|
||||
|
||||
class QContextMenuEvent;
|
||||
class QDragEnterEvent;
|
||||
class QDropEvent;
|
||||
class QMouseEvent;
|
||||
class QPaintEvent;
|
||||
class QPainter;
|
||||
class QResizeEvent;
|
||||
|
||||
class AlbumCoverChoiceController;
|
||||
class Application;
|
||||
|
||||
class QAction;
|
||||
class QActionGroup;
|
||||
class QMenu;
|
||||
class QMovie;
|
||||
class QSignalMapper;
|
||||
class QTextDocument;
|
||||
class QTimeLine;
|
||||
|
||||
class PlayingWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -20,27 +20,49 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "prettyimage.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QApplication>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QDesktopWidget>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QUrl>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QFrame>
|
||||
#include <QFuture>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QColor>
|
||||
#include <QBrush>
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QPainter>
|
||||
#include <QScrollArea>
|
||||
#include <QSizePolicy>
|
||||
#include <QTransform>
|
||||
#include <QDesktopWidget>
|
||||
#include <QLinearGradient>
|
||||
#include <QSettings>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QFlags>
|
||||
#include <QtDebug>
|
||||
#include <QtEvents>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "core/closure.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/network.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "prettyimage.h"
|
||||
|
||||
const int PrettyImage::kTotalHeight = 200;
|
||||
const int PrettyImage::kReflectionHeight = 40;
|
||||
@@ -50,7 +72,7 @@ const int PrettyImage::kMaxImageWidth = 300;
|
||||
|
||||
const char *PrettyImage::kSettingsGroup = "PrettyImageView";
|
||||
|
||||
PrettyImage::PrettyImage(const QUrl& url, QNetworkAccessManager* network, QWidget* parent)
|
||||
PrettyImage::PrettyImage(const QUrl &url, QNetworkAccessManager* network, QWidget* parent)
|
||||
: QWidget(parent),
|
||||
network_(network),
|
||||
state_(State_WaitingForLazyLoad),
|
||||
@@ -96,7 +118,8 @@ void PrettyImage::ImageFetched(RedirectFollower* follower) {
|
||||
if (image.isNull()) {
|
||||
qLog(Debug) << "Image failed to load" << reply->request().url() << reply->error();
|
||||
deleteLater();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
state_ = State_CreatingThumbnail;
|
||||
image_ = image;
|
||||
|
||||
|
||||
@@ -23,19 +23,30 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QFuture>
|
||||
#include <QUrl>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QFuture>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QMenu>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QtEvents>
|
||||
|
||||
class QContextMenuEvent;
|
||||
class QPaintEvent;
|
||||
|
||||
class QMenu;
|
||||
class QNetworkAccessManager;
|
||||
class RedirectFollower;
|
||||
|
||||
class PrettyImage : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PrettyImage(const QUrl& url, QNetworkAccessManager* network, QWidget* parent = nullptr);
|
||||
PrettyImage(const QUrl &url, QNetworkAccessManager *network, QWidget *parent = nullptr);
|
||||
|
||||
static const int kTotalHeight;
|
||||
static const int kReflectionHeight;
|
||||
@@ -43,7 +54,7 @@ public:
|
||||
|
||||
static const int kMaxImageWidth;
|
||||
|
||||
static const char* kSettingsGroup;
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize image_size() const;
|
||||
@@ -61,7 +72,7 @@ protected:
|
||||
void paintEvent(QPaintEvent*);
|
||||
|
||||
private slots:
|
||||
void ImageFetched(RedirectFollower* reply);
|
||||
void ImageFetched(RedirectFollower *reply);
|
||||
void ImageScaled(QFuture<QImage> future);
|
||||
|
||||
private:
|
||||
@@ -72,17 +83,17 @@ private:
|
||||
State_Finished,
|
||||
};
|
||||
|
||||
void DrawThumbnail(QPainter* p, const QRect& rect);
|
||||
void DrawThumbnail(QPainter *p, const QRect &rect);
|
||||
|
||||
private:
|
||||
QNetworkAccessManager* network_;
|
||||
QNetworkAccessManager *network_;
|
||||
State state_;
|
||||
QUrl url_;
|
||||
|
||||
QImage image_;
|
||||
QPixmap thumbnail_;
|
||||
|
||||
QMenu* menu_;
|
||||
QMenu *menu_;
|
||||
QString last_save_dir_;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,16 +20,28 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QUrl>
|
||||
#include <QFrame>
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QAbstractSlider>
|
||||
#include <QEasingCurve>
|
||||
#include <QLayout>
|
||||
#include <QLayoutItem>
|
||||
#include <QBoxLayout>
|
||||
#include <QScrollBar>
|
||||
#include <QSizePolicy>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QScrollArea>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "prettyimage.h"
|
||||
#include "prettyimageview.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QMouseEvent>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QScrollBar>
|
||||
#include <QTimer>
|
||||
#include <QtDebug>
|
||||
|
||||
PrettyImageView::PrettyImageView(QNetworkAccessManager* network, QWidget* parent)
|
||||
: QScrollArea(parent),
|
||||
network_(network),
|
||||
|
||||
@@ -23,32 +23,38 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QMap>
|
||||
#include <QScrollArea>
|
||||
#include <QUrl>
|
||||
#include <stdbool.h>
|
||||
|
||||
class QHBoxLayout;
|
||||
class QMenu;
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class QPropertyAnimation;
|
||||
class QTimeLine;
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QScrollArea>
|
||||
#include <QBoxLayout>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QtEvents>
|
||||
|
||||
class QEvent;
|
||||
class QMouseEvent;
|
||||
class QResizeEvent;
|
||||
class QWheelEvent;
|
||||
|
||||
class PrettyImageView : public QScrollArea {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PrettyImageView(QNetworkAccessManager* network, QWidget* parent = nullptr);
|
||||
PrettyImageView(QNetworkAccessManager *network, QWidget *parent = nullptr);
|
||||
|
||||
static const char* kSettingsGroup;
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
public slots:
|
||||
void AddImage(const QUrl& url);
|
||||
|
||||
protected:
|
||||
void mouseReleaseEvent(QMouseEvent*);
|
||||
void resizeEvent(QResizeEvent* e);
|
||||
void wheelEvent(QWheelEvent* e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
void wheelEvent(QWheelEvent *e);
|
||||
|
||||
private slots:
|
||||
void ScrollBarReleased();
|
||||
@@ -59,13 +65,13 @@ private slots:
|
||||
private:
|
||||
bool eventFilter(QObject*, QEvent*);
|
||||
|
||||
QNetworkAccessManager* network_;
|
||||
QNetworkAccessManager *network_;
|
||||
|
||||
QWidget* container_;
|
||||
QHBoxLayout* layout_;
|
||||
QWidget *container_;
|
||||
QHBoxLayout *layout_;
|
||||
|
||||
int current_index_;
|
||||
QPropertyAnimation* scroll_animation_;
|
||||
QPropertyAnimation *scroll_animation_;
|
||||
|
||||
bool recursion_filter_;
|
||||
};
|
||||
|
||||
@@ -20,9 +20,21 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "progressitemdelegate.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QApplication>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QPainter>
|
||||
#include <QStyle>
|
||||
#include <QRect>
|
||||
#include <QStyleOptionProgressBar>
|
||||
|
||||
#include "progressitemdelegate.h"
|
||||
|
||||
ProgressItemDelegate::ProgressItemDelegate(QObject *parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
@@ -30,6 +42,7 @@ ProgressItemDelegate::ProgressItemDelegate(QObject *parent)
|
||||
}
|
||||
|
||||
void ProgressItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
|
||||
|
||||
bool ok = false;
|
||||
int progress = index.data().toInt(&ok);
|
||||
|
||||
@@ -43,8 +56,10 @@ void ProgressItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
opt.textVisible = true;
|
||||
|
||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &opt, painter);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStyledItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,14 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QPainter>
|
||||
#include <QStyleOption>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QStyleOptionViewItem>
|
||||
|
||||
class QModelIndex;
|
||||
|
||||
class ProgressItemDelegate : public QStyledItemDelegate {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -20,12 +20,23 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "ratingwidget.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QStyleOptionFrameV3>
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QPixmap>
|
||||
#include <QFrame>
|
||||
#include <QPainter>
|
||||
#include <QRect>
|
||||
#include <QPoint>
|
||||
#include <QSize>
|
||||
#include <QSizePolicy>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QStylePainter>
|
||||
#include <QtDebug>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "ratingwidget.h"
|
||||
|
||||
const int RatingPainter::kStarCount;
|
||||
const int RatingPainter::kStarSize;
|
||||
@@ -61,7 +72,8 @@ RatingPainter::RatingPainter() {
|
||||
const QRect source_right(kStarSize/2, 0, kStarSize/2, kStarSize);
|
||||
p.drawPixmap(target_left, on, source_left);
|
||||
p.drawPixmap(target_right, off, source_right);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Totally full
|
||||
p.drawPixmap(rect, on);
|
||||
}
|
||||
@@ -109,8 +121,7 @@ RatingWidget::RatingWidget(QWidget* parent)
|
||||
|
||||
QSize RatingWidget::sizeHint() const {
|
||||
const int frame_width = 1 + style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
return QSize(RatingPainter::kStarSize * (RatingPainter::kStarCount+2) + frame_width*2,
|
||||
RatingPainter::kStarSize + frame_width*2);
|
||||
return QSize(RatingPainter::kStarSize * (RatingPainter::kStarCount+2) + frame_width*2, RatingPainter::kStarSize + frame_width*2);
|
||||
}
|
||||
|
||||
void RatingWidget::set_rating(float rating) {
|
||||
|
||||
@@ -21,8 +21,21 @@
|
||||
#ifndef RATINGWIDGET_H
|
||||
#define RATINGWIDGET_H
|
||||
|
||||
#include <QFrame>
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QPoint>
|
||||
#include <QtEvents>
|
||||
|
||||
class QEvent;
|
||||
class QMouseEvent;
|
||||
class QPaintEvent;
|
||||
|
||||
class RatingPainter {
|
||||
public:
|
||||
@@ -33,7 +46,7 @@ public:
|
||||
static QRect Contents(const QRect& rect);
|
||||
static double RatingForPos(const QPoint& pos, const QRect& rect);
|
||||
|
||||
void Paint(QPainter* painter, const QRect& rect, float rating) const;
|
||||
void Paint(QPainter *painter, const QRect& rect, float rating) const;
|
||||
|
||||
private:
|
||||
QPixmap stars_[kStarCount*2+1];
|
||||
@@ -44,7 +57,7 @@ class RatingWidget : public QWidget {
|
||||
Q_PROPERTY(float rating READ rating WRITE set_rating);
|
||||
|
||||
public:
|
||||
RatingWidget(QWidget* parent = nullptr);
|
||||
RatingWidget(QWidget *parent = nullptr);
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
@@ -56,8 +69,8 @@ signals:
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*);
|
||||
void mousePressEvent(QMouseEvent* e);
|
||||
void mouseMoveEvent(QMouseEvent* e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void leaveEvent(QEvent*);
|
||||
|
||||
private:
|
||||
|
||||
@@ -18,9 +18,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "renametablineedit.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "renametablineedit.h"
|
||||
|
||||
RenameTabLineEdit::RenameTabLineEdit(QWidget *parent) :
|
||||
QLineEdit(parent)
|
||||
|
||||
@@ -21,7 +21,16 @@
|
||||
#ifndef RENAMETABLINEEDIT_H
|
||||
#define RENAMETABLINEEDIT_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QLineEdit>
|
||||
#include <QtEvents>
|
||||
|
||||
class QFocusEvent;
|
||||
class QKeyEvent;
|
||||
|
||||
class RenameTabLineEdit : public QLineEdit {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -17,20 +17,36 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "sliderwidget.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QBitmap>
|
||||
#include <QBrush>
|
||||
#include <QWidget>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include <QSize>
|
||||
#include <QTimer>
|
||||
#include <QStyle>
|
||||
#include <QPainterPath>
|
||||
#include <QPalette>
|
||||
#include <QFont>
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
#include <QPoint>
|
||||
#include <QPolygon>
|
||||
#include <QRect>
|
||||
#include <QVector>
|
||||
#include <QMenu>
|
||||
#include <QWheelEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QStyleOptionSlider>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QTimer>
|
||||
#include <QAction>
|
||||
#include <QSlider>
|
||||
#include <QLinearGradient>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QFlags>
|
||||
#include <QtEvents>
|
||||
|
||||
Amarok::Slider::Slider(Qt::Orientation orientation, QWidget* parent, uint max)
|
||||
: QSlider(orientation, parent),
|
||||
|
||||
@@ -17,15 +17,30 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef AMAROKSLIDER_H
|
||||
#define AMAROKSLIDER_H
|
||||
#ifndef SLIDERWIDGET_H
|
||||
#define SLIDERWIDGET_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QSlider>
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QColor>
|
||||
#include <QPalette>
|
||||
#include <QSlider>
|
||||
#include <QTimer>
|
||||
#include <QtEvents>
|
||||
|
||||
class QPalette;
|
||||
class QTimer;
|
||||
class QEvent;
|
||||
class QMouseEvent;
|
||||
class QPaintEvent;
|
||||
class QWheelEvent;
|
||||
class QContextMenuEvent;
|
||||
|
||||
namespace Amarok {
|
||||
class Slider : public QSlider {
|
||||
@@ -36,14 +51,12 @@ class Slider : public QSlider {
|
||||
|
||||
virtual void setValue(int);
|
||||
|
||||
// WARNING non-virtual - and thus only really intended for internal use
|
||||
// this is a major flaw in the class presently, however it suits our
|
||||
// current needs fine
|
||||
// WARNING non-virtual - and thus only really intended for internal use this is a major flaw in the class presently,
|
||||
// however it suits our current needs fine
|
||||
int value() const { return adjustValue(QSlider::value()); }
|
||||
|
||||
signals:
|
||||
// we emit this when the user has specifically changed the slider
|
||||
// so connect to it if valueChanged() is too generic
|
||||
// we emit this when the user has specifically changed the slider so connect to it if valueChanged() is too generic
|
||||
// Qt also emits valueChanged( int )
|
||||
void sliderReleased(int);
|
||||
|
||||
@@ -79,8 +92,7 @@ class PrettySlider : public Slider {
|
||||
Pretty
|
||||
} SliderMode;
|
||||
|
||||
PrettySlider(Qt::Orientation orientation, SliderMode mode, QWidget* parent,
|
||||
uint max = 0);
|
||||
PrettySlider(Qt::Orientation orientation, SliderMode mode, QWidget* parent, uint max = 0);
|
||||
|
||||
protected:
|
||||
virtual void slideEvent(QMouseEvent*);
|
||||
@@ -138,4 +150,4 @@ class VolumeSlider : public Slider {
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // SLIDERWIDGET_H
|
||||
|
||||
@@ -19,42 +19,48 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "statusview.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QIODevice>
|
||||
#include <QFile>
|
||||
#include <QTextDocument>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QScrollArea>
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QMovie>
|
||||
#include <QAction>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QBrush>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QMenu>
|
||||
#include <QScrollArea>
|
||||
#include <QBoxLayout>
|
||||
#include <QSettings>
|
||||
#include <QSizePolicy>
|
||||
#include <QTimeLine>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/utilities.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/song.h"
|
||||
#include "core/application.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/player.h"
|
||||
#include "core/mainwindow.h"
|
||||
|
||||
#include "collection/collection.h"
|
||||
#include "core/song.h"
|
||||
#include "core/utilities.h"
|
||||
#include "engine/engine_fwd.h"
|
||||
#include "engine/enginebase.h"
|
||||
#include "engine/enginetype.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "collection/collectionquery.h"
|
||||
#include "collection/collectionview.h"
|
||||
#include "collection/collectionviewcontainer.h"
|
||||
|
||||
#include "covermanager/albumcoverloader.h"
|
||||
#include "covermanager/coverproviders.h"
|
||||
#include "covermanager/currentartloader.h"
|
||||
#include "covermanager/albumcoverchoicecontroller.h"
|
||||
|
||||
#include "engine/enginetype.h"
|
||||
#include "engine/enginebase.h"
|
||||
#include "covermanager/albumcoverloader.h"
|
||||
#include "covermanager/currentartloader.h"
|
||||
#include "statusview.h"
|
||||
|
||||
const char *StatusView::kSettingsGroup = "StatusView";
|
||||
|
||||
@@ -284,13 +290,12 @@ void StatusView::SwitchWidgets(WidgetState state) {
|
||||
|
||||
}
|
||||
|
||||
void StatusView::UpdateSong(const Song &song) {
|
||||
void StatusView::UpdateSong() {
|
||||
|
||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||
|
||||
SwitchWidgets(Playing);
|
||||
|
||||
const Song *song_ = &song;
|
||||
const QueryOptions opt;
|
||||
CollectionBackend::AlbumList albumlist;
|
||||
Engine::EngineType enginetype = app_->player()->engine()->type();
|
||||
@@ -301,15 +306,15 @@ void StatusView::UpdateSong(const Song &song) {
|
||||
|
||||
QString html;
|
||||
QString html_albums;
|
||||
html += QString("<b>%1 - %2</b><br/>%3").arg(song_->PrettyTitle().toHtmlEscaped(), song_->artist().toHtmlEscaped(), song_->album().toHtmlEscaped());
|
||||
html += QString("<b>%1 - %2</b><br/>%3").arg(metadata_.PrettyTitle().toHtmlEscaped(), metadata_.artist().toHtmlEscaped(), metadata_.album().toHtmlEscaped());
|
||||
label_playing_top_->setText(html);
|
||||
|
||||
html = "";
|
||||
|
||||
html += QString("Filetype: %1<br />\n").arg(song_->TextForFiletype());
|
||||
html += QString("Length: %1<br />\n").arg(Utilities::PrettyTimeNanosec(song.length_nanosec()));
|
||||
html += QString("Bitrate: %1 kbps<br />\n").arg(song_->bitrate());
|
||||
html += QString("Samplerate: %1 hz / %2 bit<br />\n").arg(song_->samplerate()).arg(song_->bitdepth());
|
||||
html += QString("Filetype: %1<br />\n").arg(metadata_.TextForFiletype());
|
||||
html += QString("Length: %1<br />\n").arg(Utilities::PrettyTimeNanosec(metadata_.length_nanosec()));
|
||||
html += QString("Bitrate: %1 kbps<br />\n").arg(metadata_.bitrate());
|
||||
html += QString("Samplerate: %1 hz / %2 bit<br />\n").arg(metadata_.samplerate()).arg(metadata_.bitdepth());
|
||||
|
||||
if (enginetype != Engine::EngineType::None) {
|
||||
html += QString("<br />");
|
||||
@@ -318,9 +323,9 @@ void StatusView::UpdateSong(const Song &song) {
|
||||
|
||||
html += QString("<br />");
|
||||
|
||||
html_albums += QString("<b>Albums by %1:</b>").arg( song_->artist().toHtmlEscaped() );
|
||||
html_albums += QString("<b>Albums by %1:</b>").arg( metadata_.artist().toHtmlEscaped() );
|
||||
|
||||
albumlist = app_->collection_backend()->GetAlbumsByArtist(song_->artist(), opt);
|
||||
albumlist = app_->collection_backend()->GetAlbumsByArtist(metadata_.artist(), opt);
|
||||
|
||||
html_albums += QString("<ul>");
|
||||
int i=0;
|
||||
@@ -379,9 +384,8 @@ void StatusView::SongChanged(const Song &song) {
|
||||
|
||||
stopped_ = false;
|
||||
metadata_ = song;
|
||||
const Song *song_ = &song;
|
||||
|
||||
UpdateSong(*song_);
|
||||
UpdateSong();
|
||||
|
||||
update();
|
||||
|
||||
|
||||
@@ -22,31 +22,38 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <memory>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QMovie>
|
||||
#include <QPainter>
|
||||
#include <QTimeLine>
|
||||
#include <QAction>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QScrollArea>
|
||||
#include <QBoxLayout>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/song.h"
|
||||
#include "core/database.h"
|
||||
#include "core/application.h"
|
||||
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "collection/collectionview.h"
|
||||
#include "collection/collectionviewcontainer.h"
|
||||
|
||||
#include "covermanager/albumcoverloaderoptions.h"
|
||||
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class QScrollArea;
|
||||
class QWidget;
|
||||
class QTimeLine;
|
||||
class QLabel;
|
||||
class QImage;
|
||||
class QPixmap;
|
||||
class QPainter;
|
||||
class QEvent;
|
||||
class QContextMenuEvent;
|
||||
class QDragEnterEvent;
|
||||
class QDropEvent;
|
||||
class QMouseEvent;
|
||||
|
||||
class Application;
|
||||
class CollectionView;
|
||||
class CollectionBackend;
|
||||
class CollectionViewContainer;
|
||||
class AlbumCoverChoiceController;
|
||||
|
||||
class StatusView : public QWidget {
|
||||
Q_OBJECT
|
||||
@@ -54,7 +61,7 @@ class StatusView : public QWidget {
|
||||
public:
|
||||
StatusView(CollectionViewContainer *collectionviewcontainer, QWidget *parent = nullptr);
|
||||
~StatusView();
|
||||
|
||||
|
||||
static const char* kSettingsGroup;
|
||||
static const int kPadding;
|
||||
static const int kGradientHead;
|
||||
@@ -62,9 +69,9 @@ public:
|
||||
static const int kMaxCoverSize;
|
||||
static const int kBottomOffset;
|
||||
static const int kTopBorder;
|
||||
|
||||
|
||||
void SetApplication(Application *app);
|
||||
|
||||
|
||||
public slots:
|
||||
void SongChanged(const Song &song);
|
||||
void SongFinished();
|
||||
@@ -100,8 +107,6 @@ private:
|
||||
QPixmap *pixmap_album_;
|
||||
QPainter *painter_album_;
|
||||
|
||||
Song song_;
|
||||
|
||||
CollectionView *collectionview_;
|
||||
|
||||
AlbumCoverLoaderOptions cover_loader_options_;
|
||||
@@ -150,10 +155,9 @@ private:
|
||||
Stopped
|
||||
};
|
||||
WidgetState widgetstate_;
|
||||
QMenu* menu_;
|
||||
QMenu *menu_;
|
||||
|
||||
protected:
|
||||
|
||||
bool eventFilter(QObject *, QEvent *);
|
||||
void handlePaintEvent(QObject *object, QEvent *event);
|
||||
void paintEvent_album(QEvent *event);
|
||||
@@ -161,7 +165,7 @@ protected:
|
||||
void mouseReleaseEvent(QMouseEvent *);
|
||||
void dragEnterEvent(QDragEnterEvent *e);
|
||||
void dropEvent(QDropEvent *e);
|
||||
void UpdateSong(const Song &song);
|
||||
void UpdateSong();
|
||||
void NoSong();
|
||||
void SwitchWidgets(WidgetState state);
|
||||
|
||||
|
||||
@@ -20,8 +20,13 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSlider>
|
||||
|
||||
#include "stickyslider.h"
|
||||
|
||||
class QMouseEvent;
|
||||
|
||||
StickySlider::StickySlider(QWidget *parent)
|
||||
: QSlider(parent),
|
||||
sticky_center_(-1),
|
||||
|
||||
@@ -23,8 +23,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QSlider>
|
||||
|
||||
class QMouseEvent;
|
||||
|
||||
class StickySlider : public QSlider {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int sticky_center READ sticky_center WRITE set_sticky_center);
|
||||
|
||||
@@ -20,15 +20,22 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "stretchheaderview.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QDataStream>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <numeric>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QHeaderView>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QIODevice>
|
||||
#include <QArrayData>
|
||||
#include <QByteArray>
|
||||
#include <QDataStream>
|
||||
#include <QList>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "stretchheaderview.h"
|
||||
|
||||
const int StretchHeaderView::kMinimumColumnWidth = 10;
|
||||
const int StretchHeaderView::kMagicNumber = 0x502c950f;
|
||||
|
||||
@@ -239,7 +246,7 @@ void StretchHeaderView::SetColumnWidth(int logical, ColumnWidthType width) {
|
||||
bool StretchHeaderView::RestoreState(const QByteArray& data) {
|
||||
|
||||
QDataStream s(data);
|
||||
s.setVersion(QDataStream::Qt_4_6);
|
||||
s.setVersion(QDataStream::Qt_5_6);
|
||||
|
||||
int magic_number = 0;
|
||||
s >> magic_number;
|
||||
@@ -264,8 +271,7 @@ bool StretchHeaderView::RestoreState(const QByteArray& data) {
|
||||
|
||||
const int persisted_column_count = qMin(qMin(visual_indices.count(), pixel_widths.count()), column_widths_.count());
|
||||
|
||||
// Set column visible state, visual indices and, if we're not in stretch mode,
|
||||
// pixel widths.
|
||||
// Set column visible state, visual indices and, if we're not in stretch mode, pixel widths.
|
||||
for (int i = 0; i < count() && i < persisted_column_count; ++i) {
|
||||
setSectionHidden(i, pixel_widths[i] <= kMinimumColumnWidth);
|
||||
moveSection(visualIndex(visual_indices[i]), i);
|
||||
@@ -281,8 +287,7 @@ bool StretchHeaderView::RestoreState(const QByteArray& data) {
|
||||
}
|
||||
|
||||
if (stretch_enabled_) {
|
||||
// In stretch mode, we've already set the proportional column widths so apply
|
||||
// them now.
|
||||
// In stretch mode, we've already set the proportional column widths so apply them now.
|
||||
UpdateWidths();
|
||||
}
|
||||
|
||||
@@ -305,7 +310,7 @@ QByteArray StretchHeaderView::SaveState() const {
|
||||
visual_indices << logicalIndex(i);
|
||||
}
|
||||
|
||||
s.setVersion(QDataStream::Qt_4_6);
|
||||
s.setVersion(QDataStream::Qt_5_6);
|
||||
s << kMagicNumber;
|
||||
|
||||
s << stretch_enabled_;
|
||||
|
||||
@@ -23,7 +23,20 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QByteArray>
|
||||
#include <QHeaderView>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QtEvents>
|
||||
|
||||
class QMouseEvent;
|
||||
class QResizeEvent;
|
||||
|
||||
class StretchHeaderView : public QHeaderView {
|
||||
Q_OBJECT
|
||||
@@ -38,14 +51,12 @@ class StretchHeaderView : public QHeaderView {
|
||||
|
||||
void setModel(QAbstractItemModel* model);
|
||||
|
||||
// Serialises the proportional and actual column widths. Use these instead
|
||||
// of QHeaderView::restoreState and QHeaderView::saveState to persist the
|
||||
// proportional values directly and avoid floating point errors over time.
|
||||
// Serialises the proportional and actual column widths.
|
||||
// Use these instead of QHeaderView::restoreState and QHeaderView::saveState to persist the proportional values directly and avoid floating point errors over time.
|
||||
bool RestoreState(const QByteArray& data);
|
||||
QByteArray SaveState() const;
|
||||
|
||||
// Hides a section and resizes all other sections to fill the gap. Does
|
||||
// nothing if you try to hide the last section.
|
||||
// Hides a section and resizes all other sections to fill the gap. Does nothing if you try to hide the last section.
|
||||
void HideSection(int logical);
|
||||
|
||||
// Shows a section and resizes all other sections to make room.
|
||||
@@ -79,8 +90,7 @@ protected:
|
||||
// Scales column_widths_ values so the total is 1.0.
|
||||
void NormaliseWidths(const QList<int>& sections = QList<int>());
|
||||
|
||||
// Resizes the actual columns to make them match the proportional values
|
||||
// in column_widths_.
|
||||
// Resizes the actual columns to make them match the proportional values in column_widths_.
|
||||
void UpdateWidths(const QList<int>& sections = QList<int>());
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -27,28 +27,36 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "stylehelper.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QtGlobal>
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QRect>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QIcon>
|
||||
#include <QPixmap>
|
||||
#include <QPixmapCache>
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include <QBrush>
|
||||
#include <QRect>
|
||||
#include <QColor>
|
||||
#include <QPoint>
|
||||
#include <QSize>
|
||||
|
||||
#include "core/qt_blurimage.h"
|
||||
|
||||
// Clamps float color values within (0, 255)
|
||||
static int clamp(float x)
|
||||
{
|
||||
static int clamp(float x) {
|
||||
const int val = x > 255 ? 255 : static_cast<int>(x);
|
||||
return val < 0 ? 0 : val;
|
||||
}
|
||||
|
||||
namespace Utils {
|
||||
|
||||
qreal StyleHelper::sidebarFontSize()
|
||||
{
|
||||
qreal StyleHelper::sidebarFontSize() {
|
||||
#if defined(Q_WS_MAC)
|
||||
return 10;
|
||||
#else
|
||||
@@ -56,8 +64,7 @@ qreal StyleHelper::sidebarFontSize()
|
||||
#endif
|
||||
}
|
||||
|
||||
QColor StyleHelper::panelTextColor(bool lightColored)
|
||||
{
|
||||
QColor StyleHelper::panelTextColor(bool lightColored) {
|
||||
if (!lightColored)
|
||||
return Qt::white;
|
||||
else
|
||||
@@ -68,57 +75,41 @@ QColor StyleHelper::panelTextColor(bool lightColored)
|
||||
QColor StyleHelper::m_baseColor;
|
||||
QColor StyleHelper::m_requestedBaseColor;
|
||||
|
||||
QColor StyleHelper::baseColor(bool lightColored)
|
||||
{
|
||||
QColor StyleHelper::baseColor(bool lightColored) {
|
||||
if (!lightColored)
|
||||
return m_baseColor;
|
||||
else
|
||||
return m_baseColor.lighter(230);
|
||||
}
|
||||
|
||||
QColor StyleHelper::highlightColor(bool lightColored)
|
||||
{
|
||||
QColor StyleHelper::highlightColor(bool lightColored) {
|
||||
QColor result = baseColor(lightColored);
|
||||
if (!lightColored)
|
||||
result.setHsv(result.hue(),
|
||||
clamp(result.saturation()),
|
||||
clamp(result.value() * 1.16));
|
||||
result.setHsv(result.hue(), clamp(result.saturation()), clamp(result.value() * 1.16));
|
||||
else
|
||||
result.setHsv(result.hue(),
|
||||
clamp(result.saturation()),
|
||||
clamp(result.value() * 1.06));
|
||||
result.setHsv(result.hue(), clamp(result.saturation()), clamp(result.value() * 1.06));
|
||||
return result;
|
||||
}
|
||||
|
||||
QColor StyleHelper::shadowColor(bool lightColored)
|
||||
{
|
||||
QColor result = baseColor(lightColored);
|
||||
result.setHsv(result.hue(),
|
||||
clamp(result.saturation() * 1.1),
|
||||
clamp(result.value() * 0.70));
|
||||
result.setHsv(result.hue(), clamp(result.saturation() * 1.1), clamp(result.value() * 0.70));
|
||||
return result;
|
||||
}
|
||||
|
||||
QColor StyleHelper::borderColor(bool lightColored)
|
||||
{
|
||||
QColor StyleHelper::borderColor(bool lightColored) {
|
||||
QColor result = baseColor(lightColored);
|
||||
result.setHsv(result.hue(),
|
||||
result.saturation(),
|
||||
result.value() / 2);
|
||||
result.setHsv(result.hue(), result.saturation(), result.value() / 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
// We try to ensure that the actual color used are within
|
||||
// reasonalbe bounds while generating the actual baseColor
|
||||
// from the users request.
|
||||
void StyleHelper::setBaseColor(const QColor &newcolor)
|
||||
{
|
||||
// We try to ensure that the actual color used are within reasonalbe bounds while generating the actual baseColor from the users request.
|
||||
void StyleHelper::setBaseColor(const QColor &newcolor) {
|
||||
m_requestedBaseColor = newcolor;
|
||||
|
||||
QColor color;
|
||||
color.setHsv(newcolor.hue(),
|
||||
newcolor.saturation() * 0.7,
|
||||
64 + newcolor.value() / 3);
|
||||
color.setHsv(newcolor.hue(), newcolor.saturation() * 0.7, 64 + newcolor.value() / 3);
|
||||
|
||||
if (color.isValid() && color != m_baseColor) {
|
||||
m_baseColor = color;
|
||||
@@ -128,8 +119,7 @@ void StyleHelper::setBaseColor(const QColor &newcolor)
|
||||
}
|
||||
}
|
||||
|
||||
static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRect &rect, bool lightColored)
|
||||
{
|
||||
static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRect &rect, bool lightColored) {
|
||||
QColor highlight = StyleHelper::highlightColor(lightColored);
|
||||
QColor shadow = StyleHelper::shadowColor(lightColored);
|
||||
QLinearGradient grad(spanRect.topRight(), spanRect.topLeft());
|
||||
@@ -139,20 +129,17 @@ static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRe
|
||||
|
||||
QColor light(255, 255, 255, 80);
|
||||
p->setPen(light);
|
||||
p->drawLine(rect.topRight() - QPoint(1, 0), rect.bottomRight() - QPoint(1, 0));
|
||||
p->drawLine(rect.topRight() - QPoint(1, 0), rect.bottomRight() - QPoint(1, 0));
|
||||
QColor dark(0, 0, 0, 90);
|
||||
p->setPen(dark);
|
||||
p->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
}
|
||||
|
||||
void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored)
|
||||
{
|
||||
void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) {
|
||||
if (StyleHelper::usePixmapCache()) {
|
||||
QString key;
|
||||
QColor keyColor = baseColor(lightColored);
|
||||
key.sprintf("mh_vertical %d %d %d %d %d",
|
||||
spanRect.width(), spanRect.height(), clipRect.width(),
|
||||
clipRect.height(), keyColor.rgb());;
|
||||
key.sprintf("mh_vertical %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb());
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(key, pixmap)) {
|
||||
@@ -165,17 +152,16 @@ void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, con
|
||||
}
|
||||
|
||||
painter->drawPixmap(clipRect.topLeft(), pixmap);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
verticalGradientHelper(painter, spanRect, clipRect, lightColored);
|
||||
}
|
||||
}
|
||||
|
||||
// Draws a cached pixmap with shadow
|
||||
void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
|
||||
QPainter *p, QIcon::Mode iconMode, int radius, const QColor &color, const QPoint &offset)
|
||||
{
|
||||
void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter *p, QIcon::Mode iconMode, int radius, const QColor &color, const QPoint &offset) {
|
||||
QPixmap cache;
|
||||
QString pixmapName = QString("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height());
|
||||
QString pixmapName = QString("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height());
|
||||
|
||||
if (!QPixmapCache::find(pixmapName, cache)) {
|
||||
QPixmap px = icon.pixmap(rect.size());
|
||||
@@ -198,7 +184,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
|
||||
}
|
||||
|
||||
// Draw shadow
|
||||
QImage tmp(px.size() + QSize(radius * 2, radius * 2 + 1), QImage::Format_ARGB32_Premultiplied);
|
||||
QImage tmp(px.size() + QSize(radius * 2, radius * 2 + 1), QImage::Format_ARGB32_Premultiplied);
|
||||
tmp.fill(Qt::transparent);
|
||||
|
||||
QPainter tmpPainter(&tmp);
|
||||
@@ -227,7 +213,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
|
||||
tmpPainter.end();
|
||||
|
||||
// draw the blurred drop shadow...
|
||||
cachePainter.drawImage(QRect(0, 0, cache.rect().width(), cache.rect().height()), tmp);
|
||||
cachePainter.drawImage(QRect(0, 0, cache.rect().width(), cache.rect().height()), tmp);
|
||||
|
||||
// Draw the actual pixmap...
|
||||
cachePainter.drawPixmap(QPoint(radius, radius) + offset, px);
|
||||
|
||||
@@ -30,16 +30,14 @@
|
||||
#ifndef STYLEHELPER_H
|
||||
#define STYLEHELPER_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QIcon>
|
||||
#include <QPainter>
|
||||
#include <QColor>
|
||||
#include <QStyle>
|
||||
|
||||
#include "core/qt_blurimage.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPalette;
|
||||
class QPainter;
|
||||
class QRect;
|
||||
QT_END_NAMESPACE
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
|
||||
// Helper class holding all custom color values
|
||||
|
||||
@@ -70,9 +68,7 @@ public:
|
||||
static void verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false);
|
||||
static bool usePixmapCache() { return true; }
|
||||
|
||||
static void drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter *p, QIcon::Mode iconMode,
|
||||
int radius = 3, const QColor &color = QColor(0, 0, 0, 130),
|
||||
const QPoint &offset = QPoint(1, -2));
|
||||
static void drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter *p, QIcon::Mode iconMode, int radius = 3, const QColor &color = QColor(0, 0, 0, 130), const QPoint &offset = QPoint(1, -2));
|
||||
|
||||
private:
|
||||
static QColor m_baseColor;
|
||||
|
||||
@@ -18,14 +18,22 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QSize>
|
||||
#include <QLabel>
|
||||
#include <QSettings>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "trackslider.h"
|
||||
#include "ui_trackslider.h"
|
||||
#include "core/timeconstants.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include "trackslider.h"
|
||||
#include "ui_trackslider.h"
|
||||
#include "clickablelabel.h"
|
||||
#include "tracksliderslider.h"
|
||||
|
||||
const char* TrackSlider::kSettingsGroup = "MainWindow";
|
||||
|
||||
@@ -59,8 +67,7 @@ void TrackSlider::SetApplication(Application* app) {
|
||||
}
|
||||
|
||||
void TrackSlider::UpdateLabelWidth() {
|
||||
// We set the label's minimum size so it won't resize itself when the user
|
||||
// is dragging the slider.
|
||||
// We set the label's minimum size so it won't resize itself when the user is dragging the slider.
|
||||
UpdateLabelWidth(ui_->elapsed, "0:00:00");
|
||||
UpdateLabelWidth(ui_->remaining, "-0:00:00");
|
||||
}
|
||||
@@ -103,12 +110,12 @@ void TrackSlider::SetValue(int elapsed, int total) {
|
||||
void TrackSlider::UpdateTimes(int elapsed) {
|
||||
|
||||
ui_->elapsed->setText(Utilities::PrettyTime(elapsed));
|
||||
//update normally if showing remaining time
|
||||
// Update normally if showing remaining time
|
||||
if (show_remaining_time_) {
|
||||
ui_->remaining->setText("-" + Utilities::PrettyTime((ui_->slider->maximum() / kMsecPerSec) - elapsed));
|
||||
}
|
||||
else {
|
||||
// check if slider maximum value is changed before updating
|
||||
// Check if slider maximum value is changed before updating
|
||||
if (slider_maximum_value_ != ui_->slider->maximum()) {
|
||||
slider_maximum_value_ = ui_->slider->maximum();
|
||||
ui_->remaining->setText(Utilities::PrettyTime((ui_->slider->maximum() / kMsecPerSec)));
|
||||
@@ -165,12 +172,12 @@ void TrackSlider::ToggleTimeDisplay() {
|
||||
|
||||
show_remaining_time_ = !show_remaining_time_;
|
||||
if (!show_remaining_time_) {
|
||||
//we set the value to -1 because the label must be updated
|
||||
// We set the value to -1 because the label must be updated
|
||||
slider_maximum_value_ = -1;
|
||||
}
|
||||
UpdateTimes(ui_->slider->value() / kMsecPerSec);
|
||||
|
||||
// save this setting
|
||||
// Save this setting
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("show_remaining_time", show_remaining_time_);
|
||||
|
||||
@@ -23,9 +23,15 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <stdbool.h>
|
||||
|
||||
class QLabel;
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QSize>
|
||||
#include <QLabel>
|
||||
|
||||
class QEvent;
|
||||
|
||||
class Application;
|
||||
class Ui_TrackSlider;
|
||||
|
||||
@@ -20,17 +20,28 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "tracksliderpopup.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QFontMetrics>
|
||||
#include <QSize>
|
||||
#include <QColor>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QBrush>
|
||||
#include <QRect>
|
||||
#include <QVector>
|
||||
#include <QPoint>
|
||||
#include <QPolygon>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/qt_blurimage.h"
|
||||
#include "tracksliderpopup.h"
|
||||
|
||||
#include <QBitmap>
|
||||
#include <QCoreApplication>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
#include <QWheelEvent>
|
||||
#include <QtDebug>
|
||||
class QPaintEvent;
|
||||
|
||||
const int TrackSliderPopup::kTextMargin = 4;
|
||||
const int TrackSliderPopup::kPointLength = 16;
|
||||
|
||||
@@ -23,7 +23,18 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QPoint>
|
||||
#include <QtEvents>
|
||||
|
||||
class QMouseEvent;
|
||||
class QPaintEvent;
|
||||
|
||||
class TrackSliderPopup : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -20,16 +20,20 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "tracksliderpopup.h"
|
||||
#include "tracksliderslider.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSlider>
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/timeconstants.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QStyle>
|
||||
#include <QStyleOptionSlider>
|
||||
#include <QtDebug>
|
||||
#include <QWheelEvent>
|
||||
#include "tracksliderpopup.h"
|
||||
#include "tracksliderslider.h"
|
||||
|
||||
TrackSliderSlider::TrackSliderSlider(QWidget* parent)
|
||||
: QSlider(parent),
|
||||
@@ -42,9 +46,8 @@ TrackSliderSlider::TrackSliderSlider(QWidget* parent)
|
||||
}
|
||||
|
||||
void TrackSliderSlider::mousePressEvent(QMouseEvent* e) {
|
||||
// QSlider asks QStyle which mouse button should do what (absolute move or
|
||||
// page step). We force our own behaviour here because it makes more sense
|
||||
// for a music player IMO.
|
||||
// QSlider asks QStyle which mouse button should do what (absolute move or page step).
|
||||
// We force our own behaviour here because it makes more sense for a music player IMO.
|
||||
|
||||
Qt::MouseButton new_button = e->button();
|
||||
if (e->button() == Qt::LeftButton) {
|
||||
|
||||
@@ -23,8 +23,16 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QSlider>
|
||||
#include <QtEvents>
|
||||
|
||||
class QEvent;
|
||||
class QKeyEvent;
|
||||
class QMouseEvent;
|
||||
class QWheelEvent;
|
||||
class TrackSliderPopup;
|
||||
|
||||
// It's the slider inside the TrackSliderSlider
|
||||
|
||||
@@ -20,14 +20,24 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "widgetfadehelper.h"
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QColor>
|
||||
#include <QBrush>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QTimeLine>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/qt_blurimage.h"
|
||||
|
||||
#include <QResizeEvent>
|
||||
#include <QPainter>
|
||||
#include <QTimeLine>
|
||||
#include <QtDebug>
|
||||
#include "widgetfadehelper.h"
|
||||
|
||||
const int WidgetFadeHelper::kLoadingPadding = 9;
|
||||
const int WidgetFadeHelper::kLoadingBorderRadius = 10;
|
||||
@@ -126,8 +136,7 @@ void WidgetFadeHelper::CaptureParent() {
|
||||
|
||||
void WidgetFadeHelper::StartFade() {
|
||||
if (blur_timeline_->state() == QTimeLine::Running) {
|
||||
// Blur timeline is still running, so we need render the current state
|
||||
// into a new pixmap.
|
||||
// Blur timeline is still running, so we need render the current state into a new pixmap.
|
||||
QPixmap pixmap(original_pixmap_);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setOpacity(blur_timeline_->currentValue());
|
||||
|
||||
@@ -23,9 +23,18 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <stdbool.h>
|
||||
|
||||
class QTimeLine;
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QTimeLine>
|
||||
#include <QtEvents>
|
||||
|
||||
class QEvent;
|
||||
class QPaintEvent;
|
||||
|
||||
class WidgetFadeHelper : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
Reference in New Issue
Block a user