Merge pull request #16971 from Chocobo1/dialog

Move stacktrace dialog to gui folder
This commit is contained in:
Chocobo1 2022-05-03 10:56:41 +08:00 committed by GitHub
commit 88a91e0769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 73 additions and 84 deletions

View file

@ -107,21 +107,6 @@ if (STACKTRACE)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_sources(qbt_app PRIVATE stacktrace_win.h)
if (GUI)
qt_wrap_ui(STACKTRACE_UI_HEADERS stacktracedialog.ui)
target_sources(qbt_app PRIVATE
stacktracedialog.h
stacktracedialog.cpp
${STACKTRACE_UI_HEADERS}
)
# UI headers will be generated in ${CMAKE_CURRENT_BINARY_DIR}
target_include_directories(qbt_app PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)
endif()
# i686 arch on Windows requires frame pointer preservation
if (MSVC)
target_compile_options(qbt_app PRIVATE /Zi)

View file

@ -23,12 +23,7 @@ stacktrace {
unix {
HEADERS += $$PWD/stacktrace.h
}
else {
win32 {
HEADERS += $$PWD/stacktrace_win.h
!nogui {
HEADERS += $$PWD/stacktracedialog.h
SOURCES += $$PWD/stacktracedialog.cpp
FORMS += $$PWD/stacktracedialog.ui
}
}
}

View file

@ -54,7 +54,7 @@
#else
#include "stacktrace_win.h"
#ifndef DISABLE_GUI
#include "stacktracedialog.h"
#include "gui/stacktracedialog.h"
#endif // DISABLE_GUI
#endif // Q_OS_UNIX
#endif //STACKTRACE
@ -120,7 +120,7 @@ namespace
#if defined Q_OS_WIN && !defined DISABLE_GUI
StacktraceDialog dlg; // unsafe
dlg.setStacktraceString(QString::fromLatin1(sigName), straceWin::getBacktrace());
dlg.setText(QString::fromLatin1(sigName), straceWin::getBacktrace());
dlg.exec();
#endif

View file

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StacktraceDialog</class>
<widget class="QDialog" name="StacktraceDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Crash info</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextBrowser" name="errorText">
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -2275,8 +2275,6 @@ nonstd::expected<lt::entry, QString> TorrentImpl::exportTorrent() const
{
return nonstd::make_unexpected(QString::fromLocal8Bit(err.what()));
}
return nonstd::make_unexpected(tr("Unexpected error"));
}
nonstd::expected<QByteArray, QString> TorrentImpl::exportToBuffer() const

View file

@ -221,6 +221,16 @@ if (DBUS)
)
endif()
if (STACKTRACE)
qt_wrap_ui(STACKTRACE_UI_HEADERS stacktracedialog.ui)
target_sources(qbt_gui PRIVATE
stacktracedialog.h
stacktracedialog.cpp
${STACKTRACE_UI_HEADERS}
)
endif()
if ((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
target_sources(qbt_gui PRIVATE
programupdater.h

View file

@ -163,26 +163,6 @@ SOURCES += \
$$PWD/watchedfolderoptionsdialog.cpp \
$$PWD/watchedfoldersmodel.cpp
win32|macx {
HEADERS += $$PWD/programupdater.h
SOURCES += $$PWD/programupdater.cpp
}
unix:!macx:dbus {
HEADERS += \
$$PWD/powermanagement/powermanagement_x11.h \
$$PWD/qtnotify/notifications.h
SOURCES += \
$$PWD/powermanagement/powermanagement_x11.cpp \
$$PWD/qtnotify/notifications.cpp
}
macx {
HEADERS += $$PWD/macutilities.h
OBJECTIVE_SOURCES += $$PWD/macutilities.mm
}
FORMS += \
$$PWD/aboutdialog.ui \
$$PWD/addnewtorrentdialog.ui \
@ -215,3 +195,31 @@ FORMS += \
$$PWD/watchedfolderoptionsdialog.ui
RESOURCES += $$PWD/about.qrc
stacktrace {
!unix {
HEADERS += $$PWD/stacktracedialog.h
SOURCES += $$PWD/stacktracedialog.cpp
FORMS += $$PWD/stacktracedialog.ui
}
}
win32|macx {
HEADERS += $$PWD/programupdater.h
SOURCES += $$PWD/programupdater.cpp
}
unix:!macx:dbus {
HEADERS += \
$$PWD/powermanagement/powermanagement_x11.h \
$$PWD/qtnotify/notifications.h
SOURCES += \
$$PWD/powermanagement/powermanagement_x11.cpp \
$$PWD/qtnotify/notifications.cpp
}
macx {
HEADERS += $$PWD/macutilities.h
OBJECTIVE_SOURCES += $$PWD/macutilities.mm
}

View file

@ -47,7 +47,7 @@ StacktraceDialog::~StacktraceDialog()
delete m_ui;
}
void StacktraceDialog::setStacktraceString(const QString &sigName, const QString &trace)
void StacktraceDialog::setText(const QString &signalName, const QString &stacktrace)
{
// try to call Qt function as less as possible
const QString htmlStr = QStringLiteral(
@ -78,8 +78,8 @@ void StacktraceDialog::setStacktraceString(const QString &sigName, const QString
, Utils::Misc::opensslVersionString()
, Utils::Misc::zlibVersionString()
, Utils::Misc::osName()
, sigName
, trace);
, signalName
, stacktrace);
m_ui->errorText->setHtml(htmlStr);
}

View file

@ -45,7 +45,7 @@ public:
explicit StacktraceDialog(QWidget *parent = nullptr);
~StacktraceDialog() override;
void setStacktraceString(const QString &sigName, const QString &trace);
void setText(const QString &signalName, const QString &stacktrace);
private:
Ui::StacktraceDialog *m_ui;

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StacktraceDialog</class>
<widget class="QDialog" name="StacktraceDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Crash info</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextBrowser" name="errorText">
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>