Cura.qml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  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 { simpleNames: true }
  119. Menu {
  120. title: model.name
  121. visible: machineExtruderCount.properties.value > 1
  122. NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index }
  123. MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials; extruderIndex: index }
  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:
  337. {
  338. if(!base.monitoringPrint)
  339. {
  340. return "";
  341. }
  342. if(Cura.MachineManager.printerOutputDevices.length > 0 && Cura.MachineManager.printerOutputDevices[0].cameraImage)
  343. {
  344. return Cura.MachineManager.printerOutputDevices[0].cameraImage;
  345. }
  346. return "";
  347. }
  348. }
  349. UM.MessageStack
  350. {
  351. anchors
  352. {
  353. horizontalCenter: parent.horizontalCenter
  354. horizontalCenterOffset: -(UM.Theme.getSize("sidebar").width/ 2)
  355. top: parent.verticalCenter;
  356. bottom: parent.bottom;
  357. }
  358. }
  359. }
  360. }
  361. UM.PreferencesDialog
  362. {
  363. id: preferences
  364. Component.onCompleted:
  365. {
  366. //; Remove & re-add the general page as we want to use our own instead of uranium standard.
  367. removePage(0);
  368. insertPage(0, catalog.i18nc("@title:tab","General"), Qt.resolvedUrl("Preferences/GeneralPage.qml"));
  369. removePage(1);
  370. insertPage(1, catalog.i18nc("@title:tab","Settings"), Qt.resolvedUrl("Preferences/SettingVisibilityPage.qml"));
  371. insertPage(2, catalog.i18nc("@title:tab", "Printers"), Qt.resolvedUrl("Preferences/MachinesPage.qml"));
  372. insertPage(3, catalog.i18nc("@title:tab", "Materials"), Qt.resolvedUrl("Preferences/MaterialsPage.qml"));
  373. insertPage(4, catalog.i18nc("@title:tab", "Profiles"), Qt.resolvedUrl("Preferences/ProfilesPage.qml"));
  374. //Force refresh
  375. setPage(0);
  376. }
  377. onVisibleChanged:
  378. {
  379. if(!visible)
  380. {
  381. // When the dialog closes, switch to the General page.
  382. // This prevents us from having a heavy page like Setting Visiblity active in the background.
  383. setPage(0);
  384. }
  385. }
  386. }
  387. Connections
  388. {
  389. target: Cura.Actions.preferences
  390. onTriggered: preferences.visible = true
  391. }
  392. Connections
  393. {
  394. target: Cura.Actions.addProfile
  395. onTriggered:
  396. {
  397. preferences.setPage(4);
  398. preferences.show();
  399. // Create a new profile after a very short delay so the preference page has time to initiate
  400. createProfileTimer.start();
  401. }
  402. }
  403. Connections
  404. {
  405. target: Cura.Actions.configureMachines
  406. onTriggered:
  407. {
  408. preferences.visible = true;
  409. preferences.setPage(2);
  410. }
  411. }
  412. Connections
  413. {
  414. target: Cura.Actions.manageProfiles
  415. onTriggered:
  416. {
  417. preferences.visible = true;
  418. preferences.setPage(4);
  419. }
  420. }
  421. Connections
  422. {
  423. target: Cura.Actions.manageMaterials
  424. onTriggered:
  425. {
  426. preferences.visible = true;
  427. preferences.setPage(3)
  428. }
  429. }
  430. Connections
  431. {
  432. target: Cura.Actions.configureSettingVisibility
  433. onTriggered:
  434. {
  435. preferences.visible = true;
  436. preferences.setPage(1);
  437. preferences.getCurrentItem().scrollToSection(source.key);
  438. }
  439. }
  440. Timer
  441. {
  442. id: createProfileTimer
  443. repeat: false
  444. interval: 1
  445. onTriggered: preferences.getCurrentItem().createProfile()
  446. }
  447. // BlurSettings is a way to force the focus away from any of the setting items.
  448. // We need to do this in order to keep the bindings intact.
  449. Connections
  450. {
  451. target: Cura.MachineManager
  452. onBlurSettings:
  453. {
  454. forceActiveFocus()
  455. }
  456. }
  457. Menu
  458. {
  459. id: objectContextMenu;
  460. property variant objectId: -1;
  461. MenuItem { action: Cura.Actions.centerObject; }
  462. MenuItem { action: Cura.Actions.deleteObject; }
  463. MenuItem { action: Cura.Actions.multiplyObject; }
  464. MenuSeparator { }
  465. MenuItem { action: Cura.Actions.selectAll; }
  466. MenuItem { action: Cura.Actions.deleteAll; }
  467. MenuItem { action: Cura.Actions.reloadAll; }
  468. MenuItem { action: Cura.Actions.resetAllTranslation; }
  469. MenuItem { action: Cura.Actions.resetAll; }
  470. MenuSeparator { }
  471. MenuItem { action: Cura.Actions.groupObjects; }
  472. MenuItem { action: Cura.Actions.mergeObjects; }
  473. MenuItem { action: Cura.Actions.unGroupObjects; }
  474. Connections
  475. {
  476. target: Cura.Actions.deleteObject
  477. onTriggered:
  478. {
  479. if(objectContextMenu.objectId != 0)
  480. {
  481. Printer.deleteObject(objectContextMenu.objectId);
  482. objectContextMenu.objectId = 0;
  483. }
  484. }
  485. }
  486. Connections
  487. {
  488. target: Cura.Actions.multiplyObject
  489. onTriggered:
  490. {
  491. if(objectContextMenu.objectId != 0)
  492. {
  493. Printer.multiplyObject(objectContextMenu.objectId, 1);
  494. objectContextMenu.objectId = 0;
  495. }
  496. }
  497. }
  498. Connections
  499. {
  500. target: Cura.Actions.centerObject
  501. onTriggered:
  502. {
  503. if(objectContextMenu.objectId != 0)
  504. {
  505. Printer.centerObject(objectContextMenu.objectId);
  506. objectContextMenu.objectId = 0;
  507. }
  508. }
  509. }
  510. }
  511. Menu
  512. {
  513. id: contextMenu;
  514. MenuItem { action: Cura.Actions.selectAll; }
  515. MenuItem { action: Cura.Actions.deleteAll; }
  516. MenuItem { action: Cura.Actions.reloadAll; }
  517. MenuItem { action: Cura.Actions.resetAllTranslation; }
  518. MenuItem { action: Cura.Actions.resetAll; }
  519. MenuSeparator { }
  520. MenuItem { action: Cura.Actions.groupObjects; }
  521. MenuItem { action: Cura.Actions.mergeObjects; }
  522. MenuItem { action: Cura.Actions.unGroupObjects; }
  523. }
  524. Connections
  525. {
  526. target: UM.Controller
  527. onContextMenuRequested:
  528. {
  529. if(objectId == 0)
  530. {
  531. contextMenu.popup();
  532. } else
  533. {
  534. objectContextMenu.objectId = objectId;
  535. objectContextMenu.popup();
  536. }
  537. }
  538. }
  539. Connections
  540. {
  541. target: Cura.Actions.quit
  542. onTriggered: base.visible = false;
  543. }
  544. Connections
  545. {
  546. target: Cura.Actions.toggleFullScreen
  547. onTriggered: base.toggleFullscreen();
  548. }
  549. FileDialog
  550. {
  551. id: openDialog;
  552. //: File open dialog title
  553. title: catalog.i18nc("@title:window","Open file")
  554. modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
  555. selectMultiple: true
  556. nameFilters: UM.MeshFileHandler.supportedReadFileTypes;
  557. folder: CuraApplication.getDefaultPath("dialog_load_path")
  558. onAccepted:
  559. {
  560. //Because several implementations of the file dialog only update the folder
  561. //when it is explicitly set.
  562. var f = folder;
  563. folder = f;
  564. CuraApplication.setDefaultPath("dialog_load_path", folder);
  565. for(var i in fileUrls)
  566. {
  567. UM.MeshFileHandler.readLocalFile(fileUrls[i])
  568. if (i == fileUrls.length - 1)
  569. {
  570. var meshName = backgroundItem.getMeshName(fileUrls.toString())
  571. backgroundItem.hasMesh(decodeURIComponent(meshName))
  572. }
  573. }
  574. }
  575. }
  576. Connections
  577. {
  578. target: Cura.Actions.open
  579. onTriggered: openDialog.open()
  580. }
  581. EngineLog
  582. {
  583. id: engineLog;
  584. }
  585. Connections
  586. {
  587. target: Cura.Actions.showProfileFolder
  588. onTriggered:
  589. {
  590. var path = UM.Resources.getPath(UM.Resources.Preferences, "");
  591. if(Qt.platform.os == "windows") {
  592. path = path.replace(/\\/g,"/");
  593. }
  594. Qt.openUrlExternally(path);
  595. }
  596. }
  597. AddMachineDialog
  598. {
  599. id: addMachineDialog
  600. onMachineAdded:
  601. {
  602. machineActionsWizard.firstRun = addMachineDialog.firstRun
  603. machineActionsWizard.start(id)
  604. }
  605. }
  606. // Dialog to handle first run machine actions
  607. UM.Wizard
  608. {
  609. id: machineActionsWizard;
  610. title: catalog.i18nc("@title:window", "Add Printer")
  611. property var machine;
  612. function start(id)
  613. {
  614. var actions = Cura.MachineActionManager.getFirstStartActions(id)
  615. resetPages() // Remove previous pages
  616. for (var i = 0; i < actions.length; i++)
  617. {
  618. actions[i].displayItem.reset()
  619. machineActionsWizard.appendPage(actions[i].displayItem, catalog.i18nc("@title", actions[i].label));
  620. }
  621. //Only start if there are actions to perform.
  622. if (actions.length > 0)
  623. {
  624. machineActionsWizard.currentPage = 0;
  625. show()
  626. }
  627. }
  628. }
  629. MessageDialog
  630. {
  631. id: messageDialog
  632. modality: Qt.ApplicationModal
  633. onAccepted: Printer.messageBoxClosed(clickedButton)
  634. onApply: Printer.messageBoxClosed(clickedButton)
  635. onDiscard: Printer.messageBoxClosed(clickedButton)
  636. onHelp: Printer.messageBoxClosed(clickedButton)
  637. onNo: Printer.messageBoxClosed(clickedButton)
  638. onRejected: Printer.messageBoxClosed(clickedButton)
  639. onReset: Printer.messageBoxClosed(clickedButton)
  640. onYes: Printer.messageBoxClosed(clickedButton)
  641. }
  642. Connections
  643. {
  644. target: Printer
  645. onShowMessageBox:
  646. {
  647. messageDialog.title = title
  648. messageDialog.text = text
  649. messageDialog.informativeText = informativeText
  650. messageDialog.detailedText = detailedText
  651. messageDialog.standardButtons = buttons
  652. messageDialog.icon = icon
  653. messageDialog.visible = true
  654. }
  655. }
  656. Connections
  657. {
  658. target: Cura.Actions.addMachine
  659. onTriggered: addMachineDialog.visible = true;
  660. }
  661. AboutDialog
  662. {
  663. id: aboutDialog
  664. }
  665. Connections
  666. {
  667. target: Cura.Actions.about
  668. onTriggered: aboutDialog.visible = true;
  669. }
  670. Connections
  671. {
  672. target: Printer
  673. onRequestAddPrinter:
  674. {
  675. addMachineDialog.visible = true
  676. addMachineDialog.firstRun = false
  677. }
  678. }
  679. Timer
  680. {
  681. id: startupTimer;
  682. interval: 100;
  683. repeat: false;
  684. running: true;
  685. onTriggered:
  686. {
  687. if(!base.visible)
  688. {
  689. base.visible = true;
  690. restart();
  691. }
  692. else if(Cura.MachineManager.activeMachineId == null || Cura.MachineManager.activeMachineId == "")
  693. {
  694. addMachineDialog.open();
  695. }
  696. }
  697. }
  698. }