1
0

qml: properly destroy ExceptionDialog after close, improve encapsulation

This commit is contained in:
Sander van Grieken
2025-03-28 14:51:12 +01:00
parent 1d07895e8c
commit 1559129016
3 changed files with 16 additions and 17 deletions

View File

@@ -17,6 +17,7 @@ ElDialog
width: parent.width
height: parent.height
z: 1000 // assure topmost of all other dialogs
header: null
@@ -61,12 +62,12 @@ ElDialog
text: qsTr('Please briefly describe what led to the error (optional):')
}
TextArea {
id: user_text
Layout.fillWidth: true
Layout.fillHeight: true
background: Rectangle {
color: Qt.darker(Material.background, 1.25)
}
onTextChanged: AppController.setCrashUserText(text)
}
Label {
text: qsTr('Do you want to send this report?')
@@ -76,7 +77,7 @@ ElDialog
Layout.fillWidth: true
Layout.preferredWidth: 3
text: qsTr('Send Bug Report')
onClicked: AppController.sendReport()
onClicked: AppController.sendReport(user_text.text)
}
Button {
Layout.fillWidth: true
@@ -106,10 +107,9 @@ ElDialog
ElDialog {
property string reportText
z: 3000
width: parent.width
height: parent.height
z: 1001 // above root
header: null
@@ -125,6 +125,7 @@ ElDialog
width: parent.width
}
}
onClosed: destroy()
}
}

View File

@@ -423,6 +423,13 @@ ApplicationWindow
}
}
Component {
id: crashDialog
ExceptionDialog {
onClosed: destroy()
}
}
property alias channelOpenProgressDialog: _channelOpenProgressDialog
ChannelOpenProgressDialog {
id: _channelOpenProgressDialog
@@ -486,13 +493,6 @@ ApplicationWindow
width: parent.width
}
Component {
id: crashDialog
ExceptionDialog {
z: 1000
}
}
Component.onCompleted: {
coverTimer.start()

View File

@@ -303,12 +303,14 @@ class QEAppController(BaseCrashReporter, QObject):
self.exc_args = (e, text, tb) # for BaseCrashReporter
self.showException.emit(self.crashData())
@pyqtSlot()
def sendReport(self):
@pyqtSlot(str)
def sendReport(self, user_text: str):
self._crash_user_text = user_text
network = Network.get_instance()
proxy = network.proxy
def report_task():
self.logger.debug('starting report_task')
try:
response = BaseCrashReporter.send_report(self, network.asyncio_loop, proxy)
except Exception as e:
@@ -330,10 +332,6 @@ class QEAppController(BaseCrashReporter, QObject):
def showNever(self):
self.config.SHOW_CRASH_REPORTER = False
@pyqtSlot(str)
def setCrashUserText(self, text):
self._crash_user_text = text
def _get_traceback_str_to_display(self) -> str:
# The msg_box that shows the report uses rich_text=True, so
# if traceback contains special HTML characters, e.g. '<',