mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 01:09:27 +02:00
Allow users to set the destination of Snapshots
This commit is contained in:
parent
f61d72fcf0
commit
1a3e6595c5
8 changed files with 186 additions and 9 deletions
|
@ -11,7 +11,8 @@ QLabel#advancedTuningLabel {
|
||||||
}
|
}
|
||||||
|
|
||||||
QPushButton#buttonBrowseHead,
|
QPushButton#buttonBrowseHead,
|
||||||
QPushButton#buttonBrowseBody {
|
QPushButton#buttonBrowseBody,
|
||||||
|
QPushButton#buttonBrowseLocation {
|
||||||
background-image: url(styles/search.svg);
|
background-image: url(styles/search.svg);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center center;
|
background-position: center center;
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QStandardPaths>
|
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
|
@ -87,7 +86,8 @@ Menu::Menu() :
|
||||||
_fpsAverage(FIVE_SECONDS_OF_FRAMES),
|
_fpsAverage(FIVE_SECONDS_OF_FRAMES),
|
||||||
_fastFPSAverage(ONE_SECOND_OF_FRAMES),
|
_fastFPSAverage(ONE_SECOND_OF_FRAMES),
|
||||||
_loginAction(NULL),
|
_loginAction(NULL),
|
||||||
_preferencesDialog(NULL)
|
_preferencesDialog(NULL),
|
||||||
|
_snapshotsLocation()
|
||||||
{
|
{
|
||||||
Application *appInstance = Application::getInstance();
|
Application *appInstance = Application::getInstance();
|
||||||
|
|
||||||
|
@ -416,6 +416,8 @@ void Menu::loadSettings(QSettings* settings) {
|
||||||
_maxVoxelPacketsPerSecond = loadSetting(settings, "maxVoxelsPPS", DEFAULT_MAX_VOXEL_PPS);
|
_maxVoxelPacketsPerSecond = loadSetting(settings, "maxVoxelsPPS", DEFAULT_MAX_VOXEL_PPS);
|
||||||
_voxelSizeScale = loadSetting(settings, "voxelSizeScale", DEFAULT_OCTREE_SIZE_SCALE);
|
_voxelSizeScale = loadSetting(settings, "voxelSizeScale", DEFAULT_OCTREE_SIZE_SCALE);
|
||||||
_boundaryLevelAdjust = loadSetting(settings, "boundaryLevelAdjust", 0);
|
_boundaryLevelAdjust = loadSetting(settings, "boundaryLevelAdjust", 0);
|
||||||
|
_snapshotsLocation = settings->value("snapshotsLocation",
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)).toString();
|
||||||
|
|
||||||
settings->beginGroup("View Frustum Offset Camera");
|
settings->beginGroup("View Frustum Offset Camera");
|
||||||
// in case settings is corrupt or missing loadSetting() will check for NaN
|
// in case settings is corrupt or missing loadSetting() will check for NaN
|
||||||
|
@ -455,6 +457,7 @@ void Menu::saveSettings(QSettings* settings) {
|
||||||
settings->setValue("maxVoxelsPPS", _maxVoxelPacketsPerSecond);
|
settings->setValue("maxVoxelsPPS", _maxVoxelPacketsPerSecond);
|
||||||
settings->setValue("voxelSizeScale", _voxelSizeScale);
|
settings->setValue("voxelSizeScale", _voxelSizeScale);
|
||||||
settings->setValue("boundaryLevelAdjust", _boundaryLevelAdjust);
|
settings->setValue("boundaryLevelAdjust", _boundaryLevelAdjust);
|
||||||
|
settings->setValue("snapshotsLocation", _snapshotsLocation);
|
||||||
settings->beginGroup("View Frustum Offset Camera");
|
settings->beginGroup("View Frustum Offset Camera");
|
||||||
settings->setValue("viewFrustumOffsetYaw", _viewFrustumOffset.yaw);
|
settings->setValue("viewFrustumOffsetYaw", _viewFrustumOffset.yaw);
|
||||||
settings->setValue("viewFrustumOffsetPitch", _viewFrustumOffset.pitch);
|
settings->setValue("viewFrustumOffsetPitch", _viewFrustumOffset.pitch);
|
||||||
|
|
|
@ -12,10 +12,12 @@
|
||||||
#ifndef hifi_Menu_h
|
#ifndef hifi_Menu_h
|
||||||
#define hifi_Menu_h
|
#define hifi_Menu_h
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include <EventTypes.h>
|
#include <EventTypes.h>
|
||||||
#include <MenuItemProperties.h>
|
#include <MenuItemProperties.h>
|
||||||
|
@ -79,6 +81,14 @@ public:
|
||||||
void setFieldOfView(float fieldOfView) { _fieldOfView = fieldOfView; }
|
void setFieldOfView(float fieldOfView) { _fieldOfView = fieldOfView; }
|
||||||
float getFaceshiftEyeDeflection() const { return _faceshiftEyeDeflection; }
|
float getFaceshiftEyeDeflection() const { return _faceshiftEyeDeflection; }
|
||||||
void setFaceshiftEyeDeflection(float faceshiftEyeDeflection) { _faceshiftEyeDeflection = faceshiftEyeDeflection; }
|
void setFaceshiftEyeDeflection(float faceshiftEyeDeflection) { _faceshiftEyeDeflection = faceshiftEyeDeflection; }
|
||||||
|
QString getSnapshotsLocation() const {
|
||||||
|
if (_snapshotsLocation.isNull() || _snapshotsLocation.isEmpty() || QDir(_snapshotsLocation).exists() == false) {
|
||||||
|
return QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
|
}
|
||||||
|
return _snapshotsLocation;
|
||||||
|
}
|
||||||
|
void setSnapshotsLocation(QString snapshotsLocation) { _snapshotsLocation = snapshotsLocation; }
|
||||||
|
|
||||||
BandwidthDialog* getBandwidthDialog() const { return _bandwidthDialog; }
|
BandwidthDialog* getBandwidthDialog() const { return _bandwidthDialog; }
|
||||||
FrustumDrawMode getFrustumDrawMode() const { return _frustumDrawMode; }
|
FrustumDrawMode getFrustumDrawMode() const { return _frustumDrawMode; }
|
||||||
ViewFrustumOffset getViewFrustumOffset() const { return _viewFrustumOffset; }
|
ViewFrustumOffset getViewFrustumOffset() const { return _viewFrustumOffset; }
|
||||||
|
@ -229,6 +239,7 @@ private:
|
||||||
QAction* _loginAction;
|
QAction* _loginAction;
|
||||||
QPointer<PreferencesDialog> _preferencesDialog;
|
QPointer<PreferencesDialog> _preferencesDialog;
|
||||||
QAction* _chatAction;
|
QAction* _chatAction;
|
||||||
|
QString _snapshotsLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace MenuOption {
|
namespace MenuOption {
|
||||||
|
|
|
@ -28,6 +28,7 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags flags) : F
|
||||||
|
|
||||||
connect(ui.buttonBrowseHead, &QPushButton::clicked, this, &PreferencesDialog::openHeadModelBrowser);
|
connect(ui.buttonBrowseHead, &QPushButton::clicked, this, &PreferencesDialog::openHeadModelBrowser);
|
||||||
connect(ui.buttonBrowseBody, &QPushButton::clicked, this, &PreferencesDialog::openBodyModelBrowser);
|
connect(ui.buttonBrowseBody, &QPushButton::clicked, this, &PreferencesDialog::openBodyModelBrowser);
|
||||||
|
connect(ui.buttonBrowseLocation, &QPushButton::clicked, this, &PreferencesDialog::openSnapshotLocationBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::accept() {
|
void PreferencesDialog::accept() {
|
||||||
|
@ -59,6 +60,17 @@ void PreferencesDialog::openBodyModelBrowser() {
|
||||||
modelBrowser.browse();
|
modelBrowser.browse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PreferencesDialog::openSnapshotLocationBrowser() {
|
||||||
|
setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
|
||||||
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Snapshots Location"),
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
|
||||||
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
|
if (!dir.isNull() && !dir.isEmpty()) {
|
||||||
|
ui.snapshotLocationEdit->setText(dir);
|
||||||
|
}
|
||||||
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
|
}
|
||||||
|
|
||||||
void PreferencesDialog::resizeEvent(QResizeEvent *resizeEvent) {
|
void PreferencesDialog::resizeEvent(QResizeEvent *resizeEvent) {
|
||||||
|
|
||||||
// keep buttons panel at the bottom
|
// keep buttons panel at the bottom
|
||||||
|
@ -94,6 +106,8 @@ void PreferencesDialog::loadPreferences() {
|
||||||
_skeletonURLString = myAvatar->getSkeletonModel().getURL().toString();
|
_skeletonURLString = myAvatar->getSkeletonModel().getURL().toString();
|
||||||
ui.skeletonURLEdit->setText(_skeletonURLString);
|
ui.skeletonURLEdit->setText(_skeletonURLString);
|
||||||
|
|
||||||
|
ui.snapshotLocationEdit->setText(menuInstance->getSnapshotsLocation());
|
||||||
|
|
||||||
ui.pupilDilationSlider->setValue(myAvatar->getHead()->getPupilDilation() *
|
ui.pupilDilationSlider->setValue(myAvatar->getHead()->getPupilDilation() *
|
||||||
ui.pupilDilationSlider->maximum());
|
ui.pupilDilationSlider->maximum());
|
||||||
|
|
||||||
|
@ -143,6 +157,10 @@ void PreferencesDialog::savePreferences() {
|
||||||
Application::getInstance()->bumpSettings();
|
Application::getInstance()->bumpSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ui.snapshotLocationEdit->text().isEmpty() && QDir(ui.snapshotLocationEdit->text()).exists()) {
|
||||||
|
Menu::getInstance()->setSnapshotsLocation(ui.snapshotLocationEdit->text());
|
||||||
|
}
|
||||||
|
|
||||||
myAvatar->getHead()->setPupilDilation(ui.pupilDilationSlider->value() / (float)ui.pupilDilationSlider->maximum());
|
myAvatar->getHead()->setPupilDilation(ui.pupilDilationSlider->value() / (float)ui.pupilDilationSlider->maximum());
|
||||||
myAvatar->setLeanScale(ui.leanScaleSpin->value());
|
myAvatar->setLeanScale(ui.leanScaleSpin->value());
|
||||||
myAvatar->setClampedTargetScale(ui.avatarScaleSpin->value());
|
myAvatar->setClampedTargetScale(ui.avatarScaleSpin->value());
|
||||||
|
|
|
@ -41,6 +41,7 @@ private slots:
|
||||||
void accept();
|
void accept();
|
||||||
void setHeadUrl(QString modelUrl);
|
void setHeadUrl(QString modelUrl);
|
||||||
void setSkeletonUrl(QString modelUrl);
|
void setSkeletonUrl(QString modelUrl);
|
||||||
|
void openSnapshotLocationBrowser();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <FileUtils.h>
|
#include <FileUtils.h>
|
||||||
|
|
||||||
#include "Snapshot.h"
|
#include "Snapshot.h"
|
||||||
|
#include "Menu.h"
|
||||||
|
|
||||||
// filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg
|
// filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg
|
||||||
// %1 <= username, %2 <= date and time, %3 <= current location
|
// %1 <= username, %2 <= date and time, %3 <= current location
|
||||||
|
@ -90,8 +91,12 @@ void Snapshot::saveSnapshot(QGLWidget* widget, Avatar* avatar) {
|
||||||
username.replace(QRegExp("[^A-Za-z0-9_]"), "-");
|
username.replace(QRegExp("[^A-Za-z0-9_]"), "-");
|
||||||
|
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
|
QString fileName = Menu::getInstance()->getSnapshotsLocation();
|
||||||
QString fileName = FileUtils::standardPath(SNAPSHOTS_DIRECTORY);
|
|
||||||
|
if (!fileName.endsWith(QDir::separator())) {
|
||||||
|
fileName.append(QDir::separator());
|
||||||
|
}
|
||||||
|
|
||||||
fileName.append(QString(FILENAME_PATH_FORMAT.arg(username, now.toString(DATETIME_FORMAT), formattedLocation)));
|
fileName.append(QString(FILENAME_PATH_FORMAT.arg(username, now.toString(DATETIME_FORMAT), formattedLocation)));
|
||||||
shot.save(fileName, 0, 100);
|
shot.save(fileName, 0, 100);
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ color: #0e7077</string>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>615</width>
|
<width>615</width>
|
||||||
<height>833</height>
|
<height>936</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
@ -300,7 +300,7 @@ color: #0e7077</string>
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>faceURLEdit</cstring>
|
<cstring>snapshotLocationEdit</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -476,6 +476,145 @@ color: #0e7077</string>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="avatarTitleLabel_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
<pointsize>20</pointsize>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: #0e7077</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Snapshots</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="headLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
<pointsize>16</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: #0e7077</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Snapshots location</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>snapshotLocationEdit</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="snapshotLocationEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonBrowseLocation">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -61,8 +61,7 @@ void FileUtils::locateFile(QString filePath) {
|
||||||
QString FileUtils::standardPath(QString subfolder) {
|
QString FileUtils::standardPath(QString subfolder) {
|
||||||
// standard path
|
// standard path
|
||||||
// Mac: ~/Library/Application Support/Interface
|
// Mac: ~/Library/Application Support/Interface
|
||||||
QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
|
QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||||
path.append("/Interface");
|
|
||||||
|
|
||||||
if (!subfolder.startsWith("/")) {
|
if (!subfolder.startsWith("/")) {
|
||||||
subfolder.prepend("/");
|
subfolder.prepend("/");
|
||||||
|
|
Loading…
Reference in a new issue