Skip to content

Commit

Permalink
MainWindow: use references instead of pointers
Browse files Browse the repository at this point in the history
There is no reason why the ytdl class should be used on the heap instead
of the stack.
  • Loading branch information
rrooij committed Jan 28, 2016
1 parent 147b604 commit 0c616a6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void MainWindow::on_pushButton_clicked()
void MainWindow::actionRetrieveUrl()
{
this->setCursor(Qt::WaitCursor);
YoutubeDL *ytdl = new YoutubeDL();
QString output = ytdl->getUrl(this->ui->videoUrlEdit->text());
YoutubeDL ytdl;
QString output = ytdl.getUrl(this->ui->videoUrlEdit->text());
OutputWindow *outputWindow = new OutputWindow();
outputWindow->setText(output);
outputWindow->show();
Expand All @@ -49,9 +49,9 @@ void MainWindow::actionDownload()
{
OutputWindow *outputWindow = new OutputWindow();
outputWindow->show();
YoutubeDL *ytdl = new YoutubeDL();
outputWindow->setYtdl(ytdl->getYtdl());
outputWindow->connect(ytdl->getYtdl(), SIGNAL(readyRead()), outputWindow, SLOT(readyRead()));
ytdl->startDownload(this->ui->videoUrlEdit->text(), saveDirectory);
YoutubeDL ytdl;
outputWindow->setYtdl(ytdl.getYtdl());
outputWindow->connect(ytdl.getYtdl(), SIGNAL(readyRead()), outputWindow, SLOT(readyRead()));
ytdl.startDownload(this->ui->videoUrlEdit->text(), saveDirectory);
}
}

0 comments on commit 0c616a6

Please sign in to comment.