Change buttons to use either secondary or primary

CURA-6006
This commit is contained in:
Jaime van Kessel 2018-12-06 14:58:28 +01:00
parent a77ad32999
commit 62c5398933
3 changed files with 16 additions and 131 deletions

View file

@ -64,11 +64,7 @@ ScrollView
{ {
id: materialList id: materialList
model: toolbox.pluginsInstalledModel model: toolbox.pluginsInstalledModel
delegate: Loader delegate: ToolboxInstalledTile {}
{
asynchronous: true
source: "ToolboxInstalledTile.qml"
}
} }
} }
} }
@ -105,11 +101,7 @@ ScrollView
{ {
id: pluginList id: pluginList
model: toolbox.materialsInstalledModel model: toolbox.materialsInstalledModel
delegate: Loader delegate: ToolboxInstalledTile {}
{
asynchronous: true
source: "ToolboxInstalledTile.qml"
}
} }
} }
} }

View file

@ -6,6 +6,8 @@ import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM import UM 1.1 as UM
import Cura 1.0 as Cura
Column Column
{ {
property bool canUpdate: false property bool canUpdate: false
@ -43,44 +45,18 @@ Column
visible: canUpdate visible: canUpdate
} }
Button Cura.SecondaryButton
{ {
id: removeButton id: removeButton
text: canDowngrade ? catalog.i18nc("@action:button", "Downgrade") : catalog.i18nc("@action:button", "Uninstall") text: canDowngrade ? catalog.i18nc("@action:button", "Downgrade") : catalog.i18nc("@action:button", "Uninstall")
visible: !model.is_bundled && model.is_installed visible: !model.is_bundled && model.is_installed
enabled: !toolbox.isDownloading enabled: !toolbox.isDownloading
style: ButtonStyle
{ width: UM.Theme.getSize("toolbox_action_button").width
background: Rectangle height: UM.Theme.getSize("toolbox_action_button").height
{
implicitWidth: UM.Theme.getSize("toolbox_action_button").width fixedWidthMode: true
implicitHeight: UM.Theme.getSize("toolbox_action_button").height
color: "transparent"
border
{
width: UM.Theme.getSize("default_lining").width
color:
{
if (control.hovered)
{
return UM.Theme.getColor("primary_hover")
}
else
{
return UM.Theme.getColor("lining")
}
}
}
}
label: Label
{
text: control.text
color: UM.Theme.getColor("text")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font: UM.Theme.getFont("default")
}
}
onClicked: toolbox.checkPackageUsageAndUninstall(model.id) onClicked: toolbox.checkPackageUsageAndUninstall(model.id)
Connections Connections
{ {

View file

@ -5,7 +5,7 @@ import QtQuick 2.2
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM import UM 1.1 as UM
import Cura 1.0 as Cura
Item Item
{ {
@ -25,9 +25,12 @@ Item
width: UM.Theme.getSize("toolbox_action_button").width width: UM.Theme.getSize("toolbox_action_button").width
height: UM.Theme.getSize("toolbox_action_button").height height: UM.Theme.getSize("toolbox_action_button").height
Button Cura.PrimaryButton
{ {
id: button id: button
width: UM.Theme.getSize("toolbox_action_button").width
height: UM.Theme.getSize("toolbox_action_button").height
fixedWidthMode: true
text: text:
{ {
if (complete) if (complete)
@ -58,92 +61,6 @@ Item
readyAction() readyAction()
} }
} }
style: ButtonStyle
{
background: Rectangle
{
implicitWidth: UM.Theme.getSize("toolbox_action_button").width
implicitHeight: UM.Theme.getSize("toolbox_action_button").height
color:
{
if (base.complete)
{
return "transparent"
}
else
{
if (control.hovered)
{
return UM.Theme.getColor("primary_hover")
}
else
{
return UM.Theme.getColor("primary")
}
}
}
border
{
width:
{
if (base.complete)
{
UM.Theme.getSize("default_lining").width
}
else
{
return 0
}
}
color:
{
if (control.hovered)
{
return UM.Theme.getColor("primary_hover")
}
else
{
return UM.Theme.getColor("lining")
}
}
}
}
label: Label
{
text: control.text
color:
{
if (base.complete)
{
return UM.Theme.getColor("text")
}
else
{
if (control.hovered)
{
return UM.Theme.getColor("button_text_hover")
}
else
{
return UM.Theme.getColor("button_text")
}
}
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font:
{
if (base.complete)
{
return UM.Theme.getFont("default")
}
else
{
return UM.Theme.getFont("default_bold")
}
}
}
}
} }
AnimatedImage AnimatedImage