Cura.qml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 1.4
  5. import QtQuick.Controls.Styles 1.4
  6. import QtQuick.Layouts 1.1
  7. import QtQuick.Dialogs 1.2
  8. import QtGraphicalEffects 1.0
  9. import UM 1.3 as UM
  10. import Cura 1.1 as Cura
  11. import "Dialogs"
  12. import "Menus"
  13. import "MainWindow"
  14. UM.MainWindow
  15. {
  16. id: base
  17. // Cura application window title
  18. title: catalog.i18nc("@title:window", "Ultimaker Cura")
  19. backgroundColor: UM.Theme.getColor("viewport_background")
  20. UM.I18nCatalog
  21. {
  22. id: catalog
  23. name: "cura"
  24. }
  25. function showTooltip(item, position, text)
  26. {
  27. tooltip.text = text;
  28. position = item.mapToItem(backgroundItem, position.x - UM.Theme.getSize("default_arrow").width, position.y);
  29. tooltip.show(position);
  30. }
  31. function hideTooltip()
  32. {
  33. tooltip.hide();
  34. }
  35. Component.onCompleted:
  36. {
  37. CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
  38. // Workaround silly issues with QML Action's shortcut property.
  39. //
  40. // Currently, there is no way to define shortcuts as "Application Shortcut".
  41. // This means that all Actions are "Window Shortcuts". The code for this
  42. // implements a rather naive check that just checks if any of the action's parents
  43. // are a window. Since the "Actions" object is a singleton it has no parent by
  44. // default. If we set its parent to something contained in this window, the
  45. // shortcut will activate properly because one of its parents is a window.
  46. //
  47. // This has been fixed for QtQuick Controls 2 since the Shortcut item has a context property.
  48. Cura.Actions.parent = backgroundItem
  49. CuraApplication.purgeWindows()
  50. }
  51. Item
  52. {
  53. id: backgroundItem
  54. anchors.fill: parent
  55. signal hasMesh(string name) //this signal sends the filebase name so it can be used for the JobSpecs.qml
  56. function getMeshName(path)
  57. {
  58. //takes the path the complete path of the meshname and returns only the filebase
  59. var fileName = path.slice(path.lastIndexOf("/") + 1)
  60. var fileBase = fileName.slice(0, fileName.indexOf("."))
  61. return fileBase
  62. }
  63. //DeleteSelection on the keypress backspace event
  64. Keys.onPressed:
  65. {
  66. if (event.key == Qt.Key_Backspace)
  67. {
  68. Cura.Actions.deleteSelection.trigger()
  69. }
  70. }
  71. ApplicationMenu
  72. {
  73. id: applicationMenu
  74. window: base
  75. }
  76. Item
  77. {
  78. id: headerBackground
  79. anchors
  80. {
  81. top: applicationMenu.bottom
  82. left: parent.left
  83. right: parent.right
  84. }
  85. height: stageMenu.source != "" ? Math.round(mainWindowHeader.height + stageMenu.height / 2) : mainWindowHeader.height
  86. LinearGradient
  87. {
  88. anchors.fill: parent
  89. start: Qt.point(0, 0)
  90. end: Qt.point(parent.width, 0)
  91. gradient: Gradient
  92. {
  93. GradientStop
  94. {
  95. position: 0.0
  96. color: UM.Theme.getColor("main_window_header_background")
  97. }
  98. GradientStop
  99. {
  100. position: 0.5
  101. color: UM.Theme.getColor("main_window_header_background_gradient")
  102. }
  103. GradientStop
  104. {
  105. position: 1.0
  106. color: UM.Theme.getColor("main_window_header_background")
  107. }
  108. }
  109. }
  110. // This is a placehoder for adding a pattern in the header
  111. Image
  112. {
  113. id: backgroundPattern
  114. anchors.fill: parent
  115. fillMode: Image.Tile
  116. source: UM.Theme.getImage("header_pattern")
  117. horizontalAlignment: Image.AlignLeft
  118. verticalAlignment: Image.AlignTop
  119. }
  120. }
  121. MainWindowHeader
  122. {
  123. id: mainWindowHeader
  124. anchors
  125. {
  126. left: parent.left
  127. right: parent.right
  128. top: applicationMenu.bottom
  129. }
  130. }
  131. Item
  132. {
  133. id: contentItem
  134. anchors
  135. {
  136. top: mainWindowHeader.bottom
  137. bottom: parent.bottom
  138. left: parent.left
  139. right: parent.right
  140. }
  141. Keys.forwardTo: applicationMenu
  142. DropArea
  143. {
  144. // The drop area is here to handle files being dropped onto Cura.
  145. anchors.fill: parent
  146. onDropped:
  147. {
  148. if (drop.urls.length > 0)
  149. {
  150. var nonPackages = [];
  151. for (var i = 0; i < drop.urls.length; i++)
  152. {
  153. var filename = drop.urls[i];
  154. if (filename.endsWith(".curapackage"))
  155. {
  156. // Try to install plugin & close.
  157. CuraApplication.getPackageManager().installPackageViaDragAndDrop(filename);
  158. packageInstallDialog.text = catalog.i18nc("@label", "This package will be installed after restarting.");
  159. packageInstallDialog.icon = StandardIcon.Information;
  160. packageInstallDialog.open();
  161. }
  162. else
  163. {
  164. nonPackages.push(filename);
  165. }
  166. }
  167. openDialog.handleOpenFileUrls(nonPackages);
  168. }
  169. }
  170. }
  171. Toolbar
  172. {
  173. // The toolbar is the left bar that is populated by all the tools (which are dynamicly populated by
  174. // plugins)
  175. id: toolbar
  176. property int mouseX: base.mouseX
  177. property int mouseY: base.mouseY
  178. anchors
  179. {
  180. verticalCenter: parent.verticalCenter
  181. left: parent.left
  182. }
  183. visible: CuraApplication.platformActivity && !PrintInformation.preSliced
  184. }
  185. ObjectsList
  186. {
  187. id: objectsList
  188. visible: UM.Preferences.getValue("cura/use_multi_build_plate")
  189. anchors
  190. {
  191. bottom: viewOrientationControls.top
  192. left: toolbar.right
  193. margins: UM.Theme.getSize("default_margin").width
  194. }
  195. }
  196. JobSpecs
  197. {
  198. id: jobSpecs
  199. visible: CuraApplication.platformActivity
  200. anchors
  201. {
  202. left: parent.left
  203. bottom: viewOrientationControls.top
  204. margins: UM.Theme.getSize("default_margin").width
  205. bottomMargin: UM.Theme.getSize("thin_margin").width
  206. }
  207. }
  208. ViewOrientationControls
  209. {
  210. id: viewOrientationControls
  211. anchors
  212. {
  213. left: parent.left
  214. bottom: parent.bottom
  215. margins: UM.Theme.getSize("default_margin").width
  216. }
  217. }
  218. Cura.ActionPanelWidget
  219. {
  220. anchors.right: parent.right
  221. anchors.bottom: parent.bottom
  222. anchors.rightMargin: UM.Theme.getSize("thick_margin").width
  223. anchors.bottomMargin: UM.Theme.getSize("thick_margin").height
  224. visible: CuraApplication.platformActivity
  225. }
  226. Loader
  227. {
  228. // A stage can control this area. If nothing is set, it will therefore show the 3D view.
  229. id: main
  230. anchors
  231. {
  232. // Align to the top of the stageMenu since the stageMenu may not exist
  233. top: stageMenu.source ? stageMenu.verticalCenter : parent.top
  234. left: parent.left
  235. right: parent.right
  236. bottom: parent.bottom
  237. }
  238. source: UM.Controller.activeStage != null ? UM.Controller.activeStage.mainComponent : ""
  239. }
  240. Loader
  241. {
  242. // The stage menu is, as the name implies, a menu that is defined by the active stage.
  243. // Note that this menu does not need to be set at all! It's perfectly acceptable to have a stage
  244. // without this menu!
  245. id: stageMenu
  246. anchors
  247. {
  248. left: parent.left
  249. right: parent.right
  250. top: parent.top
  251. }
  252. height: UM.Theme.getSize("stage_menu").height
  253. source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : ""
  254. // HACK: This is to ensure that the parent never gets set to null, as this wreaks havoc on the focus.
  255. function onParentDestroyed()
  256. {
  257. printSetupSelector.parent = stageMenu
  258. printSetupSelector.visible = false
  259. }
  260. property Item oldParent: null
  261. // The printSetupSelector is defined here so that the setting list doesn't need to get re-instantiated
  262. // Every time the stage is changed.
  263. property var printSetupSelector: Cura.PrintSetupSelector
  264. {
  265. width: UM.Theme.getSize("print_setup_widget").width
  266. height: UM.Theme.getSize("stage_menu").height
  267. headerCornerSide: RoundedRectangle.Direction.Right
  268. onParentChanged:
  269. {
  270. if(stageMenu.oldParent !=null)
  271. {
  272. stageMenu.oldParent.Component.destruction.disconnect(stageMenu.onParentDestroyed)
  273. }
  274. stageMenu.oldParent = parent
  275. visible = parent != stageMenu
  276. parent.Component.destruction.connect(stageMenu.onParentDestroyed)
  277. }
  278. }
  279. }
  280. UM.MessageStack
  281. {
  282. anchors
  283. {
  284. horizontalCenter: parent.horizontalCenter
  285. top: parent.verticalCenter
  286. bottom: parent.bottom
  287. bottomMargin: UM.Theme.getSize("default_margin").height
  288. }
  289. }
  290. }
  291. PrintSetupTooltip
  292. {
  293. id: tooltip
  294. }
  295. }
  296. UM.PreferencesDialog
  297. {
  298. id: preferences
  299. Component.onCompleted:
  300. {
  301. //; Remove & re-add the general page as we want to use our own instead of uranium standard.
  302. removePage(0);
  303. insertPage(0, catalog.i18nc("@title:tab","General"), Qt.resolvedUrl("Preferences/GeneralPage.qml"));
  304. removePage(1);
  305. insertPage(1, catalog.i18nc("@title:tab","Settings"), Qt.resolvedUrl("Preferences/SettingVisibilityPage.qml"));
  306. insertPage(2, catalog.i18nc("@title:tab", "Printers"), Qt.resolvedUrl("Preferences/MachinesPage.qml"));
  307. insertPage(3, catalog.i18nc("@title:tab", "Materials"), Qt.resolvedUrl("Preferences/Materials/MaterialsPage.qml"));
  308. insertPage(4, catalog.i18nc("@title:tab", "Profiles"), Qt.resolvedUrl("Preferences/ProfilesPage.qml"));
  309. // Remove plug-ins page because we will use the shiny new plugin browser:
  310. removePage(5);
  311. //Force refresh
  312. setPage(0);
  313. }
  314. onVisibleChanged:
  315. {
  316. // When the dialog closes, switch to the General page.
  317. // This prevents us from having a heavy page like Setting Visiblity active in the background.
  318. setPage(0);
  319. }
  320. }
  321. Connections
  322. {
  323. target: Cura.Actions.preferences
  324. onTriggered: preferences.visible = true
  325. }
  326. Connections
  327. {
  328. target: CuraApplication
  329. onShowPreferencesWindow: preferences.visible = true
  330. }
  331. Connections
  332. {
  333. target: Cura.Actions.addProfile
  334. onTriggered:
  335. {
  336. preferences.show();
  337. preferences.setPage(4);
  338. // Create a new profile after a very short delay so the preference page has time to initiate
  339. createProfileTimer.start();
  340. }
  341. }
  342. Connections
  343. {
  344. target: Cura.Actions.configureMachines
  345. onTriggered:
  346. {
  347. preferences.visible = true;
  348. preferences.setPage(2);
  349. }
  350. }
  351. Connections
  352. {
  353. target: Cura.Actions.manageProfiles
  354. onTriggered:
  355. {
  356. preferences.visible = true;
  357. preferences.setPage(4);
  358. }
  359. }
  360. Connections
  361. {
  362. target: Cura.Actions.manageMaterials
  363. onTriggered:
  364. {
  365. preferences.visible = true;
  366. preferences.setPage(3)
  367. }
  368. }
  369. Connections
  370. {
  371. target: Cura.Actions.configureSettingVisibility
  372. onTriggered:
  373. {
  374. preferences.visible = true;
  375. preferences.setPage(1);
  376. if(source && source.key)
  377. {
  378. preferences.getCurrentItem().scrollToSection(source.key);
  379. }
  380. }
  381. }
  382. Timer
  383. {
  384. id: createProfileTimer
  385. repeat: false
  386. interval: 1
  387. onTriggered: preferences.getCurrentItem().createProfile()
  388. }
  389. // BlurSettings is a way to force the focus away from any of the setting items.
  390. // We need to do this in order to keep the bindings intact.
  391. Connections
  392. {
  393. target: Cura.MachineManager
  394. onBlurSettings:
  395. {
  396. contentItem.forceActiveFocus()
  397. }
  398. }
  399. ContextMenu
  400. {
  401. id: contextMenu
  402. }
  403. onPreClosing:
  404. {
  405. close.accepted = CuraApplication.getIsAllChecksPassed();
  406. if (!close.accepted)
  407. {
  408. CuraApplication.checkAndExitApplication();
  409. }
  410. }
  411. MessageDialog
  412. {
  413. id: exitConfirmationDialog
  414. title: catalog.i18nc("@title:window", "Closing Cura")
  415. text: catalog.i18nc("@label", "Are you sure you want to exit Cura?")
  416. icon: StandardIcon.Question
  417. modality: Qt.ApplicationModal
  418. standardButtons: StandardButton.Yes | StandardButton.No
  419. onYes: CuraApplication.callConfirmExitDialogCallback(true)
  420. onNo: CuraApplication.callConfirmExitDialogCallback(false)
  421. onRejected: CuraApplication.callConfirmExitDialogCallback(false)
  422. onVisibilityChanged:
  423. {
  424. if (!visible)
  425. {
  426. // reset the text to default because other modules may change the message text.
  427. text = catalog.i18nc("@label", "Are you sure you want to exit Cura?");
  428. }
  429. }
  430. }
  431. Connections
  432. {
  433. target: CuraApplication
  434. onShowConfirmExitDialog:
  435. {
  436. exitConfirmationDialog.text = message;
  437. exitConfirmationDialog.open();
  438. }
  439. }
  440. Connections
  441. {
  442. target: Cura.Actions.quit
  443. onTriggered: CuraApplication.checkAndExitApplication();
  444. }
  445. Connections
  446. {
  447. target: Cura.Actions.toggleFullScreen
  448. onTriggered: base.toggleFullscreen();
  449. }
  450. FileDialog
  451. {
  452. id: openDialog;
  453. //: File open dialog title
  454. title: catalog.i18nc("@title:window","Open file(s)")
  455. modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
  456. selectMultiple: true
  457. nameFilters: UM.MeshFileHandler.supportedReadFileTypes;
  458. folder: CuraApplication.getDefaultPath("dialog_load_path")
  459. onAccepted:
  460. {
  461. // Because several implementations of the file dialog only update the folder
  462. // when it is explicitly set.
  463. var f = folder;
  464. folder = f;
  465. CuraApplication.setDefaultPath("dialog_load_path", folder);
  466. handleOpenFileUrls(fileUrls);
  467. }
  468. // Yeah... I know... it is a mess to put all those things here.
  469. // There are lots of user interactions in this part of the logic, such as showing a warning dialog here and there,
  470. // etc. This means it will come back and forth from time to time between QML and Python. So, separating the logic
  471. // and view here may require more effort but make things more difficult to understand.
  472. function handleOpenFileUrls(fileUrlList)
  473. {
  474. // look for valid project files
  475. var projectFileUrlList = [];
  476. var hasGcode = false;
  477. var nonGcodeFileList = [];
  478. for (var i in fileUrlList)
  479. {
  480. var endsWithG = /\.g$/;
  481. var endsWithGcode = /\.gcode$/;
  482. if (endsWithG.test(fileUrlList[i]) || endsWithGcode.test(fileUrlList[i]))
  483. {
  484. continue;
  485. }
  486. else if (CuraApplication.checkIsValidProjectFile(fileUrlList[i]))
  487. {
  488. projectFileUrlList.push(fileUrlList[i]);
  489. }
  490. nonGcodeFileList.push(fileUrlList[i]);
  491. }
  492. hasGcode = nonGcodeFileList.length < fileUrlList.length;
  493. // show a warning if selected multiple files together with Gcode
  494. var hasProjectFile = projectFileUrlList.length > 0;
  495. var selectedMultipleFiles = fileUrlList.length > 1;
  496. if (selectedMultipleFiles && hasGcode)
  497. {
  498. infoMultipleFilesWithGcodeDialog.selectedMultipleFiles = selectedMultipleFiles;
  499. infoMultipleFilesWithGcodeDialog.hasProjectFile = hasProjectFile;
  500. infoMultipleFilesWithGcodeDialog.fileUrls = nonGcodeFileList.slice();
  501. infoMultipleFilesWithGcodeDialog.projectFileUrlList = projectFileUrlList.slice();
  502. infoMultipleFilesWithGcodeDialog.open();
  503. }
  504. else
  505. {
  506. handleOpenFiles(selectedMultipleFiles, hasProjectFile, fileUrlList, projectFileUrlList);
  507. }
  508. }
  509. function handleOpenFiles(selectedMultipleFiles, hasProjectFile, fileUrlList, projectFileUrlList)
  510. {
  511. // we only allow opening one project file
  512. if (selectedMultipleFiles && hasProjectFile)
  513. {
  514. openFilesIncludingProjectsDialog.fileUrls = fileUrlList.slice();
  515. openFilesIncludingProjectsDialog.show();
  516. return;
  517. }
  518. if (hasProjectFile)
  519. {
  520. var projectFile = projectFileUrlList[0];
  521. // check preference
  522. var choice = UM.Preferences.getValue("cura/choice_on_open_project");
  523. if (choice == "open_as_project")
  524. {
  525. openFilesIncludingProjectsDialog.loadProjectFile(projectFile);
  526. }
  527. else if (choice == "open_as_model")
  528. {
  529. openFilesIncludingProjectsDialog.loadModelFiles([projectFile].slice());
  530. }
  531. else // always ask
  532. {
  533. // ask whether to open as project or as models
  534. askOpenAsProjectOrModelsDialog.fileUrl = projectFile;
  535. askOpenAsProjectOrModelsDialog.show();
  536. }
  537. }
  538. else
  539. {
  540. openFilesIncludingProjectsDialog.loadModelFiles(fileUrlList.slice());
  541. }
  542. }
  543. }
  544. MessageDialog
  545. {
  546. id: packageInstallDialog
  547. title: catalog.i18nc("@window:title", "Install Package");
  548. standardButtons: StandardButton.Ok
  549. modality: Qt.ApplicationModal
  550. }
  551. MessageDialog
  552. {
  553. id: infoMultipleFilesWithGcodeDialog
  554. title: catalog.i18nc("@title:window", "Open File(s)")
  555. icon: StandardIcon.Information
  556. standardButtons: StandardButton.Ok
  557. text: catalog.i18nc("@text:window", "We have found one or more G-Code files within the files you have selected. You can only open one G-Code file at a time. If you want to open a G-Code file, please just select only one.")
  558. property var selectedMultipleFiles
  559. property var hasProjectFile
  560. property var fileUrls
  561. property var projectFileUrlList
  562. onAccepted:
  563. {
  564. openDialog.handleOpenFiles(selectedMultipleFiles, hasProjectFile, fileUrls, projectFileUrlList);
  565. }
  566. }
  567. Connections
  568. {
  569. target: Cura.Actions.open
  570. onTriggered: openDialog.open()
  571. }
  572. OpenFilesIncludingProjectsDialog
  573. {
  574. id: openFilesIncludingProjectsDialog
  575. }
  576. AskOpenAsProjectOrModelsDialog
  577. {
  578. id: askOpenAsProjectOrModelsDialog
  579. }
  580. Connections
  581. {
  582. target: CuraApplication
  583. onOpenProjectFile:
  584. {
  585. askOpenAsProjectOrModelsDialog.fileUrl = project_file;
  586. askOpenAsProjectOrModelsDialog.show();
  587. }
  588. }
  589. Connections
  590. {
  591. target: Cura.Actions.showProfileFolder
  592. onTriggered:
  593. {
  594. var path = UM.Resources.getPath(UM.Resources.Preferences, "");
  595. if(Qt.platform.os == "windows") {
  596. path = path.replace(/\\/g,"/");
  597. }
  598. Qt.openUrlExternally(path);
  599. if(Qt.platform.os == "linux") {
  600. Qt.openUrlExternally(UM.Resources.getPath(UM.Resources.Resources, ""));
  601. }
  602. }
  603. }
  604. AddMachineDialog
  605. {
  606. id: addMachineDialog
  607. onMachineAdded:
  608. {
  609. machineActionsWizard.firstRun = addMachineDialog.firstRun
  610. machineActionsWizard.start(id)
  611. }
  612. }
  613. // Dialog to handle first run machine actions
  614. UM.Wizard
  615. {
  616. id: machineActionsWizard;
  617. title: catalog.i18nc("@title:window", "Add Printer")
  618. property var machine;
  619. function start(id)
  620. {
  621. var actions = Cura.MachineActionManager.getFirstStartActions(id)
  622. resetPages() // Remove previous pages
  623. for (var i = 0; i < actions.length; i++)
  624. {
  625. actions[i].displayItem.reset()
  626. machineActionsWizard.appendPage(actions[i].displayItem, catalog.i18nc("@title", actions[i].label));
  627. }
  628. //Only start if there are actions to perform.
  629. if (actions.length > 0)
  630. {
  631. machineActionsWizard.currentPage = 0;
  632. show()
  633. }
  634. }
  635. }
  636. MessageDialog
  637. {
  638. id: messageDialog
  639. modality: Qt.ApplicationModal
  640. onAccepted: CuraApplication.messageBoxClosed(clickedButton)
  641. onApply: CuraApplication.messageBoxClosed(clickedButton)
  642. onDiscard: CuraApplication.messageBoxClosed(clickedButton)
  643. onHelp: CuraApplication.messageBoxClosed(clickedButton)
  644. onNo: CuraApplication.messageBoxClosed(clickedButton)
  645. onRejected: CuraApplication.messageBoxClosed(clickedButton)
  646. onReset: CuraApplication.messageBoxClosed(clickedButton)
  647. onYes: CuraApplication.messageBoxClosed(clickedButton)
  648. }
  649. Connections
  650. {
  651. target: CuraApplication
  652. onShowMessageBox:
  653. {
  654. messageDialog.title = title
  655. messageDialog.text = text
  656. messageDialog.informativeText = informativeText
  657. messageDialog.detailedText = detailedText
  658. messageDialog.standardButtons = buttons
  659. messageDialog.icon = icon
  660. messageDialog.visible = true
  661. }
  662. }
  663. DiscardOrKeepProfileChangesDialog
  664. {
  665. id: discardOrKeepProfileChangesDialog
  666. }
  667. Connections
  668. {
  669. target: CuraApplication
  670. onShowDiscardOrKeepProfileChanges:
  671. {
  672. discardOrKeepProfileChangesDialog.show()
  673. }
  674. }
  675. Connections
  676. {
  677. target: Cura.Actions.addMachine
  678. onTriggered: addMachineDialog.visible = true;
  679. }
  680. AboutDialog
  681. {
  682. id: aboutDialog
  683. }
  684. Connections
  685. {
  686. target: Cura.Actions.about
  687. onTriggered: aboutDialog.visible = true;
  688. }
  689. Connections
  690. {
  691. target: CuraApplication
  692. onRequestAddPrinter:
  693. {
  694. addMachineDialog.visible = true
  695. addMachineDialog.firstRun = false
  696. }
  697. }
  698. Timer
  699. {
  700. id: startupTimer;
  701. interval: 100;
  702. repeat: false;
  703. running: true;
  704. onTriggered:
  705. {
  706. if(!base.visible)
  707. {
  708. base.visible = true;
  709. }
  710. // check later if the user agreement dialog has been closed
  711. if (CuraApplication.needToShowUserAgreement)
  712. {
  713. restart();
  714. }
  715. else if(Cura.MachineManager.activeMachine == null)
  716. {
  717. addMachineDialog.open();
  718. }
  719. }
  720. }
  721. }