mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-21 03:31:40 +00:00
COMMON: Make taskbar use Path
This commit is contained in:
parent
e689166a2c
commit
b97da06876
@ -125,13 +125,13 @@ void MacOSXTaskbarManager::setOverlayIcon(const Common::String &name, const Comm
|
||||
return;
|
||||
}
|
||||
|
||||
Common::String path = getIconPath(name, ".png");
|
||||
Common::Path path = getIconPath(name, ".png");
|
||||
if (path.empty())
|
||||
return;
|
||||
|
||||
initOverlayIconView();
|
||||
|
||||
CFStringRef imageFile = CFStringCreateWithCString(0, path.c_str(), kCFStringEncodingASCII);
|
||||
CFStringRef imageFile = CFStringCreateWithCString(0, path.toString(Common::Path::kNativeSeparator).c_str(), kCFStringEncodingASCII);
|
||||
NSImage *image = [[NSImage alloc] initWithContentsOfFile:(NSString *)imageFile];
|
||||
[_overlayIconView setImage:image];
|
||||
[image release];
|
||||
@ -232,9 +232,9 @@ void MacOSXTaskbarManager::addRecent(const Common::String &name, const Common::S
|
||||
[dict setObject:(NSString *)desc forKey:@"description"];
|
||||
|
||||
// Icon
|
||||
Common::String iconPath = getIconPath(name, ".png");
|
||||
Common::Path iconPath = getIconPath(name, ".png");
|
||||
if (!iconPath.empty()) {
|
||||
CFStringRef icon = CFStringCreateWithCString(0, iconPath.c_str(), kCFStringEncodingASCII);
|
||||
CFStringRef icon = CFStringCreateWithCString(0, iconPath.toString(Common::Path::kNativeSeparator).c_str(), kCFStringEncodingASCII);
|
||||
[dict setObject:(NSString *)icon forKey:@"icon"];
|
||||
CFRelease(icon);
|
||||
}
|
||||
|
@ -121,11 +121,11 @@ void Win32TaskbarManager::setOverlayIcon(const Common::String &name, const Commo
|
||||
}
|
||||
|
||||
// Compute full icon path
|
||||
Common::String iconPath = getIconPath(name, ".ico");
|
||||
Common::Path iconPath = getIconPath(name, ".ico");
|
||||
if (iconPath.empty())
|
||||
return;
|
||||
|
||||
TCHAR *tIconPath = Win32::stringToTchar(iconPath);
|
||||
TCHAR *tIconPath = Win32::stringToTchar(iconPath.toString(Common::Path::kNativeSeparator));
|
||||
HICON pIcon = (HICON)::LoadImage(nullptr, tIconPath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
|
||||
free(tIconPath);
|
||||
if (!pIcon) {
|
||||
@ -298,11 +298,11 @@ void Win32TaskbarManager::addRecent(const Common::String &name, const Common::St
|
||||
link->SetPath(path);
|
||||
link->SetArguments(game);
|
||||
|
||||
Common::String iconPath = getIconPath(name, ".ico");
|
||||
Common::Path iconPath = getIconPath(name, ".ico");
|
||||
if (iconPath.empty()) {
|
||||
link->SetIconLocation(path, 0); // No game-specific icon available
|
||||
} else {
|
||||
LPWSTR icon = Win32::ansiToUnicode(iconPath.c_str());
|
||||
LPWSTR icon = Win32::ansiToUnicode(iconPath.toString(Common::Path::kNativeSeparator).c_str());
|
||||
|
||||
link->SetIconLocation(icon, 0);
|
||||
|
||||
|
@ -154,7 +154,7 @@ protected:
|
||||
* @param extension The icon extension
|
||||
* @return The icon path (or "" if no icon was found)
|
||||
*/
|
||||
Common::String getIconPath(const Common::String &target, const Common::String &extension) {
|
||||
Common::Path getIconPath(const Common::String &target, const Common::String &extension) {
|
||||
// We first try to look for a iconspath configuration variable then
|
||||
// fallback to the extra path
|
||||
//
|
||||
@ -196,7 +196,7 @@ return (path); \
|
||||
}
|
||||
#undef TRY_ICON_PATH
|
||||
|
||||
return "";
|
||||
return Common::Path();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user