mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-14 12:47:03 +02:00
Fixed default preference selection bug for screenshot formats and added short descriptions
This commit is contained in:
parent
0ca8545c20
commit
ad8da103b4
3 changed files with 34 additions and 4 deletions
|
@ -250,22 +250,30 @@ void setupPreferences() {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto getter = []()->int { return DependencyManager::get<Snapshot>()->getAvailableSnapshotFormats().indexOf(DependencyManager::get<Snapshot>()->getSnapshotFormat()); };
|
auto getter = []()->int {
|
||||||
|
if (!DependencyManager::get<Snapshot>()->_snapshotFormat.isSet()) {
|
||||||
|
DependencyManager::get<Snapshot>()->setSnapshotFormat(DependencyManager::get<Snapshot>()->getAvailableSnapshotFormats()[0]);
|
||||||
|
}
|
||||||
|
return DependencyManager::get<Snapshot>()->getAvailableSnapshotFormats().indexOf(DependencyManager::get<Snapshot>()->getSnapshotFormat()); };
|
||||||
auto setter = [](int value) { DependencyManager::get<Snapshot>()->setSnapshotFormat(DependencyManager::get<Snapshot>()->getAvailableSnapshotFormats()[value]); };
|
auto setter = [](int value) { DependencyManager::get<Snapshot>()->setSnapshotFormat(DependencyManager::get<Snapshot>()->getAvailableSnapshotFormats()[value]); };
|
||||||
auto preference = new RadioButtonsPreference(SNAPSHOTS, "Snapshot format", getter, setter);
|
auto preference = new RadioButtonsPreference(SNAPSHOTS, "Snapshot format", getter, setter);
|
||||||
QStringList items;
|
QStringList items;
|
||||||
items << DependencyManager::get<Snapshot>()->getAvailableSnapshotFormats();
|
items << DependencyManager::get<Snapshot>()->getAvailableSnapshotFormatsWithDescriptions();
|
||||||
preference->setHeading("Snapshot format");
|
preference->setHeading("Snapshot format");
|
||||||
preference->setItems(items);
|
preference->setItems(items);
|
||||||
preferences->addPreference(preference);
|
preferences->addPreference(preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto getter = []()->int { return DependencyManager::get<Snapshot>()->getAvailableAnimatedSnapshotFormats().indexOf(DependencyManager::get<Snapshot>()->getAnimatedSnapshotFormat()); };
|
auto getter = []()->int {
|
||||||
|
if (!DependencyManager::get<Snapshot>()->_animatedSnapshotFormat.isSet()) {
|
||||||
|
DependencyManager::get<Snapshot>()->setAnimatedSnapshotFormat(DependencyManager::get<Snapshot>()->getAvailableAnimatedSnapshotFormats()[0]);
|
||||||
|
}
|
||||||
|
return DependencyManager::get<Snapshot>()->getAvailableAnimatedSnapshotFormats().indexOf(DependencyManager::get<Snapshot>()->getAnimatedSnapshotFormat()); };
|
||||||
auto setter = [](int value) { DependencyManager::get<Snapshot>()->setAnimatedSnapshotFormat(DependencyManager::get<Snapshot>()->getAvailableAnimatedSnapshotFormats()[value]); };
|
auto setter = [](int value) { DependencyManager::get<Snapshot>()->setAnimatedSnapshotFormat(DependencyManager::get<Snapshot>()->getAvailableAnimatedSnapshotFormats()[value]); };
|
||||||
auto preference = new RadioButtonsPreference(SNAPSHOTS, "Animated snapshot format", getter, setter);
|
auto preference = new RadioButtonsPreference(SNAPSHOTS, "Animated snapshot format", getter, setter);
|
||||||
QStringList items;
|
QStringList items;
|
||||||
items << DependencyManager::get<Snapshot>()->getAvailableAnimatedSnapshotFormats();
|
items << DependencyManager::get<Snapshot>()->getAvailableAnimatedSnapshotFormatsWithDescriptions();
|
||||||
preference->setHeading("Animated snapshot format");
|
preference->setHeading("Animated snapshot format");
|
||||||
preference->setItems(items);
|
preference->setItems(items);
|
||||||
preferences->addPreference(preference);
|
preferences->addPreference(preference);
|
||||||
|
|
|
@ -552,6 +552,14 @@ QStringList Snapshot::getAvailableSnapshotFormats() {
|
||||||
return QStringList({"png", "jpg", "webp"});
|
return QStringList({"png", "jpg", "webp"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList Snapshot::getAvailableSnapshotFormatsWithDescriptions() {
|
||||||
|
return QStringList({"PNG - lossless, large file size", "JPG - lossy, fast compression", "WEBP - lossy, higher quality and file size than JPG"});
|
||||||
|
}
|
||||||
|
|
||||||
QStringList Snapshot::getAvailableAnimatedSnapshotFormats() {
|
QStringList Snapshot::getAvailableAnimatedSnapshotFormats() {
|
||||||
return QStringList({"gif"});
|
return QStringList({"gif"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList Snapshot::getAvailableAnimatedSnapshotFormatsWithDescriptions() {
|
||||||
|
return QStringList({"GIF"});
|
||||||
|
}
|
||||||
|
|
|
@ -135,12 +135,26 @@ public slots:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE QStringList getAvailableSnapshotFormats();
|
Q_INVOKABLE QStringList getAvailableSnapshotFormats();
|
||||||
|
|
||||||
|
/*@jsdoc
|
||||||
|
* Returns a list of supported snapshot formats with short descriptions.
|
||||||
|
* @function Snapshot.getAvailableSnapshotFormatsWithDescriptions
|
||||||
|
* @returns {Array.<string>} List of supported snapshot formats with short descriptions.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QStringList getAvailableSnapshotFormatsWithDescriptions();
|
||||||
|
|
||||||
/*@jsdoc
|
/*@jsdoc
|
||||||
* Returns a list of supported animated snapshot formats.
|
* Returns a list of supported animated snapshot formats.
|
||||||
* @function Snapshot.getAvailableAnimatedSnapshotFormats
|
* @function Snapshot.getAvailableAnimatedSnapshotFormats
|
||||||
* @returns {Array.<string>} List of supported animated snapshot formats.
|
* @returns {Array.<string>} List of supported animated snapshot formats.
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE QStringList getAvailableAnimatedSnapshotFormats();
|
Q_INVOKABLE QStringList getAvailableAnimatedSnapshotFormats();
|
||||||
|
|
||||||
|
/*@jsdoc
|
||||||
|
* Returns a list of supported animated snapshot formats with short descriptions.
|
||||||
|
* @function Snapshot.getAvailableAnimatedSnapshotFormatsWithDescriptions
|
||||||
|
* @returns {Array.<string>} List of supported animated snapshot formats with short descriptions.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QStringList getAvailableAnimatedSnapshotFormatsWithDescriptions();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue