mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Add "copy info" buttons to about dialog
This commit is contained in:
parent
4f10a55f95
commit
8d3b4165da
47
about.cc
47
about.cc
|
@ -2,12 +2,13 @@
|
|||
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||
|
||||
#include "about.hh"
|
||||
#include <QPushButton>
|
||||
#include <QtGui>
|
||||
#include <QSysInfo>
|
||||
|
||||
#include "utils.hh"
|
||||
|
||||
About::About( QWidget * parent ): QDialog( parent )
|
||||
About::About(std::vector< sptr< Dictionary::Class > > * dictonaries, QWidget * parent ): QDialog( parent )
|
||||
{
|
||||
ui.setupUi( this );
|
||||
|
||||
|
@ -40,6 +41,50 @@ About::About( QWidget * parent ): QDialog( parent )
|
|||
#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"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
+ "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
|
||||
#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" );
|
||||
|
||||
if ( creditsFile.open( QFile::ReadOnly ) )
|
||||
|
|
6
about.hh
6
about.hh
|
@ -5,14 +5,16 @@
|
|||
#define ABOUT_HH
|
||||
|
||||
#include "ui_about.h"
|
||||
#include "sptr.hh"
|
||||
#include "dictionary.hh"
|
||||
#include <QDialog>
|
||||
#include <vector>
|
||||
|
||||
class About: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
About( QWidget * parent = 0 );
|
||||
About(std::vector< sptr< Dictionary::Class > > * dictonaries, QWidget * parent = 0 );
|
||||
|
||||
private:
|
||||
|
||||
|
|
43
about.ui
43
about.ui
|
@ -115,6 +115,49 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -3224,7 +3224,7 @@ void MainWindow::visitForum()
|
|||
|
||||
void MainWindow::showAbout()
|
||||
{
|
||||
About about( this );
|
||||
About about(&dictionaries, this);
|
||||
|
||||
about.show();
|
||||
about.exec();
|
||||
|
|
Loading…
Reference in a new issue