diff --git a/src/qml/main.qml b/src/qml/main.qml --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -14,15 +14,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import QtQuick 2.1 -import QtQuick.Layouts 1.1 +import QtQuick 2.4 +import QtQuick.Layouts 1.4 +import QtQuick.Controls 2.4 +import org.kde.kirigami 2.4 as Kirigami +import QtGraphicalEffects 1.4 Rectangle { id: root - SystemPalette { id: palette; colorGroup: SystemPalette.Active } - color: palette.base - width: 360 - height:320 + color: Kirigami.Theme.backgroundColor + height: childrenRect.height property string themeName: "" property string previewPath: "" @@ -34,75 +35,104 @@ property string copyright: "" property string version: "" + //Fills the QuickWidget area root wouldn't normally cover + Rectangle { + id: heightHack + color: Kirigami.Theme.backgroundColor + anchors.fill: root + } + Image { id: previewImage - width: root.paintedWidth - height: 210 source: previewPath anchors { - top: parent.top - topMargin: 25 - horizontalCenter: parent.horizontalCenter + top: root.top + left: root.left + right: root.right + margins: units.largeSpacing } - fillMode: Image.PreserveAspectFit } - - Rectangle { // rounded corners for img - id: border - width: previewImage.paintedWidth + 2 - height: previewImage.paintedHeight + 2 - color: "transparent" - border.color: "#bb000000" // color of background - border.width: 2 - radius: 2 - anchors.centerIn: previewImage - } - - GridLayout { - id: texttable - width: previewImage.paintedWidth - anchors { - top: previewImage.bottom - left: previewImage.left - right: previewImage.right - } - columns: 2 - - Text { - color: palette.text - text: description - font.bold: true - font.pointSize: 13 - } - Text { - color: palette.text - text: version - font.bold: true - font.pointSize: 10 - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } - Text { - color: palette.text - text: authorName - font.pointSize: 10 - } - Text { - color: palette.text - text: license - font.pointSize: 7 - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } - Text { - color: palette.text - text: website - font.pointSize: 7 - } - Text { - color: palette.text - text: email - font.pointSize: 7 - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } + + DropShadow { + source: previewImage + anchors.fill: previewImage + verticalOffset: 2 + radius: 7 + samples: 15 + color: "black" + } + + ColumnLayout { + id: column + width: previewImage.paintedWidth + anchors { + top: previewImage.bottom + left: previewImage.left + right: previewImage.right + topMargin: units.smallSpacing + } + + Kirigami.Heading { + text: themeName + font.bold: true + font.weight: Font.Bold + Layout.maximumWidth: column.width + elide: Text.ElideRight + maximumLineCount: 2 + wrapMode: Text.Wrap + } + + Label { + text: description + font.italic: true + Layout.maximumWidth: column.width + elide: Text.ElideRight + maximumLineCount: 2 + wrapMode: Text.Wrap + } + + Label { + text: authorName + Layout.maximumWidth: column.width + elide: Text.ElideRight + maximumLineCount: 2 + wrapMode: Text.Wrap + } + + Label { + text: license + font.pointSize: theme.smallestFont.pointSize + Layout.maximumWidth: column.width + elide: Text.ElideRight + maximumLineCount: 2 + wrapMode: Text.Wrap } + + Label { + id: url + text:(""+website+"") + onLinkActivated: Qt.openUrlExternally(link) + font.pointSize: theme.smallestFont.pointSize + Layout.maximumWidth: column.width + elide: Text.ElideRight + maximumLineCount: 2 + wrapMode: Text.Wrap + + MouseArea { + anchors.fill: url + acceptedButtons: Qt.NoButton + cursorShape: Qt.PointingHandCursor + } + } + + Label { + text: email + font.pointSize: theme.smallestFont.pointSize + Layout.maximumWidth: column.width + elide: Text.ElideRight + maximumLineCount: 2 + wrapMode: Text.Wrap + } + } }