mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 00:11:24 +12:00
Qt: simplify occasions of restoreState
This commit is contained in:
parent
31101b4828
commit
bff9a06f9f
3 changed files with 5 additions and 31 deletions
|
@ -172,18 +172,12 @@ void debugger_frame::closeEvent(QCloseEvent *event)
|
||||||
void debugger_frame::showEvent(QShowEvent * event)
|
void debugger_frame::showEvent(QShowEvent * event)
|
||||||
{
|
{
|
||||||
// resize splitter widgets
|
// resize splitter widgets
|
||||||
QByteArray state = xgui_settings->GetValue(gui::d_splitterState).toByteArray();
|
if (!m_splitter->restoreState(xgui_settings->GetValue(gui::d_splitterState).toByteArray()))
|
||||||
|
|
||||||
if (state.isEmpty()) // resize 2:1
|
|
||||||
{
|
{
|
||||||
const int width_right = width() / 3;
|
const int width_right = width() / 3;
|
||||||
const int width_left = width() - width_right;
|
const int width_left = width() - width_right;
|
||||||
m_splitter->setSizes({width_left, width_right});
|
m_splitter->setSizes({width_left, width_right});
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_splitter->restoreState(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::showEvent(event);
|
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()
|
void game_list_frame::LoadSettings()
|
||||||
{
|
{
|
||||||
QByteArray state = xgui_settings->GetValue(gui::gl_state).toByteArray();
|
QByteArray state = xgui_settings->GetValue(gui::gl_state).toByteArray();
|
||||||
|
if (!m_gameList->horizontalHeader()->restoreState(state) && m_gameList->rowCount())
|
||||||
if (!state.isEmpty())
|
|
||||||
{
|
|
||||||
m_gameList->horizontalHeader()->restoreState(state);
|
|
||||||
}
|
|
||||||
else if (m_gameList->rowCount() > 0)
|
|
||||||
{
|
{
|
||||||
// If no settings exist, go to default.
|
// If no settings exist, go to default.
|
||||||
m_gameList->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
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_gameList->horizontalHeader()->restoreState(m_gameList->horizontalHeader()->saveState());
|
||||||
|
|
||||||
m_colSortOrder = xgui_settings->GetValue(gui::gl_sortAsc).toBool() ? Qt::AscendingOrder : Qt::DescendingOrder;
|
m_colSortOrder = xgui_settings->GetValue(gui::gl_sortAsc).toBool() ? Qt::AscendingOrder : Qt::DescendingOrder;
|
||||||
|
|
||||||
m_sortColumn = xgui_settings->GetValue(gui::gl_sortCol).toInt();
|
m_sortColumn = xgui_settings->GetValue(gui::gl_sortCol).toInt();
|
||||||
|
|
||||||
m_categoryFilters = xgui_settings->GetGameListCategoryFilters();
|
m_categoryFilters = xgui_settings->GetGameListCategoryFilters();
|
||||||
|
|
||||||
Refresh(true);
|
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()))
|
if (!restoreGeometry(m_gui_settings->GetValue(gui::tr_geometry).toByteArray()))
|
||||||
resize(QDesktopWidget().availableGeometry().size() * 0.7);
|
resize(QDesktopWidget().availableGeometry().size() * 0.7);
|
||||||
|
|
||||||
QByteArray splitterstate = m_gui_settings->GetValue(gui::tr_splitterState).toByteArray();
|
if (!m_splitter->restoreState(m_gui_settings->GetValue(gui::tr_splitterState).toByteArray()))
|
||||||
if (splitterstate.isEmpty())
|
|
||||||
{
|
{
|
||||||
const int width_left = m_splitter->width() * 0.4;
|
const int width_left = m_splitter->width() * 0.4;
|
||||||
const int width_right = m_splitter->width() - width_left;
|
const int width_right = m_splitter->width() - width_left;
|
||||||
m_splitter->setSizes({ width_left, width_right });
|
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();
|
QByteArray game_table_state = m_gui_settings->GetValue(gui::tr_games_state).toByteArray();
|
||||||
if (!game_table_state.isEmpty())
|
if (!m_game_table->horizontalHeader()->restoreState(game_table_state) && m_game_table->rowCount())
|
||||||
{
|
|
||||||
m_game_table->horizontalHeader()->restoreState(game_table_state);
|
|
||||||
}
|
|
||||||
else if (m_game_table->rowCount() > 0)
|
|
||||||
{
|
{
|
||||||
// If no settings exist, go to default.
|
// If no settings exist, go to default.
|
||||||
m_game_table->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
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();
|
QByteArray trophy_table_state = m_gui_settings->GetValue(gui::tr_trophy_state).toByteArray();
|
||||||
if (!trophy_table_state.isEmpty())
|
if (!m_trophy_table->horizontalHeader()->restoreState(trophy_table_state) && m_trophy_table->rowCount())
|
||||||
{
|
|
||||||
m_trophy_table->horizontalHeader()->restoreState(trophy_table_state);
|
|
||||||
}
|
|
||||||
else if (m_trophy_table->rowCount() > 0)
|
|
||||||
{
|
{
|
||||||
// If no settings exist, go to default.
|
// If no settings exist, go to default.
|
||||||
m_trophy_table->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
m_trophy_table->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue