diff --git a/Source/Core/DolphinQt/AboutDialog.h b/Source/Core/DolphinQt/AboutDialog.h index 6f5988aad0..33d83cba3c 100644 --- a/Source/Core/DolphinQt/AboutDialog.h +++ b/Source/Core/DolphinQt/AboutDialog.h @@ -8,7 +8,8 @@ #include // Predefinitions -namespace Ui { +namespace Ui +{ class DAboutDialog; } diff --git a/Source/Core/DolphinQt/Main.cpp b/Source/Core/DolphinQt/Main.cpp index 9bcea4de27..93d853ad62 100644 --- a/Source/Core/DolphinQt/Main.cpp +++ b/Source/Core/DolphinQt/Main.cpp @@ -39,6 +39,7 @@ static QString LowestSupportedOsVersion() int main(int argc, char* argv[]) { QApplication app(argc, argv); + app.setAttribute(Qt::AA_UseHighDpiPixmaps); // TODO: Add command line options UICommon::CreateDirectories(); diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index 286dc4fae8..a1ffa1c6ed 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -8,7 +8,8 @@ #include // Predefinitions -namespace Ui { +namespace Ui +{ class DMainWindow; } diff --git a/Source/Core/DolphinQt/Utils/Resources.cpp b/Source/Core/DolphinQt/Utils/Resources.cpp index 08c9e37ed2..0056f4f972 100644 --- a/Source/Core/DolphinQt/Utils/Resources.cpp +++ b/Source/Core/DolphinQt/Utils/Resources.cpp @@ -2,6 +2,9 @@ // Licensed under GPLv2 // Refer to the license.txt file included. +#include +#include + #include "Common/FileUtil.h" #include "Core/ConfigManager.h" @@ -47,26 +50,40 @@ void Resources::Init() UpdatePixmaps(); } +// Wrapper for GetImageFilename() so you don't have to to call it directly +#define GIFN(file) GetImageFilename(SL(file), dir) + void Resources::UpdatePixmaps() { QString dir = QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name)); - m_pixmaps[TOOLBAR_OPEN].load(dir + SL("open.png")); - m_pixmaps[TOOLBAR_REFRESH].load(dir + SL("refresh.png")); - m_pixmaps[TOOLBAR_BROWSE].load(dir + SL("browse.png")); - m_pixmaps[TOOLBAR_PLAY].load(dir + SL("play.png")); - m_pixmaps[TOOLBAR_STOP].load(dir + SL("stop.png")); - m_pixmaps[TOOLBAR_PAUSE].load(dir + SL("pause.png")); - m_pixmaps[TOOLBAR_FULLSCREEN].load(dir + SL("fullscreen.png")); - m_pixmaps[TOOLBAR_SCREENSHOT].load(dir + SL("screenshot.png")); - m_pixmaps[TOOLBAR_CONFIGURE].load(dir + SL("config.png")); - m_pixmaps[TOOLBAR_PLUGIN_GFX].load(dir + SL("graphics.png")); - m_pixmaps[TOOLBAR_PLUGIN_DSP].load(dir + SL("dsp.png")); - m_pixmaps[TOOLBAR_PLUGIN_GCPAD].load(dir + SL("gcpad.png")); - m_pixmaps[TOOLBAR_PLUGIN_WIIMOTE].load(dir + SL("wiimote.png")); - m_pixmaps[TOOLBAR_HELP].load(dir + SL("nobanner.png")); // TODO + m_pixmaps[TOOLBAR_OPEN].load(GIFN("open")); + m_pixmaps[TOOLBAR_REFRESH].load(GIFN("refresh")); + m_pixmaps[TOOLBAR_BROWSE].load(GIFN("browse")); + m_pixmaps[TOOLBAR_PLAY].load(GIFN("play")); + m_pixmaps[TOOLBAR_STOP].load(GIFN("stop")); + m_pixmaps[TOOLBAR_PAUSE].load(GIFN("pause")); + m_pixmaps[TOOLBAR_FULLSCREEN].load(GIFN("fullscreen")); + m_pixmaps[TOOLBAR_SCREENSHOT].load(GIFN("screenshot")); + m_pixmaps[TOOLBAR_CONFIGURE].load(GIFN("config")); + m_pixmaps[TOOLBAR_PLUGIN_GFX].load(GIFN("graphics")); + m_pixmaps[TOOLBAR_PLUGIN_DSP].load(GIFN("dsp")); + m_pixmaps[TOOLBAR_PLUGIN_GCPAD].load(GIFN("gcpad")); + m_pixmaps[TOOLBAR_PLUGIN_WIIMOTE].load(GIFN("wiimote")); + m_pixmaps[TOOLBAR_HELP].load(GIFN("nobanner")); // TODO // TODO: toolbar[MEMCARD]; // TODO: toolbar[HOTKEYS]; - m_pixmaps[BANNER_MISSING].load(dir + SL("nobanner.png")); + m_pixmaps[BANNER_MISSING].load(GIFN("nobanner")); +} + +QString Resources::GetImageFilename(QString name, QString dir) +{ + if (qApp->devicePixelRatio() >= 2) + { + QString fileName = name.prepend(dir).append(SL("@2x.png")); + if (QFile::exists(fileName)) + return fileName; + } + return name.prepend(dir).append(SL(".png")); } QPixmap& Resources::GetRegionPixmap(DiscIO::IVolume::ECountry region) diff --git a/Source/Core/DolphinQt/Utils/Resources.h b/Source/Core/DolphinQt/Utils/Resources.h index df9def2697..2820d9d6cb 100644 --- a/Source/Core/DolphinQt/Utils/Resources.h +++ b/Source/Core/DolphinQt/Utils/Resources.h @@ -50,4 +50,6 @@ private: static QVector m_regions; static QVector m_ratings; static QVector m_pixmaps; + + static QString GetImageFilename(QString name, QString dir); };