Qt: Add reload button to postprocessing UI
This commit is contained in:
parent
7a5f167c1c
commit
3232e3b164
|
@ -1,6 +1,7 @@
|
||||||
#include "postprocessingchainconfigwidget.h"
|
#include "postprocessingchainconfigwidget.h"
|
||||||
#include "frontend-common/postprocessing_chain.h"
|
#include "frontend-common/postprocessing_chain.h"
|
||||||
#include "postprocessingshaderconfigwidget.h"
|
#include "postprocessingshaderconfigwidget.h"
|
||||||
|
#include "qthostinterface.h"
|
||||||
#include <QtGui/QCursor>
|
#include <QtGui/QCursor>
|
||||||
#include <QtWidgets/QMenu>
|
#include <QtWidgets/QMenu>
|
||||||
#include <QtWidgets/QMessageBox>
|
#include <QtWidgets/QMessageBox>
|
||||||
|
@ -21,6 +22,7 @@ void PostProcessingChainConfigWidget::connectUi()
|
||||||
connect(m_ui.clear, &QPushButton::clicked, this, &PostProcessingChainConfigWidget::onClearButtonClicked);
|
connect(m_ui.clear, &QPushButton::clicked, this, &PostProcessingChainConfigWidget::onClearButtonClicked);
|
||||||
connect(m_ui.moveUp, &QPushButton::clicked, this, &PostProcessingChainConfigWidget::onMoveUpButtonClicked);
|
connect(m_ui.moveUp, &QPushButton::clicked, this, &PostProcessingChainConfigWidget::onMoveUpButtonClicked);
|
||||||
connect(m_ui.moveDown, &QPushButton::clicked, this, &PostProcessingChainConfigWidget::onMoveDownButtonClicked);
|
connect(m_ui.moveDown, &QPushButton::clicked, this, &PostProcessingChainConfigWidget::onMoveDownButtonClicked);
|
||||||
|
connect(m_ui.reload, &QPushButton::clicked, this, &PostProcessingChainConfigWidget::onReloadButtonClicked);
|
||||||
connect(m_ui.shaderSettings, &QPushButton::clicked, this,
|
connect(m_ui.shaderSettings, &QPushButton::clicked, this,
|
||||||
&PostProcessingChainConfigWidget::onShaderConfigButtonClicked);
|
&PostProcessingChainConfigWidget::onShaderConfigButtonClicked);
|
||||||
connect(m_ui.shaders, &QListWidget::itemSelectionChanged, this, &PostProcessingChainConfigWidget::updateButtonStates);
|
connect(m_ui.shaders, &QListWidget::itemSelectionChanged, this, &PostProcessingChainConfigWidget::updateButtonStates);
|
||||||
|
@ -73,6 +75,7 @@ void PostProcessingChainConfigWidget::updateButtonStates()
|
||||||
std::optional<u32> index = getSelectedIndex();
|
std::optional<u32> index = getSelectedIndex();
|
||||||
m_ui.remove->setEnabled(index.has_value());
|
m_ui.remove->setEnabled(index.has_value());
|
||||||
m_ui.clear->setEnabled(!m_chain.IsEmpty());
|
m_ui.clear->setEnabled(!m_chain.IsEmpty());
|
||||||
|
m_ui.reload->setEnabled(!m_chain.IsEmpty());
|
||||||
m_ui.shaderSettings->setEnabled(index.has_value() && (index.value() < m_chain.GetStageCount()) &&
|
m_ui.shaderSettings->setEnabled(index.has_value() && (index.value() < m_chain.GetStageCount()) &&
|
||||||
m_chain.GetShaderStage(index.value()).HasOptions());
|
m_chain.GetShaderStage(index.value()).HasOptions());
|
||||||
|
|
||||||
|
@ -177,3 +180,8 @@ void PostProcessingChainConfigWidget::onShaderConfigButtonClicked()
|
||||||
shader_config.exec();
|
shader_config.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PostProcessingChainConfigWidget::onReloadButtonClicked()
|
||||||
|
{
|
||||||
|
QtHostInterface::GetInstance()->reloadPostProcessingShaders();
|
||||||
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ private Q_SLOTS:
|
||||||
void onMoveUpButtonClicked();
|
void onMoveUpButtonClicked();
|
||||||
void onMoveDownButtonClicked();
|
void onMoveDownButtonClicked();
|
||||||
void onShaderConfigButtonClicked();
|
void onShaderConfigButtonClicked();
|
||||||
|
void onReloadButtonClicked();
|
||||||
void updateButtonStates();
|
void updateButtonStates();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -82,6 +82,17 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="reload">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Reload Shaders</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources/icons.qrc">
|
||||||
|
<normaloff>:/icons/view-refresh.png</normaloff>:/icons/view-refresh.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -1024,7 +1024,7 @@ void QtHostInterface::setCheatEnabled(quint32 index, bool enabled)
|
||||||
SetCheatCodeState(index, enabled, g_settings.auto_load_cheats);
|
SetCheatCodeState(index, enabled, g_settings.auto_load_cheats);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtHostInterface::applyCheat(u32 index)
|
void QtHostInterface::applyCheat(quint32 index)
|
||||||
{
|
{
|
||||||
if (!isOnWorkerThread())
|
if (!isOnWorkerThread())
|
||||||
{
|
{
|
||||||
|
@ -1035,6 +1035,17 @@ void QtHostInterface::applyCheat(u32 index)
|
||||||
ApplyCheatCode(index);
|
ApplyCheatCode(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtHostInterface::reloadPostProcessingShaders()
|
||||||
|
{
|
||||||
|
if (!isOnWorkerThread())
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(this, "reloadPostProcessingShaders", Qt::QueuedConnection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReloadPostProcessingShaders();
|
||||||
|
}
|
||||||
|
|
||||||
void QtHostInterface::loadState(const QString& filename)
|
void QtHostInterface::loadState(const QString& filename)
|
||||||
{
|
{
|
||||||
if (!isOnWorkerThread())
|
if (!isOnWorkerThread())
|
||||||
|
|
|
@ -40,6 +40,8 @@ public:
|
||||||
explicit QtHostInterface(QObject* parent = nullptr);
|
explicit QtHostInterface(QObject* parent = nullptr);
|
||||||
~QtHostInterface();
|
~QtHostInterface();
|
||||||
|
|
||||||
|
ALWAYS_INLINE static QtHostInterface* GetInstance() { return static_cast<QtHostInterface*>(g_host_interface); }
|
||||||
|
|
||||||
const char* GetFrontendName() const override;
|
const char* GetFrontendName() const override;
|
||||||
|
|
||||||
bool Initialize() override;
|
bool Initialize() override;
|
||||||
|
@ -164,6 +166,7 @@ public Q_SLOTS:
|
||||||
void loadCheatList(const QString& filename);
|
void loadCheatList(const QString& filename);
|
||||||
void setCheatEnabled(quint32 index, bool enabled);
|
void setCheatEnabled(quint32 index, bool enabled);
|
||||||
void applyCheat(quint32 index);
|
void applyCheat(quint32 index);
|
||||||
|
void reloadPostProcessingShaders();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void doStopThread();
|
void doStopThread();
|
||||||
|
|
Loading…
Reference in New Issue