Refactor Media Control Keys QML into smaller bits

The old QML was a giant mess of implementation details and logic.
Reducing the buttons to only 2 essential properties allows the
MediaControllerKeys object to be more easily understood.

Moving the MediaControllerKeys into its own QML file allows the
resulting page to be more easily understood and individual pieces
swapped in and out.

The current QML directory structure is non-existent, breaking parts down
into cohesive folders will allow for easier understanding of the bigger
picture.
This commit is contained in:
Vasily
2019-01-13 16:47:38 +01:00
parent e75a4c2353
commit f5000a0ee0
5 changed files with 137 additions and 148 deletions
+38
View File
@@ -0,0 +1,38 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import matzman666.advsettings 1.0
// Necessary for the project specific Components.
import ".."
MyPushButton2 {
// Public properties
id: mediaButton
onClicked: {
// Overload this
}
property string imagePath: ""
// Private properties
Layout.preferredHeight: 48
Layout.preferredWidth: 48
contentItem: Image {
source: parent.imagePath
sourceSize: Qt.size( imgSP.sourceSize.width*2, imgSP.sourceSize.height*2 )
Image{
id: imgSP
source: parent.source
width:0
height:0
}
anchors.fill: parent
}
background: Rectangle {
// Provides feedback for mousing over and clicking buttons.
opacity: parent.down ? 1.0 : (parent.activeFocus ? 0.5 : 0.0)
color: "#406288"
radius: 4
anchors.fill: parent
}
}