winecfg: Select an audio driver on fresh install.

This commit is contained in:
Robert Reif 2005-12-21 20:07:56 +01:00 committed by Alexandre Julliard
parent 975ffe8abc
commit 9f34fd3787
3 changed files with 64 additions and 5 deletions

View File

@ -201,6 +201,7 @@ BEGIN
IDS_WINECFG_TITLE "Wine configuration" IDS_WINECFG_TITLE "Wine configuration"
IDS_THEMEFILE "Theme files" IDS_THEMEFILE "Theme files"
IDS_THEMEFILE_SELECT "Select a theme file" IDS_THEMEFILE_SELECT "Select a theme file"
IDS_AUDIO_MISSING "There is no audio driver currently specified in the registry.\n\nA recommended driver has been selected for you.\nYou can use this driver or select another driver if available.\n\nYou must click Apply for the selection to take effect."
END END

View File

@ -516,6 +516,23 @@ start_over:
free(tokens); free(tokens);
} }
static void selectDriver(HWND hDlg, const char * driver)
{
WCHAR text[1024];
WCHAR caption[64];
strcpy(curAudioDriver, driver);
set_reg_key(config_key, "Drivers", "Audio", curAudioDriver);
if (LoadStringW(GetModuleHandle(NULL), IDS_AUDIO_MISSING, text, sizeof(text)/sizeof(text[0])))
{
if (LoadStringW(GetModuleHandle(NULL), IDS_WINECFG_TITLE, caption, sizeof(caption)/sizeof(caption[0])))
MessageBoxW(hDlg, text, caption, MB_OK | MB_ICONINFORMATION);
}
SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */
}
static void initAudioDlg (HWND hDlg) static void initAudioDlg (HWND hDlg)
{ {
int i; int i;
@ -523,14 +540,54 @@ static void initAudioDlg (HWND hDlg)
WINE_TRACE("\n"); WINE_TRACE("\n");
/* make a local copy of the current registry setting */
strcpy(curAudioDriver, get_reg_key(config_key, "Drivers", "Audio", ""));
WINE_TRACE("curAudioDriver = %s\n", curAudioDriver);
/* make a list of all drivers that can be loaded */ /* make a list of all drivers that can be loaded */
findAudioDrivers(); findAudioDrivers();
/* get current registry setting if available */
buf = get_reg_key(config_key, "Drivers", "Audio", NULL);
/* check for first time install and set a default driver
* select in this order: oss, alsa, first available driver, none
*/
if (buf == NULL)
{
const AUDIO_DRIVER *pAudioDrv = NULL;
/* select oss if available */
for (pAudioDrv = loadedAudioDrv; *pAudioDrv->szName; pAudioDrv++)
{
if (strcmp(pAudioDrv->szDriver, "oss") == 0)
{
selectDriver(hDlg, "oss");
break;
}
}
if (strlen(curAudioDriver) == 0)
{
/* select alsa if available */
for (pAudioDrv = loadedAudioDrv; *pAudioDrv->szName; pAudioDrv++)
{
if (strcmp(pAudioDrv->szDriver, "alsa") == 0)
{
selectDriver(hDlg, "alsa");
break;
}
}
}
if (strlen(curAudioDriver) == 0)
{
/* select first available driver */
if (*loadedAudioDrv->szDriver)
selectDriver(hDlg, loadedAudioDrv->szDriver);
}
}
else /* make a local copy of the current registry setting */
strcpy(curAudioDriver, buf);
WINE_TRACE("curAudioDriver = %s\n", curAudioDriver);
/* check for drivers that can't be loaded */ /* check for drivers that can't be loaded */
checkRegistrySetting(hDlg); checkRegistrySetting(hDlg);

View File

@ -141,6 +141,7 @@
#define IDR_WINECFG 1305 #define IDR_WINECFG 1305
#define IDB_CHECKBOX 1306 #define IDB_CHECKBOX 1306
#define IDB_DEVICE 1307 #define IDB_DEVICE 1307
#define IDS_AUDIO_MISSING 1308
/* appearance tab */ /* appearance tab */
#define IDC_THEME_COLORCOMBO 1401 #define IDC_THEME_COLORCOMBO 1401