Initial styling changes

- Dual-button layout
- Blue buttons in line with Cura styles
- Contact info
This commit is contained in:
Ian Paschal 2018-01-17 17:02:02 +01:00
parent 5c0e2d39a3
commit 013f020a4a

View file

@ -3,13 +3,14 @@ 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.1
import QtQuick.Controls.Styles 1.4
UM.Dialog UM.Dialog
{ {
id: base id: base
title: catalog.i18nc("@title:window", "Find & Update plugins") title: catalog.i18nc("@title:window", "Find & Update plugins")
width: 600 * screenScaleFactor width: 800 * screenScaleFactor
height: 450 * screenScaleFactor height: 450 * screenScaleFactor
minimumWidth: 350 * screenScaleFactor minimumWidth: 350 * screenScaleFactor
minimumHeight: 350 * screenScaleFactor minimumHeight: 350 * screenScaleFactor
@ -62,17 +63,7 @@ UM.Dialog
height: closeButton.height height: closeButton.height
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
ProgressBar
{
id: progressbar
anchors.bottom: parent.bottom
minimumValue: 0;
maximumValue: 100
anchors.left:parent.left
anchors.right: closeButton.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
value: manager.isDownloading ? manager.downloadProgress : 0
}
Button Button
{ {
@ -92,91 +83,255 @@ UM.Dialog
} }
} }
Item Item {
{ Component {
SystemPalette { id: palette }
Component
{
id: pluginDelegate id: pluginDelegate
Rectangle
{ Rectangle {
width: pluginList.width; width: pluginList.width;
height: texts.height; height: 96
color: index % 2 ? palette.base : palette.alternateBase color: index % 2 ? UM.Theme.getColor("secondary") : "white"
Column
{ // Plugin info
id: texts Column {
width: parent.width id: pluginInfo
height: childrenRect.height height: parent.height
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.right: downloadButton.left anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.right: authorInfo.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width
Label
{
text: "<b>" + model.name + "</b>" + ((model.author !== "") ? (" - " + model.author) : "")
width: contentWidth
height: contentHeight + UM.Theme.getSize("default_margin").height
verticalAlignment: Text.AlignVCenter
}
Label Label {
{ text: model.name
text: model.short_description
width: parent.width width: parent.width
height: contentHeight + UM.Theme.getSize("default_margin").height height: 24
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font {
pixelSize: 15
bold: true
}
}
Label {
text: model.short_description
width: parent.width
height: 72
wrapMode: Text.WordWrap
} }
} }
Button
{ // Author info
id: downloadButton Column {
text: id: authorInfo
{ width: 192
if (manager.isDownloading && pluginList.activePlugin == model) height: parent.height
{
return catalog.i18nc("@action:button", "Cancel");
} anchors.top: parent.top
else if (model.already_installed) anchors.topMargin: UM.Theme.getSize("default_margin").height
{
if (model.can_upgrade) anchors.right: pluginActions.left
{
return catalog.i18nc("@action:button", "Upgrade");
}
return catalog.i18nc("@action:button", "Installed");
}
return catalog.i18nc("@action:button", "Download");
}
onClicked:
{
if(!manager.isDownloading)
{
pluginList.activePlugin = model;
manager.downloadAndInstallPlugin(model.file_location);
}
else
{
manager.cancelDownload();
}
}
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter
enabled: Label {
{ text: model.author
if (manager.isDownloading) width: parent.width
{ height: 24
return (pluginList.activePlugin == model); wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignRight
}
Label {
text: "author@ultimaker.com"
width: parent.width
height: 72
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignRight
}
}
// Plugin actions
Row {
id: pluginActions
width: 180 + UM.Theme.getSize("default_margin").width
height: parent.height
anchors {
top: parent.top
right: parent.right
topMargin: UM.Theme.getSize("default_margin").height
rightMargin: UM.Theme.getSize("default_margin").width
}
layoutDirection: Qt.RightToLeft
spacing: UM.Theme.getSize("default_margin").width
Rectangle {
visible: model.already_installed
width: 108
height: 30
color: "transparent"
Button {
id: removeButton
text: "Remove"
enabled: {
if ( manager.isDownloading && pluginList.activePlugin == model ) {
return false;
} else {
return true;
}
}
style: ButtonStyle {
background: Rectangle {
color: white
implicitWidth: 108
implicitHeight: 30
radius: 4
border {
width: 1
color: "grey"
}
}
label: Text {
verticalAlignment: Text.AlignVCenter
color: "grey"
text: control.text
horizontalAlignment: Text.AlignLeft
}
}
} }
else Button {
{ id: removeDropDown
return (!model.already_installed || model.can_upgrade); UM.RecolorImage {
anchors.centerIn: parent
height: 10
width: 10
source: UM.Theme.getIcon("arrow_bottom")
color: "grey"
}
enabled: {
if ( model.required || ( manager.isDownloading && pluginList.activePlugin == model )) {
return false;
} else {
return true;
}
}
anchors.right: parent.right
style: ButtonStyle {
background: Rectangle {
color: "transparent"
implicitWidth: 30
implicitHeight: 30
radius: 4
}
label: Text {
verticalAlignment: Text.AlignVCenter
color: "grey"
text: control.text
horizontalAlignment: Text.AlignHCenter
}
}
// For the disable option:
onClicked: pluginList.model.setEnabled(model.id, checked)
}
Rectangle {
id: divider
width: 1
height: parent.height
anchors.right: removeDropDown.left
color: "grey"
} }
} }
Button {
id: updateButton
// visible: model.already_installed && model.can_upgrade
visible: model.already_installed
text: {
// If currently downloading:
if ( manager.isDownloading && pluginList.activePlugin == model ) {
return catalog.i18nc( "@action:button", "Cancel" );
} else {
return catalog.i18nc("@action:button", "Update");
}
}
style: ButtonStyle {
background: Rectangle {
color: UM.Theme.getColor("primary")
implicitWidth: 72
implicitHeight: 30
radius: 4
}
label: Text {
verticalAlignment: Text.AlignVCenter
color: "white"
text: control.text
horizontalAlignment: Text.AlignHCenter
}
}
}
Button {
id: installButton
visible: !model.already_installed
text: {
// If currently downloading:
if ( manager.isDownloading && pluginList.activePlugin == model ) {
return catalog.i18nc( "@action:button", "Cancel" );
} else {
return catalog.i18nc("@action:button", "Install");
}
}
onClicked: {
if ( manager.isDownloading && pluginList.activePlugin == model ) {
manager.cancelDownload();
} else {
pluginList.activePlugin = model;
manager.downloadAndInstallPlugin( model.file_location );
}
}
style: ButtonStyle {
background: Rectangle {
color: UM.Theme.getColor("primary")
implicitWidth: 72
implicitHeight: 30
radius: 4
}
label: Text {
verticalAlignment: Text.AlignVCenter
color: "white"
text: control.text
horizontalAlignment: Text.AlignHCenter
}
}
}
ProgressBar {
id: progressbar
minimumValue: 0;
maximumValue: 100
anchors.left: installButton.left
anchors.right: installButton.right
anchors.top: installButton.bottom
anchors.topMargin: 4
value: manager.isDownloading ? manager.downloadProgress : 0
visible: manager.isDownloading && pluginList.activePlugin == model
style: ProgressBarStyle {
background: Rectangle {
color: "lightgray"
implicitHeight: 6
}
progress: Rectangle {
color: UM.Theme.getColor("primary")
}
}
}
} }
} }
} }
} }
UM.I18nCatalog { id: catalog; name: "cura" } UM.I18nCatalog { id: catalog; name: "cura" }