Merge branch 'master' into alpha-kung

This commit is contained in:
Kung-vr
2019-01-22 14:00:22 +09:00
3 changed files with 19 additions and 6 deletions
+3
View File
@@ -659,6 +659,9 @@ MyStackViewPage {
onPttProfileAdded:{ onPttProfileAdded:{
pttProfileComboBox.currentIndex = AudioTabController.getPttProfileCount() pttProfileComboBox.currentIndex = AudioTabController.getPttProfileCount()
} }
onDefaultProfileDisplay:{
audioProfileComboBox.currentIndex = AudioTabController.getDefaultAudioProfileIndex() + 1
}
onPlaybackDeviceListChanged: { onPlaybackDeviceListChanged: {
+10 -4
View File
@@ -101,6 +101,7 @@ void AudioTabController::initStage2( OverlayController* var_parent,
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( << vr::VROverlay()->GetOverlayErrorNameFromEnum(
overlayError ); overlayError );
} }
emit defaultProfileDisplay();
} }
void AudioTabController::reloadAudioSettings() void AudioTabController::reloadAudioSettings()
@@ -852,9 +853,8 @@ void AudioTabController::addAudioProfile( QString name )
profile->defaultProfile = m_isDefaultAudioProfile; profile->defaultProfile = m_isDefaultAudioProfile;
if ( m_isDefaultAudioProfile ) if ( m_isDefaultAudioProfile )
{ {
removeDefaultProfile( name ); removeOtherDefaultProfiles( name );
// to prevent confusion, resets checkbox
setAudioProfileDefault( false ); setAudioProfileDefault( false );
} }
saveAudioProfiles(); saveAudioProfiles();
@@ -1004,14 +1004,14 @@ int AudioTabController::getMirrorIndex( std::string str )
} }
/* /*
Name: removeDefaultProfile Name: removeOtherDefaultProfiles
input: QString name - name of new default profile input: QString name - name of new default profile
output: none output: none
description: checks all profiles and removes any OTHERS that are set as default. description: checks all profiles and removes any OTHERS that are set as default.
*/ */
void AudioTabController::removeDefaultProfile( QString name ) void AudioTabController::removeOtherDefaultProfiles( QString name )
{ {
AudioProfile* profile = nullptr; AudioProfile* profile = nullptr;
for ( auto& p : audioProfiles ) for ( auto& p : audioProfiles )
@@ -1042,11 +1042,17 @@ void AudioTabController::applyDefaultProfile()
if ( profile.defaultProfile ) if ( profile.defaultProfile )
{ {
applyAudioProfile( i ); applyAudioProfile( i );
m_defaultProfileIndex = i;
break; break;
} }
} }
} }
int AudioTabController::getDefaultAudioProfileIndex()
{
return m_defaultProfileIndex;
}
/* ---------------------------*/ /* ---------------------------*/
/*----------------------------*/ /*----------------------------*/
+6 -2
View File
@@ -69,7 +69,8 @@ private:
bool m_micProximitySensorCanMute = false; bool m_micProximitySensorCanMute = false;
bool m_micReversePtt = false; bool m_micReversePtt = false;
bool m_isDefaultAudioProfile = false; bool m_isDefaultAudioProfile = false;
std::string m_defaultProfileName;
int m_defaultProfileIndex = -1;
unsigned settingsUpdateCounter = 0; unsigned settingsUpdateCounter = 0;
@@ -100,7 +101,7 @@ private:
int getRecordingIndex( std::string str ); int getRecordingIndex( std::string str );
int getMirrorIndex( std::string str ); int getMirrorIndex( std::string str );
void removeDefaultProfile( QString name ); void removeOtherDefaultProfiles( QString name );
std::vector<AudioProfile> audioProfiles; std::vector<AudioProfile> audioProfiles;
@@ -138,6 +139,7 @@ public:
Q_INVOKABLE unsigned getAudioProfileCount(); Q_INVOKABLE unsigned getAudioProfileCount();
Q_INVOKABLE QString getAudioProfileName( unsigned index ); Q_INVOKABLE QString getAudioProfileName( unsigned index );
Q_INVOKABLE int getDefaultAudioProfileIndex();
void onNewRecordingDevice(); void onNewRecordingDevice();
void onNewPlaybackDevice(); void onNewPlaybackDevice();
@@ -182,5 +184,7 @@ signals:
void audioProfilesUpdated(); void audioProfilesUpdated();
void audioProfileAdded(); void audioProfileAdded();
void audioProfileDefaultChanged( bool value ); void audioProfileDefaultChanged( bool value );
void defaultProfileDisplay();
}; };
} // namespace advsettings } // namespace advsettings