Debian Codegraph @

plugins/core/Standard/qFacets/include/disclaimerDialog.h

raw
1 //##########################################################################
2 //# #
3 //# CLOUDCOMPARE PLUGIN: qFacets #
4 //# #
5 //# This program is free software; you can redistribute it and/or modify #
6 //# it under the terms of the GNU General Public License as published by #
7 //# the Free Software Foundation; version 2 or later of the License. #
8 //# #
9 //# This program is distributed in the hope that it will be useful, #
10 //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 //# GNU General Public License for more details. #
13 //# #
14 //# COPYRIGHT: Thomas Dewez, BRGM #
15 //# #
16 //##########################################################################
17
18 #ifndef QFACET_DISCLAIMER_DIALOG_HEADER
19 #define QFACET_DISCLAIMER_DIALOG_HEADER
20
21 #include <ui_disclaimerDlg.h>
22
23 //qCC_plugins
24 #include <ccMainAppInterface.h>
25
26 //Qt
27 #include <QMainWindow>
28
29 //! Dialog for displaying the BRGM disclaimer
30 class DisclaimerDialog : public QDialog, public Ui::DisclaimerDialog
31 {
32 public:
33 //! Default constructor
34 DisclaimerDialog(QWidget* parent = nullptr)
35 : QDialog(parent)
36 , Ui::DisclaimerDialog()
37 {
38 setupUi(this);
39 }
40 };
41
42 //whether disclaimer has already been displayed (and accepted) or not
43 static bool s_disclaimerAccepted = false;
44
45 static bool ShowDisclaimer(ccMainAppInterface* app)
46 {
47 if (!s_disclaimerAccepted)
48 {
49 //if the user "cancels" it, then he refuses the diclaimer!
50 s_disclaimerAccepted = DisclaimerDialog(app ? app->getMainWindow() : 0).exec();
51 }
52
53 return s_disclaimerAccepted;
54 }
55
56 #endif //QFACET_DISCLAIMER_DIALOG_HEADER