added folder selection dialog on first snapshot

This commit is contained in:
SamGondelman 2016-07-06 12:15:34 -07:00
parent 6a44ea76e5
commit 890b22426c
2 changed files with 10 additions and 1 deletions

View file

@ -44,6 +44,7 @@ const QString URL = "highfidelity_url";
Setting::Handle<QString> Snapshot::snapshotsLocation("snapshotsLocation",
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
Setting::Handle<bool> Snapshot::hasSetSnapshotsLocation("hasSetSnapshotsLocation", false);
SnapshotMetaData* Snapshot::parseSnapshotData(QString snapshotPath) {
@ -103,7 +104,14 @@ QFile* Snapshot::savedFileForSnapshot(QImage & shot, bool isTemporary) {
const int IMAGE_QUALITY = 100;
if (!isTemporary) {
QString snapshotFullPath = snapshotsLocation.get();
QString snapshotFullPath;
if (!hasSetSnapshotsLocation.get()) {
snapshotFullPath = QFileDialog::getExistingDirectory(nullptr, "Choose Snapshots Directory", snapshotsLocation.get());
hasSetSnapshotsLocation.set(true);
snapshotsLocation.set(snapshotFullPath);
} else {
snapshotFullPath = snapshotsLocation.get();
}
if (!snapshotFullPath.endsWith(QDir::separator())) {
snapshotFullPath.append(QDir::separator());

View file

@ -39,6 +39,7 @@ public:
static SnapshotMetaData* parseSnapshotData(QString snapshotPath);
static Setting::Handle<QString> snapshotsLocation;
static Setting::Handle<bool> hasSetSnapshotsLocation;
private:
static QFile* savedFileForSnapshot(QImage & image, bool isTemporary);
};