|
|
@ -761,6 +761,35 @@ static void addPackedSheetUpdatePaths(NLMISC::IProgressCallback &progress)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
|
|
|
|
|
|
|
static bool addRyzomIconBitmap(const std::string &directory, vector<CBitmap> &bitmaps)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (CFile::isDirectory(directory))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// build filename from directory and default ryzom client icon name
|
|
|
|
|
|
|
|
std::string filename = NLMISC::toString("%s/%s.png", directory.c_str(), RYZOM_CLIENT_ICON);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CFile::fileExists(filename))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CIFile file;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (file.open(filename))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CBitmap bitmap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bitmap.load(file))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bitmaps.push_back(bitmap);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------
|
|
|
|
//---------------------------------------------------
|
|
|
|
// prelogInit :
|
|
|
|
// prelogInit :
|
|
|
|
// Initialize the application before login
|
|
|
|
// Initialize the application before login
|
|
|
@ -1065,50 +1094,57 @@ void prelogInit()
|
|
|
|
Driver->setWindowTitle(CI18N::get("TheSagaOfRyzom"));
|
|
|
|
Driver->setWindowTitle(CI18N::get("TheSagaOfRyzom"));
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
|
|
|
#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
|
|
|
// add all existing icons
|
|
|
|
// add all existing directory prefixes
|
|
|
|
vector<string> directories;
|
|
|
|
vector<string> directoryPrefixes;
|
|
|
|
|
|
|
|
|
|
|
|
// system directories
|
|
|
|
// user local directory prefix (~/.local)
|
|
|
|
directories.push_back("/usr/share/icons/hicolor/256x256/apps");
|
|
|
|
const char* homeDirectory = getenv("HOME");
|
|
|
|
directories.push_back("/usr/share/icons/hicolor/128x128/apps");
|
|
|
|
|
|
|
|
directories.push_back("/usr/share/icons/hicolor/96x96/apps");
|
|
|
|
if (homeDirectory)
|
|
|
|
directories.push_back("/usr/share/icons/hicolor/48x48/apps");
|
|
|
|
directoryPrefixes.push_back(CPath::standardizePath(homeDirectory) + ".local");
|
|
|
|
directories.push_back("/usr/share/icons/hicolor/32x32/apps");
|
|
|
|
|
|
|
|
directories.push_back("/usr/share/icons/hicolor/24x24/apps");
|
|
|
|
// system local directory prefix (/usr/local)
|
|
|
|
directories.push_back("/usr/share/icons/hicolor/22x22/apps");
|
|
|
|
directoryPrefixes.push_back("/usr/local");
|
|
|
|
directories.push_back("/usr/share/icons/hicolor/16x16/apps");
|
|
|
|
|
|
|
|
directories.push_back("/usr/share/pixmaps");
|
|
|
|
// system directory prefix (/usr)
|
|
|
|
|
|
|
|
directoryPrefixes.push_back("/usr");
|
|
|
|
// local directories
|
|
|
|
|
|
|
|
directories.push_back("~/.local/share/icons/hicolor/256x256/apps");
|
|
|
|
// all supported icon sizes
|
|
|
|
directories.push_back("~/.local/share/icons/hicolor/128x128/apps");
|
|
|
|
vector<uint> iconSizes;
|
|
|
|
directories.push_back("~/.local/share/icons/hicolor/96x96/apps");
|
|
|
|
iconSizes.push_back(512);
|
|
|
|
directories.push_back("~/.local/share/icons/hicolor/48x48/apps");
|
|
|
|
iconSizes.push_back(256);
|
|
|
|
directories.push_back("~/.local/share/icons/hicolor/32x32/apps");
|
|
|
|
iconSizes.push_back(128);
|
|
|
|
directories.push_back("~/.local/share/icons/hicolor/24x24/apps");
|
|
|
|
iconSizes.push_back(96);
|
|
|
|
directories.push_back("~/.local/share/icons/hicolor/22x22/apps");
|
|
|
|
iconSizes.push_back(48);
|
|
|
|
directories.push_back("~/.local/share/icons/hicolor/16x16/apps");
|
|
|
|
iconSizes.push_back(32);
|
|
|
|
directories.push_back("~/.local/share/pixmaps");
|
|
|
|
iconSizes.push_back(24);
|
|
|
|
|
|
|
|
iconSizes.push_back(22);
|
|
|
|
// check if an icon is present in registered paths
|
|
|
|
iconSizes.push_back(16);
|
|
|
|
directories.push_back(".");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vector<CBitmap> bitmaps;
|
|
|
|
vector<CBitmap> bitmaps;
|
|
|
|
|
|
|
|
|
|
|
|
for(size_t i = 0; i < directories.size(); ++i)
|
|
|
|
// process all icon sizes
|
|
|
|
|
|
|
|
for(size_t j = 0; j < iconSizes.size(); ++j)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string filename = NLMISC::toString("%s/%s.png", directories[i].c_str(), RYZOM_CLIENT_ICON);
|
|
|
|
// process all directory prefixes
|
|
|
|
|
|
|
|
for(size_t i = 0; i < directoryPrefixes.size(); ++i)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint size = iconSizes[j];
|
|
|
|
|
|
|
|
|
|
|
|
CIFile file;
|
|
|
|
// build directory where to look for icon
|
|
|
|
|
|
|
|
std::string directory = toString("%s/share/icons/hicolor/%ux%u/apps", directoryPrefixes[i].c_str(), size, size);
|
|
|
|
|
|
|
|
|
|
|
|
if (CFile::fileExists(filename) && file.open(filename))
|
|
|
|
// if found, skip other directories for this icon size
|
|
|
|
{
|
|
|
|
if (addRyzomIconBitmap(directory, bitmaps)) break;
|
|
|
|
CBitmap bitmap;
|
|
|
|
|
|
|
|
if (bitmap.load(file))
|
|
|
|
|
|
|
|
bitmaps.push_back(bitmap);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bitmaps.empty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// check if an icon is present in current directory
|
|
|
|
|
|
|
|
addRyzomIconBitmap(".", bitmaps);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Driver->setWindowIcon(bitmaps);
|
|
|
|
Driver->setWindowIcon(bitmaps);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|