HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
comment_item.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 
24 #pragma once
25 
26 #include <QFrame>
27 #include <QTextEdit>
28 
30 
31 
32 class QVBoxLayout;
33 class QHBoxLayout;
34 class QToolBar;
35 class QLabel;
36 class QAction;
37 class QToolButton;
38 
39 namespace hal
40 {
41  class CommentEntry;
42  class SearchableLabel;
43 
47  class CommentItem : public QFrame
48  {
49  Q_OBJECT
54  public:
55  CommentItem(QWidget* parent = nullptr);
56  CommentItem(CommentEntry* entry, QWidget* parent = nullptr);
57  ~CommentItem();
58 
59  void setComment(CommentEntry* entry);
60  void updateCurrentEntry();
61  bool search(const QString& string, SearchOptions searchOpts);
62 
64 
65  // properties
66  QString modifyCommentIconPath(){return mModifyCommentIconPath;}
67  void setModifyCommentIconPath(const QString& str){mModifyCommentIconPath = str;}
68  QString modifyCommentIconStyle(){return mModifyCommentIconStyle;}
69  void setModifyCommentIconStyle(const QString& str){mModifyCommentIconStyle = str;}
70 
71  QString deleteCommentIconPath(){return mDeleteCommentIconPath;}
72  void setDeleteCommentIconPath(const QString& str){mDeleteCommentIconPath = str;}
73  QString deleteCommentIconStyle(){return mDeleteCommentIconStyle;}
74  void setDeleteCommentIconStyle(const QString& str){mDeleteCommentIconStyle = str;}
75 
76  Q_SIGNALS:
77 
78  //perhaps the CommentEntry for which a delete is requested?
79  //Getter for CommentEntry needed
81 
82  private:
83  QVBoxLayout* mLayout;
84  CommentEntry* mEntry;
85 
86  QString mModifyCommentIconPath;
87  QString mModifyCommentIconStyle;
88  QString mDeleteCommentIconPath;
89  QString mDeleteCommentIconStyle;
90 
91  // header part (perhaps no toolbar but a layout with toolbuttons instead of actions?)
92  QToolBar* mTopToolbar;
93  SearchableLabel* mHeader;
94  QLabel* mCreationDate;
95  QAction* mModifyAction;
96  QAction* mDeleteAction;
97 
98  // header part v2
99  QWidget* mTopWidget;
100  QHBoxLayout* mTopLayout;
101  QToolButton* mModifyButton;
102  QToolButton* mDeleteButton;
103 
104  QTextEdit* mTextEdit;
105 
106  void init();
107 
108  void handleDeleteButtonTriggered();
109  void handleModifyButtonTriggered();
110  };
111 }
The CommentEntry class encapsulated information related to a comment.
Definition: comment_entry.h:43
QString deleteCommentIconStyle()
Definition: comment_item.h:73
void setComment(CommentEntry *entry)
void delete_requested(CommentItem *item)
bool search(const QString &string, SearchOptions searchOpts)
CommentItem(QWidget *parent=nullptr)
CommentEntry * getEntry()
void setDeleteCommentIconPath(const QString &str)
Definition: comment_item.h:72
QString deleteCommentIconPath()
Definition: comment_item.h:71
QString modifyCommentIconStyle()
Definition: comment_item.h:68
QString modifyCommentIconPath()
Definition: comment_item.h:66
void setDeleteCommentIconStyle(const QString &str)
Definition: comment_item.h:74
void setModifyCommentIconStyle(const QString &str)
Definition: comment_item.h:69
void setModifyCommentIconPath(const QString &str)
Definition: comment_item.h:67
void updateCurrentEntry()
Definition: defines.h:45
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const