mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Qt/Linux: Properly hide taskbar progress when done
This commit is contained in:
parent
45f5819ef3
commit
8b3a3e4ac8
@ -124,7 +124,7 @@ gs_frame::gs_frame(QScreen* screen, const QRect& geometry, const QIcon& appIcon,
|
||||
m_tb_progress->setVisible(false);
|
||||
|
||||
#elif HAVE_QTDBUS
|
||||
UpdateProgress(0);
|
||||
UpdateProgress(0, false);
|
||||
m_progress_value = 0;
|
||||
#endif
|
||||
}
|
||||
@ -801,7 +801,7 @@ void gs_frame::progress_reset(bool reset_limit)
|
||||
m_tb_progress->reset();
|
||||
}
|
||||
#elif HAVE_QTDBUS
|
||||
UpdateProgress(0);
|
||||
UpdateProgress(0, false);
|
||||
#endif
|
||||
|
||||
if (reset_limit)
|
||||
@ -819,7 +819,7 @@ void gs_frame::progress_set_value(int value)
|
||||
}
|
||||
#elif HAVE_QTDBUS
|
||||
m_progress_value = std::clamp(value, 0, m_gauge_max);
|
||||
UpdateProgress(m_progress_value);
|
||||
UpdateProgress(m_progress_value, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -853,7 +853,7 @@ void gs_frame::progress_set_limit(int limit)
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDBUS
|
||||
void gs_frame::UpdateProgress(int progress, bool disable)
|
||||
void gs_frame::UpdateProgress(int progress, bool progress_visible)
|
||||
{
|
||||
QDBusMessage message = QDBusMessage::createSignal
|
||||
(
|
||||
@ -862,12 +862,9 @@ void gs_frame::UpdateProgress(int progress, bool disable)
|
||||
QStringLiteral("Update")
|
||||
);
|
||||
QVariantMap properties;
|
||||
if (disable)
|
||||
properties.insert(QStringLiteral("progress-visible"), false);
|
||||
else
|
||||
properties.insert(QStringLiteral("progress-visible"), true);
|
||||
//Progress takes a value from 0.0 to 0.1
|
||||
// Progress takes a value from 0.0 to 0.1
|
||||
properties.insert(QStringLiteral("progress"), 1. * progress / m_gauge_max);
|
||||
properties.insert(QStringLiteral("progress-visible"), progress_visible);
|
||||
message << QStringLiteral("application://rpcs3.desktop") << properties;
|
||||
QDBusConnection::sessionBus().send(message);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ private:
|
||||
QWinTaskbarProgress* m_tb_progress = nullptr;
|
||||
#elif HAVE_QTDBUS
|
||||
int m_progress_value = 0;
|
||||
void UpdateProgress(int progress, bool disable = false);
|
||||
void UpdateProgress(int progress, bool progress_visible);
|
||||
#endif
|
||||
|
||||
QRect m_initial_geometry;
|
||||
|
@ -66,7 +66,7 @@ void msg_dialog_frame::Create(const std::string& msg, const std::string& title)
|
||||
m_tb_progress->setRange(0, 100);
|
||||
m_tb_progress->setVisible(true);
|
||||
#elif HAVE_QTDBUS
|
||||
UpdateProgress(0);
|
||||
UpdateProgress(0, true);
|
||||
m_progress_value = 0;
|
||||
#endif
|
||||
}
|
||||
@ -249,7 +249,7 @@ void msg_dialog_frame::ProgressBarReset(u32 index)
|
||||
m_tb_progress->reset();
|
||||
}
|
||||
#elif HAVE_QTDBUS
|
||||
UpdateProgress(0);
|
||||
UpdateProgress(0, false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -285,7 +285,7 @@ void msg_dialog_frame::ProgressBarInc(u32 index, u32 delta)
|
||||
}
|
||||
#elif HAVE_QTDBUS
|
||||
m_progress_value = std::min(m_progress_value + static_cast<int>(delta), m_gauge_max);
|
||||
UpdateProgress(m_progress_value);
|
||||
UpdateProgress(m_progress_value, true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -321,7 +321,7 @@ void msg_dialog_frame::ProgressBarSetValue(u32 index, u32 value)
|
||||
}
|
||||
#elif HAVE_QTDBUS
|
||||
m_progress_value = std::min(static_cast<int>(value), m_gauge_max);
|
||||
UpdateProgress(m_progress_value);
|
||||
UpdateProgress(m_progress_value, true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -370,19 +370,16 @@ void msg_dialog_frame::ProgressBarSetLimit(u32 index, u32 limit)
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDBUS
|
||||
void msg_dialog_frame::UpdateProgress(int progress, bool disable)
|
||||
void msg_dialog_frame::UpdateProgress(int progress, bool progress_visible)
|
||||
{
|
||||
QDBusMessage message = QDBusMessage::createSignal(
|
||||
QStringLiteral("/"),
|
||||
QStringLiteral("com.canonical.Unity.LauncherEntry"),
|
||||
QStringLiteral("Update"));
|
||||
QVariantMap properties;
|
||||
if (disable)
|
||||
properties.insert(QStringLiteral("progress-visible"), false);
|
||||
else
|
||||
properties.insert(QStringLiteral("progress-visible"), true);
|
||||
// Progress takes a value from 0.0 to 0.1
|
||||
properties.insert(QStringLiteral("progress"), 1.* progress / m_gauge_max);
|
||||
properties.insert(QStringLiteral("progress"), 1. * progress / m_gauge_max);
|
||||
properties.insert(QStringLiteral("progress-visible"), progress_visible);
|
||||
message << QStringLiteral("application://rpcs3.desktop") << properties;
|
||||
QDBusConnection::sessionBus().send(message);
|
||||
}
|
||||
|
@ -48,6 +48,6 @@ public:
|
||||
void ProgressBarSetLimit(u32 index, u32 limit) override;
|
||||
#ifdef HAVE_QTDBUS
|
||||
private:
|
||||
void UpdateProgress(int progress, bool disable = false);
|
||||
void UpdateProgress(int progress, bool progress_visible);
|
||||
#endif
|
||||
};
|
||||
|
@ -41,7 +41,7 @@ progress_dialog::progress_dialog(const QString& windowTitle, const QString& labe
|
||||
m_tb_progress->setRange(minimum, maximum);
|
||||
m_tb_progress->show();
|
||||
#elif HAVE_QTDBUS
|
||||
UpdateProgress(0);
|
||||
UpdateProgress(0, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -60,8 +60,8 @@ progress_dialog::~progress_dialog()
|
||||
QStringLiteral("Update"));
|
||||
QVariantMap properties;
|
||||
properties.insert(QStringLiteral("urgent"), false);
|
||||
properties.insert(QStringLiteral("progress-visible"), false);
|
||||
properties.insert(QStringLiteral("progress"), 0);
|
||||
properties.insert(QStringLiteral("progress-visible"), false);
|
||||
message << QStringLiteral("application://rpcs3.desktop") << properties;
|
||||
QDBusConnection::sessionBus().send(message);
|
||||
#endif
|
||||
@ -83,7 +83,7 @@ void progress_dialog::SetValue(int progress)
|
||||
#ifdef _WIN32
|
||||
m_tb_progress->setValue(value);
|
||||
#elif HAVE_QTDBUS
|
||||
UpdateProgress(value);
|
||||
UpdateProgress(value, true);
|
||||
#endif
|
||||
|
||||
QProgressDialog::setValue(value);
|
||||
@ -108,19 +108,16 @@ void progress_dialog::SignalFailure() const
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDBUS
|
||||
void progress_dialog::UpdateProgress(int progress, bool disable)
|
||||
void progress_dialog::UpdateProgress(int progress, bool progress_visible)
|
||||
{
|
||||
QDBusMessage message = QDBusMessage::createSignal(
|
||||
QStringLiteral("/"),
|
||||
QStringLiteral("com.canonical.Unity.LauncherEntry"),
|
||||
QStringLiteral("Update"));
|
||||
QVariantMap properties;
|
||||
if (disable)
|
||||
properties.insert(QStringLiteral("progress-visible"), false);
|
||||
else
|
||||
properties.insert(QStringLiteral("progress-visible"), true);
|
||||
//Progress takes a value from 0.0 to 0.1
|
||||
// Progress takes a value from 0.0 to 0.1
|
||||
properties.insert(QStringLiteral("progress"), 1. * progress / maximum());
|
||||
properties.insert(QStringLiteral("progress-visible"), progress_visible);
|
||||
message << QStringLiteral("application://rpcs3.desktop") << properties;
|
||||
QDBusConnection::sessionBus().send(message);
|
||||
}
|
||||
|
@ -21,6 +21,6 @@ private:
|
||||
std::unique_ptr<QWinTaskbarButton> m_tb_button = nullptr;
|
||||
QWinTaskbarProgress* m_tb_progress = nullptr;
|
||||
#elif HAVE_QTDBUS
|
||||
void UpdateProgress(int progress, bool disable = false);
|
||||
void UpdateProgress(int progress, bool progress_visible);
|
||||
#endif
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user