mirror of
https://github.com/overte-org/overte.git
synced 2025-06-19 01:21:04 +02:00
filename format changes
- new wav file - changed filename format
This commit is contained in:
parent
74801da07f
commit
40ea552981
3 changed files with 16 additions and 9 deletions
Binary file not shown.
|
@ -699,7 +699,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
|
|
||||||
bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier);
|
bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier);
|
||||||
bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
|
bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
|
||||||
bool isControl = event->modifiers().testFlag(Qt::MetaModifier);
|
|
||||||
switch (event->key()) {
|
switch (event->key()) {
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Shift:
|
case Qt::Key_Shift:
|
||||||
|
@ -778,7 +777,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
_voxels.collectStatsForTreesAndVBOs();
|
_voxels.collectStatsForTreesAndVBOs();
|
||||||
} else if (isShifted && isMeta) {
|
} else if (isShifted && isMeta) {
|
||||||
Menu::getInstance()->triggerOption(MenuOption::SuppressShortTimings);
|
Menu::getInstance()->triggerOption(MenuOption::SuppressShortTimings);
|
||||||
} else if (!isShifted && !isMeta && isControl) {
|
} else if (!isShifted && isMeta) {
|
||||||
takeSnapshot();
|
takeSnapshot();
|
||||||
} else if (_nudgeStarted) {
|
} else if (_nudgeStarted) {
|
||||||
if (_lookingAlongX) {
|
if (_lookingAlongX) {
|
||||||
|
|
|
@ -11,12 +11,14 @@
|
||||||
#include <FileUtils.h>
|
#include <FileUtils.h>
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QStandardPaths>
|
#include <QFileInfo>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
// filename format: hifi-snap_username_current-coordinates_date_time-with-seconds.jpg
|
// filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg
|
||||||
// %1 <= username, %2 <= current location, %3 <= date and time
|
// %1 <= username, %2 <= date and time, %3 <= current location
|
||||||
const QString FILENAME_PATH_FORMAT = "hifi-snap_%1_%2_%3.jpg";
|
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 DATETIME_FORMAT = "yyyy-MM-dd_hh-mm-ss";
|
||||||
const QString SNAPSHOTS_DIRECTORY = "Snapshots";
|
const QString SNAPSHOTS_DIRECTORY = "Snapshots";
|
||||||
|
|
||||||
void Snapshot::saveSnapshot(QGLWidget* widget, QString username, glm::vec3 location) {
|
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-y", QString::number(location.y));
|
||||||
shot.setText("location-z", QString::number(location.z));
|
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();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
|
|
||||||
QString fileName = FileUtils::standardPath(SNAPSHOTS_DIRECTORY);
|
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);
|
shot.save(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue