Qt/Linux: Implement SignalFailure with dbus

This commit is contained in:
Megamouse 2021-09-26 00:58:27 +02:00
commit 45f5819ef3
2 changed files with 21 additions and 6 deletions

View file

@ -372,12 +372,10 @@ void msg_dialog_frame::ProgressBarSetLimit(u32 index, u32 limit)
#ifdef HAVE_QTDBUS #ifdef HAVE_QTDBUS
void msg_dialog_frame::UpdateProgress(int progress, bool disable) void msg_dialog_frame::UpdateProgress(int progress, bool disable)
{ {
QDBusMessage message = QDBusMessage::createSignal QDBusMessage message = QDBusMessage::createSignal(
(
QStringLiteral("/"), QStringLiteral("/"),
QStringLiteral("com.canonical.Unity.LauncherEntry"), QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update") QStringLiteral("Update"));
);
QVariantMap properties; QVariantMap properties;
if (disable) if (disable)
properties.insert(QStringLiteral("progress-visible"), false); properties.insert(QStringLiteral("progress-visible"), false);

View file

@ -54,7 +54,16 @@ progress_dialog::~progress_dialog()
m_tb_progress->hide(); m_tb_progress->hide();
} }
#elif HAVE_QTDBUS #elif HAVE_QTDBUS
UpdateProgress(0); QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"));
QVariantMap properties;
properties.insert(QStringLiteral("urgent"), false);
properties.insert(QStringLiteral("progress-visible"), false);
properties.insert(QStringLiteral("progress"), 0);
message << QStringLiteral("application://rpcs3.desktop") << properties;
QDBusConnection::sessionBus().send(message);
#endif #endif
} }
@ -84,8 +93,16 @@ void progress_dialog::SignalFailure() const
{ {
#ifdef _WIN32 #ifdef _WIN32
m_tb_progress->stop(); m_tb_progress->stop();
#elif HAVE_QTDBUS
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"));
QVariantMap properties;
properties.insert(QStringLiteral("urgent"), true);
message << QStringLiteral("application://rpcs3.desktop") << properties;
QDBusConnection::sessionBus().send(message);
#endif #endif
// TODO: Implement an equivalent for Linux, if possible
QApplication::beep(); QApplication::beep();
} }