HAL  v4.5.0-313-g29bd89cc0
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
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 #include "gui/widget/widget.h"
29 
30 #include <QIcon>
31 #include <QList>
32 
33 class QShortcut;
34 class QVBoxLayout;
35 
36 namespace hal
37 {
38  class ContentAnchor;
39  class ContentFrame;
40  class Toolbar;
41 
50  class ContentWidget : public Widget
51  {
52  Q_OBJECT
55 
56  public:
63  explicit ContentWidget(QString name, QWidget* parent = nullptr);
64 
71  virtual void setupToolbar(Toolbar* Toolbar);
72 
80 
89  void ensureShortcuts();
90 
96  void repolish();
97 
103  QString name() const;
104 
110  QIcon icon() const;
111 
117  void setAnchor(ContentAnchor* anchor);
118 
124  void setIcon(QIcon icon);
125 
132  void set_name(const QString& name);
133 
137 
143  QString iconStyle();
144 
150  QString iconPath();
152 
156 
162  void setIconStyle(const QString& style);
163 
169  void setIconPath(const QString& path);
171 
172  Q_SIGNALS:
173 
177  void removed();
178 
182  void detached();
183 
187  void reattached();
188 
192  void opened();
193 
197  void closed();
198 
204  void name_changed(const QString& name);
205 
206  public Q_SLOTS:
207 
211  void remove();
212 
216  void detach();
217 
221  void reattach();
222 
226  void open();
227 
231  void close();
232 
240 
244  virtual void restoreFromProject() {;}
245 
249  ContentFrame* detachedFrame() const;
250 
255  void setDetachedFrame(ContentFrame* df);
256 
257  private:
258  void closeEvent(QCloseEvent* event);
259 
260  QString mName;
261  QIcon mIcon;
262  ContentAnchor* mAnchor = nullptr;
263 
264  QString mIconStyle;
265  QString mIconPath;
266  bool mShortcutsCreated = false;
267 
268  protected:
274  };
275 }
An abstract class that provides the interface for specific anchors (see SplitterAnchor or TabWidget )...
Wraps the ContentWidget class.
Definition: content_frame.h:45
Abstract class for Widgets within HAL's ContentArea.
virtual void setupToolbar(Toolbar *Toolbar)
QKeySequence mSearchKeysequence
QString name() const
virtual void restoreFromProject()
void set_name(const QString &name)
void setIconPath(const QString &path)
ContentFrame * mDetachedFrame
void setAnchor(ContentAnchor *anchor)
QIcon icon() const
QShortcut * mSearchShortcut
void name_changed(const QString &name)
void setIconStyle(const QString &style)
void handleSearchKeysequenceChanged(QKeySequence seq)
void setDetachedFrame(ContentFrame *df)
ContentWidget(QString name, QWidget *parent=nullptr)
ContentFrame * detachedFrame() const
void setIcon(QIcon icon)
virtual QList< QShortcut * > createShortcuts()
QVBoxLayout * mContentLayout
Toolbar for all ContentFrames and ContentWidgets.
Definition: toolbar.h:39
A QWidget customized for hal.
Definition: widget.h:42
Definition: defines.h:45
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
virtual bool event(QEvent *event) override
QStyle * style() const const