Cura.qml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. // Copyright (c) 2015 Ultimaker B.V.
  2. // Cura is released under the terms of the AGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Controls.Styles 1.1
  6. import QtQuick.Layouts 1.1
  7. import QtQuick.Dialogs 1.1
  8. import UM 1.2 as UM
  9. import Cura 1.0 as Cura
  10. import "Menus"
  11. UM.MainWindow
  12. {
  13. id: base
  14. //: Cura application window title
  15. title: catalog.i18nc("@title:window","Cura");
  16. viewportRect: Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0)
  17. property bool monitoringPrint: false
  18. Component.onCompleted:
  19. {
  20. Printer.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
  21. // Workaround silly issues with QML Action's shortcut property.
  22. //
  23. // Currently, there is no way to define shortcuts as "Application Shortcut".
  24. // This means that all Actions are "Window Shortcuts". The code for this
  25. // implements a rather naive check that just checks if any of the action's parents
  26. // are a window. Since the "Actions" object is a singleton it has no parent by
  27. // default. If we set its parent to something contained in this window, the
  28. // shortcut will activate properly because one of its parents is a window.
  29. //
  30. // This has been fixed for QtQuick Controls 2 since the Shortcut item has a context property.
  31. Cura.Actions.parent = backgroundItem
  32. }
  33. Item
  34. {
  35. id: backgroundItem;
  36. anchors.fill: parent;
  37. UM.I18nCatalog{id: catalog; name:"cura"}
  38. signal hasMesh(string name) //this signal sends the filebase name so it can be used for the JobSpecs.qml
  39. function getMeshName(path){
  40. //takes the path the complete path of the meshname and returns only the filebase
  41. var fileName = path.slice(path.lastIndexOf("/") + 1)
  42. var fileBase = fileName.slice(0, fileName.lastIndexOf("."))
  43. return fileBase
  44. }
  45. //DeleteSelection on the keypress backspace event
  46. Keys.onPressed: {
  47. if (event.key == Qt.Key_Backspace)
  48. {
  49. Cura.Actions.deleteSelection.trigger()
  50. }
  51. }
  52. UM.ApplicationMenu
  53. {
  54. id: menu
  55. window: base
  56. Menu
  57. {
  58. id: fileMenu
  59. title: catalog.i18nc("@title:menu menubar:toplevel","&File");
  60. MenuItem {
  61. action: Cura.Actions.open;
  62. }
  63. RecentFilesMenu { }
  64. MenuSeparator { }
  65. MenuItem
  66. {
  67. text: catalog.i18nc("@action:inmenu menubar:file", "&Save Selection to File");
  68. enabled: UM.Selection.hasSelection;
  69. iconName: "document-save-as";
  70. onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false });
  71. }
  72. Menu
  73. {
  74. id: saveAllMenu
  75. title: catalog.i18nc("@title:menu menubar:file","Save &All")
  76. iconName: "document-save-all";
  77. enabled: devicesModel.rowCount() > 0 && UM.Backend.progress > 0.99;
  78. Instantiator
  79. {
  80. model: UM.OutputDevicesModel { id: devicesModel; }
  81. MenuItem
  82. {
  83. text: model.description;
  84. onTriggered: UM.OutputDeviceManager.requestWriteToDevice(model.id, PrintInformation.jobName, { "filter_by_machine": false });
  85. }
  86. onObjectAdded: saveAllMenu.insertItem(index, object)
  87. onObjectRemoved: saveAllMenu.removeItem(object)
  88. }
  89. }
  90. MenuItem { action: Cura.Actions.reloadAll; }
  91. MenuSeparator { }
  92. MenuItem { action: Cura.Actions.quit; }
  93. }
  94. Menu
  95. {
  96. title: catalog.i18nc("@title:menu menubar:toplevel","&Edit");
  97. MenuItem { action: Cura.Actions.undo; }
  98. MenuItem { action: Cura.Actions.redo; }
  99. MenuSeparator { }
  100. MenuItem { action: Cura.Actions.selectAll; }
  101. MenuItem { action: Cura.Actions.deleteSelection; }
  102. MenuItem { action: Cura.Actions.deleteAll; }
  103. MenuItem { action: Cura.Actions.resetAllTranslation; }
  104. MenuItem { action: Cura.Actions.resetAll; }
  105. MenuSeparator { }
  106. MenuItem { action: Cura.Actions.groupObjects;}
  107. MenuItem { action: Cura.Actions.mergeObjects;}
  108. MenuItem { action: Cura.Actions.unGroupObjects;}
  109. }
  110. ViewMenu { title: catalog.i18nc("@title:menu", "&View") }
  111. Menu
  112. {
  113. id: settingsMenu
  114. title: catalog.i18nc("@title:menu", "&Settings")
  115. PrinterMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&Printer") }
  116. Instantiator
  117. {
  118. model: Cura.ExtrudersModel { }
  119. Menu {
  120. title: model.name
  121. visible: machineExtruderCount.properties.value > 1
  122. NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants }
  123. MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials }
  124. ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); }
  125. MenuSeparator { }
  126. MenuItem { text: catalog.i18nc("@action:inmenu", "Set as Active Extruder"); onTriggered: ExtruderManager.setActiveExtruderIndex(model.index) }
  127. }
  128. onObjectAdded: settingsMenu.insertItem(index, object)
  129. onObjectRemoved: settingsMenu.removeItem(object)
  130. }
  131. NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: machineExtruderCount.properties.value <= 1 && Cura.MachineManager.hasVariants }
  132. MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: machineExtruderCount.properties.value <= 1 && Cura.MachineManager.hasMaterials }
  133. ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); visible: machineExtruderCount.properties.value <= 1 }
  134. MenuSeparator { }
  135. MenuItem { action: Cura.Actions.configureSettingVisibility }
  136. }
  137. Menu
  138. {
  139. id: extension_menu
  140. title: catalog.i18nc("@title:menu menubar:toplevel","E&xtensions");
  141. Instantiator
  142. {
  143. id: extensions
  144. model: UM.ExtensionModel { }
  145. Menu
  146. {
  147. id: sub_menu
  148. title: model.name;
  149. visible: actions != null
  150. enabled:actions != null
  151. Instantiator
  152. {
  153. model: actions
  154. MenuItem
  155. {
  156. text: model.text
  157. onTriggered: extensions.model.subMenuTriggered(name, model.text)
  158. }
  159. onObjectAdded: sub_menu.insertItem(index, object)
  160. onObjectRemoved: sub_menu.removeItem(object)
  161. }
  162. }
  163. onObjectAdded: extension_menu.insertItem(index, object)
  164. onObjectRemoved: extension_menu.removeItem(object)
  165. }
  166. }
  167. Menu
  168. {
  169. title: catalog.i18nc("@title:menu menubar:toplevel","P&references");
  170. MenuItem { action: Cura.Actions.preferences; }
  171. }
  172. Menu
  173. {
  174. //: Help menu
  175. title: catalog.i18nc("@title:menu menubar:toplevel","&Help");
  176. MenuItem { action: Cura.Actions.showProfileFolder; }
  177. MenuItem { action: Cura.Actions.documentation; }
  178. MenuItem { action: Cura.Actions.reportBug; }
  179. MenuSeparator { }
  180. MenuItem { action: Cura.Actions.about; }
  181. }
  182. }
  183. UM.SettingPropertyProvider
  184. {
  185. id: machineExtruderCount
  186. containerStackId: Cura.MachineManager.activeMachineId
  187. key: "machine_extruder_count"
  188. watchedProperties: [ "value" ]
  189. storeIndex: 0
  190. }
  191. Item
  192. {
  193. id: contentItem;
  194. y: menu.height
  195. width: parent.width;
  196. height: parent.height - menu.height;
  197. Keys.forwardTo: menu
  198. DropArea
  199. {
  200. anchors.fill: parent;
  201. onDropped:
  202. {
  203. if(drop.urls.length > 0)
  204. {
  205. for(var i in drop.urls)
  206. {
  207. UM.MeshFileHandler.readLocalFile(drop.urls[i]);
  208. if (i == drop.urls.length - 1)
  209. {
  210. var meshName = backgroundItem.getMeshName(drop.urls[i].toString())
  211. backgroundItem.hasMesh(decodeURIComponent(meshName))
  212. }
  213. }
  214. }
  215. }
  216. }
  217. JobSpecs
  218. {
  219. id: jobSpecs
  220. anchors
  221. {
  222. bottom: parent.bottom;
  223. right: sidebar.left;
  224. bottomMargin: UM.Theme.getSize("default_margin").height;
  225. rightMargin: UM.Theme.getSize("default_margin").width;
  226. }
  227. }
  228. Loader
  229. {
  230. id: view_panel
  231. anchors.top: viewModeButton.bottom
  232. anchors.topMargin: UM.Theme.getSize("default_margin").height;
  233. anchors.left: viewModeButton.left;
  234. height: childrenRect.height;
  235. source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "";
  236. }
  237. Button
  238. {
  239. id: openFileButton;
  240. text: catalog.i18nc("@action:button","Open File");
  241. iconSource: UM.Theme.getIcon("load")
  242. style: UM.Theme.styles.tool_button
  243. tooltip: '';
  244. anchors
  245. {
  246. top: parent.top;
  247. left: parent.left;
  248. }
  249. action: Cura.Actions.open;
  250. }
  251. Image
  252. {
  253. id: logo
  254. anchors
  255. {
  256. left: parent.left
  257. leftMargin: UM.Theme.getSize("default_margin").width;
  258. bottom: parent.bottom
  259. bottomMargin: UM.Theme.getSize("default_margin").height;
  260. }
  261. source: UM.Theme.getImage("logo");
  262. width: UM.Theme.getSize("logo").width;
  263. height: UM.Theme.getSize("logo").height;
  264. z: -1;
  265. sourceSize.width: width;
  266. sourceSize.height: height;
  267. }
  268. Toolbar
  269. {
  270. id: toolbar;
  271. property int mouseX: base.mouseX
  272. property int mouseY: base.mouseY
  273. anchors {
  274. top: openFileButton.bottom;
  275. topMargin: UM.Theme.getSize("window_margin").height;
  276. left: parent.left;
  277. }
  278. }
  279. Sidebar
  280. {
  281. id: sidebar;
  282. anchors
  283. {
  284. top: parent.top;
  285. bottom: parent.bottom;
  286. right: parent.right;
  287. }
  288. z: 1
  289. onMonitoringPrintChanged: base.monitoringPrint = monitoringPrint
  290. width: UM.Theme.getSize("sidebar").width;
  291. }
  292. Button
  293. {
  294. id: viewModeButton
  295. anchors
  296. {
  297. top: toolbar.bottom;
  298. topMargin: UM.Theme.getSize("window_margin").height;
  299. left: parent.left;
  300. }
  301. text: catalog.i18nc("@action:button","View Mode");
  302. iconSource: UM.Theme.getIcon("viewmode");
  303. style: UM.Theme.styles.tool_button;
  304. tooltip: '';
  305. menu: ViewMenu { }
  306. }
  307. Rectangle
  308. {
  309. id: viewportOverlay
  310. color: UM.Theme.getColor("viewport_overlay")
  311. anchors
  312. {
  313. top: parent.top
  314. bottom: parent.bottom
  315. left:parent.left
  316. right: sidebar.left
  317. }
  318. visible: opacity > 0
  319. opacity: base.monitoringPrint ? 0.75 : 0
  320. Behavior on opacity { NumberAnimation { duration: 100; } }
  321. MouseArea {
  322. anchors.fill: parent
  323. acceptedButtons: Qt.AllButtons
  324. onWheel: wheel.accepted = true
  325. }
  326. }
  327. Image
  328. {
  329. id: cameraImage
  330. width: Math.min(viewportOverlay.width, sourceSize.width)
  331. height: sourceSize.height * width / sourceSize.width
  332. anchors.horizontalCenter: parent.horizontalCenter
  333. anchors.verticalCenter: parent.verticalCenter
  334. anchors.horizontalCenterOffset: - UM.Theme.getSize("sidebar").width / 2
  335. visible: base.monitoringPrint
  336. source: Cura.MachineManager.printerOutputDevices.length > 0 && Cura.MachineManager.printerOutputDevices[0].cameraImage ? Cura.MachineManager.printerOutputDevices[0].cameraImage : ""
  337. }
  338. UM.MessageStack
  339. {
  340. anchors
  341. {
  342. horizontalCenter: parent.horizontalCenter
  343. horizontalCenterOffset: -(UM.Theme.getSize("sidebar").width/ 2)
  344. top: parent.verticalCenter;
  345. bottom: parent.bottom;
  346. }
  347. }
  348. }
  349. }
  350. UM.PreferencesDialog
  351. {
  352. id: preferences
  353. Component.onCompleted:
  354. {
  355. //; Remove & re-add the general page as we want to use our own instead of uranium standard.
  356. removePage(0);
  357. insertPage(0, catalog.i18nc("@title:tab","General"), Qt.resolvedUrl("Preferences/GeneralPage.qml"));
  358. removePage(1);
  359. insertPage(1, catalog.i18nc("@title:tab","Settings"), Qt.resolvedUrl("Preferences/SettingVisibilityPage.qml"));
  360. insertPage(2, catalog.i18nc("@title:tab", "Printers"), Qt.resolvedUrl("Preferences/MachinesPage.qml"));
  361. insertPage(3, catalog.i18nc("@title:tab", "Materials"), Qt.resolvedUrl("Preferences/MaterialsPage.qml"));
  362. insertPage(4, catalog.i18nc("@title:tab", "Profiles"), Qt.resolvedUrl("Preferences/ProfilesPage.qml"));
  363. //Force refresh
  364. setPage(0);
  365. }
  366. onVisibleChanged:
  367. {
  368. if(!visible)
  369. {
  370. // When the dialog closes, switch to the General page.
  371. // This prevents us from having a heavy page like Setting Visiblity active in the background.
  372. setPage(0);
  373. }
  374. }
  375. }
  376. Connections
  377. {
  378. target: Cura.Actions.preferences
  379. onTriggered: preferences.visible = true
  380. }
  381. Connections
  382. {
  383. target: Cura.Actions.addProfile
  384. onTriggered:
  385. {
  386. preferences.setPage(4);
  387. preferences.show();
  388. // Create a new profile after a very short delay so the preference page has time to initiate
  389. createProfileTimer.start();
  390. }
  391. }
  392. Connections
  393. {
  394. target: Cura.Actions.configureMachines
  395. onTriggered:
  396. {
  397. preferences.visible = true;
  398. preferences.setPage(2);
  399. }
  400. }
  401. Connections
  402. {
  403. target: Cura.Actions.manageProfiles
  404. onTriggered:
  405. {
  406. preferences.visible = true;
  407. preferences.setPage(4);
  408. }
  409. }
  410. Connections
  411. {
  412. target: Cura.Actions.manageMaterials
  413. onTriggered:
  414. {
  415. preferences.visible = true;
  416. preferences.setPage(3)
  417. }
  418. }
  419. Connections
  420. {
  421. target: Cura.Actions.configureSettingVisibility
  422. onTriggered:
  423. {
  424. preferences.visible = true;
  425. preferences.setPage(1);
  426. preferences.getCurrentItem().scrollToSection(source.key);
  427. }
  428. }
  429. Timer
  430. {
  431. id: createProfileTimer
  432. repeat: false
  433. interval: 1
  434. onTriggered: preferences.getCurrentItem().createProfile()
  435. }
  436. // BlurSettings is a way to force the focus away from any of the setting items.
  437. // We need to do this in order to keep the bindings intact.
  438. Connections
  439. {
  440. target: Cura.MachineManager
  441. onBlurSettings:
  442. {
  443. contentItem.focus = true
  444. }
  445. }
  446. Menu
  447. {
  448. id: objectContextMenu;
  449. property variant objectId: -1;
  450. MenuItem { action: Cura.Actions.centerObject; }
  451. MenuItem { action: Cura.Actions.deleteObject; }
  452. MenuItem { action: Cura.Actions.multiplyObject; }
  453. MenuSeparator { }
  454. MenuItem { action: Cura.Actions.selectAll; }
  455. MenuItem { action: Cura.Actions.deleteAll; }
  456. MenuItem { action: Cura.Actions.reloadAll; }
  457. MenuItem { action: Cura.Actions.resetAllTranslation; }
  458. MenuItem { action: Cura.Actions.resetAll; }
  459. MenuSeparator { }
  460. MenuItem { action: Cura.Actions.groupObjects; }
  461. MenuItem { action: Cura.Actions.mergeObjects; }
  462. MenuItem { action: Cura.Actions.unGroupObjects; }
  463. Connections
  464. {
  465. target: Cura.Actions.deleteObject
  466. onTriggered:
  467. {
  468. if(objectContextMenu.objectId != 0)
  469. {
  470. Printer.deleteObject(objectContextMenu.objectId);
  471. objectContextMenu.objectId = 0;
  472. }
  473. }
  474. }
  475. Connections
  476. {
  477. target: Cura.Actions.multiplyObject
  478. onTriggered:
  479. {
  480. if(objectContextMenu.objectId != 0)
  481. {
  482. Printer.multiplyObject(objectContextMenu.objectId, 1);
  483. objectContextMenu.objectId = 0;
  484. }
  485. }
  486. }
  487. Connections
  488. {
  489. target: Cura.Actions.centerObject
  490. onTriggered:
  491. {
  492. if(objectContextMenu.objectId != 0)
  493. {
  494. Printer.centerObject(objectContextMenu.objectId);
  495. objectContextMenu.objectId = 0;
  496. }
  497. }
  498. }
  499. }
  500. Menu
  501. {
  502. id: contextMenu;
  503. MenuItem { action: Cura.Actions.selectAll; }
  504. MenuItem { action: Cura.Actions.deleteAll; }
  505. MenuItem { action: Cura.Actions.reloadAll; }
  506. MenuItem { action: Cura.Actions.resetAllTranslation; }
  507. MenuItem { action: Cura.Actions.resetAll; }
  508. MenuSeparator { }
  509. MenuItem { action: Cura.Actions.groupObjects; }
  510. MenuItem { action: Cura.Actions.mergeObjects; }
  511. MenuItem { action: Cura.Actions.unGroupObjects; }
  512. }
  513. Connections
  514. {
  515. target: UM.Controller
  516. onContextMenuRequested:
  517. {
  518. if(objectId == 0)
  519. {
  520. contextMenu.popup();
  521. } else
  522. {
  523. objectContextMenu.objectId = objectId;
  524. objectContextMenu.popup();
  525. }
  526. }
  527. }
  528. Connections
  529. {
  530. target: Cura.Actions.quit
  531. onTriggered: base.visible = false;
  532. }
  533. Connections
  534. {
  535. target: Cura.Actions.toggleFullScreen
  536. onTriggered: base.toggleFullscreen();
  537. }
  538. FileDialog
  539. {
  540. id: openDialog;
  541. //: File open dialog title
  542. title: catalog.i18nc("@title:window","Open file")
  543. modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
  544. //TODO: Support multiple file selection, workaround bug in KDE file dialog
  545. //selectMultiple: true
  546. nameFilters: UM.MeshFileHandler.supportedReadFileTypes;
  547. folder: CuraApplication.getDefaultPath("dialog_load_path")
  548. onAccepted:
  549. {
  550. //Because several implementations of the file dialog only update the folder
  551. //when it is explicitly set.
  552. var f = folder;
  553. folder = f;
  554. CuraApplication.setDefaultPath("dialog_load_path", folder);
  555. UM.MeshFileHandler.readLocalFile(fileUrl)
  556. var meshName = backgroundItem.getMeshName(fileUrl.toString())
  557. backgroundItem.hasMesh(decodeURIComponent(meshName))
  558. }
  559. }
  560. Connections
  561. {
  562. target: Cura.Actions.open
  563. onTriggered: openDialog.open()
  564. }
  565. EngineLog
  566. {
  567. id: engineLog;
  568. }
  569. Connections
  570. {
  571. target: Cura.Actions.showProfileFolder
  572. onTriggered:
  573. {
  574. var path = UM.Resources.getPath(UM.Resources.Preferences, "");
  575. if(Qt.platform.os == "windows") {
  576. path = path.replace(/\\/g,"/");
  577. }
  578. Qt.openUrlExternally(path);
  579. }
  580. }
  581. AddMachineDialog
  582. {
  583. id: addMachineDialog
  584. onMachineAdded:
  585. {
  586. machineActionsWizard.firstRun = addMachineDialog.firstRun
  587. machineActionsWizard.start(id)
  588. }
  589. }
  590. // Dialog to handle first run machine actions
  591. UM.Wizard
  592. {
  593. id: machineActionsWizard;
  594. title: catalog.i18nc("@title:window", "Add Printer")
  595. property var machine;
  596. function start(id)
  597. {
  598. var actions = Cura.MachineActionManager.getFirstStartActions(id)
  599. resetPages() // Remove previous pages
  600. for (var i = 0; i < actions.length; i++)
  601. {
  602. actions[i].displayItem.reset()
  603. machineActionsWizard.appendPage(actions[i].displayItem, catalog.i18nc("@title", actions[i].label));
  604. }
  605. //Only start if there are actions to perform.
  606. if (actions.length > 0)
  607. {
  608. machineActionsWizard.currentPage = 0;
  609. show()
  610. }
  611. }
  612. }
  613. MessageDialog
  614. {
  615. id: messageDialog
  616. modality: Qt.ApplicationModal
  617. onAccepted: Printer.messageBoxClosed(clickedButton)
  618. onApply: Printer.messageBoxClosed(clickedButton)
  619. onDiscard: Printer.messageBoxClosed(clickedButton)
  620. onHelp: Printer.messageBoxClosed(clickedButton)
  621. onNo: Printer.messageBoxClosed(clickedButton)
  622. onRejected: Printer.messageBoxClosed(clickedButton)
  623. onReset: Printer.messageBoxClosed(clickedButton)
  624. onYes: Printer.messageBoxClosed(clickedButton)
  625. }
  626. Connections
  627. {
  628. target: Printer
  629. onShowMessageBox:
  630. {
  631. messageDialog.title = title
  632. messageDialog.text = text
  633. messageDialog.informativeText = informativeText
  634. messageDialog.detailedText = detailedText
  635. messageDialog.standardButtons = buttons
  636. messageDialog.icon = icon
  637. messageDialog.visible = true
  638. }
  639. }
  640. Connections
  641. {
  642. target: Cura.Actions.addMachine
  643. onTriggered: addMachineDialog.visible = true;
  644. }
  645. AboutDialog
  646. {
  647. id: aboutDialog
  648. }
  649. Connections
  650. {
  651. target: Cura.Actions.about
  652. onTriggered: aboutDialog.visible = true;
  653. }
  654. Connections
  655. {
  656. target: Printer
  657. onRequestAddPrinter:
  658. {
  659. addMachineDialog.visible = true
  660. addMachineDialog.firstRun = false
  661. }
  662. }
  663. Timer
  664. {
  665. id: startupTimer;
  666. interval: 100;
  667. repeat: false;
  668. running: true;
  669. onTriggered:
  670. {
  671. if(!base.visible)
  672. {
  673. base.visible = true;
  674. restart();
  675. }
  676. else if(Cura.MachineManager.activeMachineId == null || Cura.MachineManager.activeMachineId == "")
  677. {
  678. addMachineDialog.open();
  679. }
  680. }
  681. }
  682. }