diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-08-05 11:40:17 +0200 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-08-05 11:40:17 +0200 |
commit | 9296e6e59b12c133900903a1585115cc6a015fc7 (patch) | |
tree | bd4b7c8a9ff934c247c72a50bbf4db2d746fe911 | |
parent | d4febde01c65f89936be5db6fdbe9c462e192e59 (diff) | |
parent | 42fcb208bbdcbd26e17f15150db9d8590abea9cc (diff) |
-rw-r--r-- | src/engine/sync/enginesync.h | 4 | ||||
-rw-r--r-- | src/library/dlgtrackinfo.cpp | 17 | ||||
-rw-r--r-- | src/library/dlgtrackinfo.h | 2 | ||||
-rw-r--r-- | src/library/dlgtrackinfo.ui | 300 | ||||
-rw-r--r-- | src/mixer/basetrackplayer.cpp | 4 | ||||
-rw-r--r-- | src/mixer/playerinfo.cpp | 10 | ||||
-rw-r--r-- | src/mixer/playerinfo.h | 1 | ||||
-rw-r--r-- | src/mixxx.cpp | 1 | ||||
-rw-r--r-- | src/test/autodjprocessor_test.cpp | 20 | ||||
-rw-r--r-- | src/test/broadcastprofile_test.cpp | 25 | ||||
-rw-r--r-- | src/test/signalpathtest.h | 16 | ||||
-rw-r--r-- | src/widget/wstarrating.cpp | 14 |
12 files changed, 240 insertions, 174 deletions
diff --git a/src/engine/sync/enginesync.h b/src/engine/sync/enginesync.h index 8374d81155..29fc05ff2b 100644 --- a/src/engine/sync/enginesync.h +++ b/src/engine/sync/enginesync.h @@ -52,11 +52,13 @@ class EngineSync : public BaseSyncableListener { void notifyScratching(Syncable* pSyncable, bool scratching) override; // Used to pick a sync target for cases where master sync mode is not sufficient. - // Guaranteed to pick a Syncable that is a real deck and has an EngineBuffer. + // Guaranteed to pick a Syncable that is a real deck and has an EngineBuffer, + // but can return nullptr if there are no choices. // First choice is master sync, if it's a real deck, // then it will fall back to the first playing syncable deck, // then it will fall back to the first playing deck, // then it will fall back to the first non-playing deck. + // If there is literally nothing loaded, returns nullptr. Syncable* pickNonSyncSyncTarget(EngineChannel* pDontPick) const; // Used to test whether changing the rate of a Syncable would change the rate diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index 541fe0a0dd..75ea3a6de8 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -32,6 +32,7 @@ DlgTrackInfo::DlgTrackInfo(QWidget* parent, m_pTapFilter(new TapFilter(this, kFilterLength, kMaxInterval)), m_dLastTapedBpm(-1.), m_pWCoverArtLabel(new WCoverArtLabel(this)), + m_pWStarRating(new WStarRating(nullptr, this)), m_pConfig(pConfig), m_pTrackModel(trackModel) { init(); @@ -44,10 +45,17 @@ DlgTrackInfo::~DlgTrackInfo() { void DlgTrackInfo::init() { setupUi(this); - coverBox->setAlignment(Qt::AlignRight|Qt::AlignTop); - coverBox->setSpacing(0); - coverBox->setContentsMargins(0, 0, 0, 0); - coverBox->insertWidget(1, m_pWCoverArtLabel); + coverLayout->setAlignment(Qt::AlignRight | Qt::AlignTop); + coverLayout->setSpacing(0); + coverLayout->setContentsMargins(0, 0, 0, 0); + coverLayout->insertWidget(0, m_pWCoverArtLabel); + + starsLayout->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + starsLayout->setSpacing(0); + starsLayout->setContentsMargins(0, 0, 0, 0); + starsLayout->insertWidget(0, m_pWStarRating); + // This is necessary to pass on mouseMove events to WStarRating + m_pWStarRating->setMouseTracking(true); m_pTagFetcher.reset(new DlgTagFetcher(this, m_pTrackModel)); if (m_pTrackModel) { @@ -269,6 +277,7 @@ void DlgTrackInfo::populateFields(const Track& track) { m_loadedCoverInfo = track.getCoverInfoWithLocation(); m_pWCoverArtLabel->setCoverArt(m_loadedCoverInfo, QPixmap()); CoverArtCache::requestCover(this, m_loadedCoverInfo); + m_pWStarRating->slotTrackLoaded(m_pLoadedTrack); } void DlgTrackInfo::reloadTrackBeats(const Track& track) { diff --git a/src/library/dlgtrackinfo.h b/src/library/dlgtrackinfo.h index d4a06eea2b..8486cdaf22 100644 --- a/src/library/dlgtrackinfo.h +++ b/src/library/dlgtrackinfo.h @@ -16,6 +16,7 @@ #include "util/types.h" #include "widget/wcoverartlabel.h" #include "widget/wcoverartmenu.h" +#include "widget/wstarrating.h" /// A dialog box to display and edit track properties. /// Use TrackPointer to load a track into the dialog or @@ -100,6 +101,7 @@ class DlgTrackInfo : public QDialog, public Ui::DlgTrackInfo { CoverInfo m_loadedCoverInfo; WCoverArtLabel* m_pWCoverArtLabel; + WStarRating* m_pWStarRating; UserSettingsPointer m_pConfig; const TrackModel* m_pTrackModel; diff --git a/src/library/dlgtrackinfo.ui b/src/library/dlgtrackinfo.ui index d5516db82f..51946d11aa 100644 --- a/src/library/dlgtrackinfo.ui +++ b/src/library/dlgtrackinfo.ui @@ -43,6 +43,7 @@ <property name="currentIndex"> <number>0</number> </property> + <widget class="QWidget" name="tabSummary"> <attribute name="title"> <string>Summary</string> @@ -53,18 +54,31 @@ <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0"> <layout class="QGridLayout" name="gridLayout_5" columnstretch="0,10,0,2"> - <item row="4" column="3"> - <widget class="QLineEdit" name="txtYear"> + + <item row="0" column="0"> + <widget class="QLabel" name="lblTrackName"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> + <property name="font"> + <font> + <italic>false</italic> + </font> + </property> + <property name="text"> + <string>Title</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> </widget> </item> - <item row="5" column="1"> - <widget class="QLineEdit" name="txtGenre"> + + <item row="0" column="1"> + <widget class="QLineEdit" name="txtTrackName"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -79,15 +93,45 @@ </property> </widget> </item> - <item row="6" column="2"> - <widget class="QLabel" name="lblTrackNumber"> + + <item row="0" column="2" colspan="2" rowspan="3"> + <widget class="QWidget" name="verticalWidgetCover" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QHBoxLayout" name="coverLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="sizeConstraint"> + <enum>QLayout::SetDefaultConstraint</enum> + </property> + </layout> + </widget> + </item> + + <item row="1" column="0"> + <widget class="QLabel" name="lblArtist"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> - <string>Track #</string> + <string>Artist</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="4" column="1"> - <widget class="QLineEdit" name="txtComposer"> + + <item row="1" column="1"> + <widget class="QLineEdit" name="txtArtist"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -102,8 +146,9 @@ </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="lblAlbumArtist"> + + <item row="2" column="0"> + <widget class="QLabel" name="lblAlbum"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -111,25 +156,16 @@ </sizepolicy> </property> <property name="text"> - <string>Album Artist</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="lblComposer"> - <property name="text"> - <string>Composer</string> + <string>Album</string> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="5" column="3"> - <widget class="QLineEdit" name="txtKey"> + + <item row="2" column="1"> + <widget class="QLineEdit" name="txtAlbum"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -144,39 +180,26 @@ </property> </widget> </item> - <item row="0" column="0"> - <widget class="QLabel" name="lblTrackName"> + + <item row="3" column="0"> + <widget class="QLabel" name="lblAlbumArtist"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <italic>false</italic> - </font> - </property> - <property name="text"> - <string>Title</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="lblGrouping"> <property name="text"> - <string>Grouping</string> + <string>Album Artist</string> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="6" column="3"> - <widget class="QLineEdit" name="txtTrackNumber"> + + <item row="3" column="1"> + <widget class="QLineEdit" name="txtAlbumArtist"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -191,31 +214,39 @@ </property> </widget> </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="txtTrackName"> + + <item row="3" column="2" colspan="2"> + <widget class="QWidget" name="verticalWidgetStars" native="true"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> + <layout class="QHBoxLayout" name="starsLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="sizeConstraint"> + <enum>QLayout::SetDefaultConstraint</enum> + </property> + </layout> </widget> </item> - <item row="5" column="2"> - <widget class="QLabel" name="lblKey"> + + <item row="4" column="0"> + <widget class="QLabel" name="lblComposer"> <property name="text"> - <string>Key</string> + <string>Composer</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="6" column="1"> - <widget class="QLineEdit" name="txtGrouping"> + + <item row="4" column="1"> + <widget class="QLineEdit" name="txtComposer"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -230,6 +261,7 @@ </property> </widget> </item> + <item row="4" column="2"> <widget class="QLabel" name="lblYear"> <property name="text"> @@ -237,56 +269,84 @@ </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="txtAlbum"> + + <item row="4" column="3"> + <widget class="QLineEdit" name="txtYear"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> + </widget> + </item> + + <item row="5" column="0"> + <widget class="QLabel" name="lblGenre"> + <property name="text"> + <string>Genre</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblArtist"> + + <item row="5" column="1"> + <widget class="QLineEdit" name="txtGenre"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>Artist</string> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </widget> + </item> + + <item row="5" column="2"> + <widget class="QLabel" name="lblKey"> + <property name="text"> + <string>Key</string> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblAlbum"> + + <item row="5" column="3"> + <widget class="QLineEdit" name="txtKey"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </widget> + </item> + + <item row="6" column="0"> + <widget class="QLabel" name="lblGrouping"> <property name="text"> - <string>Album</string> + <string>Grouping</string> </property> <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="txtAlbumArtist"> + + <item row="6" column="1"> + <widget class="QLineEdit" name="txtGrouping"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -301,8 +361,17 @@ </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="txtArtist"> + + <item row="6" column="2"> + <widget class="QLabel" name="lblTrackNumber"> + <property name="text"> + <string>Track #</string> + </property> + </widget> + </item> + + <item row="6" column="3"> + <widget class="QLineEdit" name="txtTrackNumber"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -317,17 +386,23 @@ </property> </widget> </item> - <item row="5" column="0"> - <widget class="QLabel" name="lblGenre"> + + <item row="7" column="0"> + <widget class="QLabel" name="lblTrackComment"> <property name="text"> - <string>Genre</string> + <string>Comments</string> </property> <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> </property> </widget> </item> + <item row="7" column="1" colspan="3"> + <widget class="QPlainTextEdit" name="txtComment"/> + </item> + + <item row="8" column="1" colspan="3"> <layout class="QHBoxLayout" name="horizontalLayout_3"> <item> <widget class="QPushButton" name="btnImportMetadataFromMusicBrainz"> @@ -351,50 +426,14 @@ <property name="sizeHint" stdset="0"> <size> <width>40</width> - <height>20</height> + <height>10</height> </size> </property> </spacer> </item> </layout> </item> - <item row="0" column="2" rowspan="4" colspan="2"> - <widget class="QWidget" name="verticalWidget" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="spacing"> - <number>0</number> - </property> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="coverBox"> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> - </layout> - </item> - </layout> - </widget> - </item> + </layout> </item> </layout> @@ -583,7 +622,7 @@ <property name="sizeHint" stdset="0"> <size> <width>40</width> - <height>20</height> + <height>10</height> </size> </property> </spacer> @@ -613,16 +652,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="tabComments"> - <attribute name="title"> - <string>Comments</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <item> - <widget class="QPlainTextEdit" name="txtComment"/> - </item> - </layout> - </widget> + <widget class="QWidget" name="tabBPM"> <attribute name="title"> <string>BPM</string> diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp index 271cf8e691..dffc038074 100644 --- a/src/mixer/basetrackplayer.cpp +++ b/src/mixer/basetrackplayer.cpp @@ -525,7 +525,9 @@ TrackPointer BaseTrackPlayerImpl::getLoadedTrack() const { void BaseTrackPlayerImpl::slotCloneDeck() { Syncable* syncable = m_pEngineMaster->getEngineSync()->pickNonSyncSyncTarget(m_pChannel); - slotCloneChannel(syncable->getChannel()); + if (syncable) { + slotCloneChannel(syncable->getChannel()); + } } void BaseTrackPlayerImpl::slotCloneFromGroup(const QString& group) { diff --git a/src/mixer/playerinfo.cpp b/src/mixer/playerinfo.cpp index 2a9c98e206..47771586fc 100644 --- a/src/mixer/playerinfo.cpp +++ b/src/mixer/playerinfo.cpp @@ -42,9 +42,17 @@ PlayerInfo::~PlayerInfo() { clearControlCache(); } +PlayerInfo& PlayerInfo::create() { + VERIFY_OR_DEBUG_ASSERT(!s_pPlayerInfo) { + return *s_pPlayerInfo; + } + s_pPlayerInfo = new PlayerInfo(); + return *s_pPlayerInfo; +} + // static PlayerInfo& PlayerInfo::instance() { - if (!s_pPlayerInfo) { + VERIFY_OR_DEBUG_ASSERT(s_pPlayerInfo) { s_pPlayerInfo = new PlayerInfo(); } return *s_pPlayerInfo; diff --git a/src/mixer/playerinfo.h b/src/mixer/playerinfo.h index 9a94eb15a6..5aee4fc06c 100644 --- a/src/mixer/playerinfo.h +++ b/src/mixer/playerinfo.h @@ -28,6 +28,7 @@ class PlayerInfo : public QObject { Q_OBJECT public: + static PlayerInfo& create(); static PlayerInfo& instance(); static void destroy(); TrackPointer getTrackInfo(const QString& group); diff --git a/src/mixxx.cpp b/src/mixxx.cpp index 83f85edd2a..339c65563d 100644 --- a/src/mixxx.cpp +++ b/src/mixxx.cpp @@ -304,6 +304,7 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) { &PlayerManager::noVinylControlInputConfigured, this, &MixxxMainWindow::slotNoVinylControlInputConfigured); + PlayerInfo::create(); for (int i = 0; i < kMicrophoneCount; ++i) { m_pPlayerManager->addMicrophone(); diff --git a/src/test/autodjprocessor_test.cpp b/src/test/autodjprocessor_test.cpp index 987786a86f..0106e4e795 100644 --- a/src/test/autodjprocessor_test.cpp +++ b/src/test/autodjprocessor_test.cpp @@ -1,19 +1,21 @@ -#include <gtest/gtest.h> +#include "library/autodj/autodjprocessor.h" + #include <gmock/gmock.h> +#include <gtest/gtest.h> -#include <QString> #include <QScopedPointer> +#include <QString> -#include "test/librarytest.h" -#include "library/autodj/autodjprocessor.h" -#include "control/controlpushbutton.h" -#include "control/controlpotmeter.h" #include "control/controllinpotmeter.h" +#include "control/controlpotmeter.h" +#include "control/controlpushbutton.h" #include "engine/engine.h" -#include "mixer/playermanager.h" #include "mixer/basetrackplayer.h" -#include "track/track.h" +#include "mixer/playerinfo.h" +#include "mixer/playermanager.h" #include "sources/soundsourceproxy.h" +#include "test/librarytest.h" +#include "track/track.h" using ::testing::_; using ::testing::Return; @@ -188,6 +190,7 @@ class AutoDJProcessorTest : public LibraryTest { } pPlayerManager.reset(new MockPlayerManager()); + PlayerInfo::create(); // Setup 4 fake decks. ON_CALL(*pPlayerManager, getPlayer(QString("[Channel1]"))) @@ -211,6 +214,7 @@ class AutoDJProcessorTest : public LibraryTest { } virtual ~AutoDJProcessorTest() { + PlayerInfo::destroy(); } TrackId addTrackToCollection(const QString& trackLocation) { diff --git a/src/test/broadcastprofile_test.cpp b/src/test/broadcastprofile_test.cpp index 3110338f8d..4358b2f8d0 100644 --- a/src/test/broadcastprofile_test.cpp +++ b/src/test/broadcastprofile_test.cpp @@ -42,40 +42,39 @@ TEST(BroadcastProfileTest, SaveAndLoadXML) { // Preliminary: set a discriminating value in one of the profile fields QString streamName("unit testing in progress"); - BroadcastProfile profile("Unit Testing Profile"); + BroadcastProfile profile("Broadcast Profile test"); profile.setStreamName(streamName); - QString filename = profile.getProfileName() + QString(".bcp.xml"); + QTemporaryDir tempDir; + ASSERT_TRUE(tempDir.isValid()); + QString filename = tempDir.filePath(profile.getProfileName() + QString(".bcp.xml")); - // Call save() on a profile and assert it actually exists - QFile::remove(filename); // First, make sure it doesn't exists profile.save(filename); ASSERT_TRUE(QFile::exists(filename)); // Load XML file using static loadFromFile and assert // the discriminating value is present BroadcastProfilePtr savedProfile = BroadcastProfile::loadFromFile(filename); - ASSERT_NE(savedProfile, nullptr); - ASSERT_TRUE(savedProfile->getStreamName() == streamName); + EXPECT_NE(savedProfile, nullptr); + EXPECT_TRUE(savedProfile->getStreamName() == streamName); } TEST(BroadcastProfileTest, SaveAndLoadXMLDotName) { - QString profileName("profile has a dot. (in the name)"); - + QString profileName("broadcast profile has a dot. (in the name) test"); BroadcastProfile profile(profileName); - QString filename = profile.getProfileName() + QString(".bcp.xml"); + QTemporaryDir tempDir; + ASSERT_TRUE(tempDir.isValid()); + QString filename = tempDir.filePath(profile.getProfileName() + QString(".bcp.xml")); - // Call save() on a profile and assert it actually exists - QFile::remove(filename); // First, make sure it doesn't exists profile.save(filename); ASSERT_TRUE(QFile::exists(filename)); // Load XML file using static loadFromFile and assert // the discriminating value is present BroadcastProfilePtr savedProfile = BroadcastProfile::loadFromFile(filename); - ASSERT_NE(savedProfile, nullptr); - ASSERT_TRUE(savedProfile->getProfileName() == profileName); + EXPECT_NE(savedProfile, nullptr); + EXPECT_TRUE(savedProfile->getProfileName() == profileName); } TEST(BroadcastProfileTest, SetGetValues) { diff --git a/src/test/signalpathtest.h b/src/test/signalpathtest.h index da7a85fede..32fc12f478 100644 --- a/src/test/signalpathtest.h +++ b/src/test/signalpathtest.h @@ -1,24 +1,25 @@ #pragma once -#include <gtest/gtest.h> #include <gmock/gmock.h> +#include <gtest/gtest.h> -#include <QtDebug> #include <QTest> +#include <QtDebug> -#include "preferences/usersettings.h" #include "control/controlobject.h" -#include "mixer/deck.h" #include "effects/effectsmanager.h" -#include "engine/enginebuffer.h" #include "engine/bufferscalers/enginebufferscale.h" #include "engine/channels/enginechannel.h" #include "engine/channels/enginedeck.h" -#include "engine/enginemaster.h" #include "engine/controls/ratecontrol.h" +#include "engine/enginebuffer.h" +#include "engine/enginemaster.h" #include "engine/sync/enginesync.h" +#include "mixer/deck.h" +#include "mixer/playerinfo.h" #include "mixer/previewdeck.h" #include "mixer/sampler.h" +#include "preferences/usersettings.h" #include "test/mixxxtest.h" #include "util/defs.h" #include "util/memory.h" @@ -115,6 +116,8 @@ class BaseSignalPathTest : public MixxxTest { m_pEngineSync = m_pEngineMaster->getEngineSync(); ControlObject::set(ConfigKey(m_sMasterGroup, "enabled"), 1.0); + + PlayerInfo::create(); } ~BaseSignalPathTest() override { @@ -132,6 +135,7 @@ class BaseSignalPathTest : public MixxxTest { delete m_pEffectsManager; delete m_pVisualsManager; delete m_pNumDecks; + PlayerInfo::destroy(); } void addDeck(EngineDeck* pDeck) { diff --git a/src/widget/wstarrating.cpp b/src/widget/wstarrating.cpp index d2c6a8150b..db98a0ad7c 100644 --- a/src/widget/wstarrating.cpp +++ b/src/widget/wstarrating.cpp @@ -10,11 +10,15 @@ WStarRating::WStarRating(QString group, QWidget* pParent) m_starRating(0, 5), m_group(group), m_focused(false) { - // Controls to change the star rating with controllers - m_pStarsUp = std::make_unique<ControlPushButton>(ConfigKey(group, "stars_up")); - m_pStarsDown = std::make_unique<ControlPushButton>(ConfigKey(group, "stars_down")); - connect(m_pStarsUp.get(), SIGNAL(valueChanged(double)), this, SLOT(slotStarsUp(double))); - connect(m_pStarsDown.get(), SIGNAL(valueChanged(double)), this, SLOT(slotStarsDown(double))); + // Controls to change the star rating with controllers. + // Note that 'group' maybe NULLPTR, e.g. when called from DlgTrackInfo, + // so only create rate change COs if there's a group passed when creating deck widgets. + if (!m_group.isEmpty()) { + m_pStarsUp = std::make_unique<ControlPushButton>(ConfigKey(group, "stars_up")); + m_pStarsDown = std::make_unique<ControlPushButton>(ConfigKey(group, "stars_down")); + connect(m_pStarsUp.get(), SIGNAL(valueChanged(double)), this, SLOT(slotStarsUp(double))); + connect(m_pStarsDown.get(), SIGNAL(valueChanged(double)), this, SLOT(slotStarsDown(double))); + } } void WStarRating::setup(const QDomNode& node, const SkinContext& context) { |