Qt: Use global Appicon instead of setting it in every Dialog

This commit is contained in:
Unknown 2017-11-18 13:20:32 +01:00 committed by Ani
parent 222c0e0fc5
commit 61ca9df45c
8 changed files with 7 additions and 15 deletions

View File

@ -63,6 +63,9 @@ rpcs3_app::rpcs3_app(int& argc, char** argv) : QApplication(argc, argv)
void rpcs3_app::Init() void rpcs3_app::Init()
{ {
setApplicationName("RPCS3");
setWindowIcon(QIcon(":/rpcs3.ico"));
Emu.Init(); Emu.Init();
guiSettings.reset(new gui_settings()); guiSettings.reset(new gui_settings());
@ -79,7 +82,6 @@ void rpcs3_app::Init()
RPCS3MainWin->Init(); RPCS3MainWin->Init();
setApplicationName("RPCS3");
RPCS3MainWin->show(); RPCS3MainWin->show();
// Create the thumbnail toolbar after the main_window is created // Create the thumbnail toolbar after the main_window is created

View File

@ -76,8 +76,6 @@ void main_window::Init()
setAcceptDrops(true); setAcceptDrops(true);
m_appIcon = QIcon(":/rpcs3.ico");
// hide utilities from the average user // hide utilities from the average user
ui->menuUtilities->menuAction()->setVisible(guiSettings->GetValue(GUI::m_showDebugTab).toBool()); ui->menuUtilities->menuAction()->setVisible(guiSettings->GetValue(GUI::m_showDebugTab).toBool());
@ -107,7 +105,6 @@ void main_window::Init()
setMinimumSize(350, minimumSizeHint().height()); // seems fine on win 10 setMinimumSize(350, minimumSizeHint().height()); // seems fine on win 10
setWindowTitle(QString::fromStdString("RPCS3 v" + rpcs3::version.to_string())); setWindowTitle(QString::fromStdString("RPCS3 v" + rpcs3::version.to_string()));
!m_appIcon.isNull() ? setWindowIcon(m_appIcon) : LOG_WARNING(GENERAL, "AppImage could not be loaded!");
Q_EMIT RequestGlobalStylesheetChange(guiSettings->GetCurrentStylesheetPath()); Q_EMIT RequestGlobalStylesheetChange(guiSettings->GetCurrentStylesheetPath());
ConfigureGuiFromSettings(true); ConfigureGuiFromSettings(true);
@ -131,7 +128,6 @@ void main_window::Init()
QMessageBox msg; QMessageBox msg;
msg.setWindowTitle("Experimental Build Warning"); msg.setWindowTitle("Experimental Build Warning");
msg.setWindowIcon(m_appIcon);
msg.setIcon(QMessageBox::Critical); msg.setIcon(QMessageBox::Critical);
msg.setTextFormat(Qt::RichText); msg.setTextFormat(Qt::RichText);
msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
@ -196,7 +192,7 @@ QIcon main_window::GetAppIcon()
} }
// loads the appIcon from path and embeds it centered into an empty square icon // loads the appIcon from path and embeds it centered into an empty square icon
void main_window::SetAppIconFromPath(const std::string path) void main_window::SetAppIconFromPath(const std::string& path)
{ {
// get Icon for the gs_frame from path. this handles presumably all possible use cases // get Icon for the gs_frame from path. this handles presumably all possible use cases
QString qpath = qstr(path); QString qpath = qstr(path);
@ -214,7 +210,7 @@ void main_window::SetAppIconFromPath(const std::string path)
// load the image from path. It will most likely be a rectangle // load the image from path. It will most likely be a rectangle
QImage source = QImage(qstr(ico)); QImage source = QImage(qstr(ico));
int edgeMax = std::max(source.width(), source.height()); int edgeMax = std::max(source.width(), source.height());
// create a new transparent image with square size and same format as source (maybe handle other formats than RGB32 as well?) // create a new transparent image with square size and same format as source (maybe handle other formats than RGB32 as well?)
QImage::Format format = source.format() == QImage::Format_RGB32 ? QImage::Format_ARGB32 : source.format(); QImage::Format format = source.format() == QImage::Format_RGB32 ? QImage::Format_ARGB32 : source.format();
QImage dest = QImage(edgeMax, edgeMax, format); QImage dest = QImage(edgeMax, edgeMax, format);
@ -236,7 +232,7 @@ void main_window::SetAppIconFromPath(const std::string path)
} }
} }
// if nothing was found reset the icon to default // if nothing was found reset the icon to default
m_appIcon = QIcon(":/rpcs3.ico"); m_appIcon = QApplication::windowIcon();
} }
void main_window::BootElf() void main_window::BootElf()

View File

@ -100,7 +100,7 @@ protected:
void dragEnterEvent(QDragEnterEvent* event) override; void dragEnterEvent(QDragEnterEvent* event) override;
void dragMoveEvent(QDragMoveEvent* event) override; void dragMoveEvent(QDragMoveEvent* event) override;
void dragLeaveEvent(QDragLeaveEvent* event) override; void dragLeaveEvent(QDragLeaveEvent* event) override;
void SetAppIconFromPath(const std::string path); void SetAppIconFromPath(const std::string& path);
private: private:
void RepaintToolbar(); void RepaintToolbar();
void RepaintToolBarIcons(); void RepaintToolBarIcons();

View File

@ -81,8 +81,6 @@ public:
explicit custom_dialog(bool disableCancel, QWidget* parent = 0) explicit custom_dialog(bool disableCancel, QWidget* parent = 0)
: QDialog(parent), m_disable_cancel(disableCancel) : QDialog(parent), m_disable_cancel(disableCancel)
{ {
setWindowIcon(QIcon(":/rpcs3.ico"));
if (m_disable_cancel) if (m_disable_cancel)
{ {
setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint);

View File

@ -11,7 +11,6 @@ save_data_info_dialog::save_data_info_dialog(const SaveDataEntry& save, QWidget*
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Save Data Information")); setWindowTitle(tr("Save Data Information"));
setWindowIcon(QIcon(":/rpcs3.ico"));
// Table // Table
m_list = new QTableWidget(this); m_list = new QTableWidget(this);

View File

@ -32,7 +32,6 @@ save_data_list_dialog::save_data_list_dialog(const std::vector<SaveDataEntry>& e
setWindowTitle(tr("Save Data Interface (Save)")); setWindowTitle(tr("Save Data Interface (Save)"));
} }
setWindowIcon(QIcon(":/rpcs3.ico"));
setMinimumSize(QSize(400, 400)); setMinimumSize(QSize(400, 400));
// Table // Table

View File

@ -85,7 +85,6 @@ save_manager_dialog::save_manager_dialog(std::string dir, QWidget* parent) : QDi
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Save Manager")); setWindowTitle(tr("Save Manager"));
setWindowIcon(QIcon(":/rpcs3.ico"));
setMinimumSize(QSize(400, 400)); setMinimumSize(QSize(400, 400));
Init(dir); Init(dir);

View File

@ -43,7 +43,6 @@ trophy_manager_dialog::trophy_manager_dialog() : QWidget(), m_sort_column(0), m_
// Nonspecific widget settings // Nonspecific widget settings
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Trophy Manager")); setWindowTitle(tr("Trophy Manager"));
setWindowIcon(QIcon(":/rpcs3.ico"));
// HACK: dev_hdd0 must be mounted for vfs to work for loading trophies. // HACK: dev_hdd0 must be mounted for vfs to work for loading trophies.
const std::string emu_dir_ = g_cfg.vfs.emulator_dir; const std::string emu_dir_ = g_cfg.vfs.emulator_dir;