#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);
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);
-#endif
#ifdef APP_MAC_STORE
location += "/MinitubeforYouTube";
#endif
return QDir(path).dirName();
#endif
-#if QT_VERSION >= 0x050000
- QString home = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
-#else
- QString home = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
-#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);