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