# Path: qcrash/_forms/dlg_report_bug_ui.py
# class Ui_Dialog(object):
#     def setupUi(self, Dialog):
#     def retranslateUi(self, Dialog):
# 
# Path: qcrash/_dialogs/review.py
# class DlgReview(QtWidgets.QDialog):
#     """
#     Dialog for reviewing the final report.
#     """
#     def __init__(self, content, log, parent, window_icon):
#         """
#         :param content: content of the final report, before review
#         :param parent: parent widget
#         """
#         super(DlgReview, self).__init__(parent)
#         self.ui = dlg_review_ui.Ui_Dialog()
#         self.ui.setupUi(self)
#         self.ui.tabWidget.setCurrentIndex(0)
#         self.ui.edit_main.setPlainText(content)
#         self.ui.edit_main.installEventFilter(self)
#         self.ui.edit_log.installEventFilter(self)
#         self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
#         self.setWindowIcon(
#             QtGui.QIcon.fromTheme('document-edit')
#             if window_icon is None else window_icon)
#         if log:
#             self.ui.edit_log.setPlainText(log)
#         else:
#             self.ui.tabWidget.tabBar().hide()
#         self.ui.edit_main.setFocus()
# 
#     def eventFilter(self, obj, event):
#         interesting_objects = [self.ui.edit_log, self.ui.edit_main]
#         if obj in interesting_objects and event.type() == QtCore.QEvent.KeyPress:
#             if event.key() == QtCore.Qt.Key_Return and \
#                     event.modifiers() & QtCore.Qt.ControlModifier:
#                 self.accept()
#                 return True
#         return False
# 
#     @classmethod
#     def review(cls, content, log, parent, window_icon):  # pragma: no cover
#         """
#         Reviews the final bug report.
# 
#         :param content: content of the final report, before review
#         :param parent: parent widget
# 
#         :returns: the reviewed report content or None if the review was
#                   canceled.
#         """
#         dlg = DlgReview(content, log, parent, window_icon)
#         if dlg.exec_():
#             return dlg.ui.edit_main.toPlainText(), \
#                 dlg.ui.edit_log.toPlainText()
#         return None, None


import logging
from qcrash._forms import dlg_report_bug_ui
from qcrash.qt import QtCore, QtGui, QtWidgets
from qcrash._dialogs.review import DlgReview
        from qcrash import api
            self.buttons.append(bt)
        self._enable_buttons()

    def _enable_buttons(self, *_):
        title = str(self.ui.lineEditTitle.text()).strip()
        desc = str(self.ui.plainTextEditDesc.toPlainText()).strip()
        enable = title != '' and desc != ''
        for bt in self.buttons:
            bt.setEnabled(enable)

    def _on_button_clicked(self):
        bt = self.sender()
        description = self.ui.plainTextEditDesc.toPlainText()
        backend = bt.backend
        backend.parent_widget = self
        title = backend.formatter.format_title(
            str(self.ui.lineEditTitle.text()))

        sys_info = None
        if self.ui.cb_include_sys_info.isChecked():
            sys_info = api.get_system_information()

        log = None
        if self.ui.cb_include_application_log.isChecked():
            log = api.get_application_log()

        body = backend.formatter.format_body(
            str(description), sys_info, self._traceback)

        if backend.need_review:  # pragma: no cover

# Path: qcrash/_forms/dlg_report_bug_ui.py
# class Ui_Dialog(object):
#     def setupUi(self, Dialog):
#     def retranslateUi(self, Dialog):
# 
# Path: qcrash/_dialogs/review.py
# class DlgReview(QtWidgets.QDialog):
#     """
#     Dialog for reviewing the final report.
#     """
#     def __init__(self, content, log, parent, window_icon):
#         """
#         :param content: content of the final report, before review
#         :param parent: parent widget
#         """
#         super(DlgReview, self).__init__(parent)
#         self.ui = dlg_review_ui.Ui_Dialog()
#         self.ui.setupUi(self)
#         self.ui.tabWidget.setCurrentIndex(0)
#         self.ui.edit_main.setPlainText(content)
#         self.ui.edit_main.installEventFilter(self)
#         self.ui.edit_log.installEventFilter(self)
#         self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
#         self.setWindowIcon(
#             QtGui.QIcon.fromTheme('document-edit')
#             if window_icon is None else window_icon)
#         if log:
#             self.ui.edit_log.setPlainText(log)
#         else:
#             self.ui.tabWidget.tabBar().hide()
#         self.ui.edit_main.setFocus()
# 
#     def eventFilter(self, obj, event):
#         interesting_objects = [self.ui.edit_log, self.ui.edit_main]
#         if obj in interesting_objects and event.type() == QtCore.QEvent.KeyPress:
#             if event.key() == QtCore.Qt.Key_Return and \
#                     event.modifiers() & QtCore.Qt.ControlModifier:
#                 self.accept()
#                 return True
#         return False
# 
#     @classmethod
#     def review(cls, content, log, parent, window_icon):  # pragma: no cover
#         """
#         Reviews the final bug report.
# 
#         :param content: content of the final report, before review
#         :param parent: parent widget
# 
#         :returns: the reviewed report content or None if the review was
#                   canceled.
#         """
#         dlg = DlgReview(content, log, parent, window_icon)
#         if dlg.exec_():
#             return dlg.ui.edit_main.toPlainText(), \
#                 dlg.ui.edit_log.toPlainText()
#         return None, None


# Path: qcrash/_dialogs/report.py
import logging
from qcrash._forms import dlg_report_bug_ui
from qcrash.qt import QtCore, QtGui, QtWidgets
from qcrash._dialogs.review import DlgReview
        from qcrash import api

            self.buttons.append(bt)
        self._enable_buttons()

    def _enable_buttons(self, *_):
        title = str(self.ui.lineEditTitle.text()).strip()
        desc = str(self.ui.plainTextEditDesc.toPlainText()).strip()
        enable = title != '' and desc != ''
        for bt in self.buttons:
            bt.setEnabled(enable)

    def _on_button_clicked(self):
        bt = self.sender()
        description = self.ui.plainTextEditDesc.toPlainText()
        backend = bt.backend
        backend.parent_widget = self
        title = backend.formatter.format_title(
            str(self.ui.lineEditTitle.text()))

        sys_info = None
        if self.ui.cb_include_sys_info.isChecked():
            sys_info = api.get_system_information()

        log = None
        if self.ui.cb_include_application_log.isChecked():
            log = api.get_application_log()

        body = backend.formatter.format_body(
            str(description), sys_info, self._traceback)

        if backend.need_review:  # pragma: no cover

            body, log = DlgReview.review(body, log, self, self.window_icon)