10 #include <QHBoxLayout>
12 #include <QPushButton>
14 #include <QFileDialog>
41 mWarningMsg =
new QLabel(
this);
48 mWarningMsg->
setText(
"Gate library '" + defaultGl +
"' not found,\nplease select gate library from list.");
54 mWarningMsg->
setText(
"Gate library '" + defaultGl +
"' not found,\na substitute has been suggested.");
65 if (mWarningMsg->
text().isEmpty())
68 mCheckFullPath =
new QCheckBox(
"Show full path");
75 void GateLibrarySelection::handleGatelibIndexChanged(
int inx)
82 void GateLibrarySelection::handleInvokeFileDialog()
85 if (glFilename.
isEmpty())
return;
86 int inx =
static_cast<GateLibrarySelectionTable*
>(mComboGatelib->
model())->addGateLibrary(glFilename);
96 void GateLibrarySelection::handleShowFullPath(
bool checked)
117 if (mCount <= 0)
return mName;
119 case 1:
return mPath;
148 return mEntries.size();
165 if (glse.path() == path)
return inx;
166 nameMap[glse.name()]++;
182 if (glse.path() == path)
return inx;
195 if (glse.name() ==
name)
197 log_info(
"gui",
"Requested gate library '{}' not found, suggest '{}' instead.", path.
toStdString(), glse.path().toStdString());
198 mWarnSubstitute =
true;
211 if (inx < 0 || inx >= mEntries.size())
return QString();
212 return mEntries.at(inx).path();
218 mShowFullPath = checked;
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed or on behalf of
QVariant data(int column, bool fullPath) const
QString gateLibraryPath() const
GateLibrarySelection(const QString &defaultGl, QWidget *parent=nullptr)
void handleShowFullPath(bool checked)
bool isWarnSubstitute() const
int columnCount(const QModelIndex &index=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
int addGateLibrary(const QString &path)
int getIndexByPath(const QString &path)
GateLibrarySelectionTable(bool addAutoDetect, QObject *parent=nullptr)
int rowCount(const QModelIndex &index=QModelIndex()) const override
QString gateLibraryPath(int inx) const
#define log_info(channel,...)
std::vector< std::filesystem::path > get_all_path()
QIcon getStyledSvgIcon(const QString &from_to_colors_enabled, const QString &svg_path, QString from_to_colors_disabled=QString())
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
void addLayout(QLayout *layout, int stretch)
void setCurrentIndex(int index)
void currentIndexChanged(int index)
QAbstractItemModel * model() const const
void setModel(QAbstractItemModel *model)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
QString fileName() const const
void setFrameStyle(int style)
void setText(const QString &)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setObjectName(const QString &name)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString fromStdString(const std::string &str)
bool isEmpty() const const
std::string toStdString() const const
virtual void polish(QWidget *widget)
virtual void unpolish(QWidget *widget)