Browse Source

Remove central messageBox in favour of local box

The profile import/export was the only place where it was used, in our code base.

Contributes to issue CURA-8687.
Ghostkeeper 3 years ago
parent
commit
7f8591718d
3 changed files with 9 additions and 58 deletions
  1. 0 16
      cura/CuraApplication.py
  2. 0 29
      resources/qml/Cura.qml
  3. 9 13
      resources/qml/Preferences/ProfilesPage.qml

+ 0 - 16
cura/CuraApplication.py

@@ -675,22 +675,6 @@ class CuraApplication(QtApplication):
         self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing Active Machine..."))
         super().setGlobalContainerStack(stack)
 
-    showMessageBox = pyqtSignal(str,str, str, str, int, int,
-                                arguments = ["title", "text", "informativeText", "detailedText","buttons", "icon"])
-    """A reusable dialogbox"""
-
-    def messageBox(self, title, text,
-                   informativeText = "",
-                   detailedText = "",
-                   buttons = QMessageBox.Ok,
-                   icon = QMessageBox.NoIcon,
-                   callback = None,
-                   callback_arguments = []
-                   ):
-        self._message_box_callback = callback
-        self._message_box_callback_arguments = callback_arguments
-        self.showMessageBox.emit(title, text, informativeText, detailedText, buttons, icon)
-
     showDiscardOrKeepProfileChanges = pyqtSignal()
 
     def discardOrKeepProfileChanges(self) -> bool:

+ 0 - 29
resources/qml/Cura.qml

@@ -813,35 +813,6 @@ UM.MainWindow
         }
     }
 
-    MessageDialog
-    {
-        id: messageDialog
-        modality: Qt.ApplicationModal
-        onAccepted: CuraApplication.messageBoxClosed(clickedButton)
-        onApply: CuraApplication.messageBoxClosed(clickedButton)
-        onDiscard: CuraApplication.messageBoxClosed(clickedButton)
-        onHelp: CuraApplication.messageBoxClosed(clickedButton)
-        onNo: CuraApplication.messageBoxClosed(clickedButton)
-        onRejected: CuraApplication.messageBoxClosed(clickedButton)
-        onReset: CuraApplication.messageBoxClosed(clickedButton)
-        onYes: CuraApplication.messageBoxClosed(clickedButton)
-    }
-
-    Connections
-    {
-        target: CuraApplication
-        function onShowMessageBox(title, text, informativeText, detailedText, buttons, icon)
-        {
-            messageDialog.title = title
-            messageDialog.text = text
-            messageDialog.informativeText = informativeText
-            messageDialog.detailedText = detailedText
-            messageDialog.standardButtons = buttons
-            messageDialog.icon = icon
-            messageDialog.visible = true
-        }
-    }
-
     Component
     {
         id: discardOrKeepProfileChangesDialogComponent

+ 9 - 13
resources/qml/Preferences/ProfilesPage.qml

@@ -311,19 +311,8 @@ Item
         onAccepted:
         {
             var result = Cura.ContainerManager.importProfile(fileUrl);
+            messageDialog.title = catalog.i18nc("@title:window", "Import Profile")
             messageDialog.text = result.message;
-            if (result.status == "ok")
-            {
-                messageDialog.icon = StandardIcon.Information;
-            }
-            else if (result.status == "warning" || result.status == "duplicate")
-            {
-                messageDialog.icon = StandardIcon.Warning;
-            }
-            else
-            {
-                messageDialog.icon = StandardIcon.Critical;
-            }
             messageDialog.open();
             CuraApplication.setDefaultPath("dialog_profile_path", folder);
         }
@@ -344,7 +333,7 @@ Item
 
             if (result && result.status == "error")
             {
-                messageDialog.icon = StandardIcon.Critical;
+                messageDialog.title = catalog.i18nc("@title:window", "Export Profile")
                 messageDialog.text = result.message;
                 messageDialog.open();
             }
@@ -354,6 +343,13 @@ Item
         }
     }
 
+    //Dialogue box for showing the result of importing or exporting profiles.
+    UM.MessageDialog
+    {
+        id: messageDialog
+        standardButtons: Dialog.Ok
+    }
+
     Item
     {
         id: contentsItem