Compare commits

..

57 Commits
0.6.7 ... 0.6.8

Author SHA1 Message Date
Jonas Kvinge
be7cc55488 Release 0.6.8 2020-01-05 23:27:31 +01:00
Jonas Kvinge
c8f3379a48 Fix crash when deleting playlist folder. 2020-01-05 23:26:07 +01:00
Jonas Kvinge
b5a7945e49 Use QModelIndex::model() 2020-01-05 23:25:23 +01:00
Strawbs Bot
0bdac2e97d Update translations 2020-01-05 22:52:27 +01:00
Jonas Kvinge
1468a821fb Fix restoring to correct screen when maximized 2020-01-05 22:21:55 +01:00
Jonas Kvinge
3cdc8dc4b6 Use QWidget::screen() with Qt 5.14 2020-01-05 19:15:28 +01:00
Jonas Kvinge
aa255aa7e6 Use current screen, not primary screen 2020-01-05 19:14:25 +01:00
Strawbs Bot
66e5ccb9cc Update translations 2020-01-05 01:02:24 +01:00
Jonas Kvinge
2215f300bf Added option to disable playlist clear button
Fixes #339
2020-01-04 06:38:25 +01:00
Jonas Kvinge
eec767406b Add confirmation before clearing playlists with more than 500 songs 2020-01-04 06:11:21 +01:00
Jonas Kvinge
31aa42c2fa Fix compile with translations on Windows 2020-01-03 02:07:37 +01:00
Strawbs Bot
e912c59402 Add Italian 2020-01-03 01:46:38 +01:00
Strawbs Bot
c9988976f3 Update translations 2020-01-03 01:02:34 +01:00
Jonas Kvinge
443be1c2c8 Increase lyrics score if lyrics text > 60 2020-01-02 19:21:27 +01:00
Jonas Kvinge
7f442cff3b Fix QProxyStyle 2020-01-02 18:57:53 +01:00
Strawbs Bot
3696ae44ad Update translations 2019-12-31 01:09:52 +01:00
Jonas Kvinge
fc2d601424 Remove useless stdbool.h include 2019-12-30 23:14:40 +01:00
Jonas Kvinge
8818f24114 Fix compile with Qt 5.14 and above 2019-12-30 02:28:54 +01:00
Jonas Kvinge
0e12c8249e Fix actions builds 2019-12-30 00:49:39 +01:00
Strawbs Bot
06d62a70a9 Update translations 2019-12-30 00:35:45 +01:00
Jonas Kvinge
76d8018ca2 Remove HTML from translations 2019-12-29 23:53:54 +01:00
Jonas Kvinge
4123b41a5e Merge branch 'master' of github.com:jonaski/strawberry 2019-12-29 23:47:07 +01:00
Jonas Kvinge
5930257fed Remove HTML from translations 2019-12-29 23:46:49 +01:00
Jonas Kvinge
d3d60327ab Remove the answer to life the universe and everything 2019-12-29 23:46:35 +01:00
Strawbs Bot
5080ffb9fc Update translations 2019-12-29 23:41:39 +01:00
Jonas Kvinge
9b688a5179 Remove HTML from translations
Fixes #260
2019-12-29 23:37:48 +01:00
Strawbs Bot
a603dc5227 Update translations 2019-12-29 01:02:01 +01:00
Jonas Kvinge
c25f682caf Emit ExitFinished if no internet services are enabled 2019-12-28 03:35:07 +01:00
Jonas Kvinge
27a2fd298d Add the device view container widget to the tabbar
Fixes bugs related to the tabbar and the widgets being unresponsive

