diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-08-05 11:11:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-05 11:11:42 +0200 |
commit | fdaa95598596064d9934b91497509b0a4ecf4004 (patch) | |
tree | c96dcbd6896e079a76a0a8ef2ae5dbc1f6f53f38 | |
parent | b747cc135eda88e302712e99225a5b3660ea57da (diff) | |
parent | 10dd1c088063368d1e234f5713b921b5aad5701e (diff) |
Merge pull request #2991 from ronso0/dlgtrackinfo-move-comments
DlgTrackInfo improvements
-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/widget/wstarrating.cpp | 14 |
4 files changed, 189 insertions, 144 deletions
diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index ea998a073f..e876f9f273 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 1f50804fbb..4f4e77ddbd 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/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) { |