Browse Source

Merge pull request #16971 from Chocobo1/dialog

Move stacktrace dialog to gui folder
adaptive-webui-19844
Chocobo1 3 years ago committed by GitHub
parent
commit
88a91e0769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      src/app/CMakeLists.txt
  2. 7
      src/app/app.pri
  3. 4
      src/app/signalhandler.cpp
  4. 35
      src/app/stacktracedialog.ui
  5. 2
      src/base/bittorrent/torrentimpl.cpp
  6. 10
      src/gui/CMakeLists.txt
  7. 48
      src/gui/gui.pri
  8. 6
      src/gui/stacktracedialog.cpp
  9. 2
      src/gui/stacktracedialog.h
  10. 28
      src/gui/stacktracedialog.ui

15
src/app/CMakeLists.txt

@ -107,21 +107,6 @@ if (STACKTRACE) @@ -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)

7
src/app/app.pri

@ -23,12 +23,7 @@ stacktrace { @@ -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
}
}
}

4
src/app/signalhandler.cpp

@ -54,7 +54,7 @@ @@ -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 @@ -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

35
src/app/stacktracedialog.ui

@ -1,35 +0,0 @@ @@ -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>

2
src/base/bittorrent/torrentimpl.cpp

@ -2275,8 +2275,6 @@ nonstd::expected<lt::entry, QString> TorrentImpl::exportTorrent() const @@ -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

10
src/gui/CMakeLists.txt

@ -221,6 +221,16 @@ if (DBUS) @@ -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

48
src/gui/gui.pri

@ -163,26 +163,6 @@ SOURCES += \ @@ -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 += \ @@ -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
}

6
src/app/stacktracedialog.cpp → src/gui/stacktracedialog.cpp

@ -47,7 +47,7 @@ StacktraceDialog::~StacktraceDialog() @@ -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 @@ -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);
}

2
src/app/stacktracedialog.h → src/gui/stacktracedialog.h

@ -45,7 +45,7 @@ public: @@ -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;

28
src/gui/stacktracedialog.ui

@ -0,0 +1,28 @@ @@ -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>
Loading…
Cancel
Save