]> git.sur5r.net Git - minitube/blobdiff - src/snapshotsettings.cpp
New upstream version 3.6
[minitube] / src / snapshotsettings.cpp
index bfe5275718665f9b6a005531fd9a58a6a907a923..e1628f6195ced16d9d667e30517af0a676ebe291 100644 (file)
@@ -20,10 +20,11 @@ $END_LICENSE */
 
 #include "snapshotsettings.h"
 #include "mainwindow.h"
-#include <QDesktopServices>
 #ifdef APP_MAC
 #include "macutils.h"
 #endif
+#include "constants.h"
+#include <QDesktopServices>
 
 SnapshotSettings::SnapshotSettings(QWidget *parent) : QWidget(parent) {
     QBoxLayout *layout = new QHBoxLayout(this);
@@ -60,8 +61,8 @@ void SnapshotSettings::setSnapshot(const QPixmap &pixmap, const QString &filenam
     QString display = displayPath(path);
 
     QString msg = tr("Snapshot saved to %1")
-                .arg("<a href='showFile' style='text-decoration:none; color:palette(text); font-weight:bold'>%1</a>")
-                .arg(display);
+            .arg("<a href='showFile' style='text-decoration:none; color:palette(text); font-weight:bold'>%1</a>")
+            .arg(display);
     message->setText(msg);
 }
 
@@ -74,46 +75,34 @@ QString SnapshotSettings::getCurrentLocation() {
     QSettings settings;
     QString location = settings.value("snapshotsFolder").toString();
     if (location.isEmpty() || !QFile::exists(location)) {
-#if QT_VERSION >= 0x050000
         location = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
-#else
-        location = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
+#ifdef APP_MAC_STORE
+        location += "/MinitubeforYouTube";
 #endif
     }
     return location;
 }
 
 QString SnapshotSettings::displayPath(const QString &path) {
-#if QT_VERSION >= 0x050000
-    QString home = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
-#else
-    QString home = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
+#ifdef APP_MAC
+    return QDir(path).dirName();
 #endif
+
+    const QString home = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
     QString displayPath = path;
     displayPath = displayPath.remove(home + "/");
     return displayPath;
 }
 
 void SnapshotSettings::changeFolder() {
-    QString path;
+    const QString path = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
 #ifdef APP_MAC
     QFileDialog* dialog = new QFileDialog(this);
     dialog->setFileMode(QFileDialog::Directory);
     dialog->setOptions(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks | QFileDialog::ReadOnly);
-#if QT_VERSION >= 0x050000
-    path = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
-#else
-    path = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
-#endif
     dialog->setDirectory(path);
     dialog->open(this, SLOT(folderChosen(const QString &)));
 #else
-
-#if QT_VERSION >= 0x050000
-    path = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
-#else
-    path = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
-#endif
     QString folder = QFileDialog::getExistingDirectory(window(), QString(),
                                                        path,
                                                        QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks | QFileDialog::ReadOnly);