Skip to content

Commit

Permalink
Merge pull request #96 from labstreaminglayer/cboulay/whitespace
Browse files Browse the repository at this point in the history
Whitespace Fixes
  • Loading branch information
cboulay authored Apr 5, 2023
2 parents 41434dc + 1147962 commit 3229a7a
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,26 @@ void MainWindow::startRecording() {
". Please check your permissions.");
return;
}


std::vector<std::string> watchfor;
for (const QString &missing : qAsConst(missingStreams)) {
std::string query;
// Convert missing to query expected by lsl::resolve_stream
// name='BioSemi' and hostname=AASDFSDF
// QRegularExpression rx("(\S+)\s+\((\S+)\)");
QStringList name_host = missing.split(QRegExp("\\s+"));
std::string query = "name='" + name_host[0].toStdString() + "'";
if (name_host.size() > 1) {
std::string host = name_host[1].toStdString();
query += " and hostname='" + host.substr(1, host.length() - 2) + "'";
}
QRegularExpression re("(.+)\\s+\\((\\S+)\\)");
QRegularExpressionMatch match = re.match(missing);
if (match.hasMatch())
{
QString name = match.captured(1);
QString host = match.captured(2);
query = "name='" + match.captured(1).toStdString() + "'";
if (host.size() > 1) {
query += " and hostname='" + host.toStdString() + "'";
}
} else {
// Regexp failed but we can try using the entire string as the stream name.
query = "name='" + missing.toStdString() + "'";
}
watchfor.push_back(query);
}
qInfo() << "Missing: " << missingStreams;
Expand Down Expand Up @@ -557,7 +564,7 @@ QString MainWindow::replaceFilename(QString fullfile) const {
QString run = QString("%1").arg(ui->spin_counter->value(), 3, 10, QChar('0'));
fullfile.replace(counterPlaceholder(), run);

return fullfile;
return fullfile.trimmed();
}

/**
Expand Down

0 comments on commit 3229a7a

Please sign in to comment.