Merge pull request #1403 from waddlesplash/dolphin-qt
DolphinQt: Fix toolbar image loading on Retina displays
This commit is contained in:
commit
31c679a3dc
|
@ -8,7 +8,8 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
// Predefinitions
|
// Predefinitions
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class DAboutDialog;
|
class DAboutDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ static QString LowestSupportedOsVersion()
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
// TODO: Add command line options
|
// TODO: Add command line options
|
||||||
|
|
||||||
UICommon::CreateDirectories();
|
UICommon::CreateDirectories();
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
// Predefinitions
|
// Predefinitions
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class DMainWindow;
|
class DMainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
// Licensed under GPLv2
|
// Licensed under GPLv2
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
|
||||||
|
@ -47,26 +50,40 @@ void Resources::Init()
|
||||||
UpdatePixmaps();
|
UpdatePixmaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrapper for GetImageFilename() so you don't have to to call it directly
|
||||||
|
#define GIFN(file) GetImageFilename(SL(file), dir)
|
||||||
|
|
||||||
void Resources::UpdatePixmaps()
|
void Resources::UpdatePixmaps()
|
||||||
{
|
{
|
||||||
QString dir = QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name));
|
QString dir = QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name));
|
||||||
m_pixmaps[TOOLBAR_OPEN].load(dir + SL("open.png"));
|
m_pixmaps[TOOLBAR_OPEN].load(GIFN("open"));
|
||||||
m_pixmaps[TOOLBAR_REFRESH].load(dir + SL("refresh.png"));
|
m_pixmaps[TOOLBAR_REFRESH].load(GIFN("refresh"));
|
||||||
m_pixmaps[TOOLBAR_BROWSE].load(dir + SL("browse.png"));
|
m_pixmaps[TOOLBAR_BROWSE].load(GIFN("browse"));
|
||||||
m_pixmaps[TOOLBAR_PLAY].load(dir + SL("play.png"));
|
m_pixmaps[TOOLBAR_PLAY].load(GIFN("play"));
|
||||||
m_pixmaps[TOOLBAR_STOP].load(dir + SL("stop.png"));
|
m_pixmaps[TOOLBAR_STOP].load(GIFN("stop"));
|
||||||
m_pixmaps[TOOLBAR_PAUSE].load(dir + SL("pause.png"));
|
m_pixmaps[TOOLBAR_PAUSE].load(GIFN("pause"));
|
||||||
m_pixmaps[TOOLBAR_FULLSCREEN].load(dir + SL("fullscreen.png"));
|
m_pixmaps[TOOLBAR_FULLSCREEN].load(GIFN("fullscreen"));
|
||||||
m_pixmaps[TOOLBAR_SCREENSHOT].load(dir + SL("screenshot.png"));
|
m_pixmaps[TOOLBAR_SCREENSHOT].load(GIFN("screenshot"));
|
||||||
m_pixmaps[TOOLBAR_CONFIGURE].load(dir + SL("config.png"));
|
m_pixmaps[TOOLBAR_CONFIGURE].load(GIFN("config"));
|
||||||
m_pixmaps[TOOLBAR_PLUGIN_GFX].load(dir + SL("graphics.png"));
|
m_pixmaps[TOOLBAR_PLUGIN_GFX].load(GIFN("graphics"));
|
||||||
m_pixmaps[TOOLBAR_PLUGIN_DSP].load(dir + SL("dsp.png"));
|
m_pixmaps[TOOLBAR_PLUGIN_DSP].load(GIFN("dsp"));
|
||||||
m_pixmaps[TOOLBAR_PLUGIN_GCPAD].load(dir + SL("gcpad.png"));
|
m_pixmaps[TOOLBAR_PLUGIN_GCPAD].load(GIFN("gcpad"));
|
||||||
m_pixmaps[TOOLBAR_PLUGIN_WIIMOTE].load(dir + SL("wiimote.png"));
|
m_pixmaps[TOOLBAR_PLUGIN_WIIMOTE].load(GIFN("wiimote"));
|
||||||
m_pixmaps[TOOLBAR_HELP].load(dir + SL("nobanner.png")); // TODO
|
m_pixmaps[TOOLBAR_HELP].load(GIFN("nobanner")); // TODO
|
||||||
// TODO: toolbar[MEMCARD];
|
// TODO: toolbar[MEMCARD];
|
||||||
// TODO: toolbar[HOTKEYS];
|
// 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)
|
QPixmap& Resources::GetRegionPixmap(DiscIO::IVolume::ECountry region)
|
||||||
|
|
|
@ -50,4 +50,6 @@ private:
|
||||||
static QVector<QPixmap> m_regions;
|
static QVector<QPixmap> m_regions;
|
||||||
static QVector<QPixmap> m_ratings;
|
static QVector<QPixmap> m_ratings;
|
||||||
static QVector<QPixmap> m_pixmaps;
|
static QVector<QPixmap> m_pixmaps;
|
||||||
|
|
||||||
|
static QString GetImageFilename(QString name, QString dir);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue