mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-19 19:15:26 +00:00
Qt: remove discontinued QWinTaskbar code
Also remove some strange relics from the includes
This commit is contained in:
parent
73f2aaf9d8
commit
d49308ae1a
9 changed files with 230 additions and 446 deletions
File diff suppressed because it is too large
Load diff
|
@ -661,9 +661,6 @@ void gs_frame::show()
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// if we do this before show, the QWinTaskbarProgress won't show
|
||||
m_progress_indicator->show(this);
|
||||
}
|
||||
|
||||
display_handle_t gs_frame::handle() const
|
||||
|
|
|
@ -226,49 +226,6 @@ bool main_window::Init([[maybe_unused]] bool with_cli_boot)
|
|||
ui->sysPauseAct->setEnabled(enable_play_last);
|
||||
ui->toolbar_start->setEnabled(enable_play_last);
|
||||
|
||||
// create tool buttons for the taskbar thumbnail
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_thumb_bar = new QWinThumbnailToolBar(this);
|
||||
m_thumb_bar->setWindow(windowHandle());
|
||||
|
||||
m_thumb_playPause = new QWinThumbnailToolButton(m_thumb_bar);
|
||||
m_thumb_playPause->setToolTip(start_tooltip);
|
||||
m_thumb_playPause->setIcon(m_icon_thumb_play);
|
||||
m_thumb_playPause->setEnabled(enable_play_last);
|
||||
|
||||
m_thumb_stop = new QWinThumbnailToolButton(m_thumb_bar);
|
||||
m_thumb_stop->setToolTip(tr("Stop"));
|
||||
m_thumb_stop->setIcon(m_icon_thumb_stop);
|
||||
m_thumb_stop->setEnabled(false);
|
||||
|
||||
m_thumb_restart = new QWinThumbnailToolButton(m_thumb_bar);
|
||||
m_thumb_restart->setToolTip(tr("Restart"));
|
||||
m_thumb_restart->setIcon(m_icon_thumb_restart);
|
||||
m_thumb_restart->setEnabled(false);
|
||||
|
||||
m_thumb_bar->addButton(m_thumb_playPause);
|
||||
m_thumb_bar->addButton(m_thumb_stop);
|
||||
m_thumb_bar->addButton(m_thumb_restart);
|
||||
|
||||
RepaintThumbnailIcons();
|
||||
|
||||
connect(m_thumb_stop, &QWinThumbnailToolButton::clicked, this, []()
|
||||
{
|
||||
gui_log.notice("User clicked the stop button on thumbnail toolbar");
|
||||
Emu.GracefulShutdown(false, true);
|
||||
});
|
||||
connect(m_thumb_restart, &QWinThumbnailToolButton::clicked, this, []()
|
||||
{
|
||||
gui_log.notice("User clicked the restart button on thumbnail toolbar");
|
||||
Emu.Restart();
|
||||
});
|
||||
connect(m_thumb_playPause, &QWinThumbnailToolButton::clicked, this, [this]()
|
||||
{
|
||||
gui_log.notice("User clicked the playPause button on thumbnail toolbar");
|
||||
OnPlayOrPause();
|
||||
});
|
||||
#endif
|
||||
|
||||
// RPCS3 Updater
|
||||
|
||||
QMenu* download_menu = new QMenu(tr("Update Available!"));
|
||||
|
@ -1868,19 +1825,6 @@ void main_window::RepaintThumbnailIcons()
|
|||
{
|
||||
return gui::utils::get_colorized_icon(QPixmap::fromImage(gui::utils::get_opaque_image_area(path)), Qt::black, new_color);
|
||||
};
|
||||
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
if (!m_thumb_bar) return;
|
||||
|
||||
m_icon_thumb_play = icon(":/Icons/play.png");
|
||||
m_icon_thumb_pause = icon(":/Icons/pause.png");
|
||||
m_icon_thumb_stop = icon(":/Icons/stop.png");
|
||||
m_icon_thumb_restart = icon(":/Icons/restart.png");
|
||||
|
||||
m_thumb_playPause->setIcon(Emu.IsRunning() || Emu.IsStarting() ? m_icon_thumb_pause : m_icon_thumb_play);
|
||||
m_thumb_stop->setIcon(m_icon_thumb_stop);
|
||||
m_thumb_restart->setIcon(m_icon_thumb_restart);
|
||||
#endif
|
||||
}
|
||||
|
||||
void main_window::RepaintToolBarIcons()
|
||||
|
@ -1971,12 +1915,6 @@ void main_window::OnEmuRun(bool /*start_playtime*/)
|
|||
|
||||
m_debugger_frame->EnableButtons(true);
|
||||
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_thumb_stop->setToolTip(stop_tooltip);
|
||||
m_thumb_restart->setToolTip(restart_tooltip);
|
||||
m_thumb_playPause->setToolTip(pause_tooltip);
|
||||
m_thumb_playPause->setIcon(m_icon_thumb_pause);
|
||||
#endif
|
||||
ui->sysPauseAct->setText(tr("&Pause"));
|
||||
ui->sysPauseAct->setIcon(m_icon_pause);
|
||||
ui->toolbar_start->setIcon(m_icon_pause);
|
||||
|
@ -1996,12 +1934,6 @@ void main_window::OnEmuResume() const
|
|||
const QString pause_tooltip = tr("Pause %0").arg(title);
|
||||
const QString stop_tooltip = tr("Stop %0").arg(title);
|
||||
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_thumb_stop->setToolTip(stop_tooltip);
|
||||
m_thumb_restart->setToolTip(restart_tooltip);
|
||||
m_thumb_playPause->setToolTip(pause_tooltip);
|
||||
m_thumb_playPause->setIcon(m_icon_thumb_pause);
|
||||
#endif
|
||||
ui->sysPauseAct->setText(tr("&Pause"));
|
||||
ui->sysPauseAct->setIcon(m_icon_pause);
|
||||
ui->toolbar_start->setIcon(m_icon_pause);
|
||||
|
@ -2015,10 +1947,6 @@ void main_window::OnEmuPause() const
|
|||
const QString title = GetCurrentTitle();
|
||||
const QString resume_tooltip = tr("Resume %0").arg(title);
|
||||
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_thumb_playPause->setToolTip(resume_tooltip);
|
||||
m_thumb_playPause->setIcon(m_icon_thumb_play);
|
||||
#endif
|
||||
ui->sysPauseAct->setText(tr("&Resume"));
|
||||
ui->sysPauseAct->setIcon(m_icon_play);
|
||||
ui->toolbar_start->setIcon(m_icon_play);
|
||||
|
@ -2039,10 +1967,6 @@ void main_window::OnEmuStop()
|
|||
|
||||
ui->sysPauseAct->setText(tr("&Play"));
|
||||
ui->sysPauseAct->setIcon(m_icon_play);
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_thumb_playPause->setToolTip(play_tooltip);
|
||||
m_thumb_playPause->setIcon(m_icon_thumb_play);
|
||||
#endif
|
||||
|
||||
EnableMenus(false);
|
||||
|
||||
|
@ -2061,10 +1985,6 @@ void main_window::OnEmuStop()
|
|||
ui->toolbar_start->setText(tr("Restart"));
|
||||
ui->toolbar_start->setToolTip(restart_tooltip);
|
||||
ui->sysRebootAct->setEnabled(true);
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_thumb_restart->setToolTip(restart_tooltip);
|
||||
m_thumb_restart->setEnabled(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
ui->batchRemoveShaderCachesAct->setEnabled(true);
|
||||
|
@ -2106,10 +2026,7 @@ void main_window::OnEmuReady() const
|
|||
const QString play_tooltip = tr("Play %0").arg(title);
|
||||
|
||||
m_debugger_frame->EnableButtons(true);
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_thumb_playPause->setToolTip(play_tooltip);
|
||||
m_thumb_playPause->setIcon(m_icon_thumb_play);
|
||||
#endif
|
||||
|
||||
ui->sysPauseAct->setText(tr("&Play"));
|
||||
ui->sysPauseAct->setIcon(m_icon_play);
|
||||
ui->toolbar_start->setIcon(m_icon_play);
|
||||
|
@ -2133,13 +2050,6 @@ void main_window::OnEmuReady() const
|
|||
|
||||
void main_window::EnableMenus(bool enabled) const
|
||||
{
|
||||
// Thumbnail Buttons
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_thumb_playPause->setEnabled(enabled);
|
||||
m_thumb_stop->setEnabled(enabled);
|
||||
m_thumb_restart->setEnabled(enabled);
|
||||
#endif
|
||||
|
||||
// Toolbar
|
||||
ui->toolbar_start->setEnabled(enabled);
|
||||
ui->toolbar_stop->setEnabled(enabled);
|
||||
|
@ -3588,16 +3498,10 @@ void main_window::CreateDockWindows()
|
|||
|
||||
ui->toolbar_start->setEnabled(enable_play_buttons);
|
||||
ui->sysPauseAct->setEnabled(enable_play_buttons);
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_thumb_playPause->setEnabled(enable_play_buttons);
|
||||
#endif
|
||||
|
||||
if (!tooltip.isEmpty())
|
||||
{
|
||||
ui->toolbar_start->setToolTip(tooltip);
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_thumb_playPause->setToolTip(tooltip);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
#include <QWinThumbnailToolBar>
|
||||
#include <QWinThumbnailToolButton>
|
||||
#endif
|
||||
|
||||
#include <QActionGroup>
|
||||
#include <QMainWindow>
|
||||
#include <QIcon>
|
||||
|
@ -61,17 +56,6 @@ class main_window : public QMainWindow
|
|||
QIcon m_icon_fullscreen_on;
|
||||
QIcon m_icon_fullscreen_off;
|
||||
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
QIcon m_icon_thumb_play;
|
||||
QIcon m_icon_thumb_pause;
|
||||
QIcon m_icon_thumb_stop;
|
||||
QIcon m_icon_thumb_restart;
|
||||
QWinThumbnailToolBar *m_thumb_bar = nullptr;
|
||||
QWinThumbnailToolButton *m_thumb_playPause = nullptr;
|
||||
QWinThumbnailToolButton *m_thumb_stop = nullptr;
|
||||
QWinThumbnailToolButton *m_thumb_restart = nullptr;
|
||||
#endif
|
||||
|
||||
enum class drop_type
|
||||
{
|
||||
drop_error,
|
||||
|
|
|
@ -131,9 +131,6 @@ void msg_dialog_frame::Create(const std::string& msg, const std::string& title)
|
|||
// Fix size
|
||||
m_dialog->layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
m_dialog->show();
|
||||
|
||||
// if we do this before, the QWinTaskbarProgress won't show
|
||||
if (m_progress_indicator) m_progress_indicator->show(m_dialog->windowHandle());
|
||||
}
|
||||
|
||||
void msg_dialog_frame::Close(bool success)
|
||||
|
|
|
@ -51,34 +51,3 @@ void progress_dialog::SignalFailure() const
|
|||
|
||||
QApplication::beep();
|
||||
}
|
||||
|
||||
void progress_dialog::show_progress_indicator()
|
||||
{
|
||||
// Try to find a window handle first
|
||||
QWindow* handle = windowHandle();
|
||||
|
||||
for (QWidget* ancestor = this; !handle && ancestor;)
|
||||
{
|
||||
ancestor = static_cast<QWidget*>(ancestor->parent());
|
||||
if (ancestor) handle = ancestor->windowHandle();
|
||||
}
|
||||
|
||||
m_progress_indicator->show(handle);
|
||||
}
|
||||
|
||||
void progress_dialog::setVisible(bool visible)
|
||||
{
|
||||
if (visible)
|
||||
{
|
||||
if (!isVisible())
|
||||
{
|
||||
show_progress_indicator();
|
||||
}
|
||||
}
|
||||
else if (isVisible())
|
||||
{
|
||||
m_progress_indicator->hide();
|
||||
}
|
||||
|
||||
QProgressDialog::setVisible(visible);
|
||||
}
|
||||
|
|
|
@ -14,10 +14,6 @@ public:
|
|||
void SetDeleteOnClose();
|
||||
void SignalFailure() const;
|
||||
|
||||
void show_progress_indicator();
|
||||
|
||||
void setVisible(bool visible) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<progress_indicator> m_progress_indicator;
|
||||
};
|
||||
|
|
|
@ -1,106 +1,57 @@
|
|||
#include "stdafx.h"
|
||||
#include "progress_indicator.h"
|
||||
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
#include <QCoreApplication>
|
||||
#include <QWinTaskbarProgress>
|
||||
#elif HAVE_QTDBUS
|
||||
#if HAVE_QTDBUS
|
||||
#include <QtDBus/QDBusMessage>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#endif
|
||||
|
||||
progress_indicator::progress_indicator(int minimum, int maximum)
|
||||
{
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_tb_button = std::make_unique<QWinTaskbarButton>();
|
||||
m_tb_button->progress()->setRange(minimum, maximum);
|
||||
m_tb_button->progress()->setVisible(false);
|
||||
#else
|
||||
m_minimum = minimum;
|
||||
m_maximum = maximum;
|
||||
#if HAVE_QTDBUS
|
||||
update_progress(0, true, false);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
progress_indicator::~progress_indicator()
|
||||
{
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
// QWinTaskbarProgress::hide() will crash if the application is already about to close, even if the object is not null.
|
||||
if (!QCoreApplication::closingDown())
|
||||
{
|
||||
m_tb_button->progress()->hide();
|
||||
}
|
||||
#elif HAVE_QTDBUS
|
||||
#if HAVE_QTDBUS
|
||||
update_progress(0, false, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void progress_indicator::show(QWindow* window)
|
||||
{
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_tb_button->setWindow(window);
|
||||
m_tb_button->progress()->show();
|
||||
#else
|
||||
Q_UNUSED(window);
|
||||
#endif
|
||||
}
|
||||
|
||||
void progress_indicator::hide()
|
||||
{
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_tb_button->progress()->hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
int progress_indicator::value() const
|
||||
{
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
return m_tb_button->progress()->value();
|
||||
#else
|
||||
return m_value;
|
||||
#endif
|
||||
}
|
||||
|
||||
void progress_indicator::set_value(int value)
|
||||
{
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_tb_button->progress()->setValue(std::clamp(value, m_tb_button->progress()->minimum(), m_tb_button->progress()->maximum()));
|
||||
#else
|
||||
m_value = std::clamp(value, m_minimum, m_maximum);
|
||||
#if HAVE_QTDBUS
|
||||
update_progress(m_value, true, false);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void progress_indicator::set_range(int minimum, int maximum)
|
||||
{
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_tb_button->progress()->setRange(minimum, maximum);
|
||||
#else
|
||||
m_minimum = minimum;
|
||||
m_maximum = maximum;
|
||||
#endif
|
||||
}
|
||||
|
||||
void progress_indicator::reset()
|
||||
{
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_tb_button->progress()->reset();
|
||||
#else
|
||||
m_value = m_minimum;
|
||||
#if HAVE_QTDBUS
|
||||
update_progress(m_value, false, false);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void progress_indicator::signal_failure()
|
||||
{
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
m_tb_button->progress()->stop();
|
||||
#elif HAVE_QTDBUS
|
||||
#if HAVE_QTDBUS
|
||||
update_progress(0, false, true);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,20 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWindow>
|
||||
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
#include <QWinTaskbarButton>
|
||||
#endif
|
||||
|
||||
class progress_indicator
|
||||
{
|
||||
public:
|
||||
progress_indicator(int minimum, int maximum);
|
||||
~progress_indicator();
|
||||
|
||||
void show(QWindow* window);
|
||||
void hide();
|
||||
|
||||
int value() const;
|
||||
|
||||
void set_value(int value);
|
||||
|
@ -23,15 +14,10 @@ public:
|
|||
void signal_failure();
|
||||
|
||||
private:
|
||||
|
||||
#ifdef HAS_QT_WIN_STUFF
|
||||
std::unique_ptr<QWinTaskbarButton> m_tb_button;
|
||||
#else
|
||||
int m_value = 0;
|
||||
int m_minimum = 0;
|
||||
int m_maximum = 100;
|
||||
#if HAVE_QTDBUS
|
||||
void update_progress(int progress, bool progress_visible, bool urgent);
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue