Skip to content

Commit

Permalink
Merge remote-tracking branch 'mixxx/2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Nov 30, 2023
2 parents 2c2e706 + 8e41e53 commit 0f0deb1
Show file tree
Hide file tree
Showing 32 changed files with 480 additions and 346 deletions.
42 changes: 28 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/musicbrainz/web/coverartarchiveimagetask.cpp
src/musicbrainz/web/coverartarchivelinkstask.cpp
src/musicbrainz/web/musicbrainzrecordingstask.cpp
src/nativeeventhandlerwin.cpp
src/network/jsonwebtask.cpp
src/network/networktask.cpp
src/network/webtask.cpp
Expand Down Expand Up @@ -1564,6 +1565,13 @@ if (INFO_VECTORIZE)
endif()
endif()

option(RELATIVE_MACRO_PATHS "Relativize __FILE__ paths" ON)
if(RELATIVE_MACRO_PATHS)
if(NOT MSVC)
target_compile_options(mixxx-lib PUBLIC "-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.")
endif()
endif()

option(WARNINGS_FATAL "Fail if compiler generates a warning" OFF)
if(WARNINGS_FATAL)
if(MSVC)
Expand All @@ -1573,14 +1581,6 @@ if(WARNINGS_FATAL)
endif()
endif()

option(DEBUG_ASSERTIONS_FATAL "Fail if debug become true assertions" OFF)
if(DEBUG_ASSERTIONS_FATAL)
target_compile_definitions(mixxx-lib PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL MIXXX_DEBUG_ASSERTIONS_ENABLED)
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "DEBUG_ASSERT statements have been enabled because DEBUG_ASSERTIONS_FATAL is ON.")
endif()
endif()

target_compile_definitions(mixxx-lib PUBLIC
"${CMAKE_SYSTEM_PROCESSOR}"
$<$<CONFIG:Debug>:MIXXX_BUILD_DEBUG>
Expand Down Expand Up @@ -1646,7 +1646,7 @@ if(WIN32)
# shoutidjc/shout.h checks for WIN32 to see if we are on Windows.
target_compile_definitions(mixxx-lib PUBLIC WIN32)

target_link_libraries(mixxx-lib PRIVATE shell32)
target_link_libraries(mixxx-lib PRIVATE comctl32 shell32)

if(MSVC)
target_link_options(mixxx-lib PUBLIC /entry:mainCRTStartup)
Expand Down Expand Up @@ -2168,12 +2168,15 @@ if(GIT_COMMIT_DATE AND NOT GIT_COMMIT_DATE MATCHES "^[0-9]*-[0-9]*-[0-9]*T[0-9]*
endif()

add_custom_target(mixxx-gitinfo
# Note: We don't quote the paths in the command since CMake already inserts
# escapes (which, if quoted, lead to paths wrongly containing backslashes).
# See https://stackoverflow.com/questions/8925396/why-does-cmake-prefixes-spaces-with-backslashes-when-executing-a-command
COMMAND ${CMAKE_COMMAND}
-DGIT_DESCRIBE="${GIT_DESCRIBE}"
-DGIT_COMMIT_DATE="${GIT_COMMIT_DATE}"
-DINPUT_FILE="${CMAKE_CURRENT_SOURCE_DIR}/src/gitinfo.h.in"
-DOUTPUT_FILE="${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h"
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/gitinfo.cmake"
-DGIT_DESCRIBE=${GIT_DESCRIBE}
-DGIT_COMMIT_DATE=${GIT_COMMIT_DATE}
-DINPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/src/gitinfo.h.in
-DOUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/gitinfo.cmake
COMMENT "Update git version information in gitinfo.h"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
Expand Down Expand Up @@ -2650,6 +2653,17 @@ if(QML)
qt_finalize_target(mixxx)
endif()

option(DEBUG_ASSERTIONS_FATAL "Fail if debug become true assertions" OFF)
if(DEBUG_ASSERTIONS_FATAL)
target_compile_definitions(mixxx-lib PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL MIXXX_DEBUG_ASSERTIONS_ENABLED)
if(QML)
target_compile_definitions(mixxx-qml-lib PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL MIXXX_DEBUG_ASSERTIONS_ENABLED)
endif()
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "DEBUG_ASSERT statements have been enabled because DEBUG_ASSERTIONS_FATAL is ON.")
endif()
endif()

target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT QT_USE_QSTRINGBUILDER)
is_static_library(Qt_IS_STATIC Qt${QT_VERSION_MAJOR}::Core)
if(Qt_IS_STATIC)
Expand Down
10 changes: 10 additions & 0 deletions res/skins/Deere/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2045,6 +2045,16 @@ WSearchLineEdit QAbstractScrollArea,
/* remove OS focus indicator */
outline: none;
}
/* required on Windows since the QAbstractItemViews don't inherit styles from
the respective QComboBoxes */
WEffectSelector QAbstractItemView,
WEffectChainPresetSelector QAbstractItemView,
WSearchLineEdit QAbstractItemView {
selection-color: #fff;
selection-background-color: #565353;
border: 0px;
outline: none;
}
/* Remove 3D border from unchecked effects checkmark space */
WEffectSelector::item:selected,
WEffectChainPresetSelector::item:selected,
Expand Down
13 changes: 12 additions & 1 deletion res/skins/LateNight/style_classic.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2509,10 +2509,21 @@ WSearchLineEdit::item:selected,
#SkinSettingsMixerToggle[hover="true"],
#SkinSettingsLabelButton[hover="true"] {
background-color: #5E4507;
color: white;
color: #fff;
/* remove OS focus indicator */
outline: none;
}
/* required on Windows since the QAbstractItemViews don't inherit styles from
the respective QComboBoxes */
WEffectSelector QAbstractItemView,
WEffectChainPresetSelector QAbstractItemView,
WSearchLineEdit QAbstractItemView {
selection-color: #fff;
selection-background-color: #5E4507;
border-radius: 1px;
border: 0px;
outline: none;
}
/* checked item */
WEffectSelector::item:checked,
WEffectChainPresetSelector::item:checked,
Expand Down
10 changes: 10 additions & 0 deletions res/skins/LateNight/style_palemoon.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,7 @@ WEffectChainPresetSelector:!editable:on,
#RateText, #RateRangePrefix, #RateRangeText,
#MixerMainHeadphone #FxAssignButtons WPushButton[displayValue="0"],
#PreviewLabel,
WSearchLineEdit QAbstractScrollArea,
WEffectSelector QAbstractScrollArea,
WEffectChainPresetSelector QAbstractScrollArea,
#fadeModeCombobox QAbstractScrollArea,
Expand Down Expand Up @@ -3003,6 +3004,15 @@ WSearchLineEdit::item:selected,
/* remove OS focus indicator */
outline: none;
}
WEffectSelector QAbstractItemView,
WEffectChainPresetSelector QAbstractItemView,
WSearchLineEdit QAbstractItemView {
selection-color: #fff;
selection-background-color: #2c454f;
border-radius: 1px;
border: 0px;
outline: none;
}
/* checked item */
WEffectSelector::item:checked,
WEffectChainPresetSelector::item:checked,
Expand Down
10 changes: 10 additions & 0 deletions res/skins/Shade/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,16 @@ WEffectSelector::indicator:unchecked:selected,
/* remove OS focus indicator */
outline: none;
}
/* required on Windows since the QAbstractItemViews don't inherit styles from
the respective QComboBoxes */
WEffectSelector QAbstractItemView,
WEffectChainPresetSelector QAbstractItemView,
WSearchLineEdit QAbstractItemView {
selection-color: #000;
selection-background-color: lightgray;
border: 0px;
outline: none;
}
/* Remove 3D border from unchecked effects checkmark space */
WEffectSelector::item:selected,
WSearchLineEdit::item:selected,
Expand Down
7 changes: 7 additions & 0 deletions res/skins/Shade/style_dark.qss
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ WEffectSelector::indicator:unchecked:selected,
#fadeModeCombobox::indicator:unchecked:selected {
background-color: #999;
}
/* required on Windows since the QAbstractItemViews don't inherit styles from
the respective QComboBoxes */
WEffectSelector QAbstractItemView,
WEffectChainPresetSelector QAbstractItemView,
WSearchLineEdit QAbstractItemView {
selection-background-color: #999;
}
WEffectSelector::indicator:unchecked:selected,
#fadeModeCombobox::indicator:unchecked:selected {
border-color: #999;
Expand Down
7 changes: 7 additions & 0 deletions res/skins/Shade/style_summer_sunset.qss
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ WEffectSelector::indicator:unchecked:selected,
#fadeModeCombobox::indicator:unchecked:selected {
background-color: #d9c663;
}
/* required on Windows since the QAbstractItemViews don't inherit styles from
the respective QComboBoxes */
WEffectSelector QAbstractItemView,
WEffectChainPresetSelector QAbstractItemView,
WSearchLineEdit QAbstractItemView {
selection-background-color: #d9c663;
}
WEffectSelector::indicator:unchecked:selected,
#fadeModeCombobox::indicator:unchecked:selected {
border-color: #d9c663;
Expand Down
12 changes: 11 additions & 1 deletion res/skins/Tango/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2377,7 +2377,17 @@ WSearchLineEdit::item:selected,
color: #fff;
/* remove OS focus indicator */
outline: none;
}
}
/* required on Windows since the QAbstractItemViews don't inherit styles from
the respective QComboBoxes */
WEffectSelector QAbstractItemView,
WEffectChainPresetSelector QAbstractItemView,
WSearchLineEdit QAbstractItemView {
selection-color: #fff;
selection-background-color: #555;
border: 0px;
outline: none;
}

