HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
dot_viewer.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").
7 // All Rights reserved.
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included in all
17 // copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 // SOFTWARE.
26 
27 #pragma once
28 
29 #include "hal_core/defines.h"
31 
32 #include <mutex>
33 #include <string>
34 #include <vector>
35 #include <QObject>
36 
37 class QGVScene;
38 
39 namespace hal
40 {
41  class Netlist;
42  class Toolbar;
43 }
44 
45 namespace hal
46 {
47  class DotGraphicsView;
48 
53  {
54  Q_OBJECT
55  public:
62  DotViewer(const QString &pluginName, QObject* parent = nullptr);
63 
64  ~DotViewer();
65 
71  void setupToolbar(Toolbar* toolbar);
72 
76  void disableInteractions();
77 
83  static DotViewer* getDotviewerInstance();
84 
90  QString filename() const { return mFilename; }
91 
97  QString creatorPlugin() const { return mCreatorPlugin; }
98 
106  bool loadDotFile(const QString& fileName, const QString& creator = QString());
107 
108  public Q_SLOTS:
116  void handleOpenInputFileByName(const QString& fileName, const QString& creator = QString());
117 
118  private Q_SLOTS:
122  void handleOpenInputFileDialog();
123 
127  void handleToggleGrid();
128 
132  void handleColorSelect();
133 
139  void handleStyleChanged(int istyle);
140 
141  private:
143  QGVScene* mDotScene;
144 
146  DotGraphicsView* mDotGraphicsView;
147 
149  QAction* mOpenInputfileAction;
150 
152  QAction* mToggleGridAction;
153 
155  QAction* mColorSelectAction;
156 
158  QString mFilename;
159 
161  QString mCreatorPlugin;
162  };
163 
168  {
169  Q_OBJECT
170  public:
177 
186  bool openInputFileByName(DotViewer* callee, QString filename, QString plugin);
187 
188  Q_SIGNALS:
195  void callOpenInputFileByName(QString filename, QString plugin);
196  };
197 } // namespace hal
#define NETLIST_API
Definition: arch_linux.h:30
bool openInputFileByName(DotViewer *callee, QString filename, QString plugin)
Definition: dot_viewer.cpp:211
DotViewerCallFromThread(QObject *parent=nullptr)
Definition: dot_viewer.h:176
void callOpenInputFileByName(QString filename, QString plugin)
QString creatorPlugin() const
Definition: dot_viewer.h:97
QString filename() const
Definition: dot_viewer.h:90
Toolbar for all ContentFrames and ContentWidgets.
Definition: toolbar.h:39
Definition: defines.h:45
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const