#include "snapshotsettings.h"
#include "mainwindow.h"
-#include <QDesktopServices>
#ifdef APP_MAC
#include "macutils.h"
#endif
+#include "constants.h"
+#include "compatibility/pathsservice.h"
+#include <QDesktopServices>
SnapshotSettings::SnapshotSettings(QWidget *parent) : QWidget(parent) {
QBoxLayout *layout = new QHBoxLayout(this);
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);
}
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);
+ location = Paths::getPicturesLocation();
+#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 = Paths::getHomeLocation();
QString displayPath = path;
displayPath = displayPath.remove(home + "/");
return displayPath;
}
void SnapshotSettings::changeFolder() {
- QString path;
+ const QString path = Paths::getHomeLocation();
#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);