(Qt) Cleanups
This commit is contained in:
parent
cc9ff9870f
commit
a9a9075f5f
|
@ -684,7 +684,8 @@ bool audio_driver_init_internal(void *settings_data, bool audio_cb_inited)
|
|||
}
|
||||
|
||||
if (new_rate != 0)
|
||||
configuration_set_int(settings, settings->uints.audio_output_sample_rate, new_rate);
|
||||
configuration_set_int(settings,
|
||||
settings->uints.audio_output_sample_rate, new_rate);
|
||||
|
||||
if (!audio_driver_st.context_audio_data)
|
||||
{
|
||||
|
@ -715,7 +716,8 @@ bool audio_driver_init_internal(void *settings_data, bool audio_cb_inited)
|
|||
/* Should never happen. */
|
||||
RARCH_WARN("[Audio]: Input rate is invalid (%.3f Hz)."
|
||||
" Using output rate (%u Hz).\n",
|
||||
audio_driver_st.input, settings->uints.audio_output_sample_rate);
|
||||
audio_driver_st.input,
|
||||
settings->uints.audio_output_sample_rate);
|
||||
|
||||
audio_driver_st.input = settings->uints.audio_output_sample_rate;
|
||||
}
|
||||
|
@ -1593,18 +1595,18 @@ bool audio_driver_disable_callback(void)
|
|||
|
||||
bool audio_driver_callback(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool menu_pause_libretro = config_get_ptr()->bools.menu_pause_libretro;
|
||||
uint32_t runloop_flags = runloop_get_flags();
|
||||
bool runloop_paused = (runloop_flags & RUNLOOP_FLAG_PAUSED) ? true : false;
|
||||
#ifdef HAVE_MENU
|
||||
#ifdef HAVE_NETWORKING
|
||||
bool core_paused = runloop_paused
|
||||
|| (settings->bools.menu_pause_libretro
|
||||
|| (menu_pause_libretro
|
||||
&& (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)
|
||||
&& netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL));
|
||||
#else
|
||||
bool core_paused = runloop_paused
|
||||
|| (settings->bools.menu_pause_libretro
|
||||
|| (menu_pause_libretro
|
||||
&& (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE));
|
||||
#endif
|
||||
#else
|
||||
|
@ -1715,17 +1717,14 @@ void audio_driver_frame_is_reverse(void)
|
|||
|| !(audio_st->flags & AUDIO_FLAG_ACTIVE)
|
||||
|| !(audio_st->output_samples_buf)))
|
||||
if (!(audio_st->flags & AUDIO_FLAG_SUSPENDED))
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
audio_driver_flush(audio_st,
|
||||
settings->floats.slowmotion_ratio,
|
||||
config_get_ptr()->floats.slowmotion_ratio,
|
||||
audio_st->rewind_buf +
|
||||
audio_st->rewind_ptr,
|
||||
audio_st->rewind_size -
|
||||
audio_st->rewind_ptr,
|
||||
(runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false,
|
||||
(runloop_flags & RUNLOOP_FLAG_FASTMOTION) ? true : false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1857,6 +1856,7 @@ void audio_driver_menu_sample(void)
|
|||
{
|
||||
static int16_t samples_buf[1024] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
float slowmotion_ratio = settings->floats.slowmotion_ratio;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
uint32_t runloop_flags = runloop_get_flags();
|
||||
recording_state_t *recording_st = recording_state_get_ptr();
|
||||
|
@ -1887,7 +1887,7 @@ void audio_driver_menu_sample(void)
|
|||
}
|
||||
if (check_flush)
|
||||
audio_driver_flush(audio_st,
|
||||
settings->floats.slowmotion_ratio,
|
||||
slowmotion_ratio,
|
||||
samples_buf,
|
||||
1024,
|
||||
(runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false,
|
||||
|
@ -1908,9 +1908,7 @@ void audio_driver_menu_sample(void)
|
|||
}
|
||||
if (check_flush)
|
||||
audio_driver_flush(audio_st,
|
||||
settings->floats.slowmotion_ratio,
|
||||
samples_buf,
|
||||
sample_count,
|
||||
slowmotion_ratio, samples_buf, sample_count,
|
||||
(runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false,
|
||||
(runloop_flags & RUNLOOP_FLAG_FASTMOTION) ? true : false);
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
|
|||
settings_t *settings = config_get_ptr();
|
||||
bool float_format = settings->bools.audio_wasapi_float_format;
|
||||
bool exclusive_mode = settings->bools.audio_wasapi_exclusive_mode;
|
||||
bool audio_sync = settings->bools.audio_sync;
|
||||
unsigned sh_buffer_length = settings->uints.audio_wasapi_sh_buffer_length;
|
||||
wasapi_t *w = (wasapi_t*)calloc(1, sizeof(wasapi_t));
|
||||
|
||||
|
@ -140,7 +141,7 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
|
|||
goto error;
|
||||
|
||||
w->flags |= WASAPI_FLG_RUNNING;
|
||||
if (settings->bools.audio_sync)
|
||||
if (audio_sync)
|
||||
w->flags &= ~(WASAPI_FLG_NONBLOCK);
|
||||
else
|
||||
w->flags |= (WASAPI_FLG_NONBLOCK);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "audio/microphone_driver.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
|
||||
#define BYTES_TO_FRAMES(bytes, frame_bits) ((bytes) * 8 / frame_bits)
|
||||
#define FRAMES_TO_BYTES(frames, frame_bits) ((frames) * frame_bits / 8)
|
||||
|
||||
|
|
|
@ -90,18 +90,14 @@ static void wasapi_microphone_close_mic(void *driver_context, void *mic_context)
|
|||
|
||||
static void *wasapi_microphone_init(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
wasapi_microphone_t *wasapi = (wasapi_microphone_t*)calloc(1, sizeof(wasapi_microphone_t));
|
||||
|
||||
if (!wasapi)
|
||||
{
|
||||
RARCH_ERR("[WASAPI mic]: Failed to allocate microphone driver context\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wasapi->nonblock = !settings->bools.audio_sync;
|
||||
wasapi->nonblock = !config_get_ptr()->bools.audio_sync;
|
||||
RARCH_DBG("[WASAPI mic]: Initialized microphone driver context.\n");
|
||||
|
||||
return wasapi;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,9 +143,7 @@ const char *config_get_microphone_driver_options(void)
|
|||
return char_list_new_special(STRING_LIST_MICROPHONE_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
bool microphone_driver_find_driver(
|
||||
void *settings_data,
|
||||
const char *prefix,
|
||||
bool microphone_driver_find_driver(void *settings_data, const char *prefix,
|
||||
bool verbosity_enabled)
|
||||
{
|
||||
settings_t *settings = (settings_t*)settings_data;
|
||||
|
@ -184,21 +182,23 @@ bool microphone_driver_find_driver(
|
|||
return true;
|
||||
}
|
||||
|
||||
static void mic_driver_microphone_handle_init(retro_microphone_t *microphone, const retro_microphone_params_t *params)
|
||||
static void mic_driver_microphone_handle_init(retro_microphone_t *microphone,
|
||||
const retro_microphone_params_t *params)
|
||||
{
|
||||
if (microphone)
|
||||
{
|
||||
const settings_t *settings = config_get_ptr();
|
||||
microphone->microphone_context = NULL;
|
||||
microphone->flags = MICROPHONE_FLAG_ACTIVE;
|
||||
microphone->sample_buffer = NULL;
|
||||
microphone->sample_buffer_length = 0;
|
||||
const settings_t *settings = config_get_ptr();
|
||||
unsigned microphone_sample_rate = settings->uints.microphone_sample_rate;
|
||||
microphone->microphone_context = NULL;
|
||||
microphone->flags = MICROPHONE_FLAG_ACTIVE;
|
||||
microphone->sample_buffer = NULL;
|
||||
microphone->sample_buffer_length = 0;
|
||||
|
||||
microphone->requested_params.rate = params ? params->rate : settings->uints.microphone_sample_rate;
|
||||
microphone->actual_params.rate = 0;
|
||||
microphone->requested_params.rate = params ? params->rate : microphone_sample_rate;
|
||||
microphone->actual_params.rate = 0;
|
||||
/* We don't set the actual parameters until we actually open the mic.
|
||||
* (Remember, the core can request one before the driver is ready.) */
|
||||
microphone->effective_params.rate = params ? params->rate : settings->uints.microphone_sample_rate;
|
||||
microphone->effective_params.rate = params ? params->rate : microphone_sample_rate;
|
||||
/* We set the effective parameters because
|
||||
* the frontend has to do what it can
|
||||
* to give the core what it asks for. */
|
||||
|
@ -253,14 +253,6 @@ static void mic_driver_microphone_handle_free(retro_microphone_t *microphone, bo
|
|||
/* Do NOT free the microphone handle itself! It's allocated statically! */
|
||||
}
|
||||
|
||||
static enum resampler_quality microphone_driver_get_resampler_quality(
|
||||
settings_t *settings)
|
||||
{
|
||||
if (settings)
|
||||
return (enum resampler_quality)settings->uints.microphone_resampler_quality;
|
||||
return RESAMPLER_QUALITY_DONTCARE;
|
||||
}
|
||||
|
||||
bool microphone_driver_init_internal(void *settings_data)
|
||||
{
|
||||
settings_t *settings = (settings_t*)settings_data;
|
||||
|
@ -329,7 +321,7 @@ bool microphone_driver_init_internal(void *settings_data)
|
|||
else
|
||||
mic_st->resampler_ident[0] = '\0';
|
||||
|
||||
mic_st->resampler_quality = microphone_driver_get_resampler_quality(settings);
|
||||
mic_st->resampler_quality = (enum resampler_quality)settings->uints.microphone_resampler_quality;
|
||||
|
||||
RARCH_LOG("[Microphone]: Initialized microphone driver.\n");
|
||||
|
||||
|
@ -710,15 +702,13 @@ retro_microphone_t *microphone_driver_open_mic(const retro_microphone_params_t *
|
|||
void *driver_context = mic_st->driver_context;
|
||||
|
||||
if (!settings)
|
||||
{
|
||||
RARCH_ERR("[Microphone]: Failed to open microphone due to uninitialized config.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Not checking mic_st->flags because they might not be set yet;
|
||||
* don't forget, the core can ask for a mic
|
||||
* before the audio driver is ready to create one. */
|
||||
if (!settings->bools.microphone_enable)
|
||||
{ /* Not checking mic_st->flags because they might not be set yet;
|
||||
* don't forget, the core can ask for a mic
|
||||
* before the audio driver is ready to create one. */
|
||||
{
|
||||
RARCH_DBG("[Microphone]: Refused to open microphone because it's disabled in the settings.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -729,8 +719,8 @@ retro_microphone_t *microphone_driver_open_mic(const retro_microphone_params_t *
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!mic_driver &&
|
||||
(string_is_equal(settings->arrays.microphone_driver, "null")
|
||||
if ( !mic_driver
|
||||
&& (string_is_equal(settings->arrays.microphone_driver, "null")
|
||||
|| string_is_empty(settings->arrays.microphone_driver)))
|
||||
{ /* If the mic driver hasn't been initialized, but it's not going to be... */
|
||||
RARCH_ERR("[Microphone]: Cannot open microphone as the driver won't be initialized.\n");
|
||||
|
@ -756,8 +746,9 @@ retro_microphone_t *microphone_driver_open_mic(const retro_microphone_params_t *
|
|||
* But the user still wants a handle, so we'll give them one.
|
||||
*/
|
||||
mic_driver_microphone_handle_init(&mic_st->microphone, params);
|
||||
/* If driver_context is NULL, the handle won't have a valid microphone context (but we'll create one later) */
|
||||
|
||||
/* If driver_context is NULL, the handle won't have
|
||||
* a valid microphone context (but we'll create one later) */
|
||||
if (driver_context)
|
||||
{
|
||||
/* If the microphone driver is ready to open a microphone... */
|
||||
|
|
|
@ -775,8 +775,8 @@ static bool netplay_handshake_init_send(netplay_t *netplay,
|
|||
|
||||
if (netplay->is_server)
|
||||
{
|
||||
if (!string_is_empty(settings->paths.netplay_password) ||
|
||||
!string_is_empty(settings->paths.netplay_spectate_password))
|
||||
if ( !string_is_empty(settings->paths.netplay_password)
|
||||
|| !string_is_empty(settings->paths.netplay_spectate_password))
|
||||
{
|
||||
/* Demand a password */
|
||||
if (netplay->simple_rand_next == 1)
|
||||
|
@ -1435,17 +1435,17 @@ static bool netplay_handshake_sync(netplay_t *netplay,
|
|||
static bool netplay_handshake_pre_nick(netplay_t *netplay,
|
||||
struct netplay_connection *connection, bool *had_input)
|
||||
{
|
||||
struct nick_buf_s nick_buf;
|
||||
ssize_t recvd;
|
||||
struct nick_buf_s nick_buf;
|
||||
int32_t ping = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
RECV(&nick_buf, sizeof(nick_buf)) {}
|
||||
|
||||
/* Expecting only a nick command */
|
||||
if (recvd < 0 ||
|
||||
ntohl(nick_buf.cmd[0]) != NETPLAY_CMD_NICK ||
|
||||
ntohl(nick_buf.cmd[1]) != sizeof(nick_buf.nick))
|
||||
if ( recvd < 0
|
||||
|| ntohl(nick_buf.cmd[0]) != NETPLAY_CMD_NICK
|
||||
|| ntohl(nick_buf.cmd[1]) != sizeof(nick_buf.nick))
|
||||
{
|
||||
const char *_msg = NULL;
|
||||
|
||||
|
@ -1474,8 +1474,8 @@ static bool netplay_handshake_pre_nick(netplay_t *netplay,
|
|||
return false;
|
||||
|
||||
/* There's a password, so just put them in PRE_PASSWORD mode */
|
||||
if (!string_is_empty(settings->paths.netplay_password) ||
|
||||
!string_is_empty(settings->paths.netplay_spectate_password))
|
||||
if ( !string_is_empty(settings->paths.netplay_password)
|
||||
|| !string_is_empty(settings->paths.netplay_spectate_password))
|
||||
connection->mode = NETPLAY_CONNECTION_PRE_PASSWORD;
|
||||
else
|
||||
{
|
||||
|
@ -1505,19 +1505,19 @@ static bool netplay_handshake_pre_nick(netplay_t *netplay,
|
|||
static bool netplay_handshake_pre_password(netplay_t *netplay,
|
||||
struct netplay_connection *connection, bool *had_input)
|
||||
{
|
||||
ssize_t recvd;
|
||||
struct password_buf_s password_buf;
|
||||
char password[8+NETPLAY_PASS_LEN]; /* 8 for salt */
|
||||
char hash[NETPLAY_PASS_HASH_LEN+1]; /* + NULL terminator */
|
||||
ssize_t recvd;
|
||||
bool correct = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
RECV(&password_buf, sizeof(password_buf)) {}
|
||||
|
||||
/* Expecting only a password command */
|
||||
if (recvd < 0 ||
|
||||
ntohl(password_buf.cmd[0]) != NETPLAY_CMD_PASSWORD ||
|
||||
ntohl(password_buf.cmd[1]) != sizeof(password_buf.password))
|
||||
if ( recvd < 0
|
||||
|| ntohl(password_buf.cmd[0]) != NETPLAY_CMD_PASSWORD
|
||||
|| ntohl(password_buf.cmd[1]) != sizeof(password_buf.password))
|
||||
{
|
||||
RARCH_ERR("[Netplay] Failed to receive netplay password.\n");
|
||||
return false;
|
||||
|
@ -1538,7 +1538,8 @@ static bool netplay_handshake_pre_password(netplay_t *netplay,
|
|||
connection->flags |= NETPLAY_CONN_FLAG_CAN_PLAY;
|
||||
}
|
||||
}
|
||||
if (!correct && !string_is_empty(settings->paths.netplay_spectate_password))
|
||||
if ( !correct
|
||||
&& !string_is_empty(settings->paths.netplay_spectate_password))
|
||||
{
|
||||
strlcpy(password + 8, settings->paths.netplay_spectate_password,
|
||||
sizeof(password) - 8);
|
||||
|
|
|
@ -94,7 +94,7 @@ static bool netplay_json_number(void* ctx, const char *p_value, size_t len)
|
|||
static bool netplay_json_start_object(void* ctx)
|
||||
{
|
||||
struct netplay_json_context *p_ctx = (struct netplay_json_context*)ctx;
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
|
||||
if (p_ctx->state == STATE_FIELDS_START)
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ static bool netplay_json_object_member(void *ctx, const char *p_value,
|
|||
size_t len)
|
||||
{
|
||||
struct netplay_json_context* p_ctx = (struct netplay_json_context*)ctx;
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
|
||||
if (!p_value || !len)
|
||||
return true;
|
||||
|
@ -173,44 +173,32 @@ static bool netplay_json_object_member(void *ctx, const char *p_value,
|
|||
p_ctx->cur_member_size = sizeof(net_st->rooms_data->cur->address);
|
||||
}
|
||||
else if (string_is_equal(p_value, "port"))
|
||||
{
|
||||
p_ctx->cur_member_int = &net_st->rooms_data->cur->port;
|
||||
}
|
||||
else if (string_is_equal(p_value, "game_crc"))
|
||||
{
|
||||
p_ctx->cur_member_inthex = &net_st->rooms_data->cur->gamecrc;
|
||||
}
|
||||
else if (string_is_equal(p_value, "core_version"))
|
||||
{
|
||||
p_ctx->cur_member_string = net_st->rooms_data->cur->coreversion;
|
||||
p_ctx->cur_member_size = sizeof(net_st->rooms_data->cur->coreversion);
|
||||
}
|
||||
else if (string_is_equal(p_value, "has_password"))
|
||||
{
|
||||
p_ctx->cur_member_bool = &net_st->rooms_data->cur->has_password;
|
||||
}
|
||||
else if (string_is_equal(p_value, "has_spectate_password"))
|
||||
{
|
||||
p_ctx->cur_member_bool = &net_st->rooms_data->cur->has_spectate_password;
|
||||
}
|
||||
else if (string_is_equal(p_value, "mitm_ip"))
|
||||
{
|
||||
p_ctx->cur_member_string = net_st->rooms_data->cur->mitm_address;
|
||||
p_ctx->cur_member_size = sizeof(net_st->rooms_data->cur->mitm_address);
|
||||
}
|
||||
else if (string_is_equal(p_value, "mitm_port"))
|
||||
{
|
||||
p_ctx->cur_member_int = &net_st->rooms_data->cur->mitm_port;
|
||||
}
|
||||
else if (string_is_equal(p_value, "mitm_session"))
|
||||
{
|
||||
p_ctx->cur_member_string = net_st->rooms_data->cur->mitm_session;
|
||||
p_ctx->cur_member_size = sizeof(net_st->rooms_data->cur->mitm_session);
|
||||
}
|
||||
else if (string_is_equal(p_value, "host_method"))
|
||||
{
|
||||
p_ctx->cur_member_int = &net_st->rooms_data->cur->host_method;
|
||||
}
|
||||
else if (string_is_equal(p_value, "retroarch_version"))
|
||||
{
|
||||
p_ctx->cur_member_string = net_st->rooms_data->cur->retroarch_version;
|
||||
|
@ -232,13 +220,9 @@ static bool netplay_json_object_member(void *ctx, const char *p_value,
|
|||
p_ctx->cur_member_size = sizeof(net_st->rooms_data->cur->subsystem_name);
|
||||
}
|
||||
else if (string_is_equal(p_value, "connectable"))
|
||||
{
|
||||
p_ctx->cur_member_bool = &net_st->rooms_data->cur->connectable;
|
||||
}
|
||||
else if (string_is_equal(p_value, "is_retroarch"))
|
||||
{
|
||||
p_ctx->cur_member_bool = &net_st->rooms_data->cur->is_retroarch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +248,7 @@ static void netplay_rooms_error(void *context,
|
|||
|
||||
void netplay_rooms_free(void)
|
||||
{
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
if (net_st->rooms_data)
|
||||
{
|
||||
struct netplay_room *room = net_st->rooms_data->head;
|
||||
|
@ -288,7 +272,7 @@ void netplay_rooms_free(void)
|
|||
int netplay_rooms_parse(const char *buf, size_t len)
|
||||
{
|
||||
struct netplay_json_context ctx;
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
|
||||
|
@ -318,7 +302,7 @@ int netplay_rooms_parse(const char *buf, size_t len)
|
|||
struct netplay_room* netplay_room_get(int index)
|
||||
{
|
||||
int cur = 0;
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
struct netplay_room *room = net_st->rooms_data->head;
|
||||
|
||||
if (index < 0)
|
||||
|
@ -340,7 +324,7 @@ int netplay_rooms_get_count(void)
|
|||
{
|
||||
int count = 0;
|
||||
struct netplay_room *room = NULL;
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||
|
||||
if (!net_st || !net_st->rooms_data)
|
||||
return count;
|
||||
|
@ -351,7 +335,6 @@ int netplay_rooms_get_count(void)
|
|||
while (room)
|
||||
{
|
||||
count++;
|
||||
|
||||
room = room->next;
|
||||
}
|
||||
|
||||
|
|
|
@ -3638,7 +3638,8 @@ bool command_event(enum event_command cmd, void *data)
|
|||
#ifdef HAVE_MENU
|
||||
/* If we need to quit, skip unloading the core to avoid performing
|
||||
* cleanup actions (like writing autosave state) twice. */
|
||||
if (should_quit_on_close()) {
|
||||
if (should_quit_on_close())
|
||||
{
|
||||
command_event(CMD_EVENT_QUIT, NULL);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
|
|||
( detected_port == settings->uints.input_joypad_index[player]
|
||||
|| !input_config_get_device_name(settings->uints.input_joypad_index[player]))
|
||||
&& settings->uints.input_device_reservation_type[player]
|
||||
!= INPUT_DEVICE_RESERVATION_RESERVED )
|
||||
!= INPUT_DEVICE_RESERVATION_RESERVED)
|
||||
{
|
||||
first_free_player_slot = player;
|
||||
RARCH_DBG("[Autoconf]: First unconfigured / unreserved player is %d\n",
|
||||
|
|
|
@ -1068,9 +1068,11 @@ bool ListWidget::isEditorOpen()
|
|||
|
||||
void ListWidget::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
|
||||
int key = event->key();
|
||||
if ( key == Qt::Key_Return
|
||||
|| key == Qt::Key_Enter)
|
||||
emit enterPressed();
|
||||
else if (event->key() == Qt::Key_Delete)
|
||||
else if (key == Qt::Key_Delete)
|
||||
emit deletePressed();
|
||||
|
||||
QListWidget::keyPressEvent(event);
|
||||
|
@ -1113,20 +1115,20 @@ void LogTextEdit::appendMessage(const QString& text)
|
|||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
/* Only accept indexes from current path. https://www.qtcentre.org/threads/50700-QFileSystemModel-and-QSortFilterProxyModel-don-t-work-well-together */
|
||||
/* Only accept indexes from current path.
|
||||
* https://www.qtcentre.org/threads/50700-QFileSystemModel-and-QSortFilterProxyModel-don-t-work-well-together */
|
||||
bool FileSystemProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
{
|
||||
QFileSystemModel *sm = qobject_cast<QFileSystemModel*>(sourceModel());
|
||||
QModelIndex rootIndex = sm->index(sm->rootPath());
|
||||
|
||||
if (sourceParent == rootIndex)
|
||||
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* sort the source (QFileSystemModel to keep directories before files) */
|
||||
void FileSystemProxyModel::sort(int column, Qt::SortOrder order)
|
||||
{
|
||||
/* sort the source (QFileSystemModel to keep directories before files) */
|
||||
sourceModel()->sort(column, order);
|
||||
}
|
||||
|
||||
|
@ -1415,14 +1417,16 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
|
||||
connect(searchResetButton, SIGNAL(clicked()), this, SLOT(onSearchResetClicked()));
|
||||
|
||||
m_dirModel->setFilter(QDir::NoDotAndDotDot |
|
||||
QDir::AllDirs |
|
||||
QDir::Drives |
|
||||
(m_settings->value("show_hidden_files", true).toBool() ? (QDir::Hidden | QDir::System) : static_cast<QDir::Filter>(0)));
|
||||
m_dirModel->setFilter( QDir::NoDotAndDotDot
|
||||
| QDir::AllDirs
|
||||
| QDir::Drives
|
||||
| (m_settings->value("show_hidden_files", true).toBool()
|
||||
? (QDir::Hidden | QDir::System) : static_cast<QDir::Filter>(0)));
|
||||
|
||||
m_fileModel->setFilter(QDir::NoDot |
|
||||
QDir::AllEntries |
|
||||
(m_settings->value("show_hidden_files", true).toBool() ? (QDir::Hidden | QDir::System) : static_cast<QDir::Filter>(0)));
|
||||
m_fileModel->setFilter( QDir::NoDot
|
||||
| QDir::AllEntries
|
||||
| (m_settings->value("show_hidden_files", true).toBool()
|
||||
? (QDir::Hidden | QDir::System) : static_cast<QDir::Filter>(0)));
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
m_dirModel->setRootPath("");
|
||||
|
@ -1440,12 +1444,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
|
||||
if (m_dirModel->columnCount() > 3)
|
||||
{
|
||||
/* size */
|
||||
m_dirTree->hideColumn(1);
|
||||
/* type */
|
||||
m_dirTree->hideColumn(2);
|
||||
/* date modified */
|
||||
m_dirTree->hideColumn(3);
|
||||
m_dirTree->hideColumn(1); /* size */
|
||||
m_dirTree->hideColumn(2); /* type */
|
||||
m_dirTree->hideColumn(3); /* date modified */
|
||||
}
|
||||
|
||||
reloadPlaylists();
|
||||
|
@ -1460,7 +1461,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
m_searchDock->setWidget(m_searchWidget);
|
||||
m_searchDock->setFixedHeight(m_searchDock->minimumSizeHint().height());
|
||||
|
||||
addDockWidget(static_cast<Qt::DockWidgetArea>(m_searchDock->property("default_area").toInt()), m_searchDock);
|
||||
addDockWidget(static_cast<Qt::DockWidgetArea>(
|
||||
m_searchDock->property("default_area").toInt()), m_searchDock);
|
||||
|
||||
m_coreInfoLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
m_coreInfoLabel->setTextFormat(Qt::RichText);
|
||||
|
@ -1472,7 +1474,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
m_coreInfoDock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE_INFO));
|
||||
m_coreInfoDock->setWidget(m_coreInfoWidget);
|
||||
|
||||
addDockWidget(static_cast<Qt::DockWidgetArea>(m_coreInfoDock->property("default_area").toInt()), m_coreInfoDock);
|
||||
addDockWidget(static_cast<Qt::DockWidgetArea>(
|
||||
m_coreInfoDock->property("default_area").toInt()), m_coreInfoDock);
|
||||
|
||||
m_logWidget->setLayout(new QVBoxLayout());
|
||||
m_logWidget->layout()->addWidget(m_logTextEdit);
|
||||
|
@ -1619,12 +1622,12 @@ void MainWindow::startTimer()
|
|||
|
||||
void MainWindow::updateVisibleItems()
|
||||
{
|
||||
if (m_currentBrowser == BROWSER_TYPE_PLAYLISTS && m_viewType == VIEW_TYPE_ICONS)
|
||||
if ( m_currentBrowser == BROWSER_TYPE_PLAYLISTS
|
||||
&& m_viewType == VIEW_TYPE_ICONS)
|
||||
{
|
||||
size_t i;
|
||||
QVector<QModelIndex> indexes = m_gridView->visibleIndexes();
|
||||
size_t _len = indexes.size();
|
||||
|
||||
for (i = 0; i < _len; i++)
|
||||
m_playlistModel->loadThumbnail(m_proxyModel->mapToSource(indexes.at(i)));
|
||||
}
|
||||
|
@ -1754,6 +1757,10 @@ void MainWindow::showWelcomeScreen()
|
|||
{
|
||||
bool dont_ask = false;
|
||||
bool answer = false;
|
||||
|
||||
if (!m_settings->value("show_welcome_screen", true).toBool())
|
||||
return;
|
||||
|
||||
const QString welcome_txt = QStringLiteral(""
|
||||
"Welcome to the RetroArch Desktop Menu!<br>\n"
|
||||
"<br>\n"
|
||||
|
@ -1774,9 +1781,6 @@ void MainWindow::showWelcomeScreen()
|
|||
"Documentation for RetroArch, libretro and cores:<br>\n"
|
||||
"<a href=\"https://docs.libretro.com/\">https://docs.libretro.com/</a>");
|
||||
|
||||
if (!m_settings->value("show_welcome_screen", true).toBool())
|
||||
return;
|
||||
|
||||
answer = showMessageBox(welcome_txt,
|
||||
MainWindow::MSGBOX_TYPE_QUESTION_OKCANCEL, Qt::ApplicationModal,
|
||||
true, &dont_ask);
|
||||
|
@ -1794,7 +1798,9 @@ bool MainWindow::setCustomThemeFile(QString filePath)
|
|||
{
|
||||
if (filePath.isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_PATH_IS_BLANK));
|
||||
QMessageBox::critical(this,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_PATH_IS_BLANK));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1806,7 +1812,9 @@ bool MainWindow::setCustomThemeFile(QString filePath)
|
|||
|
||||
if (!opened)
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED));
|
||||
QMessageBox::critical(this,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1818,7 +1826,9 @@ bool MainWindow::setCustomThemeFile(QString filePath)
|
|||
|
||||
if (fileStr.isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_IS_EMPTY));
|
||||
QMessageBox::critical(this,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_IS_EMPTY));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1827,20 +1837,19 @@ bool MainWindow::setCustomThemeFile(QString filePath)
|
|||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST));
|
||||
QMessageBox::critical(this,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::setCustomThemeString(QString qss)
|
||||
{
|
||||
m_customThemeString = qss;
|
||||
}
|
||||
void MainWindow::setCustomThemeString(QString qss) { m_customThemeString = qss;}
|
||||
|
||||
bool MainWindow::showMessageBox(QString msg, MessageBoxType msgType,
|
||||
Qt::WindowModality modality, bool showDontAsk, bool *dont_ask)
|
||||
Qt::WindowModality modality, bool show_dont_ask, bool *dont_ask)
|
||||
{
|
||||
QCheckBox *checkbox = NULL;
|
||||
QPointer<QMessageBox> msg_box_ptr = new QMessageBox(this);
|
||||
|
@ -1850,9 +1859,10 @@ bool MainWindow::showMessageBox(QString msg, MessageBoxType msgType,
|
|||
msg_box->setTextFormat(Qt::RichText);
|
||||
msg_box->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
|
||||
if (showDontAsk)
|
||||
if (show_dont_ask)
|
||||
{
|
||||
checkbox = new QCheckBox(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_DONT_SHOW_AGAIN), msg_box);
|
||||
checkbox = new QCheckBox(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_DONT_SHOW_AGAIN), msg_box);
|
||||
/* QMessageBox::setCheckBox() is available since 5.2 */
|
||||
msg_box->setCheckBox(checkbox);
|
||||
}
|
||||
|
@ -1891,9 +1901,10 @@ bool MainWindow::showMessageBox(QString msg, MessageBoxType msgType,
|
|||
if (!msg_box_ptr)
|
||||
return true;
|
||||
|
||||
int key = msg_box->result();
|
||||
if (
|
||||
msg_box->result() != QMessageBox::Ok
|
||||
&& msg_box->result() != QMessageBox::Yes)
|
||||
key != QMessageBox::Ok
|
||||
&& key != QMessageBox::Yes)
|
||||
return false;
|
||||
|
||||
if (checkbox && dont_ask)
|
||||
|
@ -2119,10 +2130,7 @@ QString MainWindow::getThemeString(Theme theme)
|
|||
return "default";
|
||||
}
|
||||
|
||||
MainWindow::Theme MainWindow::theme()
|
||||
{
|
||||
return m_currentTheme;
|
||||
}
|
||||
MainWindow::Theme MainWindow::theme() { return m_currentTheme; }
|
||||
|
||||
void MainWindow::setTheme(Theme theme)
|
||||
{
|
||||
|
@ -2354,8 +2362,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
|
||||
if (core_info->categories_list)
|
||||
{
|
||||
QHash<QString, QString> hash;
|
||||
QString categories;
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
for (i = 0; i < core_info->categories_list->size; i++)
|
||||
{
|
||||
|
@ -2374,8 +2382,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
|
||||
if (core_info->authors_list)
|
||||
{
|
||||
QHash<QString, QString> hash;
|
||||
QString authors;
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
for (i = 0; i < core_info->authors_list->size; i++)
|
||||
{
|
||||
|
@ -2394,8 +2402,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
|
||||
if (core_info->permissions_list)
|
||||
{
|
||||
QHash<QString, QString> hash;
|
||||
QString permissions;
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
for (i = 0; i < core_info->permissions_list->size; i++)
|
||||
{
|
||||
|
@ -2414,8 +2422,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
|
||||
if (core_info->licenses_list)
|
||||
{
|
||||
QHash<QString, QString> hash;
|
||||
QString licenses;
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
for (i = 0; i < core_info->licenses_list->size; i++)
|
||||
{
|
||||
|
@ -2434,8 +2442,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
|
||||
if (core_info->supported_extensions_list)
|
||||
{
|
||||
QHash<QString, QString> hash;
|
||||
QString supported_extensions;
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
for (i = 0; i < core_info->supported_extensions_list->size; i++)
|
||||
{
|
||||
|
@ -2613,10 +2621,7 @@ void MainWindow::onSearchResetClicked()
|
|||
onSearchEnterPressed();
|
||||
}
|
||||
|
||||
QToolButton* MainWindow::coreInfoPushButton()
|
||||
{
|
||||
return m_coreInfoPushButton;
|
||||
}
|
||||
QToolButton* MainWindow::coreInfoPushButton() { return m_coreInfoPushButton; }
|
||||
|
||||
void MainWindow::onTreeViewItemsSelected(QModelIndexList selectedIndexes)
|
||||
{
|
||||
|
@ -2734,7 +2739,8 @@ void MainWindow::onStartCoreClicked()
|
|||
path_clear(RARCH_PATH_BASENAME);
|
||||
|
||||
if (!task_push_start_current_core(&content_info))
|
||||
QMessageBox::critical(this, msg_hash_to_str(MSG_ERROR), msg_hash_to_str(MSG_FAILED_TO_LOAD_CONTENT));
|
||||
QMessageBox::critical(this, msg_hash_to_str(MSG_ERROR),
|
||||
msg_hash_to_str(MSG_FAILED_TO_LOAD_CONTENT));
|
||||
}
|
||||
|
||||
QHash<QString, QString> MainWindow::getSelectedCore()
|
||||
|
@ -2889,8 +2895,8 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
|||
break;
|
||||
case CORE_SELECTION_PLAYLIST_DEFAULT:
|
||||
{
|
||||
QString plName = contentHash["pl_name"].isEmpty() ?
|
||||
contentHash["db_name"] : contentHash["pl_name"];
|
||||
QString plName = contentHash["pl_name"].isEmpty()
|
||||
? contentHash["db_name"] : contentHash["pl_name"];
|
||||
|
||||
QString defaultCorePath = getPlaylistDefaultCore(plName);
|
||||
|
||||
|
@ -2989,10 +2995,7 @@ PlaylistEntryDialog* MainWindow::playlistEntryDialog()
|
|||
return m_playlistEntryDialog;
|
||||
}
|
||||
|
||||
ViewOptionsDialog* MainWindow::viewOptionsDialog()
|
||||
{
|
||||
return m_viewOptionsDialog;
|
||||
}
|
||||
ViewOptionsDialog* MainWindow::viewOptionsDialog() {return m_viewOptionsDialog;}
|
||||
|
||||
void MainWindow::setCoreActions()
|
||||
{
|
||||
|
@ -3004,7 +3007,8 @@ void MainWindow::setCoreActions()
|
|||
|
||||
m_launchWithComboBox->clear();
|
||||
|
||||
if (sys_info->load_no_content) /* Is contentless core? */
|
||||
/* Is contentless core? */
|
||||
if (sys_info->load_no_content)
|
||||
m_startCorePushButton->show();
|
||||
else
|
||||
m_startCorePushButton->hide();
|
||||
|
@ -3068,8 +3072,8 @@ void MainWindow::setCoreActions()
|
|||
switch(m_currentBrowser)
|
||||
{
|
||||
case BROWSER_TYPE_PLAYLISTS:
|
||||
currentPlaylistFileName = hash["pl_name"].isEmpty() ?
|
||||
hash["db_name"] : hash["pl_name"];
|
||||
currentPlaylistFileName = hash["pl_name"].isEmpty()
|
||||
? hash["db_name"] : hash["pl_name"];
|
||||
break;
|
||||
case BROWSER_TYPE_FILES:
|
||||
currentPlaylistFileName = m_fileModel->rootDirectory().dirName();
|
||||
|
@ -3141,8 +3145,8 @@ void MainWindow::setCoreActions()
|
|||
if (!found_existing)
|
||||
{
|
||||
QVariantMap comboBoxMap;
|
||||
comboBoxMap["core_name"] = QVariant::fromValue(QString(coreInfo->core_name));
|
||||
comboBoxMap["core_path"] = QVariant::fromValue(QString(coreInfo->path));
|
||||
comboBoxMap["core_name"] = QVariant::fromValue(QString(coreInfo->core_name));
|
||||
comboBoxMap["core_path"] = QVariant::fromValue(QString(coreInfo->path));
|
||||
comboBoxMap["core_selection"] = CORE_SELECTION_PLAYLIST_DEFAULT;
|
||||
m_launchWithComboBox->addItem(coreInfo->core_name, QVariant::fromValue(comboBoxMap));
|
||||
}
|
||||
|
@ -3167,20 +3171,17 @@ void MainWindow::setCoreActions()
|
|||
|
||||
void MainWindow::onTabWidgetIndexChanged(int index)
|
||||
{
|
||||
if (m_browserAndPlaylistTabWidget->tabText(index) == msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER))
|
||||
QString str = m_browserAndPlaylistTabWidget->tabText(index);
|
||||
if (str == msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER))
|
||||
{
|
||||
m_currentBrowser = BROWSER_TYPE_FILES;
|
||||
|
||||
m_centralWidget->setCurrentWidget(m_fileTableView);
|
||||
|
||||
onCurrentFileChanged(m_fileTableView->currentIndex());
|
||||
}
|
||||
else if (m_browserAndPlaylistTabWidget->tabText(index) == msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_PLAYLISTS))
|
||||
else if (str == msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_PLAYLISTS))
|
||||
{
|
||||
m_currentBrowser = BROWSER_TYPE_PLAYLISTS;
|
||||
|
||||
m_centralWidget->setCurrentWidget(m_playlistViewsAndFooter);
|
||||
|
||||
onCurrentItemChanged(m_tableView->currentIndex());
|
||||
}
|
||||
|
||||
|
@ -3189,25 +3190,10 @@ void MainWindow::onTabWidgetIndexChanged(int index)
|
|||
setCoreActions();
|
||||
}
|
||||
|
||||
QToolButton* MainWindow::runPushButton()
|
||||
{
|
||||
return m_runPushButton;
|
||||
}
|
||||
|
||||
QToolButton* MainWindow::stopPushButton()
|
||||
{
|
||||
return m_stopPushButton;
|
||||
}
|
||||
|
||||
QToolButton* MainWindow::startCorePushButton()
|
||||
{
|
||||
return m_startCorePushButton;
|
||||
}
|
||||
|
||||
QComboBox* MainWindow::launchWithComboBox()
|
||||
{
|
||||
return m_launchWithComboBox;
|
||||
}
|
||||
QToolButton* MainWindow::runPushButton() { return m_runPushButton; }
|
||||
QToolButton* MainWindow::stopPushButton() { return m_stopPushButton; }
|
||||
QToolButton* MainWindow::startCorePushButton() { return m_startCorePushButton;}
|
||||
QComboBox* MainWindow::launchWithComboBox() { return m_launchWithComboBox; }
|
||||
|
||||
void MainWindow::onSearchLineEditEdited(const QString &text)
|
||||
{
|
||||
|
@ -3367,22 +3353,15 @@ void MainWindow::onShowHiddenDockWidgetAction()
|
|||
}
|
||||
}
|
||||
|
||||
QWidget* MainWindow::searchWidget()
|
||||
{
|
||||
return m_searchWidget;
|
||||
}
|
||||
|
||||
QLineEdit* MainWindow::searchLineEdit()
|
||||
{
|
||||
return m_searchLineEdit;
|
||||
}
|
||||
|
||||
QWidget* MainWindow::searchWidget() { return m_searchWidget; }
|
||||
QLineEdit* MainWindow::searchLineEdit() { return m_searchLineEdit; }
|
||||
void MainWindow::onSearchEnterPressed()
|
||||
{
|
||||
onSearchLineEditEdited(m_searchLineEdit->text());
|
||||
}
|
||||
|
||||
void MainWindow::onCurrentTableItemDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
|
||||
void MainWindow::onCurrentTableItemDataChanged(const QModelIndex &topLeft,
|
||||
const QModelIndex &bottomRight, const QVector<int> &roles)
|
||||
{
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
|
@ -3439,7 +3418,8 @@ void MainWindow::renamePlaylistItem(QListWidgetItem *item, QString newName)
|
|||
|
||||
/* Block this signal because setData() would trigger
|
||||
* an infinite loop here */
|
||||
disconnect(m_listWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(onCurrentListItemDataChanged(QListWidgetItem*)));
|
||||
disconnect(m_listWidget, SIGNAL(itemChanged(QListWidgetItem*)),
|
||||
this, SLOT(onCurrentListItemDataChanged(QListWidgetItem*)));
|
||||
|
||||
oldPath = item->data(Qt::UserRole).toString();
|
||||
|
||||
|
@ -3579,15 +3559,8 @@ void MainWindow::setCurrentThumbnailType(ThumbnailType thumbnailType)
|
|||
m_gridView->viewport()->update();
|
||||
}
|
||||
|
||||
MainWindow::ViewType MainWindow::getCurrentViewType()
|
||||
{
|
||||
return m_viewType;
|
||||
}
|
||||
|
||||
ThumbnailType MainWindow::getCurrentThumbnailType()
|
||||
{
|
||||
return m_thumbnailType;
|
||||
}
|
||||
MainWindow::ViewType MainWindow::getCurrentViewType() { return m_viewType; }
|
||||
ThumbnailType MainWindow::getCurrentThumbnailType() { return m_thumbnailType;}
|
||||
|
||||
void MainWindow::onCurrentListItemChanged(
|
||||
QListWidgetItem *current, QListWidgetItem *previous)
|
||||
|
@ -3600,46 +3573,22 @@ void MainWindow::onCurrentListItemChanged(
|
|||
setCoreActions();
|
||||
}
|
||||
|
||||
TableView* MainWindow::contentTableView()
|
||||
{
|
||||
return m_tableView;
|
||||
}
|
||||
|
||||
QTableView* MainWindow::fileTableView()
|
||||
{
|
||||
return m_fileTableView;
|
||||
}
|
||||
|
||||
QStackedWidget* MainWindow::centralWidget()
|
||||
{
|
||||
return m_centralWidget;
|
||||
}
|
||||
|
||||
FileDropWidget* MainWindow::playlistViews()
|
||||
{
|
||||
return m_playlistViews;
|
||||
}
|
||||
|
||||
QWidget* MainWindow::playlistViewsAndFooter()
|
||||
{
|
||||
return m_playlistViewsAndFooter;
|
||||
}
|
||||
|
||||
GridView* MainWindow::contentGridView()
|
||||
{
|
||||
return m_gridView;
|
||||
}
|
||||
TableView* MainWindow::contentTableView() { return m_tableView; }
|
||||
QTableView* MainWindow::fileTableView() { return m_fileTableView; }
|
||||
QStackedWidget* MainWindow::centralWidget() { return m_centralWidget; }
|
||||
FileDropWidget* MainWindow::playlistViews() { return m_playlistViews; }
|
||||
QWidget* MainWindow::playlistViewsAndFooter() {return m_playlistViewsAndFooter;}
|
||||
GridView* MainWindow::contentGridView() { return m_gridView; }
|
||||
|
||||
void MainWindow::onBrowserDownloadsClicked()
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
QDir dir(settings->paths.directory_core_assets);
|
||||
QString path = dir.absolutePath();
|
||||
QModelIndex index;
|
||||
QDir dir(config_get_ptr()->paths.directory_core_assets);
|
||||
QString path = dir.absolutePath();
|
||||
|
||||
m_pendingDirScrollPath = path;
|
||||
|
||||
index = m_dirModel->index(path);
|
||||
index = m_dirModel->index(path);
|
||||
|
||||
m_dirTree->setCurrentIndex(index);
|
||||
|
||||
|
@ -3676,22 +3625,13 @@ void MainWindow::onBrowserUpClicked()
|
|||
|
||||
void MainWindow::onBrowserStartClicked()
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
m_dirTree->setCurrentIndex(
|
||||
m_dirModel->index(settings->paths.directory_menu_content));
|
||||
m_dirModel->index(config_get_ptr()->paths.directory_menu_content));
|
||||
m_dirTree->scrollTo(m_dirTree->currentIndex(), QAbstractItemView::PositionAtTop);
|
||||
}
|
||||
|
||||
ListWidget* MainWindow::playlistListWidget()
|
||||
{
|
||||
return m_listWidget;
|
||||
}
|
||||
|
||||
TreeView* MainWindow::dirTreeView()
|
||||
{
|
||||
return m_dirTree;
|
||||
}
|
||||
ListWidget* MainWindow::playlistListWidget() { return m_listWidget; }
|
||||
TreeView* MainWindow::dirTreeView() { return m_dirTree; }
|
||||
|
||||
void MainWindow::onTimeout()
|
||||
{
|
||||
|
@ -3744,7 +3684,8 @@ void MainWindow::setCurrentCoreLabel()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (m_currentCore != libraryName && !libraryName.isEmpty())
|
||||
if ( m_currentCore != libraryName
|
||||
&& !libraryName.isEmpty())
|
||||
{
|
||||
m_currentCore = sysinfo->library_name;
|
||||
m_currentCoreVersion = (string_is_empty(sysinfo->library_version) ? "" : sysinfo->library_version);
|
||||
|
@ -3832,7 +3773,9 @@ void MainWindow::onLoadCoreClicked(const QStringList &extensionFilters)
|
|||
{
|
||||
m_loadCoreWindow->show();
|
||||
m_loadCoreWindow->resize(width() / 2, height());
|
||||
m_loadCoreWindow->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, m_loadCoreWindow->size(), geometry()));
|
||||
m_loadCoreWindow->setGeometry(QStyle::alignedRect(
|
||||
Qt::LeftToRight, Qt::AlignCenter, m_loadCoreWindow->size(),
|
||||
geometry()));
|
||||
m_loadCoreWindow->initCoreList(extensionFilters);
|
||||
}
|
||||
|
||||
|
@ -3898,10 +3841,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
|
|||
QMainWindow::keyPressEvent(event);
|
||||
}
|
||||
|
||||
QSettings* MainWindow::settings()
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
QSettings* MainWindow::settings() { return m_settings; }
|
||||
|
||||
QString MainWindow::getCurrentViewTypeString()
|
||||
{
|
||||
|
@ -4242,25 +4182,29 @@ static enum ui_msg_window_response
|
|||
ui_msg_window_qt_error(ui_msg_window_state *state)
|
||||
{
|
||||
QFlags<QMessageBox::StandardButton> flags = ui_msg_window_qt_buttons(state);
|
||||
return ui_msg_window_qt_response(state, QMessageBox::critical((QWidget*)state->window, state->title, state->text, flags));
|
||||
return ui_msg_window_qt_response(state, QMessageBox::critical(
|
||||
(QWidget*)state->window, state->title, state->text, flags));
|
||||
}
|
||||
|
||||
static enum ui_msg_window_response ui_msg_window_qt_information(ui_msg_window_state *state)
|
||||
{
|
||||
QFlags<QMessageBox::StandardButton> flags = ui_msg_window_qt_buttons(state);
|
||||
return ui_msg_window_qt_response(state, QMessageBox::information((QWidget*)state->window, state->title, state->text, flags));
|
||||
return ui_msg_window_qt_response(state, QMessageBox::information(
|
||||
(QWidget*)state->window, state->title, state->text, flags));
|
||||
}
|
||||
|
||||
static enum ui_msg_window_response ui_msg_window_qt_question(ui_msg_window_state *state)
|
||||
{
|
||||
QFlags<QMessageBox::StandardButton> flags = ui_msg_window_qt_buttons(state);
|
||||
return ui_msg_window_qt_response(state, QMessageBox::question((QWidget*)state->window, state->title, state->text, flags));
|
||||
return ui_msg_window_qt_response(state, QMessageBox::question(
|
||||
(QWidget*)state->window, state->title, state->text, flags));
|
||||
}
|
||||
|
||||
static enum ui_msg_window_response ui_msg_window_qt_warning(ui_msg_window_state *state)
|
||||
{
|
||||
QFlags<QMessageBox::StandardButton> flags = ui_msg_window_qt_buttons(state);
|
||||
return ui_msg_window_qt_response(state, QMessageBox::warning((QWidget*)state->window, state->title, state->text, flags));
|
||||
return ui_msg_window_qt_response(state, QMessageBox::warning(
|
||||
(QWidget*)state->window, state->title, state->text, flags));
|
||||
}
|
||||
|
||||
static ui_msg_window_t ui_msg_window_qt = {
|
||||
|
@ -4322,10 +4266,10 @@ static void* ui_application_qt_initialize(void)
|
|||
#endif
|
||||
#endif
|
||||
{
|
||||
QPixmap iconPixmap;
|
||||
/* Can't declare the pixmap at the top, because:
|
||||
* "QPixmap: Must construct a QGuiApplication before a QPixmap" */
|
||||
QImage iconImage(16, 16, QImage::Format_ARGB32);
|
||||
QPixmap iconPixmap;
|
||||
unsigned char *bits = iconImage.bits();
|
||||
|
||||
memcpy(bits, retroarch_qt_icon_data, 16 * 16 * sizeof(unsigned));
|
||||
|
@ -4373,13 +4317,9 @@ static ui_application_t ui_application_qt = {
|
|||
|
||||
|
||||
AppHandler::AppHandler(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
AppHandler::~AppHandler()
|
||||
{
|
||||
}
|
||||
QObject(parent) { }
|
||||
AppHandler::~AppHandler() { }
|
||||
void AppHandler::onLastWindowClosed() { }
|
||||
|
||||
void AppHandler::exit()
|
||||
{
|
||||
|
@ -4389,8 +4329,6 @@ void AppHandler::exit()
|
|||
qApp->closeAllWindows();
|
||||
}
|
||||
|
||||
void AppHandler::onLastWindowClosed() { }
|
||||
|
||||
typedef struct ui_companion_qt
|
||||
{
|
||||
ui_application_qt_t *app;
|
||||
|
@ -4515,10 +4453,10 @@ void ThumbnailLabel::paintEvent(QPaintEvent *event)
|
|||
|
||||
if (w > 0 && h > 0 && m_pixmap && !m_pixmap->isNull())
|
||||
{
|
||||
int newHeight = (m_pixmap->height() / static_cast<float>(m_pixmap->width())) * width();
|
||||
QPixmap pixmapScaled = *m_pixmap;
|
||||
QPixmap pixmap;
|
||||
QPainter pScale;
|
||||
int newHeight = (m_pixmap->height() / static_cast<float>(m_pixmap->width())) * width();
|
||||
QPixmap pixmapScaled = *m_pixmap;
|
||||
int pw = 0;
|
||||
int ph = 0;
|
||||
unsigned *buf = new unsigned[w * h];
|
||||
|
@ -4635,23 +4573,33 @@ static void* ui_companion_qt_init(void)
|
|||
|
||||
qsettings = mainwindow->settings();
|
||||
|
||||
initialPlaylist = qsettings->value("initial_playlist", mainwindow->getSpecialPlaylistPath(SPECIAL_PLAYLIST_HISTORY)).toString();
|
||||
initialPlaylist = qsettings->value("initial_playlist",
|
||||
mainwindow->getSpecialPlaylistPath(SPECIAL_PLAYLIST_HISTORY)).toString();
|
||||
|
||||
mainwindow->resize(qMin(desktopRect.width(), INITIAL_WIDTH), qMin(desktopRect.height(), INITIAL_HEIGHT));
|
||||
mainwindow->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, mainwindow->size(), desktopRect));
|
||||
mainwindow->resize(qMin(desktopRect.width(), INITIAL_WIDTH),
|
||||
qMin(desktopRect.height(), INITIAL_HEIGHT));
|
||||
mainwindow->setGeometry(QStyle::alignedRect(Qt::LeftToRight,
|
||||
Qt::AlignCenter, mainwindow->size(), desktopRect));
|
||||
|
||||
mainwindow->setWindowTitle("RetroArch");
|
||||
mainwindow->setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks | GROUPED_DRAGGING);
|
||||
mainwindow->setDockOptions(QMainWindow::AnimatedDocks
|
||||
| QMainWindow::AllowNestedDocks
|
||||
| QMainWindow::AllowTabbedDocks
|
||||
| GROUPED_DRAGGING);
|
||||
|
||||
listWidget = mainwindow->playlistListWidget();
|
||||
|
||||
widget = mainwindow->playlistViews();
|
||||
widget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
QObject::connect(widget, SIGNAL(filesDropped(QStringList)), mainwindow, SLOT(onPlaylistFilesDropped(QStringList)));
|
||||
QObject::connect(widget, SIGNAL(enterPressed()), mainwindow, SLOT(onDropWidgetEnterPressed()));
|
||||
QObject::connect(widget, SIGNAL(deletePressed()), mainwindow, SLOT(deleteCurrentPlaylistItem()));
|
||||
QObject::connect(widget, SIGNAL(customContextMenuRequested(const QPoint&)), mainwindow, SLOT(onFileDropWidgetContextMenuRequested(const QPoint&)));
|
||||
QObject::connect(widget, SIGNAL(filesDropped(QStringList)),
|
||||
mainwindow, SLOT(onPlaylistFilesDropped(QStringList)));
|
||||
QObject::connect(widget, SIGNAL(enterPressed()), mainwindow,
|
||||
SLOT(onDropWidgetEnterPressed()));
|
||||
QObject::connect(widget, SIGNAL(deletePressed()), mainwindow,
|
||||
SLOT(deleteCurrentPlaylistItem()));
|
||||
QObject::connect(widget, SIGNAL(customContextMenuRequested(const QPoint&)),
|
||||
mainwindow, SLOT(onFileDropWidgetContextMenuRequested(const QPoint&)));
|
||||
|
||||
centralWidget = mainwindow->centralWidget();
|
||||
|
||||
|
@ -4664,15 +4612,21 @@ static void* ui_companion_qt_init(void)
|
|||
|
||||
fileMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE));
|
||||
|
||||
loadCoreAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_LOAD_CORE), mainwindow, SLOT(onLoadCoreClicked()));
|
||||
loadCoreAction = fileMenu->addAction(msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_LOAD_CORE), mainwindow,
|
||||
SLOT(onLoadCoreClicked()));
|
||||
loadCoreAction->setShortcut(QKeySequence("Ctrl+L"));
|
||||
|
||||
unloadCoreAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_UNLOAD_CORE), mainwindow, SLOT(onUnloadCoreMenuAction()));
|
||||
unloadCoreAction = fileMenu->addAction(msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_UNLOAD_CORE), mainwindow,
|
||||
SLOT(onUnloadCoreMenuAction()));
|
||||
unloadCoreAction->setObjectName("unloadCoreAction");
|
||||
unloadCoreAction->setEnabled(false);
|
||||
unloadCoreAction->setShortcut(QKeySequence("Ctrl+U"));
|
||||
|
||||
exitAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_EXIT), mainwindow, SLOT(close()));
|
||||
exitAction = fileMenu->addAction(msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_EXIT), mainwindow,
|
||||
SLOT(close()));
|
||||
exitAction->setShortcut(QKeySequence::Quit);
|
||||
|
||||
editMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT));
|
||||
|
@ -4734,23 +4688,32 @@ static void* ui_companion_qt_init(void)
|
|||
browserAndPlaylistTabWidget = mainwindow->browserAndPlaylistTabWidget();
|
||||
browserAndPlaylistTabWidget->setObjectName("browserAndPlaylistTabWidget");
|
||||
|
||||
/* Several functions depend on the same tab title strings here, so if you change these, make sure to change those too
|
||||
/* Several functions depend on the same tab title strings here,
|
||||
* so if you change these, make sure to change those too
|
||||
* setCoreActions()
|
||||
* onTabWidgetIndexChanged()
|
||||
* onCurrentListItemChanged()
|
||||
*/
|
||||
browserAndPlaylistTabWidget->addTab(playlistWidget, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_PLAYLISTS));
|
||||
browserAndPlaylistTabWidget->addTab(browserWidget, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER));
|
||||
browserAndPlaylistTabWidget->addTab(playlistWidget,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_PLAYLISTS));
|
||||
browserAndPlaylistTabWidget->addTab(browserWidget,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER));
|
||||
|
||||
browserAndPlaylistTabDock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER), mainwindow);
|
||||
browserAndPlaylistTabDock = new QDockWidget(msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER), mainwindow);
|
||||
browserAndPlaylistTabDock->setObjectName("browserAndPlaylistTabDock");
|
||||
browserAndPlaylistTabDock->setProperty("default_area", Qt::LeftDockWidgetArea);
|
||||
browserAndPlaylistTabDock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER));
|
||||
browserAndPlaylistTabDock->setProperty("menu_text",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER));
|
||||
browserAndPlaylistTabDock->setWidget(browserAndPlaylistTabWidget);
|
||||
|
||||
mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(browserAndPlaylistTabDock->property("default_area").toInt()), browserAndPlaylistTabDock);
|
||||
mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(
|
||||
browserAndPlaylistTabDock->property("default_area").toInt()),
|
||||
browserAndPlaylistTabDock);
|
||||
|
||||
browserButtonsHBoxLayout->addItem(new QSpacerItem(browserAndPlaylistTabWidget->tabBar()->width(), 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
browserButtonsHBoxLayout->addItem(new QSpacerItem(
|
||||
browserAndPlaylistTabWidget->tabBar()->width(),
|
||||
20, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
|
||||
thumbnailWidget = new ThumbnailWidget(THUMBNAIL_TYPE_BOXART);
|
||||
thumbnailWidget->setObjectName("thumbnail");
|
||||
|
@ -4805,7 +4768,8 @@ static void* ui_companion_qt_init(void)
|
|||
mainwindow->tabifyDockWidget(thumbnailDock, thumbnail3Dock);
|
||||
mainwindow->tabifyDockWidget(thumbnailDock, thumbnail4Dock);
|
||||
|
||||
/* when tabifying the dock widgets, the last tab added is selected by default, so we need to re-select the first tab */
|
||||
/* When tabifying the dock widgets, the last tab added is selected
|
||||
* by default, so we need to re-select the first tab */
|
||||
thumbnailDock->raise();
|
||||
|
||||
coreSelectionWidget = new QWidget();
|
||||
|
@ -4932,17 +4896,20 @@ static void* ui_companion_qt_init(void)
|
|||
mainwindow->setCurrentThumbnailType(THUMBNAIL_TYPE_BOXART);
|
||||
}
|
||||
|
||||
/* We make sure to hook up the tab widget callback only after the tabs themselves have been added,
|
||||
* but before changing to a specific one, to avoid the callback firing before the view type is set.
|
||||
/* We make sure to hook up the tab widget callback only after the tabs
|
||||
* themselves have been added, but before changing to a specific one,
|
||||
* to avoid the callback firing before the view type is set.
|
||||
*/
|
||||
QObject::connect(browserAndPlaylistTabWidget, SIGNAL(currentChanged(int)), mainwindow, SLOT(onTabWidgetIndexChanged(int)));
|
||||
QObject::connect(browserAndPlaylistTabWidget, SIGNAL(currentChanged(int)),
|
||||
mainwindow, SLOT(onTabWidgetIndexChanged(int)));
|
||||
|
||||
/* setting the last tab must come after setting the view type */
|
||||
/* Setting the last tab must come after setting the view type */
|
||||
if (qsettings->contains("save_last_tab"))
|
||||
{
|
||||
int lastTabIndex = qsettings->value("last_tab", 0).toInt();
|
||||
|
||||
if (lastTabIndex >= 0 && browserAndPlaylistTabWidget->count() > lastTabIndex)
|
||||
if ( lastTabIndex >= 0
|
||||
&& browserAndPlaylistTabWidget->count() > lastTabIndex)
|
||||
{
|
||||
browserAndPlaylistTabWidget->setCurrentIndex(lastTabIndex);
|
||||
mainwindow->onTabWidgetIndexChanged(lastTabIndex);
|
||||
|
@ -5115,10 +5082,10 @@ ui_companion_driver_t ui_companion_qt = {
|
|||
|
||||
QStringList string_split_to_qt(QString str, char delim)
|
||||
{
|
||||
int at;
|
||||
int at = 0;
|
||||
QStringList list = QStringList();
|
||||
|
||||
for (at = 0;;)
|
||||
for (;;)
|
||||
{
|
||||
/* Find next split */
|
||||
int spl = str.indexOf(delim, at);
|
||||
|
@ -5140,13 +5107,13 @@ QStringList string_split_to_qt(QString str, char delim)
|
|||
#define CORE_VERSION_COLUMN 1
|
||||
|
||||
LoadCoreTableWidget::LoadCoreTableWidget(QWidget *parent) :
|
||||
QTableWidget(parent)
|
||||
{
|
||||
}
|
||||
QTableWidget(parent) { }
|
||||
|
||||
void LoadCoreTableWidget::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
|
||||
int key = event->key();
|
||||
if ( key == Qt::Key_Return
|
||||
|| key == Qt::Key_Enter)
|
||||
{
|
||||
event->accept();
|
||||
emit enterPressed();
|
||||
|
@ -5162,7 +5129,8 @@ LoadCoreWindow::LoadCoreWindow(QWidget *parent) :
|
|||
,m_statusLabel(new QLabel())
|
||||
{
|
||||
QHBoxLayout *hbox = new QHBoxLayout();
|
||||
QPushButton *customCoreButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_LOAD_CUSTOM_CORE));
|
||||
QPushButton *customCoreButton = new QPushButton(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_LOAD_CUSTOM_CORE));
|
||||
|
||||
connect(customCoreButton, SIGNAL(clicked()), this, SLOT(onLoadCustomCoreClicked()));
|
||||
connect(m_table, SIGNAL(enterPressed()), this, SLOT(onCoreEnterPressed()));
|
||||
|
@ -5193,7 +5161,8 @@ void LoadCoreWindow::closeEvent(QCloseEvent *event)
|
|||
|
||||
void LoadCoreWindow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
int key = event->key();
|
||||
if (key == Qt::Key_Escape)
|
||||
{
|
||||
event->accept();
|
||||
close();
|
||||
|
@ -5220,7 +5189,10 @@ void LoadCoreWindow::loadCore(const char *path)
|
|||
progress.setValue(progress.minimum());
|
||||
progress.show();
|
||||
|
||||
/* Because core loading will block, we need to go ahead and process pending events that would allow the progress dialog to fully show its contents before actually starting the core loading process. Must call processEvents() twice. */
|
||||
/* Because core loading will block, we need to go ahead and
|
||||
* process pending events that would allow the progress dialog
|
||||
* to fully show its contents before actually starting the
|
||||
* core loading process. Must call processEvents() twice. */
|
||||
qApp->processEvents();
|
||||
qApp->processEvents();
|
||||
|
||||
|
@ -5234,7 +5206,8 @@ void LoadCoreWindow::loadCore(const char *path)
|
|||
|
||||
if (!command_event(CMD_EVENT_LOAD_CORE, NULL))
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MSG_ERROR), msg_hash_to_str(MSG_FAILED_TO_OPEN_LIBRETRO_CORE));
|
||||
QMessageBox::critical(this, msg_hash_to_str(MSG_ERROR),
|
||||
msg_hash_to_str(MSG_FAILED_TO_OPEN_LIBRETRO_CORE));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5266,16 +5239,13 @@ void LoadCoreWindow::onCoreEnterPressed()
|
|||
|
||||
void LoadCoreWindow::onLoadCustomCoreClicked()
|
||||
{
|
||||
size_t _len;
|
||||
QString path;
|
||||
QByteArray pathArray;
|
||||
char filters[128];
|
||||
const char *pathData = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path_dir_libretro = settings->paths.directory_libretro;
|
||||
|
||||
|
||||
_len = strlcpy(filters, "Cores (*.", sizeof(filters));
|
||||
size_t _len = strlcpy(filters, "Cores (*.", sizeof(filters));
|
||||
_len += frontend_driver_get_core_extension(filters + _len, sizeof(filters) - _len);
|
||||
strlcpy(filters + _len, ");;All Files (*.*)", sizeof(filters) - _len);
|
||||
|
||||
|
@ -5398,5 +5368,8 @@ void LoadCoreWindow::initCoreList(const QStringList &extensionFilters)
|
|||
m_table->selectRow(0);
|
||||
m_table->setAlternatingRowColors(true);
|
||||
|
||||
resize(qMin(desktopRect.width(), contentsMargins().left() + m_table->horizontalHeader()->length() + contentsMargins().right()), height());
|
||||
resize(qMin(desktopRect.width(),
|
||||
contentsMargins().left()
|
||||
+ m_table->horizontalHeader()->length()
|
||||
+ contentsMargins().right()), height());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue