Basic style ready for PR

- Temporarily removed remove/disable button as it's non-functional for now
This commit is contained in:
Ian Paschal 2018-01-22 13:00:22 +01:00
parent 81b2f0f7cd
commit 628314af9e
2 changed files with 36 additions and 35 deletions

View file

@ -229,9 +229,11 @@ class PluginBrowser(QObject, Extension):
self._plugins_model.addRoleName(Qt.UserRole + 2, "version") self._plugins_model.addRoleName(Qt.UserRole + 2, "version")
self._plugins_model.addRoleName(Qt.UserRole + 3, "short_description") self._plugins_model.addRoleName(Qt.UserRole + 3, "short_description")
self._plugins_model.addRoleName(Qt.UserRole + 4, "author") self._plugins_model.addRoleName(Qt.UserRole + 4, "author")
self._plugins_model.addRoleName(Qt.UserRole + 5, "already_installed") self._plugins_model.addRoleName(Qt.UserRole + 5, "author_email")
self._plugins_model.addRoleName(Qt.UserRole + 6, "file_location") self._plugins_model.addRoleName(Qt.UserRole + 6, "already_installed")
self._plugins_model.addRoleName(Qt.UserRole + 7, "can_upgrade") self._plugins_model.addRoleName(Qt.UserRole + 7, "file_location")
self._plugins_model.addRoleName(Qt.UserRole + 8, "enabled")
self._plugins_model.addRoleName(Qt.UserRole + 9, "can_upgrade")
else: else:
self._plugins_model.clear() self._plugins_model.clear()
items = [] items = []
@ -241,8 +243,10 @@ class PluginBrowser(QObject, Extension):
"version": metadata["version"], "version": metadata["version"],
"short_description": metadata["short_description"], "short_description": metadata["short_description"],
"author": metadata["author"], "author": metadata["author"],
"author_email": "author@gmail.com",
"already_installed": self._checkAlreadyInstalled(metadata["id"]), "already_installed": self._checkAlreadyInstalled(metadata["id"]),
"file_location": metadata["file_location"], "file_location": metadata["file_location"],
"enabled": True,
"can_upgrade": self._checkCanUpgrade(metadata["id"], metadata["version"]) "can_upgrade": self._checkCanUpgrade(metadata["id"], metadata["version"])
}) })
self._plugins_model.setItems(items) self._plugins_model.setItems(items)

View file

@ -2,35 +2,36 @@ import UM 1.1 as UM
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles
UM.Dialog { UM.Dialog {
id: base id: base
title: catalog.i18nc("@title:tab", "Plugins"); title: catalog.i18nc("@title:tab", "Plugins");
width: 800 * screenScaleFactor width: 800 * screenScaleFactor
height: 450 * screenScaleFactor height: 600 * screenScaleFactor
minimumWidth: 350 * screenScaleFactor minimumWidth: 350 * screenScaleFactor
minimumHeight: 350 * screenScaleFactor minimumHeight: 350 * screenScaleFactor
Item
{ Item {
anchors.fill: parent anchors.fill: parent
Item
{ Item {
id: topBar id: topBar
height: childrenRect.height; height: childrenRect.height;
width: parent.width width: parent.width
Label
{ Label {
id: introText id: introText
text: catalog.i18nc("@label", "Here you can find a list of Third Party plugins.") text: catalog.i18nc("@label", "Here you can find a list of Third Party plugins.")
width: parent.width width: parent.width
height: 30 height: 30
} }
Button Button {
{
id: refresh id: refresh
text: catalog.i18nc("@action:button", "Refresh") text: catalog.i18nc("@action:button", "Refresh")
onClicked: manager.requestPluginList() onClicked: manager.requestPluginList()
@ -38,40 +39,37 @@ UM.Dialog {
enabled: !manager.isDownloading enabled: !manager.isDownloading
} }
} }
ScrollView
{ // Scroll view breaks in QtQuick.Controls 2.x
ScrollView {
width: parent.width width: parent.width
anchors.top: topBar.bottom anchors.top: topBar.bottom
anchors.bottom: bottomBar.top anchors.bottom: bottomBar.top
anchors.bottomMargin: UM.Theme.getSize("default_margin").height anchors.bottomMargin: UM.Theme.getSize("default_margin").height
frameVisible: true frameVisible: true
ListView { ListView {
id: pluginList id: pluginList
model: manager.pluginsModel model: manager.pluginsModel
anchors.fill: parent anchors.fill: parent
property var activePlugin property var activePlugin
delegate: pluginDelegate delegate: pluginDelegate
} }
} }
Item
{ Item {
id: bottomBar id: bottomBar
width: parent.width width: parent.width
height: closeButton.height height: closeButton.height
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
Button {
Button
{
id: closeButton id: closeButton
text: catalog.i18nc("@action:button", "Close") text: catalog.i18nc("@action:button", "Close")
iconName: "dialog-close" iconName: "dialog-close"
onClicked: onClicked: {
{ if ( manager.isDownloading ) {
if (manager.isDownloading)
{
manager.cancelDownload() manager.cancelDownload()
} }
base.close(); base.close();
@ -87,7 +85,7 @@ UM.Dialog {
Rectangle { Rectangle {
width: pluginList.width; width: pluginList.width;
height: 96 height: 102
color: index % 2 ? UM.Theme.getColor("secondary") : "white" color: index % 2 ? UM.Theme.getColor("secondary") : "white"
// Plugin info // Plugin info
@ -108,10 +106,10 @@ UM.Dialog {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font { font {
pixelSize: 15 pixelSize: 13
bold: true bold: true
} }
color: model.enabled ? UM.Theme.getColor("text") : "grey" color: model.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("secondary")
} }
Label { Label {
@ -145,7 +143,7 @@ UM.Dialog {
} }
Label { Label {
text: "author@ultimaker.com" text: model.author_email
width: parent.width width: parent.width
height: 72 height: 72
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
@ -156,7 +154,7 @@ UM.Dialog {
// Plugin actions // Plugin actions
Row { Row {
id: pluginActions id: pluginActions
width: 180 + UM.Theme.getSize("default_margin").width width: 72 + UM.Theme.getSize("default_margin").width
height: parent.height height: parent.height
anchors { anchors {
top: parent.top top: parent.top
@ -167,6 +165,7 @@ UM.Dialog {
layoutDirection: Qt.RightToLeft layoutDirection: Qt.RightToLeft
spacing: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width
/*
Rectangle { Rectangle {
id: removeControls id: removeControls
visible: model.already_installed visible: model.already_installed
@ -279,13 +278,11 @@ UM.Dialog {
} }
} }
} }
*/
Button { Button {
id: updateButton id: updateButton
// visible: model.already_installed && model.can_upgrade visible: model.already_installed && model.can_upgrade
visible: model.already_installed // visible: model.already_installed
text: { text: {
// If currently downloading: // If currently downloading:
if ( manager.isDownloading && pluginList.activePlugin == model ) { if ( manager.isDownloading && pluginList.activePlugin == model ) {