~ubuntu-branches/ubuntu/quantal/minitube/quantal

« back to all changes in this revision

Viewing changes to src/MediaView.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jakob Haufe
  • Date: 2011-10-12 23:06:30 UTC
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20111012230630-xmacqyul3yek12wu
Do proper temporary file creation (Closes: #644935).

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
    connect(demoTimer, SIGNAL(timeout()), SLOT(demoMessage()));
128
128
#endif
129
129
 
 
130
    tempFile = new QTemporaryFile(this);
130
131
}
131
132
 
132
133
void MediaView::initialize() {
346
347
 
347
348
 
348
349
    QString tempDir = QDesktopServices::storageLocation(QDesktopServices::TempLocation);
349
 
#ifdef Q_WS_X11
350
 
    QString tempFile = tempDir + "/minitube-" + getenv("USERNAME") + ".mp4";
351
 
#else
352
 
    QString tempFile = tempDir + "/minitube.mp4";
353
 
#endif
354
 
    if (QFile::exists(tempFile) && !QFile::remove(tempFile)) {
355
 
        qDebug() << "Cannot remove temp file";
356
 
    }
 
350
    if(tempFile->fileName().isNull())
 
351
        tempFile->open();
357
352
 
358
353
    Video *videoCopy = video->clone();
359
354
    if (downloadItem) {
360
355
        downloadItem->stop();
361
356
        delete downloadItem;
362
357
    }
363
 
    downloadItem = new DownloadItem(videoCopy, streamUrl, tempFile, this);
 
358
    downloadItem = new DownloadItem(videoCopy, streamUrl, tempFile->fileName(), this);
364
359
    connect(downloadItem, SIGNAL(statusChanged()), SLOT(downloadStatusChanged()));
365
360
    // connect(downloadItem, SIGNAL(progress(int)), SLOT(downloadProgress(int)));
366
361
    connect(downloadItem, SIGNAL(bufferProgress(int)), loadingWidget, SLOT(bufferStatus(int)));