[vlc-commits] qt: qml: enable aligned player controlbar customization
Fatih Uzunoglu
git at videolan.org
Mon Nov 16 10:04:04 CET 2020
vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Wed Aug 12 21:16:15 2020 +0300| [bde3e5a9ed3b07f05f9fe5958cd1c9effaa90031] | committer: Pierre Lamot
qt: qml: enable aligned player controlbar customization
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bde3e5a9ed3b07f05f9fe5958cd1c9effaa90031
---
.../gui/qt/dialogs/toolbar/qml/ToolbarEditor.qml | 252 +++++++++++++++++++--
.../toolbar/qml/ToolbarEditorButtonList.qml | 15 +-
modules/gui/qt/dialogs/toolbar/toolbareditor.cpp | 28 ++-
modules/gui/qt/player/playercontrolbarmodel.cpp | 87 ++++---
modules/gui/qt/player/playercontrolbarmodel.hpp | 2 +-
modules/gui/qt/player/qml/ControlBar.qml | 96 ++++++--
modules/gui/qt/player/qml/MiniPlayer.qml | 225 +++++++++++-------
7 files changed, 541 insertions(+), 164 deletions(-)
diff --git a/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditor.qml b/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditor.qml
index 709816d66a..846f84c748 100644
--- a/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditor.qml
+++ b/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditor.qml
@@ -59,20 +59,181 @@ Rectangle{
anchors.fill: parent
currentIndex: bar.currentIndex
- EditorDNDView {
- id : playerBtnDND
+ RowLayout {
Layout.preferredHeight: VLCStyle.heightBar_large
Layout.fillWidth: true
- model: playerControlBarModel
+
+ spacing: VLCStyle.margin_xlarge
+
+ TextMetrics {
+ id: leftMetric
+ text: i18n.qtr("L E F T")
+ font.pixelSize: VLCStyle.fontSize_xxlarge
+ }
+
+ TextMetrics {
+ id: centerMetric
+ text: i18n.qtr("C E N T E R")
+ font.pixelSize: VLCStyle.fontSize_xxlarge
+ }
+
+ TextMetrics {
+ id: rightMetric
+ text: i18n.qtr("R I G H T")
+ font.pixelSize: VLCStyle.fontSize_xxlarge
+ }
+
+ EditorDNDView {
+ id : playerBtnDND_left
+ Layout.preferredHeight: VLCStyle.heightBar_large
+
+ Layout.alignment: Qt.AlignLeft
+ Layout.fillWidth: count > 0 || (playerBtnDND_left.count === 0 && playerBtnDND_center.count === 0 && playerBtnDND_right.count === 0)
+ Layout.minimumWidth: leftMetric.width
+
+ model: playerControlBarModel_left
+
+ Text {
+ anchors.centerIn: parent
+
+ height: parent.height
+ width: parent.width / 2
+ text: leftMetric.text
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: VLCStyle.fontSize_xxlarge
+ color: VLCStyle.colors.menuCaption
+ horizontalAlignment: Text.AlignHCenter
+ visible: (parent.count === 0)
+ }
+ }
+
+ EditorDNDView {
+ id : playerBtnDND_center
+ Layout.preferredHeight: VLCStyle.heightBar_large
+
+ Layout.alignment: Qt.AlignHCenter
+ Layout.fillWidth: count > 0 || (playerBtnDND_left.count === 0 && playerBtnDND_center.count === 0 && playerBtnDND_right.count === 0)
+ Layout.minimumWidth: centerMetric.width
+
+ model: playerControlBarModel_center
+
+ Text {
+ anchors.centerIn: parent
+
+ height: parent.height
+ width: parent.width / 2
+ text: centerMetric.text
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: VLCStyle.fontSize_xxlarge
+ color: VLCStyle.colors.menuCaption
+ horizontalAlignment: Text.AlignHCenter
+ visible: (parent.count === 0)
+ }
+ }
+
+ EditorDNDView {
+ id : playerBtnDND_right
+ Layout.preferredHeight: VLCStyle.heightBar_large
+
+ Layout.alignment: Qt.AlignRight
+ Layout.fillWidth: count > 0 || (playerBtnDND_left.count === 0 && playerBtnDND_center.count === 0 && playerBtnDND_right.count === 0)
+ Layout.minimumWidth: rightMetric.width
+
+ model: playerControlBarModel_right
+
+ Text {
+ anchors.centerIn: parent
+
+ height: parent.height
+ width: parent.width / 2
+ text: rightMetric.text
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: VLCStyle.fontSize_xxlarge
+ color: VLCStyle.colors.menuCaption
+ horizontalAlignment: Text.AlignHCenter
+ visible: (parent.count === 0)
+ }
+ }
}
- EditorDNDView {
- id : miniPlayerBtnDND
+ RowLayout {
Layout.preferredHeight: VLCStyle.heightBar_large
Layout.fillWidth: true
- model: miniPlayerModel
- }
+ spacing: VLCStyle.margin_xlarge
+
+ EditorDNDView {
+ id : miniPlayerBtnDND_left
+ Layout.preferredHeight: VLCStyle.heightBar_large
+
+ Layout.alignment: Qt.AlignLeft
+ Layout.fillWidth: count > 0 || (miniPlayerBtnDND_left.count === 0 && miniPlayerBtnDND_center.count === 0 && miniPlayerBtnDND_right.count === 0)
+ Layout.minimumWidth: leftMetric.width
+
+ model: miniPlayerModel_left
+
+ Text {
+ anchors.centerIn: parent
+
+ height: parent.height
+ width: parent.width / 2
+ text: leftMetric.text
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: VLCStyle.fontSize_xxlarge
+ color: VLCStyle.colors.menuCaption
+ horizontalAlignment: Text.AlignHCenter
+ visible: (parent.count === 0)
+ }
+ }
+
+ EditorDNDView {
+ id : miniPlayerBtnDND_center
+ Layout.preferredHeight: VLCStyle.heightBar_large
+
+ Layout.alignment: Qt.AlignHCenter
+ Layout.fillWidth: count > 0 || (miniPlayerBtnDND_left.count === 0 && miniPlayerBtnDND_center.count === 0 && miniPlayerBtnDND_right.count === 0)
+ Layout.minimumWidth: centerMetric.width
+
+ model: miniPlayerModel_center
+
+ Text {
+ anchors.centerIn: parent
+
+ height: parent.height
+ width: parent.width / 2
+ text: centerMetric.text
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: VLCStyle.fontSize_xxlarge
+ color: VLCStyle.colors.menuCaption
+ horizontalAlignment: Text.AlignHCenter
+ visible: (parent.count === 0)
+ }
+ }
+
+ EditorDNDView {
+ id : miniPlayerBtnDND_right
+ Layout.preferredHeight: VLCStyle.heightBar_large
+
+ Layout.alignment: Qt.AlignRight
+ Layout.fillWidth: count > 0 || (miniPlayerBtnDND_left.count === 0 && miniPlayerBtnDND_center.count === 0 && miniPlayerBtnDND_right.count === 0)
+ Layout.minimumWidth: rightMetric.width
+
+ model: miniPlayerModel_right
+
+ Text {
+ anchors.centerIn: parent
+
+ height: parent.height
+ width: parent.width / 2
+ text: rightMetric.text
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: VLCStyle.fontSize_xxlarge
+ color: VLCStyle.colors.menuCaption
+ horizontalAlignment: Text.AlignHCenter
+ visible: (parent.count === 0)
+ }
+ }
+ }
}
}
@@ -100,40 +261,87 @@ Rectangle{
}
}
}
-
-
}
function getProfileConfig(){
- return playerControlBarModel.getConfig() + "|" + miniPlayerModel.getConfig()
+ return "%1#%2#%3 | %4#%5#%6".arg(playerControlBarModel_left.getConfig())
+ .arg(playerControlBarModel_center.getConfig())
+ .arg(playerControlBarModel_right.getConfig())
+ .arg(miniPlayerModel_left.getConfig())
+ .arg(miniPlayerModel_center.getConfig())
+ .arg(miniPlayerModel_right.getConfig())
}
Connections{
target: toolbareditor
onUpdatePlayerModel: {
- playerBtnDND.currentIndex = -1
- miniPlayerBtnDND.currentIndex = -1
- if (toolbarName == "MainPlayerToolbar")
- playerControlBarModel.reloadConfig(config)
- else
- miniPlayerModel.reloadConfig(config)
+ playerBtnDND_left.currentIndex = -1
+ playerBtnDND_center.currentIndex = -1
+ playerBtnDND_right.currentIndex = -1
+
+ miniPlayerBtnDND_left.currentIndex = -1
+ miniPlayerBtnDND_center.currentIndex = -1
+ miniPlayerBtnDND_right.currentIndex = -1
+
+ if (toolbarName == "MainPlayerToolbar-left")
+ playerControlBarModel_left.reloadConfig(config)
+ else if (toolbarName == "MainPlayerToolbar-center")
+ playerControlBarModel_center.reloadConfig(config)
+ else if (toolbarName == "MainPlayerToolbar-right")
+ playerControlBarModel_right.reloadConfig(config)
+ else if (toolbarName == "MiniPlayerToolbar-left")
+ miniPlayerModel_left.reloadConfig(config)
+ else if (toolbarName == "MiniPlayerToolbar-center")
+ miniPlayerModel_center.reloadConfig(config)
+ else if (toolbarName == "MiniPlayerToolbar-right")
+ miniPlayerModel_right.reloadConfig(config)
}
+
onSaveConfig: {
- miniPlayerModel.saveConfig()
- playerControlBarModel.saveConfig()
+ miniPlayerModel_left.saveConfig()
+ miniPlayerModel_center.saveConfig()
+ miniPlayerModel_right.saveConfig()
+
+ playerControlBarModel_left.saveConfig()
+ playerControlBarModel_center.saveConfig()
+ playerControlBarModel_right.saveConfig()
}
}
PlayerControlBarModel {
- id: playerControlBarModel
+ id: playerControlBarModel_left
+ mainCtx: mainctx
+ configName: "MainPlayerToolbar-left"
+ }
+
+ PlayerControlBarModel {
+ id: playerControlBarModel_center
+ mainCtx: mainctx
+ configName: "MainPlayerToolbar-center"
+ }
+
+ PlayerControlBarModel {
+ id: playerControlBarModel_right
+ mainCtx: mainctx
+ configName: "MainPlayerToolbar-right"
+ }
+
+ PlayerControlBarModel {
+ id: miniPlayerModel_left
+ mainCtx: mainctx
+ configName: "MiniPlayerToolbar-left"
+ }
+
+ PlayerControlBarModel {
+ id: miniPlayerModel_center
mainCtx: mainctx
- configName: "MainPlayerToolbar"
+ configName: "MiniPlayerToolbar-center"
}
PlayerControlBarModel {
- id: miniPlayerModel
+ id: miniPlayerModel_right
mainCtx: mainctx
- configName: "MiniPlayerToolbar"
+ configName: "MiniPlayerToolbar-right"
}
Player.ControlButtons{
diff --git a/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditorButtonList.qml b/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditorButtonList.qml
index f0091e3f7b..4eaf9f9b60 100644
--- a/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditorButtonList.qml
+++ b/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditorButtonList.qml
@@ -55,15 +55,24 @@ GridView{
held = true
var pos = this.mapToGlobal( mouseX, mouseY)
buttonDragItem.updatePos(pos.x, pos.y)
- playerBtnDND.addBtn = true
- miniPlayerBtnDND.addBtn = true
+ playerBtnDND_left.addBtn = true
+ playerBtnDND_center.addBtn = true
+ playerBtnDND_right.addBtn = true
+ miniPlayerBtnDND_left.addBtn = true
+ miniPlayerBtnDND_center.addBtn = true
+ miniPlayerBtnDND_right.addBtn = true
}
onReleased: {
drag.target.Drag.drop()
buttonDragItem.visible = false
held = false
- playerBtnDND.addBtn = false
+ playerBtnDND_left.addBtn = false
+ playerBtnDND_center.addBtn = false
+ playerBtnDND_right.addBtn = false
+ miniPlayerBtnDND_left.addBtn = false
+ miniPlayerBtnDND_center.addBtn = false
+ miniPlayerBtnDND_right.addBtn = false
}
onEntered: allButtonsView.currentIndex = index
diff --git a/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp b/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp
index 39195f989d..1e84e76f12 100644
--- a/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp
+++ b/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp
@@ -35,9 +35,9 @@
#define PROFILE_NAME_1 "Minimalist Style"
#define VALUE_1 "0;64;3;1;4;64;11;64;34;64;9;64;33 | 3;0;1;4"
#define PROFILE_NAME_2 "One-Liner Style"
-#define VALUE_2 "0;64;3;1;4;64;7;9;8;64;64;11;10;12;13;65;33 | 17;3;0;1;4;18"
+#define VALUE_2 "0;64;3;1;4;64;7;9;8;64;64;11;10;12;13;#33 | 17;3;0;1;4;18"
#define PROFILE_NAME_3 "Simplest Style"
-#define VALUE_3 "33;65;0;4;1;65;7 | 3;0;4"
+#define VALUE_3 "33;#0;4;1;#7 | 3;0;4"
ToolbarEditorDialog::ToolbarEditorDialog( QWidget *_w, intf_thread_t *_p_intf)
: QVLCDialog( _w, _p_intf )
@@ -176,8 +176,28 @@ void ToolbarEditorDialog::changeProfile( int i )
QStringList qs_list = profileCombo->itemData( i ).toString().split( "|" );
if( qs_list.count() < 2 )
return;
- emit updatePlayerModel("MainPlayerToolbar",qs_list[0]);
- emit updatePlayerModel("MiniPlayerToolbar",qs_list[1]);
+ QStringList align_list_main = qs_list[0].split("#");
+ QStringList align_list_mini = qs_list[1].split("#");
+
+ emit updatePlayerModel("MainPlayerToolbar-left", align_list_main[0]);
+ if(align_list_main.size() >= 2)
+ emit updatePlayerModel("MainPlayerToolbar-center", align_list_main[1]);
+ else
+ emit updatePlayerModel("MainPlayerToolbar-center", "");
+ if(align_list_main.size() >= 3)
+ emit updatePlayerModel("MainPlayerToolbar-right", align_list_main[2]);
+ else
+ emit updatePlayerModel("MainPlayerToolbar-right", "");
+
+ emit updatePlayerModel("MiniPlayerToolbar-left", align_list_mini[0]);
+ if(align_list_mini.size() >= 2)
+ emit updatePlayerModel("MiniPlayerToolbar-center", align_list_mini[1]);
+ else
+ emit updatePlayerModel("MiniPlayerToolbar-center", "");
+ if(align_list_mini.size() >= 3)
+ emit updatePlayerModel("MiniPlayerToolbar-right", align_list_mini[2]);
+ else
+ emit updatePlayerModel("MiniPlayerToolbar-right", "");
}
void ToolbarEditorDialog::deleteCursor()
diff --git a/modules/gui/qt/player/playercontrolbarmodel.cpp b/modules/gui/qt/player/playercontrolbarmodel.cpp
index d38060da49..877b77a8ba 100644
--- a/modules/gui/qt/player/playercontrolbarmodel.cpp
+++ b/modules/gui/qt/player/playercontrolbarmodel.cpp
@@ -20,31 +20,40 @@
#include "qt.hpp"
#include "playercontrolbarmodel.hpp"
-
-static const PlayerControlBarModel::IconToolButton MAIN_TB_DEFAULT[] = {
- {PlayerControlBarModel::LANG_BUTTON},
- {PlayerControlBarModel::MENU_BUTTON},
- {PlayerControlBarModel::WIDGET_SPACER_EXTEND},
- {PlayerControlBarModel::RANDOM_BUTTON},
- {PlayerControlBarModel::PREVIOUS_BUTTON},
- {PlayerControlBarModel::PLAY_BUTTON},
- {PlayerControlBarModel::NEXT_BUTTON},
- {PlayerControlBarModel::LOOP_BUTTON},
- {PlayerControlBarModel::WIDGET_SPACER_EXTEND},
- {PlayerControlBarModel::VOLUME},
- {PlayerControlBarModel::FULLSCREEN_BUTTON}
+enum default_align {
+ LEFT = 0,
+ CENTER,
+ RIGHT,
+ SIZE
+};
+
+static const QVector<PlayerControlBarModel::IconToolButton> MAIN_TB_DEFAULT[default_align::SIZE] = {
+ // left
+ {{PlayerControlBarModel::LANG_BUTTON},
+ {PlayerControlBarModel::MENU_BUTTON}},
+ // center
+ {{PlayerControlBarModel::RANDOM_BUTTON},
+ {PlayerControlBarModel::PREVIOUS_BUTTON},
+ {PlayerControlBarModel::PLAY_BUTTON},
+ {PlayerControlBarModel::NEXT_BUTTON},
+ {PlayerControlBarModel::LOOP_BUTTON}},
+ // right
+ {{PlayerControlBarModel::VOLUME},
+ {PlayerControlBarModel::FULLSCREEN_BUTTON}}
};
-static const PlayerControlBarModel::IconToolButton MINI_TB_DEFAULT[] = {
- {PlayerControlBarModel::WIDGET_SPACER_EXTEND},
- {PlayerControlBarModel::RANDOM_BUTTON},
+static const QVector<PlayerControlBarModel::IconToolButton> MINI_TB_DEFAULT[default_align::SIZE] = {
+ // left
+ {},
+ // center
+ {{PlayerControlBarModel::RANDOM_BUTTON},
{PlayerControlBarModel::PREVIOUS_BUTTON},
{PlayerControlBarModel::PLAY_BUTTON},
{PlayerControlBarModel::NEXT_BUTTON},
- {PlayerControlBarModel::LOOP_BUTTON},
- {PlayerControlBarModel::WIDGET_SPACER_EXTEND},
- {PlayerControlBarModel::VOLUME},
- {PlayerControlBarModel::PLAYER_SWITCH_BUTTON}
+ {PlayerControlBarModel::LOOP_BUTTON}},
+ // right
+ {{PlayerControlBarModel::VOLUME},
+ {PlayerControlBarModel::PLAYER_SWITCH_BUTTON}}
};
@@ -72,7 +81,8 @@ void PlayerControlBarModel::reloadConfig(QString config)
{
beginResetModel();
mButtons.clear();
- parseAndAdd(config);
+ if (!config.isEmpty())
+ parseAndAdd(config);
endResetModel();
}
@@ -85,19 +95,36 @@ void PlayerControlBarModel::reloadModel()
if (!config.isNull() && config.canConvert<QString>())
parseAndAdd(config.toString());
- else if (configName == "MainPlayerToolbar")
- parseDefault(MAIN_TB_DEFAULT, ARRAY_SIZE(MAIN_TB_DEFAULT));
else
- parseDefault(MINI_TB_DEFAULT, ARRAY_SIZE(MINI_TB_DEFAULT));
-
+ {
+ QString alignment = configName.split("-").at(1);
+ if (configName.startsWith("MainPlayerToolbar"))
+ {
+ if (alignment == "left")
+ parseDefault(MAIN_TB_DEFAULT[default_align::LEFT]);
+ else if (alignment == "center")
+ parseDefault(MAIN_TB_DEFAULT[default_align::CENTER]);
+ else if (alignment == "right")
+ parseDefault(MAIN_TB_DEFAULT[default_align::RIGHT]);
+ }
+ else
+ {
+ if (alignment == "left")
+ parseDefault(MINI_TB_DEFAULT[default_align::LEFT]);
+ else if (alignment == "center")
+ parseDefault(MINI_TB_DEFAULT[default_align::CENTER]);
+ else if (alignment == "right")
+ parseDefault(MINI_TB_DEFAULT[default_align::RIGHT]);
+ }
+ }
endResetModel();
}
-void PlayerControlBarModel::parseDefault(const PlayerControlBarModel::IconToolButton* config, const size_t config_size)
+void PlayerControlBarModel::parseDefault(const QVector<PlayerControlBarModel::IconToolButton>& config)
{
- beginInsertRows(QModelIndex(),rowCount(),rowCount() + config_size);
- for (size_t i = 0; i < config_size; i++)
- mButtons.append(config[i]);
+ beginInsertRows(QModelIndex(),rowCount(),rowCount() + config.size());
+ for (const auto& i : config)
+ mButtons.append(i);
endInsertRows();
}
@@ -107,7 +134,7 @@ void PlayerControlBarModel::parseAndAdd(const QString &config)
for (const QString& iconPropertyTxt : config.split( ";", QString::SkipEmptyParts ) )
{
- QStringList list2 = iconPropertyTxt.split( "-" );
+ QStringList list2 = iconPropertyTxt.trimmed().split( "-" );
if( list2.count() < 1 )
{
diff --git a/modules/gui/qt/player/playercontrolbarmodel.hpp b/modules/gui/qt/player/playercontrolbarmodel.hpp
index e497ca51e3..aac8856e2f 100644
--- a/modules/gui/qt/player/playercontrolbarmodel.hpp
+++ b/modules/gui/qt/player/playercontrolbarmodel.hpp
@@ -112,7 +112,7 @@ private:
QString configName;
void parseAndAdd(const QString& config);
- void parseDefault(const IconToolButton* config, const size_t config_size);
+ void parseDefault(const QVector<IconToolButton>& config);
bool setButtonAt(int index, const IconToolButton &button);
void addProfiles();
diff --git a/modules/gui/qt/player/qml/ControlBar.qml b/modules/gui/qt/player/qml/ControlBar.qml
index f085b7075d..ec12f97ce2 100644
--- a/modules/gui/qt/player/qml/ControlBar.qml
+++ b/modules/gui/qt/player/qml/ControlBar.qml
@@ -89,31 +89,79 @@ Widgets.NavigableFocusScope {
parentWindow: mainInterfaceRect
}
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.bottomMargin: VLCStyle.margin_xsmall
- PlayerButtonsLayout {
- id: buttons
+ PlayerButtonsLayout {
+ id: buttons_left
- model: playerControlBarModel
- forceColors: true
+ model: playerControlBarModel_left
+ forceColors: true
- Layout.fillHeight: true
- Layout.fillWidth: true
+ focus: true
- focus: true
+ navigationParent: root
+ navigationUp: function(index) {
+ if (trackPositionSlider.enabled)
+ trackPositionSlider.focus = true
+ else
+ root.navigationUp(index)
+ }
- navigationParent: root
- navigationUp: function(index) {
- if (trackPositionSlider.enabled)
- trackPositionSlider.focus = true
- else
- root.navigationUp(index)
+ Keys.priority: Keys.AfterItem
+ Keys.onPressed: defaultKeyAction(event, 0)
}
+ Item {
+ Layout.fillWidth: true
+ }
- Keys.priority: Keys.AfterItem
- Keys.onPressed: defaultKeyAction(event, 0)
- }
+ PlayerButtonsLayout {
+ id: buttons_center
+
+ model: playerControlBarModel_center
+ forceColors: true
+
+ focus: true
+
+ navigationParent: root
+ navigationUp: function(index) {
+ if (trackPositionSlider.enabled)
+ trackPositionSlider.focus = true
+ else
+ root.navigationUp(index)
+ }
+
+
+ Keys.priority: Keys.AfterItem
+ Keys.onPressed: defaultKeyAction(event, 0)
+ }
+
+ Item {
+ Layout.fillWidth: true
+ }
+
+ PlayerButtonsLayout {
+ id: buttons_right
+
+ model: playerControlBarModel_right
+ forceColors: true
+
+ focus: true
+ navigationParent: root
+ navigationUp: function(index) {
+ if (trackPositionSlider.enabled)
+ trackPositionSlider.focus = true
+ else
+ root.navigationUp(index)
+ }
+
+ Keys.priority: Keys.AfterItem
+ Keys.onPressed: defaultKeyAction(event, 0)
+ }
+ }
}
Connections{
target: mainInterface
@@ -121,9 +169,21 @@ Widgets.NavigableFocusScope {
}
PlayerControlBarModel{
- id:playerControlBarModel
+ id:playerControlBarModel_left
+ mainCtx: mainctx
+ configName: "MainPlayerToolbar-left"
+ }
+
+ PlayerControlBarModel{
+ id:playerControlBarModel_center
+ mainCtx: mainctx
+ configName: "MainPlayerToolbar-center"
+ }
+
+ PlayerControlBarModel{
+ id:playerControlBarModel_right
mainCtx: mainctx
- configName: "MainPlayerToolbar"
+ configName: "MainPlayerToolbar-right"
}
ControlButtons{
diff --git a/modules/gui/qt/player/qml/MiniPlayer.qml b/modules/gui/qt/player/qml/MiniPlayer.qml
index 368c98c0ef..4610938296 100644
--- a/modules/gui/qt/player/qml/MiniPlayer.qml
+++ b/modules/gui/qt/player/qml/MiniPlayer.qml
@@ -103,135 +103,188 @@ Widgets.NavigableFocusScope {
tint: VLCStyle.colors.blendColors(VLCStyle.colors.bg, VLCStyle.colors.banner, 0.85)
}
- RowLayout {
+ Widgets.FocusBackground {
+ id: playingItemInfo
+
anchors {
- fill: parent
+ top: parent.top
+ bottom: parent.bottom
+ left: parent.left
- leftMargin: VLCStyle.applicationHorizontalMargin
- rightMargin: VLCStyle.applicationHorizontalMargin
+ leftMargin: VLCStyle.applicationHorizontalMargin + VLCStyle.margin_normal
bottomMargin: VLCStyle.applicationVerticalMargin
}
+ width: playingItemInfoRow.width
+ focus: true
- spacing: VLCStyle.margin_normal
-
- Widgets.FocusBackground {
- id: playingItemInfo
- Layout.fillHeight: true
- Layout.preferredWidth: playingItemInfoRow.implicitWidth
- width: childrenRect.width
- focus: true
- Layout.leftMargin: VLCStyle.margin_normal
+ MouseArea {
+ anchors.fill: parent
+ onClicked: history.push(["player"])
+ }
- MouseArea {
- anchors.fill: parent
- onClicked: history.push(["player"])
+ Keys.onPressed: {
+ if (KeyHelper.matchOk(event) ) {
+ event.accepted = true
}
+ }
+ Keys.onReleased: {
+ if (!event.accepted && KeyHelper.matchOk(event))
+ history.push(["player"])
+ }
- Keys.onPressed: {
- if (KeyHelper.matchOk(event) ) {
- event.accepted = true
- }
- }
- Keys.onReleased: {
- if (!event.accepted && KeyHelper.matchOk(event))
- history.push(["player"])
- }
+ Row {
+ id: playingItemInfoRow
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
- Row {
- id: playingItemInfoRow
- anchors.top: parent.top
- anchors.bottom: parent.bottom
-
- Item {
- anchors.verticalCenter: parent.verticalCenter
- implicitHeight: childrenRect.height
- implicitWidth: childrenRect.width
-
- Rectangle {
- id: coverRect
- anchors.fill: cover
- color: VLCStyle.colors.bg
- }
-
- DropShadow {
- anchors.fill: coverRect
- source: coverRect
- radius: 8
- samples: 17
- color: VLCStyle.colors.glowColorBanner
- spread: 0.2
- }
-
- Image {
- id: cover
-
- source: (mainPlaylistController.currentItem.artwork && mainPlaylistController.currentItem.artwork.toString())
- ? mainPlaylistController.currentItem.artwork
- : VLCStyle.noArtAlbum
- fillMode: Image.PreserveAspectFit
-
- width: VLCStyle.dp(60, VLCStyle.scale)
- height: VLCStyle.dp(60, VLCStyle.scale)
- }
+ Item {
+ anchors.verticalCenter: parent.verticalCenter
+ implicitHeight: childrenRect.height
+ implicitWidth: childrenRect.width
+
+ Rectangle {
+ id: coverRect
+ anchors.fill: cover
+ color: VLCStyle.colors.bg
}
- Column {
- anchors.verticalCenter: parent.verticalCenter
- leftPadding: VLCStyle.margin_xsmall
+ DropShadow {
+ anchors.fill: coverRect
+ source: coverRect
+ radius: 8
+ samples: 17
+ color: VLCStyle.colors.glowColorBanner
+ spread: 0.2
+ }
- Widgets.MenuLabel {
- id: titleLabel
- text: mainPlaylistController.currentItem.title
- }
+ Image {
+ id: cover
- Widgets.MenuCaption {
- id: artistLabel
- text: mainPlaylistController.currentItem.artist
- }
+ source: (mainPlaylistController.currentItem.artwork && mainPlaylistController.currentItem.artwork.toString())
+ ? mainPlaylistController.currentItem.artwork
+ : VLCStyle.noArtAlbum
+ fillMode: Image.PreserveAspectFit
- Widgets.MenuCaption {
- id: progressIndicator
- text: player.time.toString() + " / " + player.length.toString()
- }
+ width: VLCStyle.dp(60, VLCStyle.scale)
+ height: VLCStyle.dp(60, VLCStyle.scale)
}
}
- KeyNavigation.right: buttonrow
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+ leftPadding: VLCStyle.margin_xsmall
+
+ Widgets.MenuLabel {
+ id: titleLabel
+ text: mainPlaylistController.currentItem.title
+ }
+
+ Widgets.MenuCaption {
+ id: artistLabel
+ text: mainPlaylistController.currentItem.artist
+ }
+
+ Widgets.MenuCaption {
+ id: progressIndicator
+ text: player.time.toString() + " / " + player.length.toString()
+ }
+ }
}
- Item {
- Layout.fillWidth: true
+ KeyNavigation.right: buttonrow_left
+ }
+
+
+ RowLayout {
+ anchors {
+ top: parent.top
+ bottom: parent.bottom
+ left: playingItemInfo.right
+ right: parent.right
+
+ leftMargin: VLCStyle.applicationHorizontalMargin
+ rightMargin: VLCStyle.applicationHorizontalMargin
+ bottomMargin: VLCStyle.applicationVerticalMargin
}
+ spacing: VLCStyle.margin_large
+
PlayerButtonsLayout {
- id: buttonrow
+ id: buttonrow_left
- model: miniPlayerModel
+ model: miniPlayerModel_left
defaultSize: VLCStyle.icon_normal
- Layout.alignment: Qt.AlignVCenter
- Layout.fillWidth: true
+ Layout.alignment: Qt.AlignLeft
Layout.preferredHeight: buttonrow.implicitHeight
Layout.leftMargin: VLCStyle.margin_normal
Layout.rightMargin: VLCStyle.margin_normal
navigationParent: root
navigationLeftItem: playingItemInfo
+ navigationRightItem: buttonrow_center
+ }
+
+ PlayerButtonsLayout {
+ id: buttonrow_center
+
+ model: miniPlayerModel_center
+ defaultSize: VLCStyle.icon_normal
+
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredHeight: buttonrow.implicitHeight
+ Layout.leftMargin: VLCStyle.margin_normal
+ Layout.rightMargin: VLCStyle.margin_normal
+
+ navigationParent: root
+ navigationLeftItem: buttonrow_left
+ navigationRightItem: buttonrow_center
+ }
+
+ PlayerButtonsLayout {
+ id: buttonrow_right
+
+ model: miniPlayerModel_right
+ defaultSize: VLCStyle.icon_normal
+
+ Layout.alignment: Qt.AlignRight
+ Layout.preferredHeight: buttonrow.implicitHeight
+ Layout.leftMargin: VLCStyle.margin_normal
+ Layout.rightMargin: VLCStyle.margin_normal
+
+ navigationParent: root
+ navigationLeftItem: buttonrow_center
}
}
+
Connections{
target: mainInterface
onToolBarConfUpdated: {
- miniPlayerModel.reloadModel()
+ miniPlayerModel_left.reloadModel()
+ miniPlayerModel_center.reloadModel()
+ miniPlayerModel_right.reloadModel()
}
}
PlayerControlBarModel {
- id: miniPlayerModel
+ id: miniPlayerModel_left
+ mainCtx: mainctx
+ configName: "MiniPlayerToolbar-left"
+ }
+
+ PlayerControlBarModel {
+ id: miniPlayerModel_center
+ mainCtx: mainctx
+ configName: "MiniPlayerToolbar-center"
+ }
+
+ PlayerControlBarModel {
+ id: miniPlayerModel_right
mainCtx: mainctx
- configName: "MiniPlayerToolbar"
+ configName: "MiniPlayerToolbar-right"
}
ControlButtons {
More information about the vlc-commits
mailing list