This commit is contained in:
John Maguire 2024-03-30 13:26:22 -03:00 committed by GitHub
commit 858377c0c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 87 additions and 31 deletions

View File

@ -915,9 +915,8 @@ jobs:
path: bin/clementine_*.deb path: bin/clementine_*.deb
build_mac: build_mac:
if: false
name: Build Mac DMG name: Build Mac DMG
runs-on: macos-10.15 runs-on: macos-11
steps: steps:
- uses: actions/checkout@v1.2.0 - uses: actions/checkout@v1.2.0
- name: git hackery - name: git hackery
@ -957,7 +956,6 @@ jobs:
Qt5LinguistTools_DIR: /usr/local/opt/qt5/lib/cmake/Qt5LinguistTools Qt5LinguistTools_DIR: /usr/local/opt/qt5/lib/cmake/Qt5LinguistTools
GST_SCANNER_PATH: /usr/local/opt/gstreamer/libexec/gstreamer-1.0/gst-plugin-scanner GST_SCANNER_PATH: /usr/local/opt/gstreamer/libexec/gstreamer-1.0/gst-plugin-scanner
GST_PLUGIN_PATH: /usr/local/lib/gstreamer-1.0 GST_PLUGIN_PATH: /usr/local/lib/gstreamer-1.0
DEVELOPER_DIR: /Applications/Xcode_10.3.app/Contents/Developer
working-directory: bin working-directory: bin
run: > run: >
cmake .. cmake ..
@ -967,6 +965,7 @@ jobs:
-DGETTEXT_MSGMERGE_EXECUTABLE=/usr/local/opt/gettext/bin/msgmerge -DGETTEXT_MSGMERGE_EXECUTABLE=/usr/local/opt/gettext/bin/msgmerge
-DGETTEXT_MSGFMT_EXECUTABLE=/usr/local/opt/gettext/bin/msgfmt -DGETTEXT_MSGFMT_EXECUTABLE=/usr/local/opt/gettext/bin/msgfmt
-DGETTEXT_XGETTEXT_EXECUTABLE=/usr/local/opt/gettext/bin/xgettext -DGETTEXT_XGETTEXT_EXECUTABLE=/usr/local/opt/gettext/bin/xgettext
-DDEVELOPER_DIR=$(xcode-select -p)
- name: make - name: make
working-directory: bin working-directory: bin
run: make -j2 run: make -j2

View File

@ -175,7 +175,7 @@ if(BUNDLE_PROJECTM_PRESETS)
configure_file( configure_file(
"${preset}" "${preset}"
"${CMAKE_BINARY_DIR}/clementine.app/Contents/Resources/projectm-presets/${PRESET_NAME}" "${CMAKE_BINARY_DIR}/clementine.app/Contents/Resources/projectm-presets/${PRESET_NAME}"
COPY_ONLY COPYONLY
) )
endforeach (preset) endforeach (preset)
else (APPLE) else (APPLE)

View File

@ -17,8 +17,11 @@
#include "Waveform.hpp" #include "Waveform.hpp"
#include <algorithm> #include <algorithm>
#include <functional>
#include "BeatDetect.hpp" #include "BeatDetect.hpp"
using std::placeholders::_1;
typedef float floatPair[2]; typedef float floatPair[2];
typedef float floatTriple[3]; typedef float floatTriple[3];
typedef float floatQuad[4]; typedef float floatQuad[4];
@ -65,8 +68,8 @@ void Waveform::Draw(RenderContext &context)
float mult= scaling*( spectrum ? 0.015f :1.0f); float mult= scaling*( spectrum ? 0.015f :1.0f);
std::transform(&value1[0],&value1[samples],&value1[0],std::bind2nd(std::multiplies<float>(),mult)); std::transform(&value1[0],&value1[samples],&value1[0],std::bind(std::multiplies<float>(),_1, mult));
std::transform(&value2[0],&value2[samples],&value2[0],std::bind2nd(std::multiplies<float>(),mult)); std::transform(&value2[0],&value2[samples],&value2[0],std::bind(std::multiplies<float>(),_1,mult));
WaveformContext waveContext(samples, context.beatDetect); WaveformContext waveContext(samples, context.beatDetect);