/* disabled menu items and checkboxes */
#MainMenu::item:disabled,
Expand Down
12 changes: 7 additions & 5 deletions src/coreservices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,11 +585,6 @@ void CoreServices::finalize() {
qDebug() << t.elapsed(false).debugMillisWithUnit() << "deleting PlayerManager";
CLEAR_AND_CHECK_DELETED(m_pPlayerManager);

// Destroy PlayerInfo explicitly to release the track
// pointers of tracks that were still loaded in decks
// or samplers when PlayerManager was destroyed!
PlayerInfo::destroy();

// Delete the library after the view so there are no dangling pointers to
// the data models.
// Depends on RecordingManager and PlayerManager
Expand All @@ -610,6 +605,13 @@ void CoreServices::finalize() {
qDebug() << t.elapsed(false).debugMillisWithUnit() << "deleting EngineMixer";
CLEAR_AND_CHECK_DELETED(m_pEngine);

// Destroy PlayerInfo explicitly to release the track
// pointers of tracks that were still loaded in decks
// or samplers when PlayerManager was destroyed!
// Do this after deleting EngineMixer which makes use of
// PlayerInfo in EngineRecord.
PlayerInfo::destroy();

qDebug() << t.elapsed(false).debugMillisWithUnit() << "deleting EffectsManager";
CLEAR_AND_CHECK_DELETED(m_pEffectsManager);

Expand Down
3 changes: 1 addition & 2 deletions src/encoder/encoderffmpegcore.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include <encoder/encoderffmpegresample.h>

extern "C" {
#include <libavutil/opt.h>
#include <libavcodec/avcodec.h>
Expand All @@ -24,6 +22,7 @@ extern "C" {
#include <QLibrary>

#include "encoder/encoder.h"
#include "encoder/encoderffmpegresample.h"
#include "track/track_decl.h"
#include "util/types.h"

Expand Down
4 changes: 1 addition & 3 deletions src/engine/sidechain/enginenetworkstream.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#pragma once

#include <engine/sidechain/networkoutputstreamworker.h>

#include <QVector>

#include "audio/types.h"
#include "engine/sidechain/networkoutputstreamworker.h"
#include "util/types.h"

class NetworkInputStreamWorker;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/sidechain/networkinputstreamworker.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <engine/sidechain/networkinputstreamworker.h>
#include "engine/sidechain/networkinputstreamworker.h"

NetworkInputStreamWorker::NetworkInputStreamWorker() {
}
Expand Down
3 changes: 2 additions & 1 deletion src/engine/sidechain/networkoutputstreamworker.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <engine/sidechain/networkoutputstreamworker.h>
#include "engine/sidechain/networkoutputstreamworker.h"

#include "engine/sidechain/enginenetworkstream.h"
#include "util/logger.h"

Expand Down
49 changes: 31 additions & 18 deletions src/library/coverartcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,14 @@ void CoverArtCache::tryLoadCover(
return;
}

const auto requestedCacheKey = coverInfo.cacheKey();
// keep a list of trackIds for which a future is currently running
// to avoid loading the same picture again while we are loading it
QPair<const QObject*, mixxx::cache_key_t> requestId = qMakePair(pRequester, requestedCacheKey);
if (m_runningRequests.contains(requestId)) {
const mixxx::cache_key_t requestedCacheKey = coverInfo.cacheKey();
// keep a list of cache keys for which a future is currently running
// to avoid loading the same picture again while we are loading it.
// This fixes also https://github.com/mixxxdj/mixxx/issues/11131 on
// Windows where simultaneous open the same file from two threads fails.
bool requestPending = m_runningRequests.contains(requestedCacheKey);
m_runningRequests.insert(requestedCacheKey, {pRequester, desiredWidth});
if (requestPending) {
return;
}

Expand All @@ -174,12 +177,11 @@ void CoverArtCache::tryLoadCover(
<< "requestCover starting future for"
<< coverInfo;
}
m_runningRequests.insert(requestId);

// The watcher will be deleted in coverLoaded()
QFutureWatcher<FutureResult>* watcher = new QFutureWatcher<FutureResult>(this);
QFuture<FutureResult> future = QtConcurrent::run(
&CoverArtCache::loadCover,
pRequester,
pTrack,
coverInfo,
desiredWidth);
Expand All @@ -193,7 +195,6 @@ void CoverArtCache::tryLoadCover(

//static
CoverArtCache::FutureResult CoverArtCache::loadCover(
const QObject* pRequester,
TrackPointer pTrack,
CoverInfo coverInfo,
int desiredWidth) {
Expand All @@ -207,7 +208,6 @@ CoverArtCache::FutureResult CoverArtCache::loadCover(
pTrack->getLocation() == coverInfo.trackLocation);

auto res = FutureResult(
pRequester,
coverInfo.cacheKey());

CoverInfo::LoadedImage loadedImage = coverInfo.loadImage(pTrack);
Expand Down Expand Up @@ -258,6 +258,8 @@ void CoverArtCache::coverLoaded() {
kLogger.trace() << "coverLoaded" << res.coverArt;
}

QString cacheKey = pixmapCacheKey(
res.coverArt.cacheKey(), res.coverArt.resizedToWidth);
QPixmap pixmap;
if (res.coverArt.loadedImage.result != CoverInfo::LoadedImage::Result::NoImage) {
if (res.coverArt.loadedImage.result == CoverInfo::LoadedImage::Result::Ok) {
Expand Down Expand Up @@ -293,18 +295,29 @@ void CoverArtCache::coverLoaded() {
// It is very unlikely that res.coverArt.hash generates the
// same hash for different images. Otherwise the wrong image would
// be displayed when loaded from the cache.
QString cacheKey = pixmapCacheKey(
res.coverArt.cacheKey(), res.coverArt.resizedToWidth);
QPixmapCache::insert(cacheKey, pixmap);
}
}

m_runningRequests.remove(qMakePair(res.pRequester, res.requestedCacheKey));

if (res.pRequester) {
emit coverFound(
res.pRequester,
std::move(res.coverArt),
pixmap);
auto runningRequests = m_runningRequests;
// First remove all requests for this cover that way we can
// re-add cover with different sizes via tryLoadCover() as usual
m_runningRequests.remove(res.coverArt.cacheKey());

auto i = runningRequests.find(res.coverArt.cacheKey());
while (i != runningRequests.end() && i.key() == res.coverArt.cacheKey()) {
if (i.value().desiredWidth == res.coverArt.resizedToWidth) {
emit coverFound(
i.value().pRequester,
res.coverArt,
pixmap);
} else {
tryLoadCover(
i.value().pRequester,
nullptr,
res.coverArt,
i.value().desiredWidth);
}
++i;
}
}
Loading

0 comments on commit 0f0deb1

Please sign in to comment.