Debian Codegraph @

plugins/core/Standard/qCanupo/include/qCanupoDisclaimerDialog.h

raw
1 //##########################################################################
2 //# #
3 //# CLOUDCOMPARE PLUGIN: qCANUPO #
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: UEB (UNIVERSITE EUROPEENNE DE BRETAGNE) / CNRS #
15 //# #
16 //##########################################################################
17
18 #ifndef CANUPO_DISCLAIMER_DIALOG_HEADER
19 #define CANUPO_DISCLAIMER_DIALOG_HEADER
20
21 #include <ui_trainDisclaimerDlg.h>
22 #include <ui_classifyDisclaimerDlg.h>
23
24 //qCC_plugins
25 #include <ccMainAppInterface.h>
26
27 //Qt
28 #include <QMainWindow>
29
30 //! Dialog for displaying the CANUPO/UEB disclaimer
31 class TrainDisclaimerDialog : public QDialog, public Ui::TrainDisclaimerDialog
32 {
33 public:
34 //! Default constructor
35 TrainDisclaimerDialog(QWidget* parent = nullptr)
36 : QDialog(parent)
37 , Ui::TrainDisclaimerDialog()
38 {
39 setupUi(this);
40 }
41 };
42
43 //whether disclaimer has already been displayed (and accepted) or not
44 static bool s_trainDisclaimerAccepted = false;
45
46 static bool ShowTrainDisclaimer(ccMainAppInterface* app)
47 {
48 if (!s_trainDisclaimerAccepted)
49 {
50 //if the user "cancels" it, then he refuses the diclaimer!
51 s_trainDisclaimerAccepted = TrainDisclaimerDialog(app ? app->getMainWindow() : 0).exec();
52 }
53
54 return s_trainDisclaimerAccepted;
55 }
56
57 //! Dialog for displaying the CANUPO/UEB disclaimer
58 class ClassifyDisclaimerDialog : public QDialog, public Ui::ClassifyDisclaimerDialog
59 {
60 public:
61 //! Default constructor
62 ClassifyDisclaimerDialog(QWidget* parent = nullptr)
63 : QDialog(parent)
64 , Ui::ClassifyDisclaimerDialog()
65 {
66 setupUi(this);
67 }
68 };
69
70 //whether disclaimer has already been displayed (and accepted) or not
71 static bool s_classifyDisclaimerAccepted = false;
72
73 static bool ShowClassifyDisclaimer(ccMainAppInterface* app)
74 {
75 if (!s_classifyDisclaimerAccepted)
76 {
77 //if the user "cancels" it, then he refuses the diclaimer!
78 s_classifyDisclaimerAccepted = ClassifyDisclaimerDialog(app ? app->getMainWindow() : 0).exec();
79 }
80
81 return s_classifyDisclaimerAccepted;
82 }
83
84 #endif //CANUPO_DISCLAIMER_DIALOG_HEADER