View File

@ -15,6 +15,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <random>
namespace omptl namespace omptl
{ {
@ -463,14 +464,15 @@ template <class RandomAccessIterator>
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, void random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
const unsigned P) const unsigned P)
{ {
return ::std::random_shuffle(first, last); std::random_device rd;
return ::std::shuffle(first, last, std::mt19937(rd()));
} }
template <class RandomAccessIterator, class RandomNumberGenerator> template <class RandomAccessIterator, class RandomNumberGenerator>
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, void random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
RandomNumberGenerator &rgen, const unsigned P) RandomNumberGenerator &rgen, const unsigned P)
{ {
return ::std::random_shuffle(first, last, rgen); return ::std::shuffle(first, last, rgen);
} }
template <class ForwardIterator, class T> template <class ForwardIterator, class T>

View File

@ -9,11 +9,6 @@ brew 'glew'
brew 'glib' brew 'glib'
brew 'gnome-common' brew 'gnome-common'
brew 'google-sparsehash' brew 'google-sparsehash'
brew 'gst-libav'
brew 'gst-plugins-bad'
brew 'gst-plugins-base'
brew 'gst-plugins-good'
brew 'gst-plugins-ugly'
brew 'gstreamer' brew 'gstreamer'
brew 'gtk-doc' brew 'gtk-doc'
brew 'intltool' brew 'intltool'

View File

@ -46,7 +46,11 @@ endif(OPENGL_FOUND)
find_package(Boost REQUIRED) find_package(Boost REQUIRED)
find_package(Gettext REQUIRED) find_package(Gettext REQUIRED)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
if (APPLE)
find_package(protobuf REQUIRED CONFIG)
else()
find_package(Protobuf REQUIRED) find_package(Protobuf REQUIRED)
endif()
find_package(FFTW3) find_package(FFTW3)
find_package(ALSA) find_package(ALSA)
if (NOT APPLE) if (NOT APPLE)

17
dist/macdeploy.py vendored
View File

