Skip to content

Commit

Permalink
Qt: Fix icon size actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Dec 3, 2017
1 parent 5838e27 commit d0364ee
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
46 changes: 28 additions & 18 deletions rpcs3/rpcs3qt/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ void main_window::CreateConnects()

auto openSettings = [=](int tabIndex)
{
settings_dialog dlg(guiSettings, emuSettings, tabIndex, this);
settings_dialog dlg(guiSettings, emuSettings, tabIndex, this);
connect(&dlg, &settings_dialog::GuiSettingsSaveRequest, this, &main_window::SaveWindowState);
connect(&dlg, &settings_dialog::GuiSettingsSyncRequest, this, &main_window::ConfigureGuiFromSettings);
connect(&dlg, &settings_dialog::GuiStylesheetRequest, this, &main_window::RequestGlobalStylesheetChange);
Expand Down Expand Up @@ -1279,21 +1279,22 @@ void main_window::CreateConnects()
{
int index;

if (act == ui->setIconSizeTinyAct) index = 0;
else if (act == ui->setIconSizeSmallAct) index = gui::get_Index(gui::gl_icon_size_small);
else if (act == ui->setIconSizeMediumAct) index = gui::get_Index(gui::gl_icon_size_medium);
else index = gui::gl_max_slider_pos;
if (act == ui->setIconSizeTinyAct)
index = 0;
else if (act == ui->setIconSizeSmallAct)
index = gui::get_Index(gui::gl_icon_size_small);
else if (act == ui->setIconSizeMediumAct)
index = gui::get_Index(gui::gl_icon_size_medium);
else
index = gui::gl_max_slider_pos;

m_save_slider_pos = true;
resizeIcons(index);
});

connect (m_gameListFrame, &game_list_frame::RequestIconSizeActSet, [=](const int& idx)
{
if (idx < gui::get_Index((gui::gl_icon_size_small + gui::gl_icon_size_min) / 2)) ui->setIconSizeTinyAct->setChecked(true);
else if (idx < gui::get_Index((gui::gl_icon_size_medium + gui::gl_icon_size_small) / 2)) ui->setIconSizeSmallAct->setChecked(true);
else if (idx < gui::get_Index((gui::gl_icon_size_max + gui::gl_icon_size_medium) / 2)) ui->setIconSizeMediumAct->setChecked(true);
else ui->setIconSizeLargeAct->setChecked(true);

SetIconSizeActions(idx);
resizeIcons(idx);
});

Expand Down Expand Up @@ -1478,16 +1479,13 @@ void main_window::ConfigureGuiFromSettings(bool configure_all)
ui->showCatUnknownAct->setChecked(guiSettings->GetCategoryVisibility(Category::Unknown_Cat));
ui->showCatOtherAct->setChecked(guiSettings->GetCategoryVisibility(Category::Others));

int idx = guiSettings->GetValue(gui::gl_iconSize).toInt();
int index = gui::gl_max_slider_pos / 4;
if (idx < index) ui->setIconSizeTinyAct->setChecked(true);
else if (idx < index * 2) ui->setIconSizeSmallAct->setChecked(true);
else if (idx < index * 3) ui->setIconSizeMediumAct->setChecked(true);
else ui->setIconSizeLargeAct->setChecked(true);
SetIconSizeActions(guiSettings->GetValue(gui::gl_iconSize).toInt());

bool isListMode = guiSettings->GetValue(gui::gl_listMode).toBool();
if (isListMode) ui->setlistModeListAct->setChecked(true);
else ui->setlistModeGridAct->setChecked(true);
if (isListMode)
ui->setlistModeListAct->setChecked(true);
else
ui->setlistModeGridAct->setChecked(true);
m_categoryVisibleActGroup->setEnabled(isListMode);

if (configure_all)
Expand All @@ -1500,6 +1498,18 @@ void main_window::ConfigureGuiFromSettings(bool configure_all)
}
}

void main_window::SetIconSizeActions(int idx)
{
if (idx < gui::get_Index((gui::gl_icon_size_small + gui::gl_icon_size_min) / 2))
ui->setIconSizeTinyAct->setChecked(true);
else if (idx < gui::get_Index((gui::gl_icon_size_medium + gui::gl_icon_size_small) / 2))
ui->setIconSizeSmallAct->setChecked(true);
else if (idx < gui::get_Index((gui::gl_icon_size_max + gui::gl_icon_size_medium) / 2))
ui->setIconSizeMediumAct->setChecked(true);
else
ui->setIconSizeLargeAct->setChecked(true);
}

void main_window::keyPressEvent(QKeyEvent *keyEvent)
{
if (((keyEvent->modifiers() & Qt::AltModifier) && keyEvent->key() == Qt::Key_Return) || (isFullScreen() && keyEvent->key() == Qt::Key_Escape))
Expand Down
1 change: 1 addition & 0 deletions rpcs3/rpcs3qt/main_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ private Q_SLOTS:

void SaveWindowState();
void ConfigureGuiFromSettings(bool configure_all = false);
void SetIconSizeActions(int idx);

protected:
void closeEvent(QCloseEvent *event) override;
Expand Down

0 comments on commit d0364ee

Please sign in to comment.