mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-14 10:21:21 +00:00
Qt/RSX: add taskbar progress in msg_dialog_frame for shader compilation
This commit is contained in:
parent
edc9e9b4ec
commit
b9b6bd85a6
@ -78,6 +78,9 @@ public:
|
||||
|
||||
MsgDialogType type{};
|
||||
|
||||
// the progressbar that will be represented in the taskbar. Use -1 to combine the progress.
|
||||
s32 taskbar_index = 0;
|
||||
|
||||
std::function<void(s32 status)> on_close;
|
||||
std::function<void()> on_osk_input_entered;
|
||||
|
||||
|
@ -404,6 +404,8 @@ namespace rsx
|
||||
|
||||
struct progress_dialog_helper
|
||||
{
|
||||
s32 taskbar_index = -1; // -1 to combine all progressbars in the taskbar progress
|
||||
|
||||
std::shared_ptr<MsgDialogBase> dlg;
|
||||
atomic_t<bool> initialized{ false };
|
||||
|
||||
@ -413,6 +415,7 @@ namespace rsx
|
||||
dlg->type.se_normal = true;
|
||||
dlg->type.bg_invisible = true;
|
||||
dlg->type.progress_bar_count = 2;
|
||||
dlg->taskbar_index = taskbar_index;
|
||||
dlg->on_close = [](s32 status)
|
||||
{
|
||||
Emu.CallAfter([]()
|
||||
|
@ -33,7 +33,7 @@ void msg_dialog_frame::Create(const std::string& msg, const std::string& title)
|
||||
{
|
||||
text = new QLabel("", m_dialog);
|
||||
bar = new QProgressBar(m_dialog);
|
||||
bar->setRange(0, m_gauge_max);
|
||||
bar->setRange(0, 100);
|
||||
bar->setValue(0);
|
||||
bar->setFixedWidth(barWidth());
|
||||
bar->setAlignment(Qt::AlignCenter);
|
||||
@ -58,11 +58,11 @@ void msg_dialog_frame::Create(const std::string& msg, const std::string& title)
|
||||
#ifdef _WIN32
|
||||
m_tb_button = new QWinTaskbarButton();
|
||||
m_tb_progress = m_tb_button->progress();
|
||||
m_tb_progress->setRange(0, m_gauge_max);
|
||||
m_tb_progress->setRange(0, 100);
|
||||
m_tb_progress->setVisible(true);
|
||||
#elif HAVE_QTDBUS
|
||||
UpdateProgress(0);
|
||||
progressValue = 0;
|
||||
m_progress_value = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -274,58 +274,101 @@ void msg_dialog_frame::ProgressBarSetMsg(u32 index, const std::string& msg)
|
||||
|
||||
void msg_dialog_frame::ProgressBarReset(u32 index)
|
||||
{
|
||||
if (!m_dialog)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (index == 0 && m_gauge1)
|
||||
{
|
||||
m_gauge1->setValue(0);
|
||||
#ifdef _WIN32
|
||||
m_tb_progress->reset();
|
||||
#elif HAVE_QTDBUS
|
||||
UpdateProgress(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (index == 1 && m_gauge2)
|
||||
{
|
||||
m_gauge2->setValue(0);
|
||||
}
|
||||
|
||||
if (index == taskbar_index)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (m_tb_progress)
|
||||
{
|
||||
m_tb_progress->reset();
|
||||
}
|
||||
#elif HAVE_QTDBUS
|
||||
UpdateProgress(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void msg_dialog_frame::ProgressBarInc(u32 index, u32 delta)
|
||||
{
|
||||
if (m_dialog)
|
||||
if (!m_dialog)
|
||||
{
|
||||
if (index == 0 && m_gauge1)
|
||||
{
|
||||
m_gauge1->setValue(m_gauge1->value() + delta);
|
||||
#ifdef _WIN32
|
||||
m_tb_progress->setValue(m_tb_progress->value() + delta);
|
||||
#elif HAVE_QTDBUS
|
||||
progressValue += delta;
|
||||
UpdateProgress(progressValue);
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (index == 1 && m_gauge2)
|
||||
if (index == 0 && m_gauge1)
|
||||
{
|
||||
m_gauge1->setValue(m_gauge1->value() + delta);
|
||||
}
|
||||
|
||||
if (index == 1 && m_gauge2)
|
||||
{
|
||||
m_gauge2->setValue(m_gauge2->value() + delta);
|
||||
}
|
||||
|
||||
if (index == taskbar_index || taskbar_index == -1)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (m_tb_progress)
|
||||
{
|
||||
m_gauge2->setValue(m_gauge2->value() + delta);
|
||||
m_tb_progress->setValue(m_tb_progress->value() + delta);
|
||||
}
|
||||
#elif HAVE_QTDBUS
|
||||
m_progress_value += delta;
|
||||
UpdateProgress(m_progress_value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void msg_dialog_frame::ProgressBarSetLimit(u32 index, u32 limit)
|
||||
{
|
||||
if (m_dialog)
|
||||
if (!m_dialog)
|
||||
{
|
||||
if (index == 0 && m_gauge1)
|
||||
{
|
||||
m_gauge1->setMaximum(limit);
|
||||
}
|
||||
|
||||
if (index == 1 && m_gauge2)
|
||||
{
|
||||
m_gauge2->setMaximum(limit);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (index == 0 && m_gauge1)
|
||||
{
|
||||
m_gauge1->setMaximum(limit);
|
||||
}
|
||||
|
||||
if (index == 1 && m_gauge2)
|
||||
{
|
||||
m_gauge2->setMaximum(limit);
|
||||
}
|
||||
|
||||
bool set_taskbar_limit = false;
|
||||
|
||||
if (index == taskbar_index)
|
||||
{
|
||||
m_gauge_max = limit;
|
||||
set_taskbar_limit = true;
|
||||
}
|
||||
else if (taskbar_index == -1)
|
||||
{
|
||||
m_gauge_max += limit;
|
||||
set_taskbar_limit = true;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (set_taskbar_limit && m_tb_progress)
|
||||
{
|
||||
m_tb_progress->setMaximum(m_gauge_max);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDBUS
|
||||
|
@ -34,12 +34,12 @@ class msg_dialog_frame : public QObject, public MsgDialogBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
#ifdef _WIN32
|
||||
QWinTaskbarButton* m_tb_button = nullptr;
|
||||
QWinTaskbarProgress* m_tb_progress = nullptr;
|
||||
|
||||
#elif HAVE_QTDBUS
|
||||
int progressValue = 0;
|
||||
int m_progress_value = 0;
|
||||
#endif
|
||||
custom_dialog* m_dialog =nullptr;
|
||||
QLabel* m_text = nullptr;
|
||||
@ -56,7 +56,7 @@ class msg_dialog_frame : public QObject, public MsgDialogBase
|
||||
custom_dialog* m_osk_dialog = nullptr;
|
||||
char16_t* m_osk_text_return;
|
||||
|
||||
const int m_gauge_max = 100;
|
||||
int m_gauge_max = 0;
|
||||
|
||||
public:
|
||||
msg_dialog_frame(QWindow* taskbarTarget);
|
||||
|
Loading…
x
Reference in New Issue
Block a user