@ -35,11 +35,11 @@ STRIP_PREFIX = [
'@@HOMEBREW_CELLAR@@/qt5/5.8.0_1/lib/', '@@HOMEBREW_CELLAR@@/qt5/5.8.0_1/lib/',
] ]
LIBRARY_SEARCH_PATH = ['/target', '/target/lib', '/usr/local/lib', '/sw/lib'] LIBRARY_SEARCH_PATH = ['/opt/homebrew/lib', '/target', '/target/lib', '/usr/local/lib', '/sw/lib']
GSTREAMER_PLUGINS = [ GSTREAMER_PLUGINS = [
# Core plugins # Core plugins
'libgstapp.dylib', 'libgstapp-1.0.dylib',
'libgstaudioconvert.dylib', 'libgstaudioconvert.dylib',
'libgstaudiofx.dylib', 'libgstaudiofx.dylib',
'libgstaudiotestsrc.dylib', 'libgstaudiotestsrc.dylib',
@ -88,10 +88,13 @@ GSTREAMER_PLUGINS = [
] ]
GSTREAMER_SEARCH_PATH = [ GSTREAMER_SEARCH_PATH = [
'/opt/homebrew/lib',
'/opt/homebrew/opt/gstreamer/libexec/gstreamer-1.0',
'/usr/local/lib',
'/usr/local/lib/gstreamer-1.0', '/usr/local/lib/gstreamer-1.0',
'/usr/local/opt/gstreamer/libexec/gstreamer-1.0',
'/target/lib/gstreamer-1.0', '/target/lib/gstreamer-1.0',
'/target/libexec/gstreamer-1.0', '/target/libexec/gstreamer-1.0',
'/usr/local/opt/gstreamer/libexec/gstreamer-1.0',
] ]
QT_PLUGINS = [ QT_PLUGINS = [
@ -110,6 +113,7 @@ QT_PLUGINS = [
'styles/libqmacstyle.dylib', 'styles/libqmacstyle.dylib',
] ]
QT_PLUGINS_SEARCH_PATH = [ QT_PLUGINS_SEARCH_PATH = [
'/opt/homebrew/Cellar/qt@5/5.15.10/plugins',
'/usr/local/opt/qt5/plugins', '/usr/local/opt/qt5/plugins',
'/target/plugins', '/target/plugins',
'/usr/local/Trolltech/Qt-4.7.0/plugins', '/usr/local/Trolltech/Qt-4.7.0/plugins',
@ -117,6 +121,7 @@ QT_PLUGINS_SEARCH_PATH = [
] ]
GIO_MODULES_SEARCH_PATH = [ GIO_MODULES_SEARCH_PATH = [
'/opt/homebrew/lib/gio/modules',
'/usr/local/lib/gio/modules', '/usr/local/lib/gio/modules',
'/target/lib/gio/modules', '/target/lib/gio/modules',
] ]
@ -204,6 +209,12 @@ def GetBrokenLibraries(binary):
*os.path.split(line)[1:], *os.path.split(line)[1:],
) )
broken_libs['libs'].append(abs_path) broken_libs['libs'].append(abs_path)
elif re.match(r'^\s*@rpath', line):
abs_path = os.path.join(
os.path.dirname(binary),
*os.path.split(line)[1:],
)
broken_libs['libs'].append(abs_path)
elif re.match(r'^\s*@executable_path', line): elif re.match(r'^\s*@executable_path', line):
# Potentially already fixed library # Potentially already fixed library
relative_path = os.path.join(*line.split('/')[3:]) relative_path = os.path.join(*line.split('/')[3:])

View File

@ -32,6 +32,11 @@ target_link_libraries(clementine-tagreader
z z
) )
set_property(
TARGET clementine-tagreader
PROPERTY CXX_STANDARD 17
)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
target_link_libraries(clementine-tagreader target_link_libraries(clementine-tagreader
execinfo execinfo

View File

@ -33,6 +33,11 @@ add_library(libclementine-common STATIC
${MOC} ${MOC}
) )
set_property(
TARGET libclementine-common
PROPERTY CXX_STANDARD 17
)
target_link_libraries(libclementine-common target_link_libraries(libclementine-common
Qt5::Core Qt5::Core
Qt5::Network Qt5::Network

View File

@ -6,14 +6,27 @@ set(MESSAGES
remotecontrolmessages.proto remotecontrolmessages.proto
) )
protobuf_generate_cpp(PROTO_SOURCES PROTO_HEADERS ${MESSAGES}) add_library(libclementine-remote STATIC)
add_library(libclementine-remote STATIC protobuf_generate(
${PROTO_SOURCES} LANGUAGE cpp
TARGET libclementine-remote
PROTOS ${MESSAGES}
) )
set_property(
TARGET libclementine-remote
PROPERTY CXX_STANDARD 17
)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
target_link_libraries(libclementine-remote target_link_libraries(libclementine-remote
${PROTOBUF_LIBRARY} protobuf::libprotobuf
libclementine-common libclementine-common
) )

View File

@ -28,16 +28,24 @@ optional_source(HAVE_GOOGLE_DRIVE
qt5_wrap_cpp(MOC ${HEADERS}) qt5_wrap_cpp(MOC ${HEADERS})
protobuf_generate_cpp(PROTO_SOURCES PROTO_HEADERS ${MESSAGES})
add_library(libclementine-tagreader STATIC add_library(libclementine-tagreader STATIC
${PROTO_SOURCES}
${SOURCES} ${SOURCES}
${MOC} ${MOC}
) )
protobuf_generate(
LANGUAGE cpp
TARGET libclementine-tagreader
PROTOS ${MESSAGES}
)
set_property(
TARGET libclementine-tagreader
PROPERTY CXX_STANDARD 17
)
target_link_libraries(libclementine-tagreader target_link_libraries(libclementine-tagreader
${PROTOBUF_LIBRARY} protobuf::libprotobuf
libclementine-common libclementine-common
) )

View File

@ -1244,6 +1244,11 @@ add_library(clementine_lib STATIC
${OTHER_UIC_SOURCES} ${OTHER_UIC_SOURCES}
) )
set_property(
TARGET clementine_lib
PROPERTY CXX_STANDARD 17
)
target_link_libraries(clementine_lib target_link_libraries(clementine_lib
libclementine-common libclementine-common
libclementine-tagreader libclementine-tagreader

View File

@ -26,7 +26,7 @@
#include "core/closure.h" #include "core/closure.h"
#include "core/network.h" #include "core/network.h"
using std::mem_fun; using std::mem_fn;
namespace { namespace {
@ -89,7 +89,7 @@ void MusicbrainzCoverProvider::ReleaseSearchFinished(QNetworkReply* reply,
void MusicbrainzCoverProvider::ImageCheckFinished(int id) { void MusicbrainzCoverProvider::ImageCheckFinished(int id) {
QList<QNetworkReply*> replies = image_checks_.values(id); QList<QNetworkReply*> replies = image_checks_.values(id);
int finished_count = std::count_if(replies.constBegin(), replies.constEnd(), int finished_count = std::count_if(replies.constBegin(), replies.constEnd(),
mem_fun(&QNetworkReply::isFinished)); mem_fn(&QNetworkReply::isFinished));
if (finished_count == replies.size()) { if (finished_count == replies.size()) {
QString cover_name = cover_names_.take(id); QString cover_name = cover_names_.take(id);
QList<CoverSearchResult> results; QList<CoverSearchResult> results;

View File

@ -22,6 +22,7 @@
#include <QTimerEvent> #include <QTimerEvent>
#include <QUrl> #include <QUrl>
#include <algorithm> #include <algorithm>
#include <random>
#include "core/application.h" #include "core/application.h"
#include "core/logging.h" #include "core/logging.h"
@ -371,7 +372,9 @@ QStringList GlobalSearch::GetSuggestions(int count) {
} }
// Randomize the suggestions // Randomize the suggestions
std::random_shuffle(ret.begin(), ret.end()); std::random_device rd;
std::mt19937 g(rd());
std::shuffle(ret.begin(), ret.end(), g);
// Only return the first count // Only return the first count
while (ret.length() > count) { while (ret.length() > count) {

View File

@ -32,6 +32,7 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <random>
#include <unordered_map> #include <unordered_map>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
@ -2077,6 +2078,8 @@ void Playlist::ReshuffleIndices() {
if (current_virtual_index_ != -1) if (current_virtual_index_ != -1)
std::advance(begin, current_virtual_index_ + 1); std::advance(begin, current_virtual_index_ + 1);
std::random_device rd;
switch (playlist_sequence_->shuffle_mode()) { switch (playlist_sequence_->shuffle_mode()) {
case PlaylistSequence::Shuffle_Off: case PlaylistSequence::Shuffle_Off:
// Handled above. // Handled above.
@ -2084,7 +2087,7 @@ void Playlist::ReshuffleIndices() {
case PlaylistSequence::Shuffle_All: case PlaylistSequence::Shuffle_All:
case PlaylistSequence::Shuffle_InsideAlbum: case PlaylistSequence::Shuffle_InsideAlbum:
std::random_shuffle(begin, end); std::shuffle(begin, end, std::mt19937(rd()));
break; break;
case PlaylistSequence::Shuffle_Albums: { case PlaylistSequence::Shuffle_Albums: {
@ -2101,8 +2104,8 @@ void Playlist::ReshuffleIndices() {
// Shuffle them // Shuffle them
QStringList shuffled_album_keys = album_key_set.values(); QStringList shuffled_album_keys = album_key_set.values();
std::random_shuffle(shuffled_album_keys.begin(), std::shuffle(shuffled_album_keys.begin(), shuffled_album_keys.end(),
shuffled_album_keys.end()); std::mt19937(rd()));
// If the user is currently playing a song, force its album to be first // If the user is currently playing a song, force its album to be first
// Or if the song was not playing but it was selected, force its album // Or if the song was not playing but it was selected, force its album