On Sun, Jan 18, 2015 at 7:01 PM, Andre "Osku" Schmidt
<[email protected]> wrote:
> On Sun, Jan 18, 2015 at 3:59 PM, Tobias Doerffel
> <[email protected]> wrote:
>> Hi,
>>
>> basically everything should be prepared. A few months ago I made
>> everything work with Qt. You can try by calling "cmake -DWANT_QT5=ON"
>> or running the build_mingw{32/64} scripts with the "-qt5" parameter.
>> However things might have changed in the meantime by new commits and a
>> few modifications are required again. Feel free to submit according
>> patches :-)
>
> i mean more like why is upstream not using qt5 by default?
> some show-stoppers or?

FWIW,

QML[0] could be a nice way to a create a runtime loaded scalable UI.

I (as a webmonkey) had quite the fun creating the attached vu-slider
prototype. You can run the qml file (at least) with the qml
runtime[1].

cheers
.andre

[0] http://doc.qt.io/qt-5/qtqml-index.html
[1] http://www.ics.com/blog/whole-shebang-running-qml-files-directly
import QtQuick 2.0
import QtGraphicalEffects 1.0

Rectangle {
    id: container
    color: "#444"
    width: 60
    height: 200
    anchors.fill: parent

    Rectangle {
        id: vuSlider

        property int borderRadius: 5
        property int thumbHeight: 40
        property int meterMargin: 2
        property int peakHeight: 2

        property real leftVolume: 1
        property real rightVolume: 1
        property real prevLeftPeak: 0
        property real prevRightPeak: 0
        property int  peakFallCount: 10

        property int leftPeakCounter: 0
        property int rightPeakCounter: 0

        color: "#333"
        border.color: "#222"
        border.width: 1
        anchors.fill: parent
        anchors.margins: 20
        radius: borderRadius
        antialiasing: true

        function setVolumes (leftVol, rightVol)
        {
            leftVolume  = leftVol
            rightVolume = rightVol
        }

        function setMeters (leftVal, rightVal)
        {
            meterLeftMaskReal.height  = meterSource.height * leftVal
            meterRightMaskReal.height = meterSource.height * rightVal
            var leftPeakPos = meterSource.height * (1 - leftVal)
            var rightPeakPos = meterSource.height * (1 - rightVal)
            if (leftVal > prevLeftPeak) {
                peakLeftMaskReal.y = leftPeakPos
                prevLeftPeak = leftVal
                leftPeakCounter = 0
            } else {
                leftPeakCounter++
                if (leftPeakCounter > peakFallCount) {
                    peakLeftMaskReal.y = leftPeakPos
                    prevLeftPeak = leftVal
                    leftPeakCounter = 0
                }
            }
            if (rightVal > prevRightPeak) {
                peakRightMaskReal.y = rightPeakPos
                prevRightPeak = rightVal
                rightPeakCounter = 0
            } else {
                rightPeakCounter++
                if (rightPeakCounter > peakFallCount) {
                    peakRightMaskReal.y = rightPeakPos
                    prevRightPeak = rightVal
                    rightPeakCounter = 0
                }
            }
        }

        Rectangle {
            id: meterSource
            visible: false
            anchors.fill: parent
            anchors.margins: vuSlider.meterMargin
            radius: parent.borderRadius - parent.meterMargin
            antialiasing: true
            gradient: Gradient {
                GradientStop { position: 0.0; color: "red" }
                GradientStop { position: 0.25; color: "yellow" }
                GradientStop { position: 1.0; color: "green" }
            }
        }

        Rectangle {
            id: meterLeftMask
            visible: false
            anchors.fill: meterSource
            color: "transparent"
            Rectangle {
                id: meterLeftMaskReal
                anchors.bottom: parent.bottom
                anchors.left: parent.left
                anchors.right: parent.horizontalCenter
           }
        }

        OpacityMask {
            source: meterSource
            maskSource: meterLeftMask
            anchors.fill: meterLeftMask
        }

        Rectangle {
            id: meterRightMask
            visible: false
            anchors.fill: meterSource
            color: "transparent"
            Rectangle {
                id: meterRightMaskReal
                anchors.bottom: parent.bottom
                anchors.left: parent.horizontalCenter
                anchors.right: parent.right
           }
        }

        OpacityMask {
            source: meterSource
            maskSource: meterRightMask
            anchors.fill: meterRightMask
        }

        Rectangle {
            id: peakLeftMask
            visible: false
            anchors.fill: meterSource
            color: "transparent"
            Rectangle {
                id: peakLeftMaskReal
                anchors.left: parent.left
                anchors.right: parent.horizontalCenter
                height: vuSlider.peakHeight
            }
        }

        OpacityMask {
            source: meterSource
            maskSource: peakLeftMask
            anchors.fill: peakLeftMask
        }

        Rectangle {
            id: peakRightMask
            visible: false
            anchors.fill: meterSource
            color: "transparent"
            Rectangle {
                id: peakRightMaskReal
                anchors.left: parent.horizontalCenter
                anchors.right: parent.right
                height: vuSlider.peakHeight
            }
        }

        OpacityMask {
            source: meterSource
            maskSource: peakRightMask
            anchors.fill: peakRightMask
        }

        Rectangle {
            id: meterDivider
            color: "#333"
            anchors.horizontalCenter: meterSource.horizontalCenter
            anchors.top: meterSource.top
            anchors.bottom: meterSource.bottom
            width: vuSlider.meterMargin
        }

        Rectangle {
            id: thumb
            color: Qt.rgba(1,1,1, 0.2)
            border.color: "#222"
            border.width: 1
            anchors.left: parent.left
            anchors.right: parent.right
            height: parent.thumbHeight
            radius: parent.borderRadius
            antialiasing: true

            MouseArea {
                anchors.fill: parent
                drag.target: thumb
                drag.axis: Drag.YAxis
                drag.minimumY: 0
                drag.maximumY: vuSlider.height - thumb.height
                onPositionChanged: {
                    var vol = (100 - (100 / drag.maximumY * thumb.y)) * 0.01
                    vuSlider.setVolumes(vol, vol)
                }
            }
        }
    }

    // just a temporary function to animate meters
    Timer {
        interval: 100
        running: true
        repeat: true
        onTriggered: {
            var leftRnd  = Math.random() * vuSlider.leftVolume
            var rightRnd = Math.random() * vuSlider.rightVolume
            vuSlider.setMeters(leftRnd, rightRnd)
        }
    }
}
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
LMMS-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lmms-devel

Reply via email to