Skip to content

Commit

Permalink
Preset default traces in mixed mode conversion dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
jankae committed May 8, 2024
1 parent 37c1064 commit 5ae57bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ void TraceSetSelector::setPorts(unsigned int newPorts)
emit selectionChanged();
}

void TraceSetSelector::setDefaultTraces()
{
auto traces = model->getTraces();
for(unsigned int i=1;i<=ports;i++) {
for(unsigned int j=1;j<=ports;j++) {
QString defaultTraceName = "S"+QString::number(i)+QString::number(j);
for(auto t : traces) {
if(t->name() == defaultTraceName) {
setTrace(i, j, t);
break;
}
}
}
}
}

bool TraceSetSelector::setTrace(unsigned int destPort, unsigned int srcPort, Trace *t)
{
if(destPort < 1 || destPort > ports || srcPort < 1 || srcPort > ports) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class TraceSetSelector : public QWidget

unsigned int getPorts() const;
void setPorts(unsigned int newPorts);
void setDefaultTraces();

bool setTrace(unsigned int destPort, unsigned int srcPort, Trace *t);
Trace *getTrace(unsigned int destPort, unsigned int srcPort);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MixedModeConversion::MixedModeConversion(TraceModel &m, QWidget *parent) :
});
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &QDialog::reject);
selectionChanged();
ui->selector->setDefaultTraces();
}

MixedModeConversion::~MixedModeConversion()
Expand Down

0 comments on commit 5ae57bf

Please sign in to comment.