CURA-5035 Clean-up

This commit is contained in:
Ian Paschal 2018-04-19 16:07:31 +02:00
parent 8f8d709b64
commit 921e8f7602
17 changed files with 181 additions and 350 deletions

View file

@ -4,17 +4,12 @@
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles
import UM 1.1 as UM
Window
{
id: base
title: catalog.i18nc("@title:tab", "Toolbox")
title: catalog.i18nc("@title", "Toolbox")
modality: Qt.ApplicationModal
width: 720 * screenScaleFactor
height: 640 * screenScaleFactor
@ -22,6 +17,11 @@ Window
maximumWidth: 720 * screenScaleFactor
minimumHeight: 350 * screenScaleFactor
color: UM.Theme.getColor("sidebar")
UM.I18nCatalog
{
id: catalog
name:"cura"
}
Item
{
anchors.fill: parent
@ -29,11 +29,11 @@ Window
{
id: header
}
Rectangle
Item
{
id: mainView
width: parent.width
color: "transparent"
z: -1
anchors
{
top: header.bottom
@ -66,25 +66,13 @@ Window
visible: toolbox.viewCategory == "installed"
}
}
ToolboxShadow
{
anchors.top: header.bottom
}
ToolboxFooter
{
id: footer
visible: toolbox.restartRequired
height: toolbox.restartRequired ? UM.Theme.getSize("base_unit").height * 5 : 0
}
ToolboxShadow
{
visible: toolbox.restartRequired
anchors.bottom: footer.top
reversed: true
}
UM.I18nCatalog { id: catalog; name: "cura" }
// TODO: Clean this up:
Connections
{
target: toolbox
@ -96,23 +84,9 @@ Window
licenseDialog.show();
}
}
Connections
{
target: toolbox
onShowRestartDialog:
{
restartDialog.message = toolbox.getRestartDialogMessage();
restartDialog.show();
}
}
ToolboxLicenseDialog
{
id: licenseDialog
}
ToolboxRestartDialog
{
id: restartDialog
}
}
}

View file

