Qt: add setting in User Interface to enable use of the desktop menu in general (disabling it may improve startup time if desktop menu is not being used)

This commit is contained in:
Brad Parker 2018-04-30 19:11:38 -04:00
parent fc28edd821
commit 71257adb8e
11 changed files with 69 additions and 14 deletions

View file

@ -673,6 +673,9 @@ static const bool ui_companion_enable = false;
/* Currently only used to show the WIMP UI on startup */
static const bool ui_companion_toggle = false;
/* Only init the WIMP UI for this session if this is enabled */
static const bool desktop_menu_enable = true;
#if defined(__QNX__) || defined(_XBOX1) || defined(_XBOX360) || defined(__CELLOS_LV2__) || (defined(__MACH__) && defined(IOS)) || defined(ANDROID) || defined(WIIU) || defined(HAVE_NEON) || defined(GEKKO) || defined(__ARM_NEON__)
static enum resampler_quality audio_resampler_quality_level = RESAMPLER_QUALITY_LOWER;
#elif defined(PSP) || defined(_3DS) || defined(VITA)

View file

@ -1181,6 +1181,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("ui_companion_start_on_boot", &settings->bools.ui_companion_start_on_boot, true, ui_companion_start_on_boot, false);
SETTING_BOOL("ui_companion_enable", &settings->bools.ui_companion_enable, true, ui_companion_enable, false);
SETTING_BOOL("ui_companion_toggle", &settings->bools.ui_companion_toggle, false, ui_companion_toggle, false);
SETTING_BOOL("desktop_menu_enable", &settings->bools.desktop_menu_enable, true, desktop_menu_enable, false);
SETTING_BOOL("video_gpu_record", &settings->bools.video_gpu_record, true, gpu_record, false);
SETTING_BOOL("input_remap_binds_enable", &settings->bools.input_remap_binds_enable, true, true, false);
SETTING_BOOL("all_users_control_menu", &settings->bools.input_all_users_control_menu, true, all_users_control_menu, false);

View file

@ -199,6 +199,7 @@ typedef struct settings
bool ui_companion_start_on_boot;
bool ui_companion_enable;
bool ui_companion_toggle;
bool desktop_menu_enable;
/* Cheevos */
bool cheevos_enable;

View file

@ -887,6 +887,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE,
"ゲームのフォーカスを切り替え")
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_UI_COMPANION_TOGGLE,
"デスクトップメニューを切り替え")
MSG_HASH(MENU_ENUM_LABEL_VALUE_DESKTOP_MENU_ENABLE,
"デスクトップメニューを有効(再起動が必要)")
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY,
"保存状態をロード")
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE,
@ -1692,7 +1694,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX,
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION,
"黒いフレームを挿入")
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN,
"オーバースキャンをクロップ (再起動が必要)")
"オーバースキャンをクロップ(再起動が必要)")
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_DISABLE_COMPOSITION,
"デスクトップのコンポジットを無効")
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER,

View file

@ -1059,6 +1059,8 @@ MSG_HASH(MENU_ENUM_LABEL_UI_COMPANION_START_ON_BOOT,
"ui_companion_start_on_boot")
MSG_HASH(MENU_ENUM_LABEL_UI_COMPANION_TOGGLE,
"ui_companion_toggle")
MSG_HASH(MENU_ENUM_LABEL_DESKTOP_MENU_ENABLE,
"desktop_menu_enable")
MSG_HASH(MENU_ENUM_LABEL_UI_MENUBAR_ENABLE,
"ui_menubar_enable")
MSG_HASH(MENU_ENUM_LABEL_UNDO_LOAD_STATE,

View file

@ -1661,6 +1661,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT,
"UI Companion Start On Boot")
MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_TOGGLE,
"Show desktop menu on startup")
MSG_HASH(MENU_ENUM_LABEL_VALUE_DESKTOP_MENU_ENABLE,
"Enable desktop menu (restart)")
MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE,
"Menubar")
MSG_HASH(MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE,

View file

@ -5551,6 +5551,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
MENU_ENUM_LABEL_UI_MENUBAR_ENABLE,
PARSE_ONLY_BOOL, false);
#ifdef HAVE_QT
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_DESKTOP_MENU_ENABLE,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_UI_COMPANION_TOGGLE,
PARSE_ONLY_BOOL, false);

View file

