HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
gatelibrary_content_widget.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) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6 // Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 // SOFTWARE.
25 
26 #pragma once
27 
28 
29 #include <QAction>
30 #include <QFrame>
31 #include <QTableView>
32 #include <QMessageBox>
33 #include <QFileDialog>
36 
37 namespace hal
38 {
39  class GatelibraryTableModel;
40  class GatelibraryManager;
41  class Toolbar;
42  class Searchbar;
43 
48  {
49  Q_OBJECT
59 
60  friend class GateLibraryManager;
61 
62  QTableView* mTableView;
63  PinProxyModel* mPinProxyModel;
64  Searchbar* mSearchbar;
65  Toolbar* mToolbar;
66  QAction* mAddAction;
67  QAction* mEditAction;
68  QAction* mSearchAction;
69  QAction* mDeleteAction;
70 
71  QAction* mSaveAction;
72  QAction* mSaveAsAction;
73 
74  QString mDisabledIconStyle;
75  QString mEnabledIconStyle;
76  QString mAddTypeIconPath;
77  QString mEditTypeIconPath;
78  QString mSearchIconPath;
79  QString mSearchIconStyle;
80  QString mSearchActiveIconStyle;
81  QString mDeleteIconPath;
82  QString mDeleteIconStyle;
83 
84  bool mReadOnly = false;
85 
86  Q_SIGNALS:
91 
92  private Q_SLOTS:
93  void toggleSearchbar();
94  void handleEditAction();
95  void handleDeleteAction();
96  void handleCurrentSelectionChanged(QModelIndex prevIndex);
97  void handleDoubleClicked(QModelIndex index);
98  void handleUnsavedChanges();
99 
100  public Q_SLOTS:
101  void handleSaveAction();
102  void handleSaveAsAction();
103 
104  public:
106 
108 
109  void activate(bool readOnly = false);
110 
111  void toggleReadOnlyMode(bool readOnly);
112 
113  void toggleSelection(bool selected);
114 
115  void setGateLibrary(GateLibrary* gl);
116 
117  void setGateLibraryPath(std::filesystem::path p);
118 
119  QString disabledIconStyle() const;
120 
121  QString enabledIconStyle() const;
122 
123  QString addTypeIconPath() const;
124 
125  QString editTypeIconPath() const;
126 
127  QString searchIconPath() const;
128 
129  QString searchIconStyle() const;
130 
132 
133  QString deleteIconPath() const;
134 
135  QString deleteIconStyle() const;
136 
137  void setDisabledIconStyle(const QString& s);
138 
139  void setEnabledIconStyle(const QString& s);
140 
141  void setAddTypeIconPath(const QString& s);
142 
143  void setEditTypeIconPath(const QString& s);
144 
145  void setSearchIconPath(const QString& s);
146 
147  void setSearchIconStyle(const QString& s);
148 
149  void setSearchActiveIconStyle(const QString& s);
150 
151  void setDeleteIconPath(const QString& s);
152 
153  void setDeleteIconStyle(const QString& s);
154 
155  private:
156  GateLibrary* mGateLibrary;
157  std::filesystem::path mPath;
158  QString mTitle;
159  bool mCreationMode;
160 
161  bool initialize(GateLibrary* gateLibrary, bool readOnly); // only callable from friend
162  };
163 }
void setGateLibraryPath(std::filesystem::path p)
void triggerEditType(QModelIndex index)
void handleContextMenuRequested(const QPoint &pos)
void triggerCurrentSelectionChanged(QModelIndex index, QModelIndex prevIndex)
void triggerDoubleClicked(QModelIndex index)
GatelibraryContentWidget(GatelibraryTableModel *model, QWidget *parent=nullptr)
void triggerDeleteType(QModelIndex index)
A model to display loaded gatelibraries.
A proxy model to filter the ContextTableModel by a given string.
A QFrame with a QLineEdit that can be used to input a substring to search for.
Definition: searchbar.h:48
Toolbar for all ContentFrames and ContentWidgets.
Definition: toolbar.h:39
Definition: defines.h:45
void initialize()
Definition: event_log.cpp:302
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const