Fixes #279
Fixes #321
2019-12-28 03:13:41 +01:00
Strawbs Bot
bb38053cb3 Update translations 2019-12-24 01:01:42 +01:00
Strawbs Bot
5e82ee8695 Add German 2019-12-22 14:56:55 +01:00
Strawbs Bot
6c691ff9a8 Update translations 2019-12-22 14:55:33 +01:00
Jonas Kvinge
ac5a14fe4a Add StartupWMClass to desktop file
Fixes #305
2019-12-22 14:16:24 +01:00
Jonas Kvinge
00402d13ef Fix collection watcher on macOS
Fixes #324
2019-12-22 14:15:25 +01:00
Gavin D. Howard
079a559247 Make context title and summary changeable (#329)
* Make context title and summary changeable

Closes #30

* Fix checkboxes on context settings page

So...I am new to Qt, and I forgot that checkboxes can have a label.
Duh. Fixed.

* Put context settings in a different place

* Put ReplaceMessage and ReplaceVariable in Utilities
2019-12-22 12:09:05 +01:00
Strawbs Bot
a19ea8fdba Update translations 2019-12-22 01:04:20 +01:00
Jonas Kvinge
c6e172f942 Remove unused afc_port_ variable 2019-12-22 00:54:56 +01:00
Jonas Kvinge
bdc9f3e8bf Use AFC_E_SUCCESS 2019-12-22 00:45:01 +01:00
Jonas Kvinge
8ec5a587fc Fix compile 2019-12-21 22:34:42 +01:00
Jonas Kvinge
9caf46f2fb Use QString::asprintf 2019-12-21 22:07:04 +01:00
Jonas Kvinge
13fdbfc5e8 Use QString::asprintf 2019-12-21 21:56:48 +01:00
Jonas Kvinge
882c94110e Update temporary metadata when tags are changed 2019-12-21 21:55:24 +01:00
Jonas Kvinge
97bc980611 Upgrade packages 2019-12-21 18:26:51 +01:00
Jonas Kvinge
be9bf5c173 Replace use of QSet::fromList with Qt 5.14 and above 2019-12-21 18:22:18 +01:00
Jonas Kvinge
6df38c389c Replace use of QSet::toList() with QSet::values() 2019-12-21 18:19:09 +01:00
Jonas Kvinge
6c6bceb8cc Replace use of QString::sprintf 2019-12-21 18:17:58 +01:00
Jonas Kvinge
b5a897bb4d Replace use of QString::sprintf 2019-12-21 18:15:45 +01:00
Jonas Kvinge
ab85b716bb Replace use of QTime::start() with QElapsedTimer 2019-12-21 18:11:54 +01:00
Jonas Kvinge
8e256e6d5c Fix indent 2019-12-21 17:55:24 +01:00
Jonas Kvinge
288036a63b Fix spelling 2019-12-21 17:54:43 +01:00
Jonas Kvinge
f2005c3343 Update README.md 2019-12-11 20:46:15 +01:00
Jonas Kvinge
79d516b899 Update README.md 2019-12-11 20:45:27 +01:00
Jonas Kvinge
28b2f6eae3 Update README.md 2019-12-11 20:21:03 +01:00
Strawbs Bot
09ed2b945c Update translations 2019-12-07 12:45:08 +01:00
Jonas Kvinge
74aec89ef0 Add French 2019-12-05 19:58:07 +01:00
Jonas Kvinge
4faa23d099 Add Indonesian 2019-12-05 19:57:14 +01:00
Jonas Kvinge
5c4997ab20 Turn back git revision 2019-12-05 19:53:41 +01:00
268 changed files with 21282 additions and 1820 deletions

View File

@@ -7,6 +7,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Update Packages
run: sudo apt-get update -y
- name: Install Packages
run:
sudo apt-get install -y git make cmake g++ gettext libglib2.0-dev libdbus-1-dev libboost-dev libprotobuf-dev protobuf-compiler libsqlite3-dev sqlite3 libgnutls28-dev libasound2-dev libpulse-dev qtbase5-dev qtbase5-dev-tools qtbase5-private-dev libqt5core5a libqt5gui5 libqt5widgets5 libqt5concurrent5 libqt5network5 libqt5sql5 libqt5x11extras5-dev libqt5dbus5 qttools5-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev gstreamer1.0-alsa gstreamer1.0-pulseaudio libgstreamer1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer-plugins-good1.0-0 libgstreamer-plugins-bad1.0-0 libchromaprint-dev libfftw3-dev libcdio-dev libmtp-dev libgpod-dev libimobiledevice-dev libplist-dev libusbmuxd-dev libxine2-dev libvlc-dev
@@ -27,6 +29,8 @@ jobs:
- uses: actions/checkout@v1
- name: Update HomeBrew
run: brew update
- name: Unlink python
run: brew unlink python@2
- name: Install Packages
run: brew install glib pkgconfig boost libffi protobuf protobuf-c qt gettext gnutls fftw sqlite chromaprint gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav libcdio libmtp libimobiledevice libplist create-dmg
- name: Create Build Environment

View File

@@ -37,7 +37,7 @@
#include <QSharedMemory>
#include <QByteArray>
#include <QDateTime>
#include <QTime>
#include <QElapsedTimer>
#include "singleapplication.h"
#include "singleapplication_p.h"
@@ -88,7 +88,7 @@ SingleApplication::SingleApplication(int &argc, char *argv[], bool allowSecondar
}
InstancesInfo* inst = static_cast<InstancesInfo*>(d->memory->data());
QTime time;
QElapsedTimer time;
time.start();
// Make sure the shared memory block is initialised and in consistent state

View File

@@ -37,7 +37,7 @@
#include <QSharedMemory>
#include <QByteArray>
#include <QDateTime>
#include <QTime>
#include <QElapsedTimer>
#include "singlecoreapplication.h"
#include "singlecoreapplication_p.h"
@@ -89,7 +89,7 @@ SingleCoreApplication::SingleCoreApplication(int &argc, char *argv[], bool allow
}
InstancesInfo* inst = static_cast<InstancesInfo*>(d->memory->data());
QTime time;
QElapsedTimer time;
time.start();
// Make sure the shared memory block is initialised and in consistent state

View File

@@ -107,10 +107,6 @@ pkg_check_modules(LIBPLIST libplist)
find_package(Gettext)
find_package(FFTW3)
if(WIN32)
find_package(ZLIB REQUIRED)
endif(WIN32)
# QT
set(QT_MIN_VERSION 5.5)
set(QT_COMPONENTS Core Concurrent Widgets Network Sql)
@@ -128,7 +124,7 @@ if(WIN32)
list(APPEND QT_COMPONENTS WinExtras)
endif()
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED ${QT_COMPONENTS})
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS ${QT_COMPONENTS})
set(QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Concurrent_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Sql_LIBRARIES})
@@ -146,7 +142,7 @@ if(Qt5WinExtras_FOUND)
list(APPEND QT_LIBRARIES ${Qt5WinExtras_LIBRARIES})
endif()
find_package(Qt5LinguistTools CONFIG)
find_package(Qt5 ${QT_MIN_VERSION} QUIET COMPONENTS LinguistTools CONFIG)
if (Qt5LinguistTools_FOUND)
set(QT_LCONVERT_EXECUTABLE Qt5::lconvert)
endif()

View File

@@ -2,6 +2,22 @@ Strawberry Music Player
=======================
ChangeLog
Version 0.6.8:
* Fixed stuck tabbar and collection GUI with some themes.
* Fixed possible crashes related to QProxyStyle.
* Fixed a bug where metadata in the playlist was not updated when editing metadata for the current playing track.
* Fixed crash when deleting a folder with playlists.
* Increased lyrics score if lyrics text is larger than 60 characters to avoid using "no lyrics available" text.
* Made context title and summary changeable.
* Added option to disable playlist clear button.
* Added confirmation dialog before clearing playlists with more than 500 songs.
* Added German, French and Indonesian translations.
* Added StartupWMClass to desktop file.
* Replaced use of Qt deprecated functionality as of 5.14.
* (macOS) Fixed filesystem watcher to correctly pick up changed collection directories.
* (Windows) Fixed translations not being included.
Version 0.6.7:
* Fixed crash when cancelling scrobbler authentication
@@ -14,8 +30,8 @@ Version 0.6.7:
* Fixed scrobbler to also scrobble songs without album title
* Fixed text for replay gain setting not loading in backend setting
* Added back lyrics from Chartlyrics
* Added ability to show fullsize cover on doubleclick in playing widget
* Added seperator between "unset cover" and "show fullsize" in popup menu
* Added ability to show fullsize cover on double-click in playing widget
* Added separator between "unset cover" and "show fullsize" in popup menu
* Removed left click on analyzer to popup menu
* (Windows) Added killproc executable to terminate running process before uninstalling

View File

