TagPage::TagPage(QWidget* parent) : FilterPage(parent) { _layoutTop = new QVBoxLayout(this); _layoutAnd = new QHBoxLayout; _radioAnd = new QRadioButton("And", this); _radioOr = new QRadioButton("Or", this); _radioOr->setChecked(true); QButtonGroup* buttonGroup = new QButtonGroup(this); buttonGroup->addButton(_radioAnd); buttonGroup->addButton(_radioOr); _layoutAnd->addWidget(_radioAnd); _layoutAnd->addWidget(_radioOr); _btShowAll = new QPushButton(tr("Show all"), this); _layoutTop->addWidget(_btShowAll); _layoutTags = new QVBoxLayout; _layoutTop->addLayout(_layoutAnd); _layoutTop->addLayout(_layoutTags); connect(_btShowAll, SIGNAL(clicked()), SLOT(onShowAll())); connect(_radioAnd, SIGNAL(clicked()), SLOT(onTagChecked())); connect(_radioOr, SIGNAL(clicked()), SLOT(onTagChecked())); }
//----------------------------------------------------------------------------- // Function: BusIfPortmapTab::BusIfPortmapTab() //----------------------------------------------------------------------------- BusIfPortmapTab::BusIfPortmapTab( LibraryInterface* libHandler, QSharedPointer<Component> component, BusInterface* busif, QWidget* parent ): QWidget(parent), busif_(busif), component_(component), libHandler_(libHandler), model_(busif, component, libHandler, this), view_(this), logicalView_(this), logicalModel_(libHandler, &model_, this), mappingLabel_(tr("Bit-field mapping"),this), mappingView_(component, this), mappingProxy_(this), mappingModel_(busif, component, libHandler, this), physicalView_(this), physProxy_(component, this), physModel_(component, &model_, this), cleanButton_(QIcon(":/icons/common/graphics/cleanup.png"), tr("Clean up"), this), connectButton_(QIcon(":/icons/common/graphics/connect.png"), tr("Connect"), this), showAllButton_(tr("Show all ports in component"), this), showHideMappingButton_(tr("Show bit-field mapping"),this), nameFilterEditor_(new QLineEdit(this)), inButton_(QIcon(":/icons/common/graphics/control-180.png"), "", this), outButton_(QIcon(":/icons/common/graphics/control.png"), "", this), hideConnectedBox_(tr("Hide connected ports"), this), portSet_() { view_.setModel(&model_); view_.setItemDelegate(new PortMapsDelegate(this)); mappingView_.setDragDropMode(QAbstractItemView::DropOnly); mappingView_.setAcceptDrops(true); mappingProxy_.setSourceModel(&mappingModel_); mappingView_.setModel(&mappingProxy_); mappingLabel_.hide(); mappingView_.hide(); // Set view to be sortable. mappingProxy_.setSortCaseSensitivity(Qt::CaseInsensitive); mappingView_.setSortingEnabled(true); mappingView_.sortByColumn(BitMappingModel::INDEX, Qt::AscendingOrder); hideConnectedBox_.setCheckState(Qt::Checked); // Set the sources for views. logicalView_.setModel(&logicalModel_); physProxy_.setSourceModel(&physModel_); physicalView_.setModel(&physProxy_); // Remove the ports from the port lists that are already mapped. logicalModel_.removePorts(model_.logicalPorts()); setupLayout(); // By default, show all button is not visible, but setting physical ports sets visible. showAllButton_.setVisible(false); inButton_.setToolTip(tr("Filter ports by direction in")); outButton_.setToolTip(tr("Filter ports by direction out")); nameFilterEditor_->setToolTip(tr("Filter ports by name")); setTabOrder(&inButton_, &outButton_); setTabOrder(&outButton_, nameFilterEditor_); setTabOrder(nameFilterEditor_, &physicalView_); // Connect signals from model. connect(&model_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection); connect(&model_, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SIGNAL(contentChanged()), Qt::UniqueConnection); connect(&model_, SIGNAL(errorMessage(const QString&)), this, SIGNAL(errorMessage(const QString&)), Qt::UniqueConnection); connect(&model_, SIGNAL(noticeMessage(const QString&)), this, SIGNAL(noticeMessage(const QString&)), Qt::UniqueConnection); connect(&model_, SIGNAL(logicalRemoved(const QString&)), &logicalModel_, SLOT(addPort(const QString&)), Qt::UniqueConnection); connect(&model_, SIGNAL(logicalRemoved(const QString&)), &mappingModel_, SLOT(onRemoveMapping(const QString&)), Qt::UniqueConnection); connect(&model_, SIGNAL(logicalRestored(const QString&)), &logicalModel_, SLOT(addPort(const QString&)), Qt::UniqueConnection); connect(&model_, SIGNAL(logicalRestored(const QString&)), &logicalView_, SLOT(onPortRestored(const QString&)), Qt::UniqueConnection); connect(&model_, SIGNAL(physicalRemoved(const QString&)), &physModel_, SLOT(addPort(const QString&)), Qt::UniqueConnection); connect(&model_, SIGNAL(physicalRemoved(const QString&)), &physProxy_, SLOT(onPortDisconnected(const QString&)), Qt::UniqueConnection); // Connect signals from logical view. connect(&logicalView_, SIGNAL(removeItem(const QModelIndex&)), &logicalModel_, SLOT(removeItem(const QModelIndex&)), Qt::UniqueConnection); connect(&logicalView_, SIGNAL(removeItems(const QModelIndexList&)), &logicalModel_, SLOT(removeItems(const QModelIndexList&)), Qt::UniqueConnection); connect(&logicalView_, SIGNAL(makeConnection(const QStringList&, const QStringList&)), this, SLOT(onMakeConnections(const QStringList&, const QStringList&)), Qt::UniqueConnection); connect(&logicalView_, SIGNAL(moveItems(const QStringList&, const QModelIndex&)), &logicalModel_, SLOT(onMoveItems(const QStringList&, const QModelIndex&)), Qt::UniqueConnection); connect(&logicalView_, SIGNAL(clicked(const QModelIndex&)), this, SLOT(onLogicalChanged(const QModelIndex&)), Qt::UniqueConnection); // Connect signals from physical view. connect(&physicalView_, SIGNAL(makeConnection(const QStringList&, const QStringList&)), this, SLOT(onMakeConnections(const QStringList&, const QStringList&)), Qt::UniqueConnection); connect(&physicalView_, SIGNAL(moveItems(const QStringList&, const QModelIndex&)), &physModel_, SLOT(onMoveItems(const QStringList&, const QModelIndex&)), Qt::UniqueConnection); // Connect signals from logical model. connect(&logicalModel_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection); connect(&logicalModel_, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SIGNAL(contentChanged()), Qt::UniqueConnection); // Connect signal from physical model. connect(&physModel_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection); connect(&physModel_, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SIGNAL(contentChanged()), Qt::UniqueConnection); // Connect signals from physical port filters. connect(nameFilterEditor_, SIGNAL(textChanged(const QString&)), &physProxy_, SLOT(setFilterPortName(const QString&)), Qt::UniqueConnection); connect(nameFilterEditor_, SIGNAL(textChanged(const QString&)), &physicalView_, SLOT(onFilterNameChanged(const QString&)), Qt::UniqueConnection); connect(&inButton_, SIGNAL(clicked(bool)), &physProxy_, SLOT(setFilterInDirection(bool)), Qt::UniqueConnection); connect(&outButton_, SIGNAL(clicked(bool)), &physProxy_, SLOT(setFilterOutDirection(bool)), Qt::UniqueConnection); // Connect signals from bit-field mapping model. connect(&mappingModel_, SIGNAL(errorMessage(const QString&)), this, SIGNAL(errorMessage(const QString&)), Qt::UniqueConnection); connect(&mappingModel_, SIGNAL(logicalPortSet(const QString&)), &mappingView_, SLOT(onLogicalPortChanged(const QString&)), Qt::UniqueConnection); // Connect signals from toolbar buttons. connect(&cleanButton_, SIGNAL(clicked(bool)), this, SLOT(onRefresh()), Qt::UniqueConnection); connect(&connectButton_, SIGNAL(clicked(bool)), this, SLOT(onConnect()), Qt::UniqueConnection); connect(&showHideMappingButton_, SIGNAL(clicked(bool)), this, SLOT(toggleMappingVisibility()), Qt::UniqueConnection); connect(&hideConnectedBox_, SIGNAL(toggled(bool)), &physProxy_, SLOT(setFilterHideConnected(bool)), Qt::UniqueConnection); connect(&showAllButton_, SIGNAL(clicked(bool)), this, SLOT(onShowAll()), Qt::UniqueConnection); }