From bf1e342bc4c6b6f39944b71c871b3f4750a1bb98 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 15 Jan 2018 05:17:08 -0800 Subject: [PATCH] Add developer mode CVar, use `CPU max MHz instead` --- hecl-gui/LaunchMenu.cpp | 21 +++++++++++++++++++-- hecl-gui/LaunchMenu.hpp | 2 ++ hecl-gui/SysReqTableView.cpp | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/hecl-gui/LaunchMenu.cpp b/hecl-gui/LaunchMenu.cpp index 8dfbc7910..be222d000 100644 --- a/hecl-gui/LaunchMenu.cpp +++ b/hecl-gui/LaunchMenu.cpp @@ -1,6 +1,8 @@ #include "LaunchMenu.hpp" #include "hecl/CVarCommons.hpp" +extern hecl::BoolCVar* hecl::com_developer; + LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent) : QMenu("Launch Menu", parent), m_commons(commons), @@ -35,6 +37,7 @@ LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent) initAnisoAction(QStringLiteral("8")); initAnisoAction(QStringLiteral("16")); + initDeveloperMode(); m_apiMenu.addActions(m_apiGroup.actions()); m_msaaMenu.addActions(m_msaaGroup.actions()); m_anisoMenu.addActions(m_anisoGroup.actions()); @@ -70,6 +73,14 @@ void LaunchMenu::initAnisoAction(const QString& action) act->setChecked(true); } +void LaunchMenu::initDeveloperMode() +{ + QAction* act = addAction("&Developer Mode"); + act->setCheckable(true); + act->setChecked(hecl::com_developer->value()); + connect(act, SIGNAL(triggered()), this, SLOT(developerModeTriggered())); +} + void LaunchMenu::apiTriggered() { m_commons.setGraphicsApi(qobject_cast(sender())->text().toStdString()); @@ -78,12 +89,18 @@ void LaunchMenu::apiTriggered() void LaunchMenu::msaaTriggered() { - m_commons.setSamples(qobject_cast(sender())->text().toInt()); + m_commons.setSamples(qobject_cast(sender())->text().toUInt()); m_commons.serialize(); } void LaunchMenu::anisoTriggered() { - m_commons.setAnisotropy(qobject_cast(sender())->text().toInt()); + m_commons.setAnisotropy(qobject_cast(sender())->text().toUInt()); + m_commons.serialize(); +} + +void LaunchMenu::developerModeTriggered() +{ + hecl::CVarManager::instance()->setDeveloperMode(qobject_cast(sender())->isChecked(), true); m_commons.serialize(); } diff --git a/hecl-gui/LaunchMenu.hpp b/hecl-gui/LaunchMenu.hpp index 25a916420..4dee4d93d 100644 --- a/hecl-gui/LaunchMenu.hpp +++ b/hecl-gui/LaunchMenu.hpp @@ -20,6 +20,7 @@ class LaunchMenu : public QMenu void initApiAction(const QString& action); void initMsaaAction(const QString& action); void initAnisoAction(const QString& action); + void initDeveloperMode(); public: LaunchMenu(hecl::CVarCommons& commons, QWidget* parent = Q_NULLPTR); @@ -28,6 +29,7 @@ public slots: void apiTriggered(); void msaaTriggered(); void anisoTriggered(); + void developerModeTriggered(); }; #endif // GUI_LAUNCHMENU_HPP diff --git a/hecl-gui/SysReqTableView.cpp b/hecl-gui/SysReqTableView.cpp index 293cca34c..e8ae24d62 100644 --- a/hecl-gui/SysReqTableView.cpp +++ b/hecl-gui/SysReqTableView.cpp @@ -55,7 +55,7 @@ SysReqTableModel::SysReqTableModel(QObject* parent) for (const QJsonValue& v: lscpuObj.toArray()) { QJsonObject vObj = v.toObject(); - if (vObj.take("field").toString() == "CPU MHz:") + if (vObj.take("field").toString() == "CPU max MHz:") { double speed = vObj.take("data").toString().toDouble(); m_cpuSpeed = speed;