|
|
|
@ -6,7 +6,6 @@
|
|
|
|
|
#include "qthost.h"
|
|
|
|
|
#include "qtutils.h"
|
|
|
|
|
#include "settingswindow.h"
|
|
|
|
|
#include "settingwidgetbinder.h"
|
|
|
|
|
|
|
|
|
|
#include "core/cheats.h"
|
|
|
|
|
|
|
|
|
@ -17,15 +16,15 @@
|
|
|
|
|
GamePatchDetailsWidget::GamePatchDetailsWidget(std::string name, const std::string& author,
|
|
|
|
|
const std::string& description, bool disallowed_for_achievements,
|
|
|
|
|
bool enabled, SettingsWindow* dialog, QWidget* parent)
|
|
|
|
|
: QWidget(parent), m_dialog(dialog), m_name(name)
|
|
|
|
|
: QWidget(parent), m_dialog(dialog), m_name(std::move(name))
|
|
|
|
|
{
|
|
|
|
|
m_ui.setupUi(this);
|
|
|
|
|
|
|
|
|
|
QFont title_font(m_ui.name->font());
|
|
|
|
|
title_font.setPointSizeF(title_font.pointSizeF() + 4.0f);
|
|
|
|
|
title_font.setBold(true);
|
|
|
|
|
m_ui.name->setText(QString::fromStdString(name));
|
|
|
|
|
m_ui.name->setFont(title_font);
|
|
|
|
|
m_ui.name->setText(QString::fromStdString(m_name));
|
|
|
|
|
m_ui.description->setText(
|
|
|
|
|
tr("<strong>Author: </strong>%1%2<br>%3")
|
|
|
|
|
.arg(author.empty() ? tr("Unknown") : QString::fromStdString(author))
|
|
|
|
@ -40,7 +39,7 @@ GamePatchDetailsWidget::GamePatchDetailsWidget(std::string name, const std::stri
|
|
|
|
|
|
|
|
|
|
GamePatchDetailsWidget::~GamePatchDetailsWidget() = default;
|
|
|
|
|
|
|
|
|
|
void GamePatchDetailsWidget::onEnabledStateChanged(int state)
|
|
|
|
|
void GamePatchDetailsWidget::onEnabledStateChanged(Qt::CheckState state)
|
|
|
|
|
{
|
|
|
|
|
INISettingsInterface* si = m_dialog->getSettingsInterface();
|
|
|
|
|
if (state == Qt::Checked)
|
|
|
|
@ -55,8 +54,6 @@ void GamePatchDetailsWidget::onEnabledStateChanged(int state)
|
|
|
|
|
GamePatchSettingsWidget::GamePatchSettingsWidget(SettingsWindow* dialog, QWidget* parent) : m_dialog(dialog)
|
|
|
|
|
{
|
|
|
|
|
m_ui.setupUi(this);
|
|
|
|
|
m_ui.scrollArea->setFrameShape(QFrame::WinPanel);
|
|
|
|
|
m_ui.scrollArea->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
|
|
|
|
|
connect(m_ui.reload, &QPushButton::clicked, this, &GamePatchSettingsWidget::onReloadClicked);
|
|
|
|
|
connect(m_ui.disableAllPatches, &QPushButton::clicked, this, &GamePatchSettingsWidget::disableAllPatches);
|
|
|
|
@ -89,26 +86,22 @@ void GamePatchSettingsWidget::reloadList()
|
|
|
|
|
std::vector<std::string> enabled_list =
|
|
|
|
|
m_dialog->getSettingsInterface()->GetStringList(Cheats::PATCHES_CONFIG_SECTION, Cheats::PATCH_ENABLE_CONFIG_KEY);
|
|
|
|
|
|
|
|
|
|
delete m_ui.scrollArea->takeWidget();
|
|
|
|
|
|
|
|
|
|
QWidget* container = new QWidget(m_ui.scrollArea);
|
|
|
|
|
m_ui.scrollArea->setWidget(container);
|
|
|
|
|
|
|
|
|
|
QWidget* container = new QWidget;
|
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(container);
|
|
|
|
|
m_ui.scrollArea->setWidget(container);
|
|
|
|
|
|
|
|
|
|
if (!patches.empty())
|
|
|
|
|
{
|
|
|
|
|
m_ui.scrollArea->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
|
|
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
bool first = true;
|
|
|
|
|
|
|
|
|
|
for (Cheats::CodeInfo& pi : patches)
|
|
|
|
|
{
|
|
|
|
|
if (!first)
|
|
|
|
|
{
|
|
|
|
|
QFrame* frame = new QFrame(container);
|
|
|
|
|
frame->setFrameShape(QFrame::HLine);
|
|
|
|
|
frame->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
|
|
|
|
|
layout->addWidget(frame);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -124,6 +117,8 @@ void GamePatchSettingsWidget::reloadList()
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_ui.scrollArea->setFrameStyle(QFrame::NoFrame);
|
|
|
|
|
|
|
|
|
|
QLabel* label = new QLabel(tr("No patches are available for this game."), container);
|
|
|
|
|
QFont font(label->font());
|
|
|
|
|
font.setPointSizeF(font.pointSizeF() + 2.0f);
|
|
|
|
@ -132,5 +127,5 @@ void GamePatchSettingsWidget::reloadList()
|
|
|
|
|
layout->addWidget(label);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
layout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
|
|
|
|
layout->addStretch();
|
|
|
|
|
}
|
|
|
|
|