@ -2,7 +2,6 @@
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM
@ -127,7 +126,8 @@ Item
anchors.bottom: parent.bottom
}
}
ToolboxDetailList {
ToolboxDetailList
{
anchors
{
top: header.bottom

View file

@ -2,7 +2,6 @@
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM
@ -23,17 +22,23 @@ Item
Button
{
id: button
text: "Back"
text: catalog.i18nc("@action:button", "Back")
UM.RecolorImage
{
id: backArrow
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors
{
verticalCenter: parent.verticalCenter
left: parent.left
rightMargin: UM.Theme.getSize("default_margin").width
}
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width
sourceSize.height: height
sourceSize
{
width: width
height: height
}
color: button.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text")
source: UM.Theme.getIcon("arrow_left")
}

View file

@ -2,7 +2,6 @@
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM

View file

@ -141,7 +141,8 @@ Item
anchors.bottom: parent.bottom
}
}
ToolboxDetailList {
ToolboxDetailList
{
anchors
{
top: header.bottom

View file

@ -2,17 +2,15 @@
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM
Rectangle
Item
{
property bool installed: toolbox.isInstalled(model.id)
width: base.width - UM.Theme.getSize("double_margin").width
height: UM.Theme.getSize("base_unit").height * 8
color: "transparent"
Column
{
anchors
@ -60,9 +58,11 @@ Rectangle
anchors.right: parent.right
anchors.top: parent.top
width: childrenRect.width
Button {
Button
{
id: installButton
text: {
text:
{
if (installed)
{
return catalog.i18nc("@action:button", "Installed")
@ -95,7 +95,8 @@ Rectangle
}
}
opacity: enabled ? 1.0 : 0.5
style: ButtonStyle {
style: ButtonStyle
{
background: Rectangle
{
implicitWidth: 96

View file

@ -2,8 +2,6 @@
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
@ -19,7 +17,7 @@ Column
Label
{
id: heading
text: toolbox.viewCategory == "material" ? "Maker Choices" : "Community Plugins"
text: toolbox.viewCategory == "material" ? catalog.i18nc("@label", "Maker Choices") : catalog.i18nc("@label", "Community Plugins")
width: parent.width
color: UM.Theme.getColor("text_medium")
font: UM.Theme.getFont("medium")

View file

@ -2,8 +2,6 @@
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
@ -34,7 +32,8 @@ Item
color: "white"
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
Image {
Image
{
anchors.centerIn: parent
width: UM.Theme.getSize("toolbox_thumbnail_small").width - 26
height: UM.Theme.getSize("toolbox_thumbnail_small").height - 26
@ -89,19 +88,24 @@ Item
}
onClicked:
{
if ( toolbox.viewCategory == "material" )
switch(toolbox.viewCategory)
{
case "material":
console.log("OKAY FILTER BY AUTHOR", model.name)
toolbox.viewSelection = model.name
toolbox.viewPage = "author"
toolbox.filterModelByProp("packages", "author_name", model.name)
toolbox.filterModelByProp("authors", "name", model.name)
}
else
{
console.log(toolbox)
var name = model.name
toolbox.filterModelByProp("authors", "name", name)
toolbox.filterModelByProp("packages", "author_name", name)
console.log(toolbox)
break
default:
toolbox.viewSelection = model.id
toolbox.viewPage = "detail"
toolbox.filterModelByProp("packages", "id", model.id)
toolbox.filterModelByProp("authors", "name", model.author_name)
toolbox.filterModelByProp("packages", "id", model.id)
break
}
}
}

View file

@ -18,7 +18,7 @@ Column
Label
{
id: heading
text: "Featured"
text: catalog.i18nc("@label", "Featured")
width: parent.width
color: UM.Theme.getColor("text_medium")
font: UM.Theme.getFont("medium")

View file

@ -2,8 +2,6 @@
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM
@ -28,8 +26,11 @@ Item
color: "white"
width: UM.Theme.getSize("toolbox_thumbnail_medium").width
height: UM.Theme.getSize("toolbox_thumbnail_medium").height
border.width: 1
border.color: UM.Theme.getColor("lining")
border
{
width: UM.Theme.getSize("default_lining").width
color: UM.Theme.getColor("lining")
}
anchors
{
top: parent.top
@ -37,8 +38,8 @@ Item
}
Image {
anchors.centerIn: parent
width: UM.Theme.getSize("toolbox_thumbnail_medium").width - 26
height: UM.Theme.getSize("toolbox_thumbnail_medium").height - 26
width: UM.Theme.getSize("toolbox_thumbnail_medium").width - 2 * UM.Theme.getSize("default_margin")
height: UM.Theme.getSize("toolbox_thumbnail_medium").height - 2 * UM.Theme.getSize("default_margin")
fillMode: Image.PreserveAspectFit
source: model.icon_url || "../images/logobot.svg"
}
@ -61,7 +62,8 @@ Item
MouseArea
{
anchors.fill: parent
onClicked: {
onClicked:
{
switch(toolbox.viewCategory)
{
case "material":

View file

@ -2,30 +2,29 @@
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles
import UM 1.1 as UM
Item
{
id: footer
width: parent.width
anchors.bottom: parent.bottom
height: visible ? Math.floor(UM.Theme.getSize("base_unit").height * 5.5) : 0
Label
{
visible: toolbox.restartRequired
text: "You will need to restart Cura before changes in plugins have effect."
height: UM.Theme.getSize("base_unit").height * 2
height: Math.floor(UM.Theme.getSize("base_unit").height * 2.5)
verticalAlignment: Text.AlignVCenter
anchors
{
top: closeButton.top
top: restartButton.top
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
leftMargin: UM.Theme.getSize("double_margin").width
right: restartButton.right
rightMargin: UM.Theme.getSize("default_margin").width
}
}
Button
@ -34,9 +33,10 @@ Item
text: "Quit Cura"
anchors
{
top: closeButton.top
right: closeButton.left
rightMargin: UM.Theme.getSize("default_margin").width
top: parent.top
topMargin: UM.Theme.getSize("default_margin").height
right: parent.right
rightMargin: UM.Theme.getSize("double_margin").width
}
visible: toolbox.restartRequired
iconName: "dialog-restart"
@ -45,65 +45,24 @@ Item
{
background: Rectangle
{
implicitWidth: 96
implicitHeight: UM.Theme.getSize("base_unit").height * 2
implicitWidth: UM.Theme.getSize("base_unit").width * 8
implicitHeight: Math.floor(UM.Theme.getSize("base_unit").height * 2.5)
color: control.hovered ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary")
}
label: Text
{
verticalAlignment: Text.AlignVCenter
color: UM.Theme.getColor("button_text")
font
{
pixelSize: 13
bold: true
}
font: UM.Theme.getFont("default_bold")
text: control.text
horizontalAlignment: Text.AlignHCenter
}
}
}
Button
{
id: closeButton
text: catalog.i18nc("@action:button", "Close")
iconName: "dialog-close"
onClicked:
{
if ( toolbox.isDownloading )
{
toolbox.cancelDownload()
}
base.close();
}
anchors
{
top: parent.top
topMargin: UM.Theme.getSize("default_margin").height
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
}
style: ButtonStyle
{
background: Rectangle
{
color: "transparent"
implicitWidth: 96
implicitHeight: UM.Theme.getSize("base_unit").height * 2
border
{
width: 1
color: UM.Theme.getColor("lining")
}
}
label: Text
{
verticalAlignment: Text.AlignVCenter
color: UM.Theme.getColor("text")
text: control.text
horizontalAlignment: Text.AlignHCenter
}
}
}
ToolboxShadow
{
visible: toolbox.restartRequired
anchors.bottom: footer.top
reversed: true
}
}

View file

@ -2,54 +2,29 @@
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM
Rectangle {
Item
{
id: header
width: parent.width
color: "transparent"
height: childrenRect.height
height: UM.Theme.getSize("base_unit").height * 4
Row
{
id: bar
spacing: 12
height: childrenRect.height
width: childrenRect.width
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
Button
anchors
{
text: "Plugins"
style: ButtonStyle
{
background: Rectangle
{
color: "transparent"
implicitWidth: 96
implicitHeight: 48
Rectangle
{
visible: toolbox.viewCategory == "plugin"
color: UM.Theme.getColor("primary")
anchors.bottom: parent.bottom
width: parent.width
height: 3
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
}
}
label: Text
ToolboxTabButton
{
text: control.text
color: UM.Theme.getColor("text")
font.pixelSize: 15
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
text: catalog.i18nc("@title:tab", "Plugins")
active: toolbox.viewCategory == "plugin"
onClicked:
{
toolbox.filterModelByProp("packages", "type", "plugin")
@ -58,35 +33,10 @@ Rectangle {
toolbox.viewPage = "overview"
}
}
Button
ToolboxTabButton
{
text: "Materials"
style: ButtonStyle
{
background: Rectangle
{
color: "transparent"
implicitWidth: 96
implicitHeight: 48
Rectangle
{
visible: toolbox.viewCategory == "material"
color: UM.Theme.getColor("primary")
anchors.bottom: parent.bottom
width: parent.width
height: 3
}
}
label: Text
{
text: control.text
color: UM.Theme.getColor("text")
font.pixelSize: 15
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
text: catalog.i18nc("@title:tab", "Materials")
active: toolbox.viewCategory == "material"
onClicked:
{
toolbox.filterModelByProp("packages", "type", "material")
@ -96,36 +46,19 @@ Rectangle {
}
}
}
Button
ToolboxTabButton
{
text: "Installed"
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
style: ButtonStyle
text: catalog.i18nc("@title:tab", "Installed")
active: toolbox.viewCategory == "installed"
anchors
{
background: Rectangle
{
color: "transparent"
implicitWidth: 96
implicitHeight: 48
Rectangle {
visible: toolbox.viewCategory == "installed"
color: UM.Theme.getColor("primary")
anchors.bottom: parent.bottom
width: parent.width
height: 3
}
}
label: Text
{
text: control.text
color: UM.Theme.getColor("text")
font.pixelSize: 15
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
}
onClicked: toolbox.viewCategory = "installed"
}
ToolboxShadow
{
anchors.top: bar.bottom
}
}

View file

@ -31,7 +31,7 @@ ScrollView
Label
{
width: parent.width
text: "Plugins"
text: catalog.i18nc("@title:tab", "Plugins")
color: UM.Theme.getColor("text_medium")
font: UM.Theme.getFont("medium")
}
@ -66,7 +66,7 @@ ScrollView
Label
{
width: base.width
text: "Materials"
text: catalog.i18nc("@title:tab", "Materials")
color: UM.Theme.getColor("text_medium")
font: UM.Theme.getFont("medium")
}

View file

@ -2,8 +2,6 @@
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM
@ -43,20 +41,17 @@ Item
{
text: model.name
width: parent.width
height: 24
height: UM.Theme.getSize("base_unit").height * 2
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
font {
pixelSize: 13
bold: true
}
font: UM.Theme.getFont("default_bold")
color: pluginInfo.color
}
Text
{
text: model.description
width: parent.width
height: 36
height: UM.Theme.getSize("base_unit").height * 3
clip: true
wrapMode: Text.WordWrap
color: pluginInfo.color
@ -66,7 +61,7 @@ Item
Column
{
id: authorInfo
width: 192
width: UM.Theme.getSize("base_unit").width * 16
height: parent.height
anchors
{
@ -89,7 +84,7 @@ Item
}
}
width: parent.width
height: 24
height: UM.Theme.getSize("base_unit").height * 3
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
@ -97,8 +92,6 @@ Item
color: model.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("lining")
}
}
// Plugin actions
Column
{
id: pluginActions
@ -111,7 +104,6 @@ Item
right: parent.right
topMargin: UM.Theme.getSize("default_margin").height
}
Button {
id: removeButton
text:
@ -131,7 +123,7 @@ Item
background: Rectangle
{
implicitWidth: UM.Theme.getSize("base_unit").width * 8
implicitHeight: UM.Theme.getSize("base_unit").width * 2.5
implicitHeight: Math.floor(UM.Theme.getSize("base_unit").width * 2.5)
color: "transparent"
border
{
@ -139,7 +131,8 @@ Item
color: UM.Theme.getColor("lining")
}
}
label: Text {
label: Text
{
text: control.text
color: UM.Theme.getColor("text")
verticalAlignment: Text.AlignVCenter
@ -165,8 +158,8 @@ Item
}
}
}
Button {
Button
{
id: updateButton
text: catalog.i18nc("@action:button", "Update")
visible: canUpdate
@ -195,10 +188,13 @@ Item
ProgressBar
{
id: progressbar
anchors.left: updateButton.left
anchors.right: updateButton.right
anchors.top: updateButton.bottom
anchors.topMargin: 4
anchors
{
left: updateButton.left
right: updateButton.right
top: updateButton.bottom
topMargin: Math.floor(UM.Theme.getSize("base_unit") / 4)
}
value: toolbox.isDownloading ? toolbox.downloadProgress : 0
visible: toolbox.isDownloading
style: ProgressBarStyle

View file

@ -11,22 +11,19 @@ import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM
UM.Dialog {
UM.Dialog
{
title: catalog.i18nc("@title:window", "Plugin License Agreement")
minimumWidth: UM.Theme.getSize("license_window_minimum").width
minimumHeight: UM.Theme.getSize("license_window_minimum").height
width: minimumWidth
height: minimumHeight
property var pluginName;
property var licenseContent;
property var pluginFileLocation;
Item
{
anchors.fill: parent
Label
{
id: licenseTitle
@ -36,7 +33,6 @@ UM.Dialog {
text: licenseDialog.pluginName + catalog.i18nc("@label", "This plugin contains a license.\nYou need to accept this license to install this plugin.\nDo you agree with the terms below?")
wrapMode: Text.Wrap
}
TextArea
{
id: licenseText
@ -49,8 +45,8 @@ UM.Dialog {
text: licenseDialog.licenseContent != null ? licenseDialog.licenseContent : ""
}
}
rightButtons: [
rightButtons:
[
Button
{
id: acceptButton

View file

@ -1,88 +0,0 @@
// Copyright (c) 2018 Ultimaker B.V.
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM
Window {
// title: catalog.i18nc("@title:tab", "Plugins");
width: 360 * screenScaleFactor
height: 120 * screenScaleFactor
minimumWidth: 360 * screenScaleFactor
minimumHeight: 120 * screenScaleFactor
color: UM.Theme.getColor("sidebar")
property var message;
Text {
id: message
anchors {
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
top: parent.top
topMargin: UM.Theme.getSize("default_margin").height
}
text: restartDialog.message != null ? restartDialog.message : ""
}
Button {
id: laterButton
text: "Later"
onClicked: restartDialog.close();
anchors {
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
bottom: parent.bottom
bottomMargin: UM.Theme.getSize("default_margin").height
}
style: ButtonStyle {
background: Rectangle {
color: "transparent"
implicitWidth: 96
implicitHeight: 30
border {
width: 1
color: UM.Theme.getColor("lining")
}
}
label: Text {
verticalAlignment: Text.AlignVCenter
color: UM.Theme.getColor("text")
text: control.text
horizontalAlignment: Text.AlignHCenter
}
}
}
Button {
id: restartButton
text: "Quit Cura"
anchors {
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
bottom: parent.bottom
bottomMargin: UM.Theme.getSize("default_margin").height
}
onClicked: toolbox.restart()
style: ButtonStyle {
background: Rectangle {
implicitWidth: 96
implicitHeight: 30
color: UM.Theme.getColor("primary")
}
label: Text {
verticalAlignment: Text.AlignVCenter
color: UM.Theme.getColor("button_text")
font {
pixelSize: 13
bold: true
}
text: control.text
horizontalAlignment: Text.AlignHCenter
}
}
}
}

View file

@ -0,0 +1,51 @@
// Copyright (c) 2018 Ultimaker B.V.
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM
Button
{
property bool active: false
style: ButtonStyle
{
background: Rectangle
{
color: "transparent"
implicitWidth: UM.Theme.getSize("base_unit").height * 8
implicitHeight: UM.Theme.getSize("base_unit").height * 4
Rectangle
{
visible: control.active
color: UM.Theme.getColor("sidebar_header_highlight_hover")
anchors.bottom: parent.bottom
width: parent.width
height: UM.Theme.getSize("sidebar_header_highlight").height
}
}
label: Text
{
text: control.text
color:
{
if( control.hovered )
{
return UM.Theme.getColor("topbar_button_text_hovered");
}
if( control.active )
{
return UM.Theme.getColor("topbar_button_text_active");
}
else
{
return UM.Theme.getColor("topbar_button_text_inactive");
}
}
font: control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
}