Added "Force Revive Page" checkbox to application settings.

This commit is contained in:
2016-12-24 15:56:21 +01:00
parent 3f53235b1b
commit 342f4795df
6 changed files with 59 additions and 7 deletions
+2 -3
View File
@@ -26,7 +26,7 @@ namespace advsettings {
void ReviveTabController::initStage1() {
m_isOverlayInstalled = vr::VRApplications()->IsApplicationInstalled(appkey_overlay);
if (m_isOverlayInstalled) {
if (m_isOverlayInstalled || parent->settingsTabController.forceRevivePage()) {
vr::EVRSettingsError vrSettingsError;
float valuef = vr::VRSettings()->GetFloat(section_revive, key_pixelsPerDisplayPixel, &vrSettingsError);
@@ -157,7 +157,7 @@ namespace advsettings {
}
void ReviveTabController::eventLoopTick() {
if (m_isOverlayInstalled) {
if (m_isOverlayInstalled || parent->settingsTabController.forceRevivePage()) {
if (settingsUpdateCounter >= 50) {
settingsUpdateCounter = 0;
vr::EVRSettingsError vrSettingsError;
@@ -718,7 +718,6 @@ namespace advsettings {
}
void ReviveTabController::addControllerProfile(QString name) {
vr::EVRSettingsError vrSettingsError;
ReviveControllerProfile* profile = nullptr;
for (auto& p : controllerProfiles) {
if (p.profileName.compare(name.toStdString()) == 0) {
@@ -8,6 +8,13 @@ namespace advsettings {
void SettingsTabController::initStage1() {
m_autoStartEnabled = vr::VRApplications()->GetApplicationAutoLaunch(OverlayController::applicationKey);
auto settings = OverlayController::appSettings();
settings->beginGroup("applicationSettings");
auto value = settings->value("forceRevivePage", m_forceRevivePage);
settings->endGroup();
if (value.isValid() && !value.isNull()) {
m_forceRevivePage = value.toBool();
}
}
void SettingsTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
@@ -41,4 +48,24 @@ void SettingsTabController::setAutoStartEnabled(bool value, bool notify) {
}
}
bool SettingsTabController::forceRevivePage() const {
return m_forceRevivePage;
}
void SettingsTabController::setForceRevivePage(bool value, bool notify) {
if (m_forceRevivePage != value) {
m_forceRevivePage = value;
auto settings = OverlayController::appSettings();
settings->beginGroup("applicationSettings");
settings->setValue("forceRevivePage", m_forceRevivePage);
settings->endGroup();
settings->sync();
if (notify) {
emit forceRevivePageChanged(m_forceRevivePage);
}
}
}
} // namespace advconfig
@@ -14,6 +14,7 @@ class OverlayController;
class SettingsTabController : public QObject {
Q_OBJECT
Q_PROPERTY(bool autoStartEnabled READ autoStartEnabled WRITE setAutoStartEnabled NOTIFY autoStartEnabledChanged)
Q_PROPERTY(bool forceRevivePage READ forceRevivePage WRITE setForceRevivePage NOTIFY forceRevivePageChanged)
private:
OverlayController* parent;
@@ -22,6 +23,7 @@ private:
unsigned settingsUpdateCounter = 0;
bool m_autoStartEnabled = false;
bool m_forceRevivePage = false;
public:
void initStage1();
@@ -30,12 +32,15 @@ public:
void eventLoopTick();
bool autoStartEnabled() const;
bool forceRevivePage() const;
public slots:
void setAutoStartEnabled(bool value, bool notify = true);
void setForceRevivePage(bool value, bool notify = true);
signals:
void autoStartEnabledChanged(bool value);
void forceRevivePageChanged(bool value);
};
} // namespace advsettings