diff --git a/src/qml/ExpandableItem.qml b/src/qml/ExpandableItem.qml index bfa2420..95bd0f1 100644 --- a/src/qml/ExpandableItem.qml +++ b/src/qml/ExpandableItem.qml @@ -23,6 +23,10 @@ Item { stateGroup.state = "closed" } + function open() { + stateGroup.state = "opened" + } + function getSideMargin() { if (applicationWindow.isScreenPortrait) { if (ScreenValues.isTablet) @@ -133,12 +137,6 @@ Item { anchors.fill: rectangleMinizedIndicator enabled: stateGroup.state === "closed" - onClicked: { - if (stateGroup.state === "closed") { - stateGroup.state = "opened" - } else { - stateGroup.state = "closed" - } - } + onClicked: open() } } diff --git a/src/qml/config/Theme.qml b/src/qml/config/Theme.qml index 4efc7e9..5534660 100644 --- a/src/qml/config/Theme.qml +++ b/src/qml/config/Theme.qml @@ -3,4 +3,39 @@ import QtQuick 2.0 Item { property color colorGridContainer: "#f5f5f5" + property color colorApplicationWindow: "#00000000" + + property bool portrait: false + property bool tablet: false + + property int columns: getColumns(portrait) + property int rows: getRows(portrait) + + function getColumns(portrait) { + if (portrait) { + if (tablet) { + return 5 + } else { + return 4 + } + } else { + if (tablet) { + return 6 + } else { + return 4 + } + } + } + + function getRows(portrait) { + if (portrait) { + return 6 + } else { + if (tablet) { + return 5 + } else { + return 4 + } + } + } } diff --git a/src/qml/debug/Debug.qml b/src/qml/debug/Debug.qml new file mode 100644 index 0000000..97e2783 --- /dev/null +++ b/src/qml/debug/Debug.qml @@ -0,0 +1,72 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.4 +import com.iktwo.qutelauncher 1.0 as QL + +/*! + \qmltype Debug + + \brief Element that displays debug data. +*/ + +Item { + id: root + + property string jsonStyle: "" + + property var debugData + + function _replacer(match, pIndent, pKey, pVal, pEnd) { + var key = '
' + var val = '' + var str = '' + var r = pIndent || '' + + if (pKey) + r = r + key + pKey.replace(/[": ]/g, '') + ': ' + + if (pVal) + r = r + (pVal[0] === '"' ? str : val) + pVal + '' + + return r + (pEnd || '') + } + + function prettyPrint(obj) { + var jsonLine = /^( *)("[\w]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/mg + + var jsonString = JSON.stringify(obj, null, 2) + + if (!jsonString) + return + + return jsonString + .replace(/&/g, '&').replace(/\\"/g, '"') + .replace(//g, '>') + .replace(jsonLine, root._replacer) + .replace("}", "
}") + } + + anchors.fill: parent + + Rectangle { + anchors.fill: parent + color: "#000000" + opacity: 0.2 + } + + Label { + anchors { + fill: parent + margins: Math.min(root.height, root.width) * 0.02 + } + + opacity: 0.8 + color: "#95a5a6" + textFormat: Text.RichText + wrapMode: Text.Wrap + font.pointSize: 22 + text: jsonStyle + prettyPrint(root.debugData) + } +} diff --git a/src/qml/debug/qmldir b/src/qml/debug/qmldir new file mode 100644 index 0000000..506472c --- /dev/null +++ b/src/qml/debug/qmldir @@ -0,0 +1 @@ +Debug 1.0 Debug.qml diff --git a/src/resources.qrc b/src/resources.qrc index 8b6d2b6..4911c06 100755 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -8,10 +8,11 @@ qml/config/qmldir qml/config/Theme.qml qml/config/Dimensions.qml + qml/debug/Debug.qml + qml/debug/qmldir resources/images/test.png - resources/images/background.jpg resources/images/shadow.png resources/images/shadow_navigationbar.png diff --git a/src/resources/images/background.jpg b/src/resources/images/background.jpg deleted file mode 100755 index 3574c24..0000000 Binary files a/src/resources/images/background.jpg and /dev/null differ diff --git a/src/resources/images/shadow.png b/src/resources/images/shadow.png index 0592a18..97a72c6 100644 Binary files a/src/resources/images/shadow.png and b/src/resources/images/shadow.png differ diff --git a/src/resources/images/shadow_navigationbar.png b/src/resources/images/shadow_navigationbar.png index 3acea88..808cb32 100644 Binary files a/src/resources/images/shadow_navigationbar.png and b/src/resources/images/shadow_navigationbar.png differ