Disable remove custom config if no custom config exists.

This commit is contained in:
Robbie 2017-07-10 18:42:12 -05:00 committed by Ivan
parent 0405b860c6
commit 9403948ce3
3 changed files with 15 additions and 8 deletions

View File

@ -597,6 +597,8 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
globalPos = m_xgrid->mapToGlobal(pos);
}
GameInfo currGame = m_game_data[row].info;
QMenu myMenu;
// Make Actions
@ -616,7 +618,7 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
connect(boot, &QAction::triggered, [=]() {Boot(row); });
connect(configure, &QAction::triggered, [=]() {
settings_dialog (xgui_settings, m_Render_Creator, 0, this, &m_game_data[row].info).exec();
settings_dialog (xgui_settings, m_Render_Creator, 0, this, &currGame).exec();
});
connect(removeGame, &QAction::triggered, [=]() {
if (QMessageBox::question(this, tr("Confirm Delete"), tr("Permanently delete files?")) == QMessageBox::Yes)
@ -627,16 +629,15 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
}
});
connect(removeConfig, &QAction::triggered, [=]() {RemoveCustomConfiguration(row); });
connect(openGameFolder, &QAction::triggered, [=]() {open_dir(Emu.GetGameDir() + m_game_data[row].info.root); });
connect(openConfig, &QAction::triggered, [=]() {open_dir(fs::get_config_dir() + "data/" + m_game_data[row].info.serial); });
connect(openGameFolder, &QAction::triggered, [=]() {open_dir(Emu.GetGameDir() + currGame.root); });
connect(openConfig, &QAction::triggered, [=]() {open_dir(fs::get_config_dir() + "data/" + currGame.serial); });
connect(checkCompat, &QAction::triggered, [=]() {
QString serial = qstr(m_game_data[row].info.serial);
QString link = "https://rpcs3.net/compatibility?g=" + serial;
QString link = "https://rpcs3.net/compatibility?g=" + qstr(currGame.serial);
QDesktopServices::openUrl(QUrl(link));
});
//Disable options depending on software category
QString category = qstr(m_game_data[row].info.category);
QString category = qstr(currGame.category);
if (category == category::disc_Game)
{
@ -655,6 +656,12 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
checkCompat->setEnabled(false);
}
// Disable removeconfig if no config exists.
if (fs::is_file(fs::get_config_dir() + "data/" + currGame.serial + "/config.yml") == false)
{
removeConfig->setEnabled(false);
}
myMenu.exec(globalPos);
}

View File

@ -22,7 +22,7 @@
inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); }
settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const Render_Creator& r_Creator, const int& tabIndex, QWidget *parent, GameInfo* game)
settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const Render_Creator& r_Creator, const int& tabIndex, QWidget *parent, const GameInfo* game)
: QDialog(parent), xgui_settings(xSettings), ui(new Ui::settings_dialog)
{
ui->setupUi(this);

View File

@ -19,7 +19,7 @@ class settings_dialog : public QDialog
Q_OBJECT
public:
explicit settings_dialog(std::shared_ptr<gui_settings> xSettings, const Render_Creator& r_Creator, const int& tabIndex = 0, QWidget *parent = 0, GameInfo *game = nullptr);
explicit settings_dialog(std::shared_ptr<gui_settings> xSettings, const Render_Creator& r_Creator, const int& tabIndex = 0, QWidget *parent = 0, const GameInfo *game = nullptr);
Q_SIGNALS:
void GuiSettingsSyncRequest();
void GuiStylesheetRequest(const QString& path);