diff --git a/interface/resources/sounds/snap.wav b/interface/resources/sounds/snap.wav index 3e22124abf..bb562e1db9 100644 Binary files a/interface/resources/sounds/snap.wav and b/interface/resources/sounds/snap.wav differ diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d4d9f5d949..e660446a10 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -699,7 +699,6 @@ void Application::keyPressEvent(QKeyEvent* event) { bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier); bool isMeta = event->modifiers().testFlag(Qt::ControlModifier); - bool isControl = event->modifiers().testFlag(Qt::MetaModifier); switch (event->key()) { break; case Qt::Key_Shift: @@ -778,7 +777,7 @@ void Application::keyPressEvent(QKeyEvent* event) { _voxels.collectStatsForTreesAndVBOs(); } else if (isShifted && isMeta) { Menu::getInstance()->triggerOption(MenuOption::SuppressShortTimings); - } else if (!isShifted && !isMeta && isControl) { + } else if (!isShifted && isMeta) { takeSnapshot(); } else if (_nudgeStarted) { if (_lookingAlongX) { diff --git a/interface/src/ui/Snapshot.cpp b/interface/src/ui/Snapshot.cpp index b024890d12..a7ba9bd2a1 100644 --- a/interface/src/ui/Snapshot.cpp +++ b/interface/src/ui/Snapshot.cpp @@ -11,12 +11,14 @@ #include #include -#include +#include +#include -// filename format: hifi-snap_username_current-coordinates_date_time-with-seconds.jpg -// %1 <= username, %2 <= current location, %3 <= date and time -const QString FILENAME_PATH_FORMAT = "hifi-snap_%1_%2_%3.jpg"; -const QString DATETIME_FORMAT = "yyyy-MM-dd_hh.mm.ss"; +// filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg +// %1 <= username, %2 <= date and time, %3 <= current location +const QString FILENAME_PATH_FORMAT = "hifi-snap-by-%1-on-%2@%3.jpg"; + +const QString DATETIME_FORMAT = "yyyy-MM-dd_hh-mm-ss"; const QString SNAPSHOTS_DIRECTORY = "Snapshots"; void Snapshot::saveSnapshot(QGLWidget* widget, QString username, glm::vec3 location) { @@ -27,11 +29,17 @@ void Snapshot::saveSnapshot(QGLWidget* widget, QString username, glm::vec3 locat shot.setText("location-y", QString::number(location.y)); shot.setText("location-z", QString::number(location.z)); - QString formattedLocation = QString("%1-%2-%3").arg(location.x).arg(location.y).arg(location.z); + QString formattedLocation = QString("%1_%2_%3").arg(location.x).arg(location.y).arg(location.z); + // replace decimal . with '-' + formattedLocation.replace('.', '-'); + + // normalize username, replace all non alphanumeric with '-' + username.replace(QRegExp("[^A-Za-z0-9_]"), "-"); + QDateTime now = QDateTime::currentDateTime(); QString fileName = FileUtils::standardPath(SNAPSHOTS_DIRECTORY); - fileName.append(QString(FILENAME_PATH_FORMAT.arg(username, formattedLocation, now.toString(DATETIME_FORMAT)))); + fileName.append(QString(FILENAME_PATH_FORMAT.arg(username, now.toString(DATETIME_FORMAT), formattedLocation))); shot.save(fileName); }