11 #include <QHeaderView>
12 #include <QVBoxLayout>
29 mTableView->
setModel(mPinProxyModel);
48 mAddAction =
new QAction(
"Add gate type",
this);
49 mEditAction =
new QAction(
"Edit gate type",
this);
50 mDeleteAction =
new QAction(
"Delete gate type",
this);
51 mSearchAction =
new QAction(
"Search",
this);
79 bool GatelibraryContentWidget::initialize(
GateLibrary* gateLibrary,
bool readOnly)
90 QString title =
"Load gate library";
91 QString text =
"HAL Gate Library (*.hgl *.lib)";
93 QFile gldpath(
":/path/gate_library_definitions");
99 if (fileName ==
nullptr)
108 mGateLibrary = gateLibrary;
112 mGateLibrary =
new GateLibrary(std::filesystem::path(fileName.
toStdString()),
QFileInfo(fileName).baseName().toStdString());
121 mReadOnly = readOnly;
122 mGateLibrary = gateLibrary;
127 mPath = mGateLibrary->
get_path().generic_string();
157 void GatelibraryContentWidget::handleEditAction()
164 void GatelibraryContentWidget::handleDeleteAction()
171 void GatelibraryContentWidget::handleCurrentSelectionChanged(
QModelIndex prevIndex){
198 mCreationMode =
false;
203 std::filesystem::path oldPath = mGateLibrary->
get_path();
205 QFile gldpath(
":/path/gate_library_definitions");
213 QFileDialog fd(
this,
"Save as", path,
"HGL *.hgl");
230 mGateLibrary->
set_path(std::filesystem::path(mPath));
234 mGateLibrary->
set_name(gatelibName);
236 std::string p = mGateLibrary->
get_path().generic_string();
237 mCreationMode =
false;
240 void GatelibraryContentWidget::handleUnsavedChanges()
249 void GatelibraryContentWidget::toggleSearchbar()
273 mReadOnly = readOnly;
282 mReadOnly = readOnly;
304 return mDisabledIconStyle;
309 return mEnabledIconStyle;
314 return mAddTypeIconPath;
319 return mEditTypeIconPath;
324 return mSearchIconPath;
329 return mSearchIconStyle;
334 return mSearchActiveIconStyle;
339 return mDeleteIconPath;
344 return mDeleteIconStyle;
349 mDisabledIconStyle = s;
354 mEnabledIconStyle = s;
359 mAddTypeIconPath = s;
364 mEditTypeIconPath = s;
374 mSearchIconStyle = s;
379 mSearchActiveIconStyle = s;
389 mDeleteIconStyle = s;
static GateLibrary * loadGateLibrary(const QString &path)
bool isGatelibModified() const
std::filesystem::path get_path() const
void set_path(const std::filesystem::path &modified_path)
void set_name(const std::string &modified_name)
void setDeleteIconStyle(const QString &s)
void setGateLibraryPath(std::filesystem::path p)
void triggerEditType(QModelIndex index)
void handleContextMenuRequested(const QPoint &pos)
void triggerCurrentSelectionChanged(QModelIndex index, QModelIndex prevIndex)
QString searchIconStyle() const
void handleSaveAsAction()
QString editTypeIconPath() const
void triggerDoubleClicked(QModelIndex index)
void setSearchActiveIconStyle(const QString &s)
void toggleReadOnlyMode(bool readOnly)
QString searchIconPath() const
void setDeleteIconPath(const QString &s)
QString deleteIconPath() const
GatelibraryContentWidget(GatelibraryTableModel *model, QWidget *parent=nullptr)
void setEditTypeIconPath(const QString &s)
QString deleteIconStyle() const
QString disabledIconStyle() const
void setSearchIconStyle(const QString &s)
void triggerDeleteType(QModelIndex index)
void setDisabledIconStyle(const QString &s)
QString enabledIconStyle() const
void setEnabledIconStyle(const QString &s)
void activate(bool readOnly=false)
void setAddTypeIconPath(const QString &s)
void toggleSelection(bool selected)
QString addTypeIconPath() const
void setGateLibrary(GateLibrary *gl)
void setSearchIconPath(const QString &s)
QString searchActiveIconStyle() const
A model to display loaded gatelibraries.
void loadFeature(FacExtensionInterface::Feature ft, const QString &extension=QString())
const GateLibrary * get_gate_library() const
A proxy model to filter the ContextTableModel by a given string.
GuiPluginTable * mGuiPluginTable
virtual void startSearch(QString text, int options)=0
A QFrame with a QLineEdit that can be used to input a substring to search for.
void setColumnNames(QList< QString > list)
void triggerNewSearch(const QString &text, int searchOptions)
bool save(std::filesystem::path file_path, GateLibrary *gate_lib, bool overwrite=false)
QIcon getStyledSvgIcon(const QString &from_to_colors_enabled, const QString &svg_path, QString from_to_colors_disabled=QString())
PluginRelay * gPluginRelay
FileStatusManager * gFileStatusManager
QModelIndex currentIndex() const const
void doubleClicked(const QModelIndex &index)
void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior)
void setSelectionMode(QAbstractItemView::SelectionMode mode)
QItemSelectionModel * selectionModel() const const
bool isEnabled() const const
void setIcon(const QIcon &icon)
void triggered(bool checked)
virtual bool open(QIODevice::OpenMode mode) override
void setAcceptMode(QFileDialog::AcceptMode mode)
void setDefaultSuffix(const QString &suffix)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
QStringList selectedFiles() const const
void setFrameStyle(int style)
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
bool isValid() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const const override
virtual void setSourceModel(QAbstractItemModel *sourceModel) override
QString fromStdString(const std::string &str)
QString fromUtf8(const char *str, int size)
bool isEmpty() const const
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
QString left(int n) const const
QString mid(int position, int n) const const
std::string toStdString() const const
virtual void polish(QWidget *widget)
virtual void unpolish(QWidget *widget)
void sortByColumn(int column)
virtual QModelIndex indexAt(const QPoint &pos) const const override
virtual void setModel(QAbstractItemModel *model) override
void setSortingEnabled(bool enable)