mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-22 10:21:39 -07:00
Remove hack in WelcomePagesModel and add WhatsNewPagesModel
CURA-6447
This commit is contained in:
parent
e0e3c9609f
commit
9494173f43
7 changed files with 116 additions and 63 deletions
|
|
@ -61,6 +61,7 @@ Item
|
|||
property alias documentation: documentationAction;
|
||||
property alias showTroubleshooting: showTroubleShootingAction
|
||||
property alias reportBug: reportBugAction;
|
||||
property alias whatsNew: whatsNewAction
|
||||
property alias about: aboutAction;
|
||||
|
||||
property alias toggleFullScreen: toggleFullScreenAction;
|
||||
|
|
@ -229,6 +230,13 @@ Item
|
|||
onTriggered: CuraActions.openBugReportPage();
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: whatsNewAction;
|
||||
text: catalog.i18nc("@action:inmenu menubar:help", "What's New");
|
||||
iconName: "help-whats-new";
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: aboutAction;
|
||||
|
|
|
|||
|
|
@ -68,32 +68,54 @@ UM.MainWindow
|
|||
z: greyOutBackground.z + 1
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
Connections
|
||||
{
|
||||
CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
|
||||
// Workaround silly issues with QML Action's shortcut property.
|
||||
//
|
||||
// Currently, there is no way to define shortcuts as "Application Shortcut".
|
||||
// This means that all Actions are "Window Shortcuts". The code for this
|
||||
// implements a rather naive check that just checks if any of the action's parents
|
||||
// are a window. Since the "Actions" object is a singleton it has no parent by
|
||||
// default. If we set its parent to something contained in this window, the
|
||||
// shortcut will activate properly because one of its parents is a window.
|
||||
//
|
||||
// This has been fixed for QtQuick Controls 2 since the Shortcut item has a context property.
|
||||
Cura.Actions.parent = backgroundItem
|
||||
CuraApplication.purgeWindows()
|
||||
target: CuraApplication
|
||||
onInitializationFinished:
|
||||
{
|
||||
CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
|
||||
// Workaround silly issues with QML Action's shortcut property.
|
||||
//
|
||||
// Currently, there is no way to define shortcuts as "Application Shortcut".
|
||||
// This means that all Actions are "Window Shortcuts". The code for this
|
||||
// implements a rather naive check that just checks if any of the action's parents
|
||||
// are a window. Since the "Actions" object is a singleton it has no parent by
|
||||
// default. If we set its parent to something contained in this window, the
|
||||
// shortcut will activate properly because one of its parents is a window.
|
||||
//
|
||||
// This has been fixed for QtQuick Controls 2 since the Shortcut item has a context property.
|
||||
Cura.Actions.parent = backgroundItem
|
||||
CuraApplication.purgeWindows()
|
||||
|
||||
if (CuraApplication.getWelcomePagesModel().shouldShowWelcomeFlow)
|
||||
{
|
||||
welcomeDialogItem.visible = true
|
||||
}
|
||||
else
|
||||
{
|
||||
welcomeDialogItem.visible = false
|
||||
if (CuraApplication.shouldShowWelcomeDialog())
|
||||
{
|
||||
welcomeDialogItem.visible = true
|
||||
}
|
||||
else
|
||||
{
|
||||
welcomeDialogItem.visible = false
|
||||
}
|
||||
|
||||
if (CuraApplication.shouldShowWhatsNewDialog())
|
||||
{
|
||||
showWhatsNewDialogTimer.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// HACK: Use a timer here because if we call "Cura.Actions.whatsNew.trigger()" or "whatsNewDialog.show()" when
|
||||
// the component gets completed or when the application finishes its initialization, the main window has not been
|
||||
// fully initialized yet. If we should the dialog before the main window is fully initialized, you will see the
|
||||
// dialog first but when the main windows is fully initialized, the dialog will disappear. Adding a timer here is
|
||||
// to bypass this problem.
|
||||
Timer
|
||||
{
|
||||
id: showWhatsNewDialogTimer
|
||||
repeat: false
|
||||
interval: 1000
|
||||
onTriggered: Cura.Actions.whatsNew.trigger()
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: backgroundItem
|
||||
|
|
@ -780,6 +802,20 @@ UM.MainWindow
|
|||
progressBarVisible: false
|
||||
}
|
||||
|
||||
Cura.WizardDialog
|
||||
{
|
||||
id: whatsNewDialog
|
||||
title: catalog.i18nc("@title:window", "What's New")
|
||||
model: CuraApplication.getWhatsNewPagesModel()
|
||||
progressBarVisible: false
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: Cura.Actions.whatsNew
|
||||
onTriggered: whatsNewDialog.show()
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: Cura.Actions.addMachine
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ Item
|
|||
MenuItem { action: Cura.Actions.documentation }
|
||||
MenuItem { action: Cura.Actions.reportBug }
|
||||
MenuSeparator { }
|
||||
MenuItem { action: Cura.Actions.whatsNew }
|
||||
MenuItem { action: Cura.Actions.about }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ Item
|
|||
id: getStartedButton
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
text: catalog.i18nc("@button", "Next")
|
||||
text: base.currentItem.next_page_button_text
|
||||
onClicked: base.showNextPage()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue