| 1 |
/*************************************************************************** |
| 2 |
* Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net> * |
| 3 |
* * |
| 4 |
* This file is part of the FreeCAD CAx development system. * |
| 5 |
* * |
| 6 |
* This library is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Library General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 |
* GNU Library General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Library General Public * |
| 17 |
* License along with this library; see the file COPYING.LIB. If not, * |
| 18 |
* write to the Free Software Foundation, Inc., 59 Temple Place, * |
| 19 |
* Suite 330, Boston, MA 02111-1307, USA * |
| 20 |
* * |
| 21 |
***************************************************************************/ |
| 22 |
|
| 23 |
#ifndef GUI_DLG_ABOUT_H |
| 24 |
#define GUI_DLG_ABOUT_H |
| 25 |
|
| 26 |
#include <QDialog> |
| 27 |
#include <QTextBrowser> |
| 28 |
#include <Gui/MDIView.h> |
| 29 |
#include <qlocale.h> |
| 30 |
|
| 31 |
namespace Gui |
| 32 |
{ |
| 33 |
namespace Dialog |
| 34 |
{ |
| 35 |
|
| 36 |
class Ui_AboutApplication; |
| 37 |
|
| 38 |
class GuiExport AboutDialogFactory |
| 39 |
{ |
| 40 |
public: |
| 41 |
AboutDialogFactory() = default; |
| 42 |
virtual ~AboutDialogFactory(); |
| 43 |
|
| 44 |
virtual QDialog* create(QWidget* parent) const; |
| 45 |
|
| 46 |
static const AboutDialogFactory* defaultFactory(); |
| 47 |
static void setDefaultFactory(AboutDialogFactory* factory); |
| 48 |
|
| 49 |
private: |
| 50 |
static AboutDialogFactory* factory; |
| 51 |
}; |
| 52 |
|
| 53 |
class GuiExport LicenseView: public Gui::MDIView |
| 54 |
{ |
| 55 |
Q_OBJECT |
| 56 |
|
| 57 |
public: |
| 58 |
explicit LicenseView(QWidget* parent = nullptr); |
| 59 |
~LicenseView() override; |
| 60 |
|
| 61 |
void setSource(const QUrl& url); |
| 62 |
const char* getName() const override |
| 63 |
{ |
| 64 |
return "LicenseView"; |
| 65 |
} |
| 66 |
|
| 67 |
private: |
| 68 |
QTextBrowser* browser; |
| 69 |
}; |
| 70 |
|
| 71 |
/** This widget provides the "About dialog" of an application. |
| 72 |
* This shows the current version, the build number and date. |
| 73 |
* \author Werner Mayer |
| 74 |
*/ |
| 75 |
class GuiExport AboutDialog: public QDialog |
| 76 |
{ |
| 77 |
Q_OBJECT |
| 78 |
|
| 79 |
public: |
| 80 |
explicit AboutDialog(QWidget* parent = nullptr); |
| 81 |
~AboutDialog() override; |
| 82 |
|
| 83 |
protected: |
| 84 |
void setupLabels(); |
| 85 |
void showCredits(); |
| 86 |
void showLicenseInformation(); |
| 87 |
QString getAdditionalLicenseInformation() const; |
| 88 |
void showLibraryInformation(); |
| 89 |
void showCollectionInformation(); |
| 90 |
void showPrivacyPolicy(); |
| 91 |
void showOrHideImage(const QRect& rect); |
| 92 |
void addModuleInfo(QTextStream& inout_str, const QString& modPath, bool& inout_first); |
| 93 |
|
| 94 |
protected: |
| 95 |
QPixmap aboutImage() const; |
| 96 |
virtual void copyToClipboard(); |
| 97 |
void linkActivated(const QUrl& link); |
| 98 |
|
| 99 |
private: |
| 100 |
Ui_AboutApplication* ui; |
| 101 |
}; |
| 102 |
|
| 103 |
} // namespace Dialog |
| 104 |
} // namespace Gui |
| 105 |
|
| 106 |
#endif // GUI_DLG_ABOUT_H |