Showing the changes to interface/src/ui/PreferencesDialog.cpp (1 of 20 files). Show all
Unified · Split
| @@ -28,6 +28,7 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags flags) : F · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | connect(ui.buttonBrowseHead, &QPushButton::clicked, this, &PreferencesDialog::openHeadModelBrowser); |
| 30 | 30 | connect(ui.buttonBrowseBody, &QPushButton::clicked, this, &PreferencesDialog::openBodyModelBrowser); |
| 31 | + connect(ui.buttonBrowseLocation, &QPushButton::clicked, this, &PreferencesDialog::openSnapshotLocationBrowser); | |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | void PreferencesDialog::accept() { |
| @@ -59,6 +60,17 @@ void PreferencesDialog::openBodyModelBrowser() { · 25 unmodified lines | ||
| 59 | 60 | modelBrowser.browse(); |
| 60 | 61 | } |
| 61 | 62 | |
| 63 | +void PreferencesDialog::openSnapshotLocationBrowser() { | |
| 64 | + setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint); | |
| 65 | + QString dir = QFileDialog::getExistingDirectory(this, tr("Snapshots Location"), | |
| 66 | + QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), | |
| 67 | + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); | |
| 68 | + if (!dir.isNull() && !dir.isEmpty()) { | |
| 69 | + ui.snapshotLocationEdit->setText(dir); | |
| 70 | + } | |
| 71 | + setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); | |
| 72 | +} | |
| 73 | + | |
| 62 | 74 | void PreferencesDialog::resizeEvent(QResizeEvent *resizeEvent) { |
| 63 | 75 | |
| 64 | 76 | // keep buttons panel at the bottom |
| @@ -94,6 +106,8 @@ void PreferencesDialog::loadPreferences() { · 29 unmodified lines | ||
| 94 | 106 | _skeletonURLString = myAvatar->getSkeletonModel().getURL().toString(); |
| 95 | 107 | ui.skeletonURLEdit->setText(_skeletonURLString); |
| 96 | 108 | |
| 109 | + ui.snapshotLocationEdit->setText(menuInstance->getSnapshotsLocation()); | |
| 110 | + | |
| 97 | 111 | ui.pupilDilationSlider->setValue(myAvatar->getHead()->getPupilDilation() * |
| 98 | 112 | ui.pupilDilationSlider->maximum()); |
| 99 | 113 | |
| @@ -143,6 +157,10 @@ void PreferencesDialog::savePreferences() { · 43 unmodified lines | ||
| 143 | 157 | Application::getInstance()->bumpSettings(); |
| 144 | 158 | } |
| 145 | 159 | |
| 160 | + if (!ui.snapshotLocationEdit->text().isEmpty() && QDir(ui.snapshotLocationEdit->text()).exists()) { | |
| 161 | + Menu::getInstance()->setSnapshotsLocation(ui.snapshotLocationEdit->text()); | |
| 162 | + } | |
| 163 | + | |
| 146 | 164 | myAvatar->getHead()->setPupilDilation(ui.pupilDilationSlider->value() / (float)ui.pupilDilationSlider->maximum()); |
| 147 | 165 | myAvatar->setLeanScale(ui.leanScaleSpin->value()); |
| 148 | 166 | myAvatar->setClampedTargetScale(ui.avatarScaleSpin->value()); |