Convert to new paths system
This commit is contained in:
+17
-18
@@ -65,20 +65,19 @@ OverlayController::OverlayController( bool desktopMode,
|
||||
<< focusChangedSoundFile;
|
||||
}
|
||||
|
||||
QString alarm01SoundFile
|
||||
= QStandardPaths::locate( QStandardPaths::AppDataLocation,
|
||||
QStringLiteral( "res/sounds/alarm01.wav" ) );
|
||||
QFileInfo alarm01SoundFileInfo( alarm01SoundFile );
|
||||
if ( alarm01SoundFileInfo.exists() && alarm01SoundFileInfo.isFile() )
|
||||
constexpr auto alarmFileName = "res/sounds/alarm01.wav";
|
||||
const auto alarm01SoundFile
|
||||
= paths::binaryDirectoryFindFile( alarmFileName );
|
||||
|
||||
if ( alarm01SoundFile.has_value() )
|
||||
{
|
||||
m_alarm01SoundEffect.setSource(
|
||||
QUrl::fromLocalFile( alarm01SoundFile ) );
|
||||
m_alarm01SoundEffect.setSource( QUrl::fromLocalFile(
|
||||
QString::fromStdString( ( *alarm01SoundFile ) ) ) );
|
||||
m_alarm01SoundEffect.setVolume( 1.0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG( ERROR ) << "Could not find alarm01 sound file "
|
||||
<< alarm01SoundFile;
|
||||
LOG( ERROR ) << "Could not find alarm01 sound file " << alarmFileName;
|
||||
}
|
||||
|
||||
QSurfaceFormat format;
|
||||
@@ -326,19 +325,19 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
|
||||
m_ulOverlayHandle,
|
||||
vr::VROverlayFlags_SendVRSmoothScrollEvents,
|
||||
true );
|
||||
QString thumbIconPath = QStandardPaths::locate(
|
||||
QStandardPaths::AppDataLocation,
|
||||
QStringLiteral( "res/img/icons/thumbicon.png" ) );
|
||||
if ( QFile::exists( thumbIconPath ) )
|
||||
|
||||
constexpr auto thumbiconFilename = "res/img/icons/thumbicon.png";
|
||||
const auto thumbIconPath
|
||||
= paths::binaryDirectoryFindFile( thumbiconFilename );
|
||||
if ( thumbIconPath.has_value() )
|
||||
{
|
||||
vr::VROverlay()->SetOverlayFromFile(
|
||||
m_ulOverlayThumbnailHandle,
|
||||
thumbIconPath.toStdString().c_str() );
|
||||
vr::VROverlay()->SetOverlayFromFile( m_ulOverlayThumbnailHandle,
|
||||
thumbIconPath->c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG( ERROR ) << "Could not find thumbnail icon \"" << thumbIconPath
|
||||
<< "\"";
|
||||
LOG( ERROR ) << "Could not find thumbnail icon \""
|
||||
<< thumbiconFilename << "\"";
|
||||
}
|
||||
|
||||
// Too many render calls in too short time overwhelm Qt and an assertion
|
||||
|
||||
@@ -70,15 +70,14 @@ void AudioTabController::initStage2( OverlayController* var_parent,
|
||||
notifKey.c_str(), notifKey.c_str(), &m_ulNotificationOverlayHandle );
|
||||
if ( overlayError == vr::VROverlayError_None )
|
||||
{
|
||||
QString notifIconPath = QStandardPaths::locate(
|
||||
QStandardPaths::AppDataLocation,
|
||||
QStringLiteral(
|
||||
"/res/img/audio/microphone/ptt_notification.png" ) );
|
||||
if ( QFile::exists( notifIconPath ) )
|
||||
constexpr auto notificationIconFilename
|
||||
= "/res/img/audio/microphone/ptt_notification.png";
|
||||
const auto notifIconPath
|
||||
= paths::binaryDirectoryFindFile( notificationIconFilename );
|
||||
if ( notifIconPath.has_value() )
|
||||
{
|
||||
vr::VROverlay()->SetOverlayFromFile(
|
||||
m_ulNotificationOverlayHandle,
|
||||
notifIconPath.toStdString().c_str() );
|
||||
vr::VROverlay()->SetOverlayFromFile( m_ulNotificationOverlayHandle,
|
||||
notifIconPath->c_str() );
|
||||
vr::VROverlay()->SetOverlayWidthInMeters(
|
||||
m_ulNotificationOverlayHandle, 0.02f );
|
||||
vr::HmdMatrix34_t notificationTransform
|
||||
@@ -93,7 +92,7 @@ void AudioTabController::initStage2( OverlayController* var_parent,
|
||||
else
|
||||
{
|
||||
LOG( ERROR ) << "Could not find notification icon \""
|
||||
<< notifIconPath << "\"";
|
||||
<< notificationIconFilename << "\"";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -250,10 +250,22 @@ void UtilitiesTabController::modAlarmTimeMinute( int value, bool notify )
|
||||
|
||||
QString getBatteryIconPath( int batteryState )
|
||||
{
|
||||
QString batteryPrefix = "/res/img/battery/battery_";
|
||||
return QStandardPaths::locate(
|
||||
QStandardPaths::AppDataLocation,
|
||||
batteryPrefix + QString::number( batteryState ) + ".png" );
|
||||
constexpr auto batteryPrefix = "/res/img/battery/battery_";
|
||||
|
||||
const auto batteryFullPath
|
||||
= ( batteryPrefix + QString::number( batteryState ) + ".png" )
|
||||
.toStdString();
|
||||
|
||||
const auto batteryPath = paths::binaryDirectoryFindFile( batteryFullPath );
|
||||
|
||||
if ( !batteryPath.has_value() )
|
||||
{
|
||||
LOG( ERROR ) << "Unable to find battery image number '" << batteryState
|
||||
<< "'.";
|
||||
return "";
|
||||
}
|
||||
|
||||
return QString::fromStdString( *batteryPath );
|
||||
}
|
||||
|
||||
vr::VROverlayHandle_t createBatteryOverlay( vr::TrackedDeviceIndex_t index )
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ optional<string> binaryDirectoryFindFile( const string fileName )
|
||||
return path.toStdString();
|
||||
}
|
||||
|
||||
optional<string> binaryDirectoryFindDirectory( string directoryName )
|
||||
optional<string> binaryDirectoryFindDirectory( const string directoryName )
|
||||
{
|
||||
const auto path
|
||||
= QStandardPaths::locate( QStandardPaths::AppDataLocation,
|
||||
|
||||
Reference in New Issue
Block a user