Mercurial > trustbridge
annotate ui/certificateitemwidget.h @ 1387:c64b6c56ce96 0.9.8
(issue95) Change keys for release build. Fix release build usage.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 15 Jan 2015 16:46:36 +0100 |
parents | d2b32c75efcf |
children |
rev | line source |
---|---|
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 * |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=2) |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 * See LICENSE.txt for details. |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 */ |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 #ifndef CERTIFICATELISTITEM_H |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 #define CERTIFICATELISTITEM_H |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 /** |
1053
78798d3af8f0
Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1011
diff
changeset
|
11 * @file certificateitemwidget.h |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 * @brief Item delegate drawing custom certificate items in list views. |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 * |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 */ |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 #include <QWidget> |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 #include <QLabel> |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
17 #include <QToolButton> |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 #include "certificate.h" |
701
31c3d2bc9880
(Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
687
diff
changeset
|
20 |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
21 /** @brief A tool button that always looks as if it were unchecked. */ |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
22 class CheckLessToolBtn : public QToolButton |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
23 { |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
24 void paintEvent(QPaintEvent * pe); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
25 }; |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
27 /** @brief Item delegate drawing custom certificate items in list views.*/ |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 class CertificateItemWidget : public QWidget |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 { |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
30 Q_OBJECT |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 public: |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
32 /** @brief ctor of the widget |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
33 * |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
34 * @param [in] parent the parent of the widget |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
35 * @param [in] cert the certificate to hold. |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
36 * @param [in] state wether or not the action of the certificate should be done. |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
37 * @param [in] btn the button used to manage the state of the cert.*/ |
638
9d806f140bd5
Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
38 CertificateItemWidget( |
9d806f140bd5
Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
39 QWidget *parent = 0, |
9d806f140bd5
Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
40 const Certificate &cert = Certificate(), |
9d806f140bd5
Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
41 bool state = false, |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
42 QToolButton * btn = NULL); |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
44 bool state(); |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
45 /** @brief set the state of the certificate. |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
46 * |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
47 * A false state means that the certificate action (install or remove) |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
48 * should not be executed. |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
49 * |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
50 * @param [in] state the state of the certificate |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
51 **/ |
638
9d806f140bd5
Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
52 void setState(bool state); |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
53 |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
54 /** @brief Obtain a copy of the certificate that is shown in the widget. |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
55 * |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
56 * @returns A copy of the hold certificate. |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
57 **/ |
1108
9bb9932bb819
Revert commit 1101 the inactive manual changes were a bad idea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1106
diff
changeset
|
58 Certificate certificate(); |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
59 |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 private: |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 void setupGUI(); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 Certificate mCertificate; |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
64 bool mOriginalState; |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
65 QToolButton *mButton; |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
66 |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
67 private slots: |
1288
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
68 /** @brief called when the certificate state has been changed */ |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
69 void currentStateChanged(bool state); |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
70 |
1288
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
71 /** @brief Used to open the native cert dialog of the certificate */ |
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
72 void showCertDlg(); |
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1255
diff
changeset
|
73 |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
74 signals: |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
75 void stateChanged(bool state, const Certificate &cert); |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 }; |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 #endif |