Skip to content

Commit

Permalink
Added client resource files path info to Advanced tab
Browse files Browse the repository at this point in the history
  • Loading branch information
ccw808 committed May 5, 2016
1 parent 15ae187 commit aae89d5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
35 changes: 32 additions & 3 deletions MTA10/core/CSettings.cpp
Expand Up @@ -1416,6 +1416,25 @@ void CSettings::CreateGUI ( void )
#endif
}

// Cache path info
m_pCachePathLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pTabAdvanced, _("Client resource files:") ) );
m_pCachePathLabel->SetPosition ( CVector2D ( vecTemp.fX, vecTemp.fY ) );
m_pCachePathLabel->AutoSize ( );

m_pCachePathShowButton = reinterpret_cast < CGUIButton* > ( pManager->CreateButton ( pTabAdvanced, _("Show in Explorer") ) );
m_pCachePathShowButton->SetPosition ( CVector2D ( vecTemp.fX + fIndentX + 1, vecTemp.fY - 1 ) );
m_pCachePathShowButton->AutoSize ( NULL, 20.0f, 8.0f );
m_pCachePathShowButton->SetClickHandler ( GUI_CALLBACK ( &CSettings::OnCachePathShowButtonClick, this ) );
m_pCachePathShowButton->SetZOrderingEnabled ( false );
m_pCachePathShowButton->GetSize ( vecSize );

SString strFileCachePath = GetCommonRegistryValue( "", "File Cache Path" );
m_pCachePathValue = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pTabAdvanced, strFileCachePath ) );
m_pCachePathValue->SetPosition ( CVector2D ( vecTemp.fX + fIndentX + vecSize.fX + 10, vecTemp.fY + 3 ) );
m_pCachePathValue->SetFont ( "default-small" );
m_pCachePathValue->AutoSize ( );
vecTemp.fY += fLineHeight;

// Auto updater section label
m_pAdvancedUpdaterLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pTabAdvanced, _("Auto updater") ) );
m_pAdvancedUpdaterLabel->SetPosition ( CVector2D ( vecTemp.fX - 10.0f, vecTemp.fY ) );
Expand Down Expand Up @@ -1467,11 +1486,11 @@ void CSettings::CreateGUI ( void )
vecTemp.fX -= fComboWidth + 15;

// Description label
vecTemp.fY = 354 + 10;
vecTemp.fY = 354 + 35;
m_pAdvancedSettingDescriptionLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pTabAdvanced, "" ) );
m_pAdvancedSettingDescriptionLabel->SetPosition ( CVector2D ( vecTemp.fX + 10.f, vecTemp.fY ) );
m_pAdvancedSettingDescriptionLabel->SetPosition ( CVector2D ( 0, vecTemp.fY ) );
m_pAdvancedSettingDescriptionLabel->SetFont ( "default-bold-small" );
m_pAdvancedSettingDescriptionLabel->SetSize ( CVector2D ( 500.0f, 95.0f ) );
m_pAdvancedSettingDescriptionLabel->SetSize ( CVector2D ( tabPanelSize.fX, 95.0f ) );
m_pAdvancedSettingDescriptionLabel->SetHorizontalAlign ( CGUI_ALIGN_HORIZONTALCENTER_WORDWRAP );

// Set up the events
Expand Down Expand Up @@ -3883,6 +3902,16 @@ bool CSettings::OnUpdateButtonClick ( CGUIElement* pElement )
return true;
}


bool CSettings::OnCachePathShowButtonClick ( CGUIElement* pElement )
{
SString strFileCachePath = GetCommonRegistryValue( "", "File Cache Path" );
if ( DirectoryExists( strFileCachePath ) )
ShellExecuteNonBlocking( "open", strFileCachePath );
return true;
}


bool CSettings::OnFxQualityChanged ( CGUIElement* pElement )
{
CGUIListItem* pItem = m_pComboFxQuality->GetSelectedItem ();
Expand Down
5 changes: 4 additions & 1 deletion MTA10/core/CSettings.h
Expand Up @@ -233,7 +233,9 @@ class CSettings
CGUIButton* m_pButtonUpdate;
CGUILabel* m_pAdvancedMiscLabel;
CGUILabel* m_pAdvancedUpdaterLabel;

CGUILabel* m_pCachePathLabel;
CGUILabel* m_pCachePathValue;
CGUIButton* m_pCachePathShowButton;
CGUILabel* m_pLabelRadioVolume;
CGUILabel* m_pLabelSFXVolume;
CGUILabel* m_pLabelMTAVolume;
Expand Down Expand Up @@ -367,6 +369,7 @@ class CSettings
bool OnChatBlueChanged ( CGUIElement* pElement );
bool OnChatAlphaChanged ( CGUIElement* pElement );
bool OnUpdateButtonClick ( CGUIElement* pElement );
bool OnCachePathShowButtonClick ( CGUIElement* pElement );
bool OnMouseSensitivityChanged ( CGUIElement* pElement );
bool OnVerticalAimSensitivityChanged ( CGUIElement* pElement );
bool OnBrowserBlacklistAdd ( CGUIElement* pElement );
Expand Down

0 comments on commit aae89d5

Please sign in to comment.