mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 18:02:13 +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 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) {
|
||||
|
|
|
@ -11,12 +11,14 @@
|
|||
#include <FileUtils.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QStandardPaths>
|
||||
#include <QFileInfo>
|
||||
#include <QDebug>
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue