Move application strings into separate namespace
Them being in the overlay controller required them to be static, which forces the compiler to give them a memory location at compile time. They also don't really fit into the overlaycontroller.
This commit is contained in:
+7
-9
@@ -8,13 +8,12 @@ int main( int argc, char* argv[] )
|
||||
|
||||
MyQApplication mainEventLoop( argc, argv );
|
||||
mainEventLoop.setOrganizationName(
|
||||
advsettings::OverlayController::applicationOrganizationName );
|
||||
mainEventLoop.setApplicationName(
|
||||
advsettings::OverlayController::applicationName );
|
||||
application_strings::applicationOrganizationName );
|
||||
mainEventLoop.setApplicationName( application_strings::applicationName );
|
||||
mainEventLoop.setApplicationDisplayName(
|
||||
advsettings::OverlayController::applicationDisplayName );
|
||||
application_strings::applicationDisplayName );
|
||||
mainEventLoop.setApplicationVersion(
|
||||
advsettings::OverlayController::applicationVersionString );
|
||||
application_strings::applicationVersionString );
|
||||
|
||||
qInstallMessageHandler( mainQtMessageHandler );
|
||||
|
||||
@@ -61,10 +60,9 @@ int main( int argc, char* argv[] )
|
||||
<< std::endl;
|
||||
}
|
||||
auto quickObj = component.create();
|
||||
controller.SetWidget(
|
||||
qobject_cast<QQuickItem*>( quickObj ),
|
||||
advsettings::OverlayController::applicationDisplayName,
|
||||
advsettings::OverlayController::applicationKey );
|
||||
controller.SetWidget( qobject_cast<QQuickItem*>( quickObj ),
|
||||
application_strings::applicationDisplayName,
|
||||
application_strings::applicationKey );
|
||||
|
||||
// Attempts to install the application manifest on all "regular" starts.
|
||||
if ( !commandLineArgs.desktopMode && !commandLineArgs.forceNoManifest )
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
// application namespace
|
||||
namespace advsettings
|
||||
{
|
||||
constexpr const char* OverlayController::applicationVersionString;
|
||||
|
||||
QSettings* OverlayController::_appSettings = nullptr;
|
||||
|
||||
OverlayController::OverlayController( bool desktopMode,
|
||||
@@ -1035,7 +1033,7 @@ void OverlayController::RotateCollisionBounds( float angle, bool commit )
|
||||
|
||||
QString OverlayController::getVersionString()
|
||||
{
|
||||
return QString( applicationVersionString );
|
||||
return QString( application_strings::applicationVersionString );
|
||||
}
|
||||
|
||||
QUrl OverlayController::getVRRuntimePathUrl()
|
||||
|
||||
@@ -40,6 +40,15 @@
|
||||
|
||||
#include "openvr/ivrinput.h"
|
||||
|
||||
namespace application_strings
|
||||
{
|
||||
constexpr auto applicationOrganizationName = "matzman666";
|
||||
constexpr auto applicationName = "OpenVRAdvancedSettings";
|
||||
constexpr const char* applicationKey = "matzman666.AdvancedSettings";
|
||||
constexpr const char* applicationDisplayName = "Advanced Settings";
|
||||
constexpr const char* applicationVersionString = "v2.8.0-dev";
|
||||
} // namespace application_strings
|
||||
|
||||
// application namespace
|
||||
namespace advsettings
|
||||
{
|
||||
@@ -66,13 +75,6 @@ class OverlayController : public QObject
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( bool m_desktopMode READ isDesktopMode )
|
||||
|
||||
public:
|
||||
static constexpr auto applicationOrganizationName = "matzman666";
|
||||
static constexpr auto applicationName = "OpenVRAdvancedSettings";
|
||||
static constexpr const char* applicationKey = "matzman666.AdvancedSettings";
|
||||
static constexpr const char* applicationDisplayName = "Advanced Settings";
|
||||
static constexpr const char* applicationVersionString = "v2.8.0-dev";
|
||||
|
||||
private:
|
||||
vr::VROverlayHandle_t m_ulOverlayHandle = vr::k_ulOverlayHandleInvalid;
|
||||
vr::VROverlayHandle_t m_ulOverlayThumbnailHandle
|
||||
|
||||
@@ -64,7 +64,7 @@ void AudioTabController::initStage2( OverlayController* var_parent,
|
||||
this->widget = var_widget;
|
||||
|
||||
std::string notifKey
|
||||
= std::string( OverlayController::applicationKey ) + ".pptnotification";
|
||||
= std::string( application_strings::applicationKey ) + ".pptnotification";
|
||||
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->CreateOverlay(
|
||||
notifKey.c_str(), notifKey.c_str(), &m_ulNotificationOverlayHandle );
|
||||
|
||||
@@ -540,8 +540,7 @@ void ChaperoneTabController::handleChaperoneWarnings( float distance )
|
||||
{
|
||||
if ( !vr::VROverlay()->IsDashboardVisible() )
|
||||
{
|
||||
vr::VROverlay()->ShowDashboard(
|
||||
OverlayController::applicationKey );
|
||||
vr::VROverlay()->ShowDashboard( application_strings::applicationKey );
|
||||
}
|
||||
m_chaperoneShowDashboardActive = true;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace advsettings
|
||||
void SettingsTabController::initStage1()
|
||||
{
|
||||
m_autoStartEnabled = vr::VRApplications()->GetApplicationAutoLaunch(
|
||||
OverlayController::applicationKey );
|
||||
application_strings::applicationKey );
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup( "applicationSettings" );
|
||||
auto value = settings->value( "forceRevivePage", m_forceRevivePage );
|
||||
@@ -33,7 +33,7 @@ void SettingsTabController::eventLoopTick()
|
||||
if ( parent->isDashboardVisible() )
|
||||
{
|
||||
setAutoStartEnabled( vr::VRApplications()->GetApplicationAutoLaunch(
|
||||
OverlayController::applicationKey ) );
|
||||
application_strings::applicationKey ) );
|
||||
}
|
||||
settingsUpdateCounter = 0;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ void SettingsTabController::setAutoStartEnabled( bool value, bool notify )
|
||||
{
|
||||
m_autoStartEnabled = value;
|
||||
auto apperror = vr::VRApplications()->SetApplicationAutoLaunch(
|
||||
OverlayController::applicationKey, m_autoStartEnabled );
|
||||
application_strings::applicationKey, m_autoStartEnabled );
|
||||
if ( apperror != vr::VRApplicationError_None )
|
||||
{
|
||||
LOG( ERROR ) << "Could not set auto start: "
|
||||
|
||||
@@ -259,8 +259,8 @@ QString getBatteryIconPath( int batteryState )
|
||||
vr::VROverlayHandle_t createBatteryOverlay( vr::TrackedDeviceIndex_t index )
|
||||
{
|
||||
vr::VROverlayHandle_t handle = vr::k_ulOverlayHandleInvalid;
|
||||
std::string batteryKey = std::string( OverlayController::applicationKey )
|
||||
+ ".battery." + std::to_string( index );
|
||||
std::string batteryKey = std::string( application_strings::applicationKey ) + ".battery."
|
||||
+ std::to_string( index );
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->CreateOverlay(
|
||||
batteryKey.c_str(), batteryKey.c_str(), &handle );
|
||||
if ( overlayError == vr::VROverlayError_None )
|
||||
|
||||
+6
-7
@@ -102,7 +102,7 @@ namespace manifest
|
||||
void enableApplicationAutostart()
|
||||
{
|
||||
const auto app_error = vr::VRApplications()->SetApplicationAutoLaunch(
|
||||
advsettings::OverlayController::applicationKey, true );
|
||||
application_strings::applicationKey, true );
|
||||
if ( app_error != vr::VRApplicationError_None )
|
||||
{
|
||||
throw std::runtime_error(
|
||||
@@ -119,7 +119,7 @@ void enableApplicationAutostart()
|
||||
void installApplicationManifest( const QString manifestPath )
|
||||
{
|
||||
if ( vr::VRApplications()->IsApplicationInstalled(
|
||||
advsettings::OverlayController::applicationKey ) )
|
||||
application_strings::applicationKey ) )
|
||||
{
|
||||
// We don't want to disrupt applications that are already installed.
|
||||
return;
|
||||
@@ -148,7 +148,7 @@ void removeApplicationManifest( const QString manifestPath )
|
||||
}
|
||||
|
||||
if ( vr::VRApplications()->IsApplicationInstalled(
|
||||
advsettings::OverlayController::applicationKey ) )
|
||||
application_strings::applicationKey ) )
|
||||
{
|
||||
vr::VRApplications()->RemoveApplicationManifest(
|
||||
QDir::toNativeSeparators( manifestPath ).toStdString().c_str() );
|
||||
@@ -166,14 +166,14 @@ void reinstallApplicationManifest( const QString manifestPath )
|
||||
}
|
||||
|
||||
if ( vr::VRApplications()->IsApplicationInstalled(
|
||||
advsettings::OverlayController::applicationKey ) )
|
||||
application_strings::applicationKey ) )
|
||||
{
|
||||
// String size was arbitrarily chosen by original author.
|
||||
constexpr auto kStringSize = 1024;
|
||||
char oldApplicationWorkingDir[kStringSize] = { 0 };
|
||||
auto app_error = vr::VRApplicationError_None;
|
||||
vr::VRApplications()->GetApplicationPropertyString(
|
||||
advsettings::OverlayController::applicationKey,
|
||||
application_strings::applicationKey,
|
||||
vr::VRApplicationProperty_WorkingDirectory_String,
|
||||
oldApplicationWorkingDir,
|
||||
kStringSize,
|
||||
@@ -293,7 +293,6 @@ void setUpLogging()
|
||||
el::Loggers::reconfigureAllLoggers( conf );
|
||||
|
||||
LOG( INFO ) << "Application started (Version "
|
||||
<< advsettings::OverlayController::applicationVersionString
|
||||
<< ")";
|
||||
<< application_strings::applicationVersionString << ")";
|
||||
LOG( INFO ) << "Log File: " << logFilePath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user