Skip to content

Commit

Permalink
Remove unused resources, add Debug element
Browse files Browse the repository at this point in the history
  • Loading branch information
Iktwo committed Aug 29, 2016
1 parent 811bdaa commit 4dc8d0c
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/qml/ExpandableItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Item {
stateGroup.state = "closed"
}

function open() {
stateGroup.state = "opened"
}

function getSideMargin() {
if (applicationWindow.isScreenPortrait) {
if (ScreenValues.isTablet)
Expand Down Expand Up @@ -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()
}
}
35 changes: 35 additions & 0 deletions src/qml/config/Theme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
72 changes: 72 additions & 0 deletions src/qml/debug/Debug.qml
Original file line number Diff line number Diff line change
@@ -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: "<style>
.json-key { color: #3498db; }
.json-value { color: #2ecc71; }
.json-string { color: #e67e22; }</style>"

property var debugData

function _replacer(match, pIndent, pKey, pVal, pEnd) {
var key = '<span class=json-key><br>'
var val = '<span class=json-value>'
var str = '<span class=json-string>'
var r = pIndent || ''

if (pKey)
r = r + key + pKey.replace(/[": ]/g, '') + '</span>: '

if (pVal)
r = r + (pVal[0] === '"' ? str : val) + pVal + '</span>'

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, '&amp;').replace(/\\"/g, '&quot;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(jsonLine, root._replacer)
.replace("}", "<br>}")
}

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)
}
}
1 change: 1 addition & 0 deletions src/qml/debug/qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Debug 1.0 Debug.qml
3 changes: 2 additions & 1 deletion src/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
<file>qml/config/qmldir</file>
<file>qml/config/Theme.qml</file>
<file>qml/config/Dimensions.qml</file>
<file>qml/debug/Debug.qml</file>
<file>qml/debug/qmldir</file>
</qresource>
<qresource prefix="/images">
<file alias="test">resources/images/test.png</file>
<file alias="background">resources/images/background.jpg</file>
<file alias="shadow">resources/images/shadow.png</file>
<file alias="shadow_navigationbar">resources/images/shadow_navigationbar.png</file>
</qresource>
Expand Down
Binary file removed src/resources/images/background.jpg
Binary file not shown.
Binary file modified src/resources/images/shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/resources/images/shadow_navigationbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4dc8d0c

Please sign in to comment.