mirror of https://github.com/RPCS3/rpcs3.git
Implement progress bar in taskbar for non-windows platforms, Fixes #2605
This commit is contained in:
parent
11aa0be04a
commit
bfe2bccc51
|
@ -12,8 +12,14 @@ if (WIN32)
|
||||||
set(RPCS3_QT_LIBS Qt5::Widgets Qt5::WinExtras)
|
set(RPCS3_QT_LIBS Qt5::Widgets Qt5::WinExtras)
|
||||||
include_directories(${Qt5Widgets_INCLUDE_DIRS} ${Qt5WinExtras_INCLUDE_DIRS})
|
include_directories(${Qt5Widgets_INCLUDE_DIRS} ${Qt5WinExtras_INCLUDE_DIRS})
|
||||||
else()
|
else()
|
||||||
set(RPCS3_QT_LIBS Qt5::Widgets)
|
find_package(Qt5DBus)
|
||||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
if (Qt5DBus_FOUND)
|
||||||
|
set(RPCS3_QT_LIBS Qt5::Widgets Qt5::DBus)
|
||||||
|
add_definitions(-DHAVE_QTDBUS)
|
||||||
|
else()
|
||||||
|
set(RPCS3_QT_LIBS Qt5::Widgets)
|
||||||
|
endif()
|
||||||
|
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Let's make sure we have Qt before we continue
|
# Let's make sure we have Qt before we continue
|
||||||
|
|
|
@ -65,6 +65,9 @@ void msg_dialog_frame::Create(const std::string& msg)
|
||||||
m_tb_progress = m_tb_button->progress();
|
m_tb_progress = m_tb_button->progress();
|
||||||
m_tb_progress->setRange(0, m_gauge_max);
|
m_tb_progress->setRange(0, m_gauge_max);
|
||||||
m_tb_progress->setVisible(true);
|
m_tb_progress->setVisible(true);
|
||||||
|
#elif HAVE_QTDBUS
|
||||||
|
UpdateProgress(0);
|
||||||
|
progressValue = new int(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,6 +271,12 @@ msg_dialog_frame::~msg_dialog_frame()
|
||||||
{
|
{
|
||||||
m_tb_button->deleteLater();
|
m_tb_button->deleteLater();
|
||||||
}
|
}
|
||||||
|
#elif HAVE_QTDBUS
|
||||||
|
if (progressValue)
|
||||||
|
{
|
||||||
|
UpdateProgress(0, false);
|
||||||
|
delete progressValue;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (m_dialog)
|
if (m_dialog)
|
||||||
{
|
{
|
||||||
|
@ -295,6 +304,8 @@ void msg_dialog_frame::ProgressBarReset(u32 index)
|
||||||
m_gauge1->reset();
|
m_gauge1->reset();
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_tb_progress->reset();
|
m_tb_progress->reset();
|
||||||
|
#elif HAVE_QTDBUS
|
||||||
|
UpdateProgress(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,6 +324,9 @@ void msg_dialog_frame::ProgressBarInc(u32 index, u32 delta)
|
||||||
m_gauge1->setValue(m_gauge1->value() + delta);
|
m_gauge1->setValue(m_gauge1->value() + delta);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_tb_progress->setValue(m_tb_progress->value() + delta);
|
m_tb_progress->setValue(m_tb_progress->value() + delta);
|
||||||
|
#elif HAVE_QTDBUS
|
||||||
|
*progressValue += delta;
|
||||||
|
UpdateProgress(*progressValue);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,3 +336,21 @@ void msg_dialog_frame::ProgressBarInc(u32 index, u32 delta)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_QTDBUS
|
||||||
|
void msg_dialog_frame::UpdateProgress(int progress, bool disable)
|
||||||
|
{
|
||||||
|
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"), (double)progress/(double)m_gauge_max);
|
||||||
|
message << QStringLiteral("application://rpcs3.desktop") << properties;
|
||||||
|
QDBusConnection::sessionBus().send(message);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
#include <QWinTaskbarButton>
|
#include <QWinTaskbarButton>
|
||||||
#include <QWinTHumbnailToolbar>
|
#include <QWinTHumbnailToolbar>
|
||||||
#include <QWinTHumbnailToolbutton>
|
#include <QWinTHumbnailToolbutton>
|
||||||
|
#elif HAVE_QTDBUS
|
||||||
|
#include <QtDBus/QDBusMessage>
|
||||||
|
#include <QtDBus/QDBusConnection>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class custom_dialog;
|
class custom_dialog;
|
||||||
|
@ -34,6 +37,9 @@ class msg_dialog_frame : public QObject, public MsgDialogBase
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
QWinTaskbarButton* m_tb_button = nullptr;
|
QWinTaskbarButton* m_tb_button = nullptr;
|
||||||
QWinTaskbarProgress* m_tb_progress = nullptr;
|
QWinTaskbarProgress* m_tb_progress = nullptr;
|
||||||
|
|
||||||
|
#elif HAVE_QTDBUS
|
||||||
|
int* progressValue = nullptr;
|
||||||
#endif
|
#endif
|
||||||
custom_dialog* m_dialog =nullptr;
|
custom_dialog* m_dialog =nullptr;
|
||||||
QLabel* m_text = nullptr;
|
QLabel* m_text = nullptr;
|
||||||
|
@ -59,6 +65,10 @@ public:
|
||||||
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) override;
|
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) override;
|
||||||
virtual void ProgressBarReset(u32 progressBarIndex) override;
|
virtual void ProgressBarReset(u32 progressBarIndex) override;
|
||||||
virtual void ProgressBarInc(u32 progressBarIndex, u32 delta) override;
|
virtual void ProgressBarInc(u32 progressBarIndex, u32 delta) override;
|
||||||
|
#ifdef HAVE_QTDBUS
|
||||||
|
private:
|
||||||
|
void UpdateProgress(int progress, bool disable = false);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class custom_dialog : public QDialog
|
class custom_dialog : public QDialog
|
||||||
|
|
Loading…
Reference in New Issue