@@ -1,5 +1,5 @@
:strawberry: Strawberry Music Player [![Build Status](https://travis-ci.org/jonaski/strawberry.svg?branch=master)](https://travis-ci.org/jonaski/strawberry)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FRJUYV5QP6HW8)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/jonaskvinge)
=======================
Strawberry is a music player and music collection organizer. It is a fork of Clementine released in 2018 aimed at music collectors, audio enthusiasts and audiophiles. The name is inspired by the band Strawbs. It's based on a heavily modified version of Clementine created in 2012-2013. It's written in C++ and Qt 5.
@@ -19,15 +19,15 @@ Strawberry is a music player and music collection organizer. It is a fork of Cle
* Advanced audio output and device configuration for bit-perfect playback on Linux
* Edit tags on music files
* Fetch tags from MusicBrainz
* Album cover art from Last.fm, Musicbrainz, Discogs, Deezer and Tidal
* Song lyrics from AudD, ChartLyrics, lyrics.ovh and lololyrics.com
* Album cover art from [Last.fm](https://www.last.fm/), [Musicbrainz](https://musicbrainz.org/), [Discogs](https://www.discogs.com/), [Deezer](https://www.deezer.com/) and [Tidal](https://tidal.com/)
* Song lyrics from [AudD](https://audd.io/), [ChartLyrics](http://www.chartlyrics.com/), [lyrics.ovh](https://lyrics.ovh/) and [lololyrics.com](https://www.lololyrics.com/)
* Support for multiple backends
* Audio analyzer
* Audio equalizer
* Transfer music to iPod, iPhone, MTP or mass-storage USB player
* Subsonic streaming support
* Unofficial streaming support for Tidal and Qobuz
* Scrobbler with support for Last.fm, Libre.fm and ListenBrainz
* Unofficial streaming support for [Tidal](https://tidal.com/) and [Qobuz](https://www.qobuz.com/)
* Scrobbler with support for [Last.fm](https://www.last.fm/), [Libre.fm](https://libre.fm/) and [ListenBrainz](https://listenbrainz.org/)
**Tidal and Qobuz streaming in Strawberry is unofficial. You need an official API token (or App ID/Secret) to use it, we can not provide API tokens, or help getting them. Tidal will not work with Tidal Masters (MQA), because MQA is a proprietary format in lossy quality without an open source decoder, we can't support it.**
@@ -91,4 +91,4 @@ You should also install the gstreamer plugins base and good, and optionally bad
### :moneybag: Donate
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FRJUYV5QP6HW8)
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://paypal.me/jonaskvinge)

View File

@@ -1,6 +1,6 @@
set(STRAWBERRY_VERSION_MAJOR 0)
set(STRAWBERRY_VERSION_MINOR 6)
set(STRAWBERRY_VERSION_PATCH 7)
set(STRAWBERRY_VERSION_PATCH 8)
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
set(INCLUDE_GIT_REVISION OFF)

View File

@@ -11,3 +11,4 @@ Terminal=false
Categories=AudioVideo;Player;Qt;Audio;
StartupNotify=false
MimeType=x-content/audio-player;application/ogg;application/x-ogg;application/x-ogm-audio;audio/flac;audio/ogg;audio/vorbis;audio/aac;audio/mp4;audio/mpeg;audio/mpegurl;audio/vnd.rn-realaudio;audio/x-flac;audio/x-oggflac;audio/x-vorbis;audio/x-vorbis+ogg;audio/x-speex;audio/x-wav;audio/x-wavpack;audio/x-ape;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-ms-wma;audio/x-musepack;audio/x-pn-realaudio;audio/x-scpls;video/x-ms-asf;x-scheme-handler/tidal;
StartupWMClass=strawberry

View File

@@ -1,5 +1,5 @@
name: strawberry
version: '0.6.7+git'
version: '0.6.8+git'
summary: music player and collection organizer
description: |
Strawberry is a music player and collection organizer.

View File

@@ -242,6 +242,7 @@ set(SOURCES
settings/behavioursettingspage.cpp
settings/collectionsettingspage.cpp
settings/backendsettingspage.cpp
settings/contextsettingspage.cpp
settings/playlistsettingspage.cpp
settings/networkproxysettingspage.cpp
settings/appearancesettingspage.cpp
@@ -427,6 +428,7 @@ set(HEADERS
settings/behavioursettingspage.h
settings/collectionsettingspage.h
settings/backendsettingspage.h
settings/contextsettingspage.h
settings/playlistsettingspage.h
settings/networkproxysettingspage.h
settings/appearancesettingspage.h
@@ -524,6 +526,7 @@ set(UI
settings/behavioursettingspage.ui
settings/collectionsettingspage.ui
settings/backendsettingspage.ui
settings/contextsettingspage.ui
settings/playlistsettingspage.ui
settings/networkproxysettingspage.ui
settings/appearancesettingspage.ui
@@ -1134,10 +1137,7 @@ if (APPLE)
endif (APPLE)
if (WIN32)
target_link_libraries(strawberry_lib
${ZLIB_LIBRARIES}
dsound
)
target_link_libraries(strawberry_lib dsound)
endif (WIN32)
if (UNIX AND NOT APPLE)

View File

@@ -29,7 +29,6 @@
# include <sys/types.h>
#endif
#include <stdbool.h>
#include <vector>
#include <QtGlobal>

View File

@@ -22,7 +22,6 @@
#include "config.h"
#include <stdbool.h>
#include <QWidget>
#include <QList>

View File

@@ -24,7 +24,6 @@
#ifndef BLOCKANALYZER_H
#define BLOCKANALYZER_H
#include <stdbool.h>
#include <vector>
#include <QtGlobal>

View File

@@ -21,7 +21,6 @@
#include "config.h"
#include <stdbool.h>
#include <unistd.h>
#include <QObject>

View File

@@ -658,7 +658,7 @@ QStringList CollectionBackend::GetAllArtistsWithAlbums(const QueryOptions &opt)
artists << query2.Value(0).toString();
}
return QStringList(artists.toList());
return QStringList(artists.values());
}

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -61,9 +61,28 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
ui_->setupUi(this);
// Add the available fields to the tooltip here instead of the ui file to prevent that they get translated by mistake.
QString available_fields = Song::kFtsColumns.join(", ").replace(QRegExp("\\bfts"), "");
ui_->filter->setToolTip(ui_->filter->toolTip().arg(available_fields));
ui_->filter->setToolTip(
"<html><head/><body><p>" +
tr("Prefix a word with a field name to limit the search to that field, e.g.:") +
" " +
"<span style=\"font-weight:600;\">" +
tr("artist") +
":" +
"</span><span style=\"font-style:italic;\">Strawbs</span>" +
" " +
tr("searches the collection for all artists that contain the word") +
"Strawbs" +
"." +
"</p><p><span style=\"font-weight:600;\">" +
tr("Available fields") +
": " +
"</span><span style=\"font-style:italic;\">" +
available_fields +
"</span>." +
"</p></body></html>"
);
connect(ui_->filter, SIGNAL(returnPressed()), SIGNAL(ReturnPressed()));
connect(filter_delay_, SIGNAL(timeout()), SLOT(FilterDelayTimeout()));

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QWidget>
#include <QObject>

View File

@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
<string>Collection Filter</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
@@ -31,9 +31,6 @@
</property>
<item>
<widget class="QSearchField" name="filter" native="true">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Prefix a word with a field name to limit the search to that field, e.g. &lt;span style=&quot; font-weight:600;&quot;&gt;artist:&lt;/span&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Bode&lt;/span&gt; searches the collection for all artists that contain the word Bode.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Available fields: &lt;/span&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;%1&lt;/span&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="placeholderText" stdset="0">
<string>Enter search terms here</string>
</property>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QStyledItemDelegate>
#include <QAbstractItemView>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QVariant>
#include <QString>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QMetaType>
#include <QVariant>

View File

@@ -463,7 +463,11 @@ void CollectionView::ShowInVarious(bool on) {
}
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
for (const QString &album : QSet<QString>(albums.keyBegin(), albums.keyEnd())) {
#else
for (const QString &album : QSet<QString>::fromList(albums.keys())) {
#endif
app_->collection_backend()->ForceCompilation(album, albums.values(album), on);
}

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QObject>
#include <QWidget>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -18,7 +18,6 @@
*
*/
#include <stdbool.h>
#include <QDialog>
#include <QWidget>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -25,7 +25,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QObject>
#include <QWidget>

View File

@@ -62,6 +62,8 @@
#include "covermanager/albumcoverloader.h"
#include "covermanager/currentalbumcoverloader.h"
#include "lyrics/lyricsfetcher.h"
#include "settings/contextsettingspage.h"
#include "widgets/osd.h"
#include "contextview.h"
#include "contextalbumsmodel.h"
@@ -69,8 +71,6 @@
using std::unique_ptr;
const char *ContextView::kSettingsGroup = "ContextView";
ContextView::ContextView(QWidget *parent) :
QWidget(parent),
ui_(new Ui_ContextViewContainer),
@@ -152,13 +152,7 @@ void ContextView::AddActions() {
menu_->addActions(cover_actions);
menu_->addSeparator();
QSettings s;
s.beginGroup(kSettingsGroup);
action_show_data_->setChecked(s.value("show_data", true).toBool());
action_show_output_->setChecked(s.value("show_output", true).toBool());
action_show_albums_->setChecked(s.value("show_albums", false).toBool());
action_show_lyrics_->setChecked(s.value("show_lyrics", true).toBool());
s.endGroup();
ReloadSettings();
connect(action_show_data_, SIGNAL(triggered()), this, SLOT(ActionShowData()));
connect(action_show_output_, SIGNAL(triggered()), this, SLOT(ActionShowOutput()));
@@ -207,6 +201,26 @@ void ContextView::SongChanged(const Song &song) {
}
void ContextView::ReloadSettings() {
QSettings s;
s.beginGroup(ContextSettingsPage::kSettingsGroup);
title_fmt_ = s.value(ContextSettingsPage::kSettingsTitleFmt, "%title% - %artist%").toString();
summary_fmt_ = s.value(ContextSettingsPage::kSettingsSummaryFmt, "%album%").toString();
action_show_data_->setChecked(s.value(ContextSettingsPage::kSettingsGroupEnable[ContextSettingsPage::ContextSettingsOrder::TECHNICAL_DATA], true).toBool());
action_show_output_->setChecked(s.value(ContextSettingsPage::kSettingsGroupEnable[ContextSettingsPage::ContextSettingsOrder::ENGINE_AND_DEVICE], true).toBool());
action_show_albums_->setChecked(s.value(ContextSettingsPage::kSettingsGroupEnable[ContextSettingsPage::ContextSettingsOrder::ALBUMS_BY_ARTIST], false).toBool());
action_show_lyrics_->setChecked(s.value(ContextSettingsPage::kSettingsGroupEnable[ContextSettingsPage::ContextSettingsOrder::SONG_LYRICS], true).toBool());
s.endGroup();
if (song_.is_valid()) {
SetSong(song_);
}
else {
UpdateNoSong();
}
}
void ContextView::SetLabelEnabled(QLabel *label) {
label->setEnabled(true);
label->setVisible(true);
@@ -232,15 +246,18 @@ void ContextView::NoSong() {
ui_->label_stop_top->setText(tr("No song playing"));
QString html = tr(
"%1 songs<br />\n"
"%2 artists<br />\n"
"%3 albums<br />\n"
)
.arg(collectionview_->TotalSongs())
.arg(collectionview_->TotalArtists())
.arg(collectionview_->TotalAlbums())
;
QString html;
if (collectionview_->TotalSongs() == 1) html += tr("%1 song").arg(collectionview_->TotalSongs());
else html += tr("%1 songs").arg(collectionview_->TotalSongs());
html += "<br />";
if (collectionview_->TotalArtists() == 1) html += tr("%1 artist").arg(collectionview_->TotalArtists());
else html += tr("%1 artists").arg(collectionview_->TotalArtists());
html += "<br />";
if (collectionview_->TotalAlbums() == 1) html += tr("%1 album").arg(collectionview_->TotalAlbums());
else html += tr("%1 albums").arg(collectionview_->TotalAlbums());
html += "<br />";
ui_->label_stop_summary->setStyleSheet(
"font: 12pt;"
@@ -269,7 +286,7 @@ void ContextView::SetSong(const Song &song) {
"font: 11pt;"
"font-weight: regular;"
);
ui_->label_play_top->setText( QString("<b>%1 - %2</b><br/>%3").arg(song.PrettyTitle().toHtmlEscaped(), song.artist().toHtmlEscaped(), song.album().toHtmlEscaped()));
ui_->label_play_top->setText(QString("<b>%1</b><br/>%2").arg(Utilities::ReplaceMessage(title_fmt_, song, "<br/>"), Utilities::ReplaceMessage(summary_fmt_, song, "<br/>")));
if (action_show_data_->isChecked()) {
ui_->layout_play_data->setEnabled(true);
@@ -402,7 +419,7 @@ void ContextView::SetSong(const Song &song) {
if (albumlist.count() > 1) {
ui_->label_play_albums->setVisible(true);
ui_->label_play_albums->setMinimumSize(0, 20);
ui_->label_play_albums->setText(tr("<b>Albums by %1</b>").arg( song.artist().toHtmlEscaped()));
ui_->label_play_albums->setText("<b>" + tr("Albums by %1").arg( song.artist().toHtmlEscaped()) + "</b>");
ui_->label_play_albums->setStyleSheet("background-color: #3DADE8; color: rgb(255, 255, 255); font: 11pt;");
for (CollectionBackend::Album album : albumlist) {
SongList songs = app_->collection_backend()->GetSongs(song.artist(), album.album_name, opt);
@@ -447,9 +464,7 @@ void ContextView::SetSong(const Song &song) {
void ContextView::UpdateSong(const Song &song) {
if (song.artist() != song_playing_.artist() || song.album() != song_playing_.album() || song.title() != song_playing_.title()) {
ui_->label_play_top->setText( QString("<b>%1 - %2</b><br/>%3").arg(song.PrettyTitle().toHtmlEscaped(), song.artist().toHtmlEscaped(), song.album().toHtmlEscaped()));
}
ui_->label_play_top->setText(QString("<b>%1</b><br/>%2").arg(Utilities::ReplaceMessage(title_fmt_, song, "<br/>"), Utilities::ReplaceMessage(summary_fmt_, song, "<br/>")));
if (action_show_data_->isChecked()) {
if (song.filetype() != song_playing_.filetype()) ui_->filetype->setText(song.TextForFiletype());
@@ -657,24 +672,24 @@ void ContextView::AutomaticCoverSearchDone() {
void ContextView::ActionShowData() {
QSettings s;
s.beginGroup(kSettingsGroup);
s.setValue("show_data", action_show_data_->isChecked());
s.beginGroup(ContextSettingsPage::kSettingsGroup);
s.setValue(ContextSettingsPage::kSettingsGroupEnable[ContextSettingsPage::ContextSettingsOrder::TECHNICAL_DATA], action_show_data_->isChecked());
s.endGroup();
SetSong(song_);
}
void ContextView::ActionShowOutput() {
QSettings s;
s.beginGroup(kSettingsGroup);
s.setValue("show_output", action_show_output_->isChecked());
s.beginGroup(ContextSettingsPage::kSettingsGroup);
s.setValue(ContextSettingsPage::kSettingsGroupEnable[ContextSettingsPage::ContextSettingsOrder::ENGINE_AND_DEVICE], action_show_output_->isChecked());
s.endGroup();
SetSong(song_);
}
void ContextView::ActionShowAlbums() {
QSettings s;
s.beginGroup(kSettingsGroup);
s.setValue("show_albums", action_show_albums_->isChecked());
s.beginGroup(ContextSettingsPage::kSettingsGroup);
s.setValue(ContextSettingsPage::kSettingsGroupEnable[ContextSettingsPage::ContextSettingsOrder::ALBUMS_BY_ARTIST], action_show_albums_->isChecked());
s.endGroup();
song_prev_ = Song();
SetSong(song_);
@@ -682,8 +697,8 @@ void ContextView::ActionShowAlbums() {
void ContextView::ActionShowLyrics() {
QSettings s;
s.beginGroup(kSettingsGroup);
s.setValue("show_lyrics", action_show_lyrics_->isChecked());
s.beginGroup(ContextSettingsPage::kSettingsGroup);
s.setValue(ContextSettingsPage::kSettingsGroupEnable[ContextSettingsPage::ContextSettingsOrder::SONG_LYRICS], action_show_lyrics_->isChecked());
s.endGroup();
SetSong(song_);
if (lyrics_.isEmpty() && action_show_lyrics_->isChecked() && !song_.artist().isEmpty() && !song_.title().isEmpty()) {

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>
@@ -71,9 +70,9 @@ class ContextView : public QWidget {
void Stopped();
void Error();
void SongChanged(const Song &song);
void ReloadSettings();
private:
static const char *kSettingsGroup;
Ui_ContextViewContainer *ui_;
Application *app_;
@@ -103,6 +102,8 @@ class ContextView : public QWidget {
std::unique_ptr<QMovie> spinner_animation_;
qint64 lyrics_id_;
QString lyrics_;
QString title_fmt_;
QString summary_fmt_;
void AddActions();
void SetLabelEnabled(QLabel *label);

View File

@@ -191,7 +191,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>70</height>
<height>700</height>
</size>
</property>
<property name="text">

View File

@@ -20,7 +20,6 @@
#include "config.h"
#include <stdbool.h>
#include <QApplication>
#include <QObject>

View File

@@ -26,7 +26,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QObject>
#include <QThread>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QDataStream>
#include <QByteArray>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <sqlite3.h>
#include <QtGlobal>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QObject>
#include <QThread>

View File

@@ -21,7 +21,6 @@
#include "config.h"
#include <stdbool.h>
#include <QDir>
#include <QFile>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QString>
#include "musicstorage.h"

View File

@@ -26,12 +26,13 @@
#include <CoreServices/CoreServices.h>
#include <QObject>
#include <QString>
#include <QSet>
#include <QTimer>
#include <QString>
#include "filesystemwatcherinterface.h"
class QTimer;
class MacFSListener : public FileSystemWatcherInterface {
Q_OBJECT
@@ -57,7 +58,7 @@ signals:
FSEventStreamRef stream_;
QSet<QString> paths_;
QTimer update_timer_;
QTimer *update_timer_;
};
#endif

View File

@@ -22,6 +22,8 @@
#include "config.h"
#include <QTimer>
#include <CoreFoundation/CFArray.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSString.h>
@@ -30,21 +32,21 @@
#include "scoped_nsobject.h"
MacFSListener::MacFSListener(QObject* parent)
: FileSystemWatcherInterface(parent), run_loop_(nullptr), stream_(nullptr) {
update_timer_.setSingleShot(true);
update_timer_.setInterval(2000);
connect(&update_timer_, SIGNAL(timeout()), SLOT(UpdateStream()));
: FileSystemWatcherInterface(parent),
run_loop_(nullptr),
stream_(nullptr),
update_timer_(new QTimer(this)) {
update_timer_->setSingleShot(true);
update_timer_->setInterval(2000);
connect(update_timer_, SIGNAL(timeout()), SLOT(UpdateStream()));
}
void MacFSListener::Init() { run_loop_ = CFRunLoopGetCurrent(); }
void MacFSListener::EventStreamCallback(
ConstFSEventStreamRef stream,
void* user_data,
size_t num_events,
void* event_paths,
const FSEventStreamEventFlags event_flags[],
const FSEventStreamEventId event_ids[]) {
void MacFSListener::EventStreamCallback(ConstFSEventStreamRef stream, void* user_data, size_t num_events, void* event_paths, const FSEventStreamEventFlags event_flags[], const FSEventStreamEventId event_ids[]) {
MacFSListener* me = reinterpret_cast<MacFSListener*>(user_data);
char** paths = reinterpret_cast<char**>(event_paths);
for (int i = 0; i < num_events; ++i) {
@@ -55,26 +57,35 @@ void MacFSListener::EventStreamCallback(
}
emit me->PathChanged(path);
}
}
void MacFSListener::AddPath(const QString& path) {
Q_ASSERT(run_loop_);
paths_.insert(path);
UpdateStreamAsync();
}
void MacFSListener::RemovePath(const QString& path) {
Q_ASSERT(run_loop_);
paths_.remove(path);
UpdateStreamAsync();
}
void MacFSListener::Clear() {
paths_.clear();
UpdateStreamAsync();
}
void MacFSListener::UpdateStreamAsync() { update_timer_.start(); }
void MacFSListener::UpdateStreamAsync() {
update_timer_->start();
}
void MacFSListener::UpdateStream() {
if (stream_) {
@@ -88,11 +99,10 @@ void MacFSListener::UpdateStream() {
return;
}
scoped_nsobject<NSMutableArray> array([[NSMutableArray alloc] init]);
scoped_nsobject<NSMutableArray> array([ [NSMutableArray alloc] init]);
for (const QString& path : paths_) {
scoped_nsobject<NSString> string(
[[NSString alloc] initWithUTF8String:path.toUtf8().constData()]);
scoped_nsobject<NSString> string([ [NSString alloc] initWithUTF8String:path.toUtf8().constData()]);
[array addObject:string.get()];
}

View File

@@ -200,8 +200,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
collection_view_(new CollectionViewContainer(this)),
file_view_(new FileView(this)),
#ifndef Q_OS_WIN
device_view_container_(new DeviceViewContainer(this)),
device_view_(device_view_container_->view()),
device_view_(new DeviceViewContainer(this)),
#endif
playlist_list_(new PlaylistListContainer(this)),
queue_view_(new QueueView(this)),
@@ -214,8 +213,6 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
connect(cover_manager, SIGNAL(AddToPlaylist(QMimeData*)), this, SLOT(AddToPlaylist(QMimeData*)));
return cover_manager;
}),
//organise_dialog_(new OrganiseDialog(app_->task_manager())),
equalizer_(new Equalizer),
organise_dialog_([=]() {
OrganiseDialog *dialog = new OrganiseDialog(app->task_manager(), app->collection_backend());
@@ -329,7 +326,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
collection_view_->view()->setModel(collection_sort_model_);
collection_view_->view()->SetApplication(app_);
#ifndef Q_OS_WIN
device_view_->SetApplication(app_);
device_view_->view()->SetApplication(app_);
#endif
playlist_list_->SetApplication(app_);
@@ -408,7 +405,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
connect(ui_->action_stop_after_this_track, SIGNAL(triggered()), SLOT(StopAfterCurrent()));
connect(ui_->action_mute, SIGNAL(triggered()), app_->player(), SLOT(Mute()));
connect(ui_->action_clear_playlist, SIGNAL(triggered()), app_->playlist_manager(), SLOT(ClearCurrent()));
connect(ui_->action_clear_playlist, SIGNAL(triggered()), SLOT(PlaylistClearCurrent()));
connect(ui_->action_remove_duplicates, SIGNAL(triggered()), app_->playlist_manager(), SLOT(RemoveDuplicatesCurrent()));
connect(ui_->action_remove_unavailable, SIGNAL(triggered()), app_->playlist_manager(), SLOT(RemoveUnavailableCurrent()));
connect(ui_->action_remove_from_playlist, SIGNAL(triggered()), SLOT(PlaylistRemoveCurrent()));
@@ -539,7 +536,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
#ifndef Q_OS_WIN
// Devices connections
connect(device_view_, SIGNAL(AddToPlaylistSignal(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
connect(device_view_->view(), SIGNAL(AddToPlaylistSignal(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
#endif
// Collection filter widget
@@ -782,10 +779,11 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
// Set last used geometry to position window on the correct monitor
// Set window state only if the window was last maximized
if (settings_.contains("geometry")) {
restoreGeometry(settings_.value("geometry").toByteArray());
}
was_maximized_ = settings_.value("maximized", true).toBool();
if (was_maximized_) setWindowState(windowState() | Qt::WindowMaximized);
else restoreGeometry(settings_.value("geometry").toByteArray());
if (!ui_->splitter->restoreState(settings_.value("splitter_state").toByteArray())) {
ui_->splitter->setSizes(QList<int>() << 250 << width() - 250);
@@ -952,9 +950,11 @@ void MainWindow::ReloadAllSettings() {
osd_->ReloadSettings();
collection_view_->ReloadSettings();
ui_->playlist->view()->ReloadSettings();
app_->playlist_manager()->playlist_container()->ReloadSettings();
app_->album_cover_loader()->ReloadSettings();
album_cover_choice_controller_->ReloadSettings();
if (cover_manager_.get()) cover_manager_->ReloadSettings();
context_view_->ReloadSettings();
#ifdef HAVE_TIDAL
tidal_view_->ReloadSettings();
#endif
@@ -1168,10 +1168,8 @@ void MainWindow::SaveGeometry() {
if (!initialised_) return;
was_maximized_ = isMaximized();
settings_.setValue("maximized", was_maximized_);
if (was_maximized_) settings_.remove("geometry");
else settings_.setValue("geometry", saveGeometry());
settings_.setValue("maximized", isMaximized());
settings_.setValue("geometry", saveGeometry());
settings_.setValue("splitter_state", ui_->splitter->saveState());
}
@@ -1962,6 +1960,25 @@ void MainWindow::PlaylistRemoveCurrent() {
ui_->playlist->view()->RemoveSelected(false);
}
void MainWindow::PlaylistClearCurrent() {
if (app_->playlist_manager()->current()->rowCount() > Playlist::kUndoItemLimit) {
QMessageBox messagebox(QMessageBox::Warning, tr("Clear playlist"), tr("Playlist has %1 songs, too large to undo, are you sure you want to clear the playlist?").arg(app_->playlist_manager()->current()->rowCount()), QMessageBox::Ok|QMessageBox::Cancel);
messagebox.setTextFormat(Qt::RichText);
int result = messagebox.exec();
switch (result) {
case QMessageBox::Ok:
break;
case QMessageBox::Cancel:
default:
return;
}
}
app_->playlist_manager()->ClearCurrent();
}
void MainWindow::PlaylistEditFinished(const QModelIndex &index) {
if (index == playlist_menu_index_) SelectionSetValue();
}

View File

@@ -25,7 +25,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>
@@ -156,6 +155,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
void PlaylistSkip();
void PlaylistRemoveCurrent();
void PlaylistEditFinished(const QModelIndex& index);
void PlaylistClearCurrent();
void RescanSongs();
void EditTracks();
void EditTagDialogAccepted();
@@ -282,7 +282,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
#endif
Application *app_;
SystemTrayIcon *tray_icon_;
SystemTrayIcon *tray_icon_;
OSD *osd_;
Lazy<About> about_dialog_;
Lazy<EditTagDialog> edit_tag_dialog_;
@@ -294,8 +294,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
CollectionViewContainer *collection_view_;
FileView *file_view_;
#ifndef Q_OS_WIN
DeviceViewContainer *device_view_container_;
DeviceView *device_view_;
DeviceViewContainer *device_view_;
#endif
PlaylistListContainer *playlist_list_;
QueueView *queue_view_;

View File

@@ -25,7 +25,6 @@
#include <memory>
#include <cstddef>
#include <stdbool.h>
#include <QObject>
#include <QMimeData>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QSortFilterProxyModel>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <functional>
#include <memory>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QMutex>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -25,7 +25,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QSystemTrayIcon>

View File

@@ -20,7 +20,6 @@
#include "config.h"
#include <stdbool.h>
#include <QSqlDatabase>
#include "core/logging.h"

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <boost/noncopyable.hpp>
#include <QSqlDatabase>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <glib-object.h>
#include <stdbool.h>
#include <QtGlobal>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QSharedData>

View File

@@ -27,7 +27,6 @@
#include <memory>
#include <functional>
#include <glib.h>
#include <stdbool.h>
#ifdef HAVE_GSTREAMER
# include <gst/gst.h>

View File

@@ -87,7 +87,11 @@ void StandardItemIconLoader::RowsAboutToBeRemoved(const QModelIndex &parent, int
void StandardItemIconLoader::ModelReset() {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
cover_loader_->CancelTasks(QSet<quint64>(pending_covers_.keyBegin(), pending_covers_.keyEnd()));
#else
cover_loader_->CancelTasks(QSet<quint64>::fromList(pending_covers_.keys()));
#endif
pending_covers_.clear();
}

View File

@@ -196,9 +196,8 @@ static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRe
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());
QString key = QString::asprintf("mh_vertical %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb());
QPixmap pixmap;
if (!QPixmapCache::find(key, &pixmap)) {
@@ -253,9 +252,8 @@ static void horizontalGradientHelper(QPainter *p, const QRect &spanRect, const Q
void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) {
if (StyleHelper::usePixmapCache()) {
QString key;
QColor keyColor = baseColor(lightColored);
key.sprintf("mh_horizontal %d %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb(), spanRect.x());
QString key = QString::asprintf("mh_horizontal %d %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb(), spanRect.x());
QPixmap pixmap;
if (!QPixmapCache::find(key, &pixmap)) {
@@ -294,8 +292,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
QRect r = option->rect;
int size = qMin(r.height(), r.width());
QPixmap pixmap;
QString pixmapName;
pixmapName.sprintf("StyleHelper::drawArrow-%d-%d-%d-%f", element, size, enabled, devicePixelRatio);
QString pixmapName = QString::asprintf("StyleHelper::drawArrow-%d-%d-%d-%f", element, size, enabled, devicePixelRatio);
if (!QPixmapCache::find(pixmapName, &pixmap)) {
QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
image.fill(Qt::transparent);
@@ -336,8 +333,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) {
if (StyleHelper::usePixmapCache()) {
QString key;
key.sprintf("mh_menu %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), StyleHelper::baseColor().rgb());
QString key = QString::asprintf("mh_menu %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), StyleHelper::baseColor().rgb());
QPixmap pixmap;
if (!QPixmapCache::find(key, &pixmap)) {

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QWidget>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QString>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QList>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -88,6 +88,7 @@
#endif
#include "core/logging.h"
#include "core/song.h"
#include "utilities.h"
#include "timeconstants.h"
@@ -119,8 +120,8 @@ QString PrettyTime(int seconds) {
seconds %= 60;
QString ret;
if (hours) ret.sprintf("%d:%02d:%02d", hours, minutes, seconds);
else ret.sprintf("%d:%02d", minutes, seconds);
if (hours) ret = QString::asprintf("%d:%02d:%02d", hours, minutes, seconds);
else ret = QString::asprintf("%d:%02d", minutes, seconds);
return ret;
@@ -186,11 +187,11 @@ QString PrettySize(quint64 bytes) {
if (bytes <= 1000)
ret = QString::number(bytes) + " bytes";
else if (bytes <= 1000 * 1000)
ret.sprintf("%.1f KB", float(bytes) / 1000);
ret = QString::asprintf("%.1f KB", float(bytes) / 1000);
else if (bytes <= 1000 * 1000 * 1000)
ret.sprintf("%.1f MB", float(bytes) / (1000 * 1000));
ret = QString::asprintf("%.1f MB", float(bytes) / (1000 * 1000));
else
ret.sprintf("%.1f GB", float(bytes) / (1000 * 1000 * 1000));
ret = QString::asprintf("%.1f GB", float(bytes) / (1000 * 1000 * 1000));
}
return ret;
@@ -849,6 +850,79 @@ QString MacAddress() {
}
QString ReplaceMessage(const QString &message, const Song &song, const QString &newline) {
QRegExp variable_replacer("[%][a-z]+[%]");
QString copy(message);
// Replace the first line
int pos = 0;
variable_replacer.indexIn(message);
while ((pos = variable_replacer.indexIn(message, pos)) != -1) {
QStringList captured = variable_replacer.capturedTexts();
copy.replace(captured[0], ReplaceVariable(captured[0], song, newline));
pos += variable_replacer.matchedLength();
}
return copy;
}
QString ReplaceVariable(const QString &variable, const Song &song, const QString &newline) {
QString return_value;
if (variable == "%artist%") {
return song.artist().toHtmlEscaped();
}
else if (variable == "%album%") {
return song.album().toHtmlEscaped();
}
else if (variable == "%title%") {
return song.PrettyTitle().toHtmlEscaped();
}
else if (variable == "%albumartist%") {
return song.effective_albumartist().toHtmlEscaped();
}
else if (variable == "%year%") {
return song.PrettyYear().toHtmlEscaped();
}
else if (variable == "%composer%") {
return song.composer().toHtmlEscaped();
}
else if (variable == "%performer%") {
return song.performer().toHtmlEscaped();
}
else if (variable == "%grouping%") {
return song.grouping().toHtmlEscaped();
}
else if (variable == "%length%") {
return song.PrettyLength().toHtmlEscaped();
}
else if (variable == "%disc%") {
return return_value.setNum(song.disc()).toHtmlEscaped();
}
else if (variable == "%track%") {
return return_value.setNum(song.track()).toHtmlEscaped();
}
else if (variable == "%genre%") {
return song.genre().toHtmlEscaped();
}
else if (variable == "%playcount%") {
return return_value.setNum(song.playcount()).toHtmlEscaped();
}
else if (variable == "%skipcount%") {
return return_value.setNum(song.skipcount()).toHtmlEscaped();
}
else if (variable == "%filename%") {
return song.basefilename().toHtmlEscaped();
}
else if (variable == "%newline%") {
return QString(newline);
}
//if the variable is not recognized, just return it
return variable;
}
} // namespace Utilities
ScopedWCharArray::ScopedWCharArray(const QString &str)

View File

@@ -25,7 +25,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QtGlobal>
#include <QWidget>
@@ -44,6 +43,8 @@
#include <QXmlStreamReader>
#include <QtEvents>
#include "core/song.h"
namespace Utilities {
QString PrettyTime(int seconds);
QString PrettyTimeDelta(int seconds);
@@ -156,6 +157,9 @@ QString UnicodeToAscii(const QString &unicode);
QString MacAddress();
QString ReplaceMessage(const QString &message, const Song &song, const QString &newline);
QString ReplaceVariable(const QString &variable, const Song &song, const QString &newline);
} // namespace
class ScopedWCharArray {

View File

@@ -24,6 +24,7 @@
#include <QtGlobal>
#include <QGuiApplication>
#include <QScreen>
#include <QWindow>
#include <QWidget>
#include <QDialog>
#include <QDir>
@@ -283,8 +284,12 @@ void AlbumCoverChoiceController::ShowCover(const Song &song, const QPixmap &pixm
title_text += " (" + QString::number(label->pixmap()->width()) + "x" + QString::number(label->pixmap()->height()) + "px)";
// If the cover is larger than the screen, resize the window 85% seems to be enough to account for title bar and taskbar etc.
QScreen *screen = QGuiApplication::primaryScreen();
QRect screenGeometry = screen->geometry();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QScreen *screen = QWidget::screen();
#else
QScreen *screen = (window() && window()->windowHandle() ? window()->windowHandle()->screen() : QGuiApplication::primaryScreen());
#endif
QRect screenGeometry = screen->availableGeometry();
int desktop_height = screenGeometry.height();
int desktop_width = screenGeometry.width();

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QWidget>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QImage>
struct AlbumCoverLoaderOptions {

View File

@@ -251,7 +251,11 @@ void AlbumCoverManager::closeEvent(QCloseEvent *e) {
void AlbumCoverManager::CancelRequests() {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
app_->album_cover_loader()->CancelTasks(QSet<quint64>(cover_loading_tasks_.keyBegin(), cover_loading_tasks_.keyEnd()));
#else
app_->album_cover_loader()->CancelTasks(QSet<quint64>::fromList(cover_loading_tasks_.keys()));
#endif
cover_loading_tasks_.clear();
cover_exporter_->Cancel();

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -20,7 +20,6 @@
#include "config.h"
#include <stdbool.h>
#include <QWidget>
#include <QDialog>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QList>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -20,7 +20,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -22,7 +22,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QVariant>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QHash>

View File

@@ -22,7 +22,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QVariant>

View File

@@ -22,7 +22,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QByteArray>

View File

@@ -19,7 +19,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QList>

View File

@@ -22,7 +22,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QVariant>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QString>

View File

@@ -23,7 +23,6 @@
#include <config.h>
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QMutex>

View File

@@ -25,7 +25,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QObject>
#include <QString>

View File

@@ -20,7 +20,6 @@
#include "config.h"
#include <stdbool.h>
#include <assert.h>
#include <QObject>

View File

@@ -21,7 +21,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QVariant>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -23,7 +23,6 @@
#include <memory>
#include <functional>
#include <stdbool.h>
#include <QApplication>
#include <QObject>

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QDialog>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QString>

View File

@@ -25,7 +25,6 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <QObject>
#include <QWidget>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QWidget>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <QObject>
#include <QThread>

View File

@@ -31,7 +31,6 @@
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdbool.h>
#include <QtGlobal>
#include <QObject>

View File

@@ -23,7 +23,6 @@
#include "config.h"
#include <stdbool.h>
#include <gpod/itdb.h>
#include <QObject>

View File

@@ -33,7 +33,7 @@
#include "core/logging.h"
#include "imobiledeviceconnection.h"
iMobileDeviceConnection::iMobileDeviceConnection(const QString &uuid) : device_(nullptr), afc_(nullptr), afc_port_(0) {
iMobileDeviceConnection::iMobileDeviceConnection(const QString &uuid) : device_(nullptr), afc_(nullptr) {
idevice_error_t err = idevice_new(&device_, uuid.toUtf8().constData());
if (err != IDEVICE_E_SUCCESS) {
@@ -60,7 +60,7 @@ iMobileDeviceConnection::iMobileDeviceConnection(const QString &uuid) : device_(
}
afc_error_t afc_err = afc_client_new(device_, lockdown_service_desc, &afc_);
if (afc_err != 0) {
if (afc_err != AFC_E_SUCCESS) {
qLog(Warning) << "afc error:" << afc_err;
lockdownd_service_descriptor_free(lockdown_service_desc);
lockdownd_client_free(lockdown);
@@ -220,8 +220,7 @@ QString iMobileDeviceConnection::GetUnusedFilename(Itdb_iTunesDB *itdb, const So
// Get the total number of F.. directories
int total_musicdirs = 0;
for ( ; ; ++total_musicdirs) {
QString dir;
dir.sprintf("/iTunes_Control/Music/F%02d", total_musicdirs);
QString dir = QString::asprintf("/iTunes_Control/Music/F%02d", total_musicdirs);
if (!Exists(dir))
break;
@@ -234,8 +233,7 @@ QString iMobileDeviceConnection::GetUnusedFilename(Itdb_iTunesDB *itdb, const So
// Pick one at random
const int dir_num = qrand() % total_musicdirs;
QString dir;
dir.sprintf("/iTunes_Control/Music/F%02d", dir_num);
QString dir = QString::asprintf("/iTunes_Control/Music/F%02d", dir_num);
if (!Exists(dir)) {
qLog(Warning) << "Music directory doesn't exist:" << dir;
@@ -252,7 +250,7 @@ QString iMobileDeviceConnection::GetUnusedFilename(Itdb_iTunesDB *itdb, const So
static const int kRandMax = 999999;
QString filename;
forever {
filename.sprintf("libgpod%06d", qrand() % kRandMax);
filename = QString::asprintf("libgpod%06d", qrand() % kRandMax);
filename += "." + extension;
if (!Exists(dir + "/" + filename))

Some files were not shown because too many files have changed in this diff Show More