HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
generalinfo_wizardpage.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 
30 
31 #include <QWizardPage>
32 #include <QGridLayout>
33 #include <QLabel>
34 #include <QLineEdit>
35 #include <QListView>
36 #include <QComboBox>
37 #include <QPushButton>
38 #include <QIcon>
39 #include <QAbstractTableModel>
40 #include <QSortFilterProxyModel>
41 
42 namespace hal {
47  {
48  Q_OBJECT
49  public:
54  {
56  bool isSelected;
57  };
58  private:
60  public:
61  ListPropertyModel(QObject* parent = nullptr);
62  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
63  int columnCount(const QModelIndex& index = QModelIndex()) const override { return 1; }
64  int rowCount(const QModelIndex& index = QModelIndex()) const override { return mList.size(); }
65  bool isSelected(int irow) const { return mList.at(irow).isSelected; }
66  GateTypeProperty property(int irow) const { return mList.at(irow).property; }
67  void setSelected(GateTypeProperty gtp, bool select);
68  };
69 
74  {
75  Q_OBJECT
76  bool mShowSelected;
77  public:
78  ListPropertyProxy(bool showSel, QObject* parent = nullptr);
79  bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent = QModelIndex()) const override;
80  };
81 
82  class GateLibraryWizard;
87  Q_OBJECT
88 
93  public:
94  GeneralInfoWizardPage(const GateLibrary* gt, QWidget* parent = nullptr);
95  void setData(QString name, const std::vector<GateTypeProperty>& properties);
96  QString getName();
98  bool isComplete() const override;
99  void initializePage() override;
100 
101  QString disabledIconStyle() const { return mDisabledIconStyle; }
102  QString enabledIconStyle() const { return mEnabledIconStyle; }
103  QString leftArrowIconPath() const { return mLeftArrowIconPath; }
104  QString rightArrowIconPath() const { return mRightArrowIconPath; }
105 
106  void setDisabledIconStyle (const QString& s) { mDisabledIconStyle = s; }
107  void setEnabledIconStyle (const QString& s) { mEnabledIconStyle = s; }
108  void setLeftArrowIconPath (const QString& p) { mLeftArrowIconPath = p; }
109  void setRightArrowIconPath(const QString& p) { mRightArrowIconPath = p; }
110 
111  private Q_SLOTS:
112  void addProperty();
113  void deleteProperty();
114  void handleNameChanged(const QString& txt);
115 
116  private:
117  GateLibraryWizard* mWizard;
118  QGridLayout* mLayout;
119  QLabel* mLabelName;
120 
121  QLineEdit* mName;
122  QListView* mPropertiesSelected;
123  QListView* mPropertiesAvailable;
124  ListPropertyModel* mPropertyModel;
125 
126  QPushButton* mDelBtn;
127  QPushButton* mAddBtn;
128 
129  QIcon mLeftArrowIcon;
130  QIcon mRightArrowIcon;
131 
132  const GateLibrary* mGateLibrary;
133  QString mNameInit;
134  QValidator* mValidator;
135 
136  QString mDisabledIconStyle;
137  QString mEnabledIconStyle;
138  QString mLeftArrowIconPath;
139  QString mRightArrowIconPath;
140  };
141 }
void setLeftArrowIconPath(const QString &p)
QList< GateTypeProperty > getProperties() const
void setDisabledIconStyle(const QString &s)
void setRightArrowIconPath(const QString &p)
GeneralInfoWizardPage(const GateLibrary *gt, QWidget *parent=nullptr)
void setEnabledIconStyle(const QString &s)
void setData(QString name, const std::vector< GateTypeProperty > &properties)
int rowCount(const QModelIndex &index=QModelIndex()) const override
bool isSelected(int irow) const
void setSelected(GateTypeProperty gtp, bool select)
int columnCount(const QModelIndex &index=QModelIndex()) const override
ListPropertyModel(QObject *parent=nullptr)
GateTypeProperty property(int irow) const
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
ListPropertyProxy(bool showSel, QObject *parent=nullptr)
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent=QModelIndex()) const override
Definition: defines.h:45
std::string name
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
const T & at(int i) const const
int size() const const
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SLOTSQ_SLOTS
QObject * parent() const const
DisplayRole
GateTypeProperty property
bool isSelected