@ -6520,6 +6520,21 @@ static bool setting_append_list(
SD_FLAG_NONE);
}
#ifdef HAVE_QT
CONFIG_BOOL(
list, list_info,
&settings->bools.desktop_menu_enable,
MENU_ENUM_LABEL_DESKTOP_MENU_ENABLE,
MENU_ENUM_LABEL_VALUE_DESKTOP_MENU_ENABLE,
desktop_menu_enable,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_ADVANCED);
CONFIG_BOOL(
list, list_info,
&settings->bools.ui_companion_toggle,

View file

@ -808,6 +808,7 @@ enum msg_hash_enums
MENU_LABEL(UI_COMPANION_ENABLE),
MENU_LABEL(UI_COMPANION_START_ON_BOOT),
MENU_LABEL(UI_COMPANION_TOGGLE),
MENU_LABEL(DESKTOP_MENU_ENABLE),
MENU_LABEL(UI_MENUBAR_ENABLE),
MENU_ENUM_LABEL_FILE_CONFIG,

View file

@ -732,6 +732,9 @@ video_message_bgcolor_opacity = 1.0
# Toggle companion UI on startup (currently only used to show the WIMP UI)
# ui_companion_toggle = false
# Only init the WIMP UI for this session if this is enabled
# desktop_menu_enable = true
#### Camera
# Override the default camera device the camera driver uses. This is driver dependant.

View file

@ -46,6 +46,7 @@ static void *ui_companion_data = NULL;
#ifdef HAVE_QT
static void *ui_companion_qt_data = NULL;
static bool qt_is_inited = false;
#endif
/**
@ -107,26 +108,34 @@ void ui_companion_event_command(enum event_command action)
void ui_companion_driver_deinit(void)
{
const ui_companion_driver_t *ui = ui_companion_get_ptr();
if (!ui)
return;
if (ui->deinit)
ui->deinit(ui_companion_data);
#ifdef HAVE_QT
ui_companion_qt.deinit(ui_companion_qt_data);
ui_companion_qt_data = NULL;
if (qt_is_inited)
{
ui_companion_qt.deinit(ui_companion_qt_data);
ui_companion_qt_data = NULL;
}
#endif
ui_companion_data = NULL;
}
void ui_companion_driver_init_first(void)
{
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
ui_companion = (ui_companion_driver_t*)ui_companion_init_first();
#ifdef HAVE_QT
ui_companion_qt_data = ui_companion_qt.init();
if (settings->bools.desktop_menu_enable)
{
ui_companion_qt_data = ui_companion_qt.init();
qt_is_inited = true;
}
#endif
if (ui_companion)
@ -140,7 +149,8 @@ void ui_companion_driver_init_first(void)
ui_companion->toggle(ui_companion_data, false);
#ifdef HAVE_QT
ui_companion_qt.toggle(ui_companion_qt_data, false);
if (settings->bools.desktop_menu_enable)
ui_companion_qt.toggle(ui_companion_qt_data, false);
#endif
}
}
@ -148,25 +158,31 @@ void ui_companion_driver_init_first(void)
void ui_companion_driver_toggle(bool force)
{
settings_t *settings = config_get_ptr();
if (ui_companion && ui_companion->toggle)
ui_companion->toggle(ui_companion_data, false);
#ifdef HAVE_QT
if (ui_companion_qt.toggle)
ui_companion_qt.toggle(ui_companion_qt_data, force);
if (settings->bools.desktop_menu_enable)
if (ui_companion_qt.toggle)
ui_companion_qt.toggle(ui_companion_qt_data, force);
#endif
}
void ui_companion_driver_notify_refresh(void)
{
const ui_companion_driver_t *ui = ui_companion_get_ptr();
settings_t *settings = config_get_ptr();
if (!ui)
return;
if (ui->notify_refresh)
ui->notify_refresh(ui_companion_data);
#ifdef HAVE_QT
if (ui_companion_qt.notify_refresh)
ui_companion_qt.notify_refresh(ui_companion_qt_data);
if (settings->bools.desktop_menu_enable)
if (ui_companion_qt.notify_refresh)
ui_companion_qt.notify_refresh(ui_companion_qt_data);
#endif
}
@ -235,11 +251,14 @@ const ui_application_t *ui_companion_driver_get_application_ptr(void)
void ui_companion_driver_msg_queue_push(const char *msg, unsigned priority, unsigned duration, bool flush)
{
const ui_companion_driver_t *ui = ui_companion_get_ptr();
settings_t *settings = config_get_ptr();
if (ui && ui->msg_queue_push)
ui->msg_queue_push(ui_companion_data, msg, priority, duration, flush);
#ifdef HAVE_QT
if (ui_companion_qt.msg_queue_push)
ui_companion_qt.msg_queue_push(ui_companion_qt_data, msg, priority, duration, flush);
if (settings->bools.desktop_menu_enable)
if (ui_companion_qt.msg_queue_push)
ui_companion_qt.msg_queue_push(ui_companion_qt_data, msg, priority, duration, flush);
#endif
}
@ -261,10 +280,13 @@ const char *ui_companion_driver_get_ident(void)
void ui_companion_driver_log_msg(const char *msg)
{
settings_t *settings = config_get_ptr();
(void)msg;
#ifdef HAVE_QT
if (ui_companion_qt_data)
ui_companion_qt.log_msg(ui_companion_qt_data, msg);
if (settings->bools.desktop_menu_enable)
if (ui_companion_qt_data)
ui_companion_qt.log_msg(ui_companion_qt_data, msg);
#endif
}