#ifdef APP_EXTRA
#include "extra.h"
#endif
+#include "datautils.h"
+#include "compatibility/pathsservice.h"
+#include "iconutils.h"
static DownloadManager *downloadManagerInstance = 0;
if (!Activation::instance().isActivated()) {
if (video->duration() >= 60*4) {
QMessageBox msgBox(MainWindow::instance());
- msgBox.setIconPixmap(QPixmap(":/images/app.png").scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation));
+ msgBox.setIconPixmap(IconUtils::pixmap(":/images/app.png").scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation));
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.")
video->disconnect(this);
- QString basename = video->title();
- basename.replace('(', '[');
- basename.replace(')', ']');
- basename.replace('/', ' ');
- basename.replace('\\', ' ');
- basename.replace('<', ' ');
- basename.replace('>', ' ');
- basename.replace(':', ' ');
- basename.replace('"', ' ');
- basename.replace('|', ' ');
- basename.replace('?', ' ');
- basename.replace('*', ' ');
- basename = basename.simplified();
-
- if (!basename.isEmpty() && basename.at(0) == '.')
- basename = basename.mid(1).trimmed();
-
+ QString basename = DataUtils::stringToFilename(video->title());
if (basename.isEmpty()) basename = video->id();
QString filename = currentDownloadFolder() + "/" + basename + ".mp4";
QString DownloadManager::defaultDownloadFolder() {
// download in the Movies system folder
-#if QT_VERSION >= 0x050000
- QString path = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
-#else
- QString path = QDesktopServices::storageLocation(QDesktopServices::MoviesLocation);
-#endif
+ QString path = Paths::getMoviesLocation();
- QDir moviesDir(path);
+ const QDir moviesDir(path);
if (!moviesDir.exists()) {
// fallback to Desktop
-#if QT_VERSION >= 0x050000
- path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
-#else
- path = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
-#endif
+ path = Paths::getDesktopLocation();
- QDir desktopDir(path);
+ const QDir desktopDir(path);
if (!desktopDir.exists()) {
// fallback to Home
-#if QT_VERSION >= 0x050000
- path = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
-#else
- path = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
-#endif
+ path = Paths::getHomeLocation();
}
}
return path;