Merge pull request #205 from shenlebantongying/staged

Add two basic "copy info" buttons to about dialog for easier bug reporting
This commit is contained in:
xiaoyifang 2022-11-19 18:53:37 +08:00 committed by GitHub
commit 892dab0410
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 89 additions and 4 deletions

View file

@ -2,12 +2,13 @@
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "about.hh" #include "about.hh"
#include <QPushButton>
#include <QtGui> #include <QtGui>
#include <QSysInfo> #include <QSysInfo>
#include "utils.hh" #include "utils.hh"
About::About( QWidget * parent ): QDialog( parent ) About::About( QWidget * parent, std::vector< sptr< Dictionary::Class > > * dictonaries ): QDialog( parent )
{ {
ui.setupUi( this ); ui.setupUi( this );
@ -40,6 +41,45 @@ About::About( QWidget * parent ): QDialog( parent )
#endif #endif
); );
// copy basic debug info to clipboard
connect(ui.copyInfoBtn, &QPushButton::clicked, [=]{
QGuiApplication::clipboard()->setText(
"Goldendict " + version + "\n" +
QSysInfo::productType() + " " + QSysInfo::kernelType() + " " + QSysInfo::kernelVersion() + " " +
"Qt " + QLatin1String(qVersion()) + " " +
QSysInfo::buildAbi() + "\n" +
compilerVersion + "\n"
+ "Flags:"
#ifdef USE_XAPIAN
+" USE_XAPIAN "
#endif
#ifdef MAKE_ZIM_SUPPORT
+" MAKE_ZIM_SUPPORT"
#endif
#ifdef MAKE_EXTRA_TIFF_HANDLER
+" MAKE_EXTRA_TIFF_HANDLER"
#endif
#ifdef NO_EPWING_SUPPORT
+" NO_EPWING_SUPPORT"
#endif
#ifdef MAKE_CHINESE_CONVERSION_SUPPORT
+" MAKE_CHINESE_CONVERSION_SUPPORT"
#endif
);
});
connect(ui.copyDictListBtn, &QPushButton::clicked, [=]{
QString tempDictList{};
for (auto dict : *dictonaries) {
tempDictList.append(QString::fromStdString(dict->getName() + "\n"));
}
QGuiApplication::clipboard()->setText(tempDictList);
});
QFile creditsFile( ":/CREDITS.txt" ); QFile creditsFile( ":/CREDITS.txt" );
if ( creditsFile.open( QFile::ReadOnly ) ) if ( creditsFile.open( QFile::ReadOnly ) )

View file

@ -5,14 +5,16 @@
#define ABOUT_HH #define ABOUT_HH
#include "ui_about.h" #include "ui_about.h"
#include "sptr.hh"
#include "dictionary.hh"
#include <QDialog> #include <QDialog>
#include <vector>
class About: public QDialog class About: public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
About( QWidget * parent, std::vector< sptr< Dictionary::Class > > * dictonaries);
About( QWidget * parent = 0 );
private: private:

View file

@ -115,6 +115,49 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="copyInfoBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Copy version info</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="copyDictListBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Copy dictionaries list</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View file

@ -3226,7 +3226,7 @@ void MainWindow::visitForum()
void MainWindow::showAbout() void MainWindow::showAbout()
{ {
About about( this ); About about(this, &dictionaries);
about.show(); about.show();
about.exec(); about.exec();