Cura.qml 26 KB

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