Add developer mode CVar, use `CPU max MHz instead`

This commit is contained in:
Phillip Stephens 2018-01-15 05:17:08 -08:00
parent 2fd21e3270
commit bf1e342bc4
3 changed files with 22 additions and 3 deletions

View File

@ -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<QAction*>(sender())->text().toStdString());
@ -78,12 +89,18 @@ void LaunchMenu::apiTriggered()
void LaunchMenu::msaaTriggered()
{
m_commons.setSamples(qobject_cast<QAction*>(sender())->text().toInt());
m_commons.setSamples(qobject_cast<QAction*>(sender())->text().toUInt());
m_commons.serialize();
}
void LaunchMenu::anisoTriggered()
{
m_commons.setAnisotropy(qobject_cast<QAction*>(sender())->text().toInt());
m_commons.setAnisotropy(qobject_cast<QAction*>(sender())->text().toUInt());
m_commons.serialize();
}
void LaunchMenu::developerModeTriggered()
{
hecl::CVarManager::instance()->setDeveloperMode(qobject_cast<QAction*>(sender())->isChecked(), true);
m_commons.serialize();
}

View File

@ -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

View File

@ -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;