Browse Source

Arguments must be cleared before launching a new command.

master
Andrius Štikonas 5 years ago
parent
commit
fc70c9d302
1 changed files with 9 additions and 8 deletions
  1. +9
    -8
      dialog.cpp

+ 9
- 8
dialog.cpp View File

@@ -38,35 +38,36 @@ Dialog::~Dialog()

void Dialog::connectToClients()
{
QString line, command = "tvnserver";
QStringList arguments;
QString line, command = QStringLiteral("tvnserver");

if(connected)
{
arguments << "-controlservice" << "-disconnectall" << line;
QStringList arguments;
arguments << QStringLiteral("-controlservice") << QStringLiteral("-disconnectall") << line;
QProcess *process = new QProcess();
process->start(command, arguments);
connected = false;
ui->buttonStart->setText("Start streaming");
ui->buttonStart->setText(QStringLiteral("Start streaming"));

return;
}

QFile file("clients.txt");
QFile file(QStringLiteral("clients.txt"));
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QTextStream in(&file);
while (!in.atEnd()) {
line = in.readLine();
if (line != "")
if (line != QString())
{
arguments << "-controlservice" << "-connect" << line;
QStringList arguments;
arguments << QStringLiteral("-controlservice") << QStringLiteral("-connect") << line;
QProcess *process = new QProcess();
process->start(command, arguments);
}
}
connected = true;
ui->buttonStart->setText("Disconnect");
ui->buttonStart->setText(QStringLiteral("Disconnect"));

return;
}

Loading…
Cancel
Save