X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fdownloadmanager.cpp;h=f7267b393c2383f634b78c2a5ec50e7f76a60635;hb=57c25e20a8f10a98a18dbc2b64ce55cf87d4fd7c;hp=5363d1ea74782a9c08e69c06961292a41f56a761;hpb=a3f14b781684abfbe76b349e68a3cdaaa454c09f;p=minitube diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 5363d1e..f7267b3 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -6,7 +6,7 @@ static DownloadManager *downloadManagerInstance = 0; -DownloadManager::DownloadManager(QObject *parent) : +DownloadManager::DownloadManager(QWidget *parent) : QObject(parent), downloadModel(new DownloadModel(this, this)) { } @@ -42,21 +42,23 @@ void DownloadManager::addItem(Video *video) { #ifdef APP_DEMO if (video->duration() >= 60*4) { - QMessageBox msgBox; + QMessageBox msgBox(dynamic_cast(parent())->window()); msgBox.setIconPixmap(QPixmap(":/images/app.png").scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation)); - msgBox.setText(tr("This is just the demo version of %1.").arg(Constants::APP_NAME)); + msgBox.setText(tr("This is just the demo version of %1.").arg(Constants::NAME)); msgBox.setInformativeText( tr("It can only download videos shorter than %1 minutes so you can test the download functionality.") .arg(4)); msgBox.setModal(true); + // make it a "sheet" on the Mac + msgBox.setWindowModality(Qt::WindowModal); - QPushButton *quitButton = msgBox.addButton(tr("Continue"), QMessageBox::RejectRole); + msgBox.addButton(tr("Continue"), QMessageBox::RejectRole); QPushButton *buyButton = msgBox.addButton(tr("Get the full version"), QMessageBox::ActionRole); msgBox.exec(); if (msgBox.clickedButton() == buyButton) { - QDesktopServices::openUrl(QString(Constants::WEBSITE) + "#download"); + QDesktopServices::openUrl(QUrl(QString(Constants::WEBSITE) + "#download")); } return; @@ -143,6 +145,12 @@ QString DownloadManager::defaultDownloadFolder() { if (!moviesDir.exists()) { // fallback to Desktop path = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); + + QDir desktopDir(path); + if (!desktopDir.exists()) { + // fallback to Home + path = QDesktopServices::storageLocation(QDesktopServices::HomeLocation); + } } return path; }