use QStandardPaths to get resource locations (#44)

* use QStandardPaths to get resource locations

While this shouldn't change behaviour for windows, it allows installing the resource files seperate from the binary on unix systems

* initialize battery overlay handles to 0
This commit is contained in:
Robin Appelman
2019-01-12 16:34:45 -06:00
committed by ykeara
parent b418c76315
commit e75a4c2353
5 changed files with 43 additions and 34 deletions
+10 -8
View File
@@ -85,8 +85,9 @@ OverlayController::OverlayController( bool desktopMode,
<< focusChangedSoundFile;
}
QString alarm01SoundFile = QApplication::applicationDirPath().append(
"/res/sounds/alarm01.wav" );
QString alarm01SoundFile
= QStandardPaths::locate( QStandardPaths::AppDataLocation,
QStringLiteral( "res/sounds/alarm01.wav" ) );
QFileInfo alarm01SoundFileInfo( alarm01SoundFile );
if ( alarm01SoundFileInfo.exists() && alarm01SoundFileInfo.isFile() )
{
@@ -433,13 +434,14 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
m_ulOverlayHandle, vr::VROverlayInputMethod_Mouse );
vr::VROverlay()->SetOverlayFlag(
m_ulOverlayHandle, vr::VROverlayFlags_SendVRScrollEvents, true );
std::string thumbIconPath
= QApplication::applicationDirPath().toStdString()
+ "\\res\\thumbicon.png";
if ( QFile::exists( QString::fromStdString( thumbIconPath ) ) )
QString thumbIconPath
= QStandardPaths::locate( QStandardPaths::AppDataLocation,
QStringLiteral( "res/thumbicon.png" ) );
if ( QFile::exists( thumbIconPath ) )
{
vr::VROverlay()->SetOverlayFromFile( m_ulOverlayThumbnailHandle,
thumbIconPath.c_str() );
vr::VROverlay()->SetOverlayFromFile(
m_ulOverlayThumbnailHandle,
thumbIconPath.toStdString().c_str() );
}
else
{