mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-23 11:13:19 +01:00
Qt: simplify occasions of restoreState
This commit is contained in:
parent
31101b4828
commit
bff9a06f9f
@ -172,18 +172,12 @@ void debugger_frame::closeEvent(QCloseEvent *event)
|
||||
void debugger_frame::showEvent(QShowEvent * event)
|
||||
{
|
||||
// resize splitter widgets
|
||||
QByteArray state = xgui_settings->GetValue(gui::d_splitterState).toByteArray();
|
||||
|
||||
if (state.isEmpty()) // resize 2:1
|
||||
if (!m_splitter->restoreState(xgui_settings->GetValue(gui::d_splitterState).toByteArray()))
|
||||
{
|
||||
const int width_right = width() / 3;
|
||||
const int width_left = width() - width_right;
|
||||
m_splitter->setSizes({width_left, width_right});
|
||||
}
|
||||
else
|
||||
{
|
||||
m_splitter->restoreState(state);
|
||||
}
|
||||
|
||||
QDockWidget::showEvent(event);
|
||||
}
|
||||
|
@ -174,12 +174,7 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std:
|
||||
void game_list_frame::LoadSettings()
|
||||
{
|
||||
QByteArray state = xgui_settings->GetValue(gui::gl_state).toByteArray();
|
||||
|
||||
if (!state.isEmpty())
|
||||
{
|
||||
m_gameList->horizontalHeader()->restoreState(state);
|
||||
}
|
||||
else if (m_gameList->rowCount() > 0)
|
||||
if (!m_gameList->horizontalHeader()->restoreState(state) && m_gameList->rowCount())
|
||||
{
|
||||
// If no settings exist, go to default.
|
||||
m_gameList->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
||||
@ -198,9 +193,7 @@ void game_list_frame::LoadSettings()
|
||||
m_gameList->horizontalHeader()->restoreState(m_gameList->horizontalHeader()->saveState());
|
||||
|
||||
m_colSortOrder = xgui_settings->GetValue(gui::gl_sortAsc).toBool() ? Qt::AscendingOrder : Qt::DescendingOrder;
|
||||
|
||||
m_sortColumn = xgui_settings->GetValue(gui::gl_sortCol).toInt();
|
||||
|
||||
m_categoryFilters = xgui_settings->GetGameListCategoryFilters();
|
||||
|
||||
Refresh(true);
|
||||
|
@ -243,24 +243,15 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
|
||||
if (!restoreGeometry(m_gui_settings->GetValue(gui::tr_geometry).toByteArray()))
|
||||
resize(QDesktopWidget().availableGeometry().size() * 0.7);
|
||||
|
||||
QByteArray splitterstate = m_gui_settings->GetValue(gui::tr_splitterState).toByteArray();
|
||||
if (splitterstate.isEmpty())
|
||||
if (!m_splitter->restoreState(m_gui_settings->GetValue(gui::tr_splitterState).toByteArray()))
|
||||
{
|
||||
const int width_left = m_splitter->width() * 0.4;
|
||||
const int width_right = m_splitter->width() - width_left;
|
||||
m_splitter->setSizes({ width_left, width_right });
|
||||
}
|
||||
else
|
||||
{
|
||||
m_splitter->restoreState(splitterstate);
|
||||
}
|
||||
|
||||
QByteArray game_table_state = m_gui_settings->GetValue(gui::tr_games_state).toByteArray();
|
||||
if (!game_table_state.isEmpty())
|
||||
{
|
||||
m_game_table->horizontalHeader()->restoreState(game_table_state);
|
||||
}
|
||||
else if (m_game_table->rowCount() > 0)
|
||||
if (!m_game_table->horizontalHeader()->restoreState(game_table_state) && m_game_table->rowCount())
|
||||
{
|
||||
// If no settings exist, go to default.
|
||||
m_game_table->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
||||
@ -268,11 +259,7 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
|
||||
}
|
||||
|
||||
QByteArray trophy_table_state = m_gui_settings->GetValue(gui::tr_trophy_state).toByteArray();
|
||||
if (!trophy_table_state.isEmpty())
|
||||
{
|
||||
m_trophy_table->horizontalHeader()->restoreState(trophy_table_state);
|
||||
}
|
||||
else if (m_trophy_table->rowCount() > 0)
|
||||
if (!m_trophy_table->horizontalHeader()->restoreState(trophy_table_state) && m_trophy_table->rowCount())
|
||||
{
|
||||
// If no settings exist, go to default.
|
||||
m_trophy_table->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
||||
|
Loading…
Reference in New Issue
Block a user