Load new stylesheets for locale depended things.

Loading order:
qss.default (internal)
qss.<locale> (internal e.g. qss.de_DE)
stylesheet.qss (internal or external)
stylesheet_<locale>.lqss (parallel to stylesheet)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6067 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-01-09 12:16:12 +00:00
parent a60422069c
commit a96c467419

View File

@ -424,6 +424,7 @@ void Rshare::resetLanguageAndStyle()
void Rshare::loadStyleSheet(const QString &sheetName)
{
QString locale = QLocale().name();
QString styleSheet;
/* load the default stylesheet */
@ -433,7 +434,15 @@ void Rshare::loadStyleSheet(const QString &sheetName)
file.close();
}
/* load locale depended default stylesheet */
file.setFileName(":/qss/stylesheet/qss." + locale);
if (file.open(QFile::ReadOnly)) {
styleSheet = QLatin1String(file.readAll()) + "\n";
file.close();
}
if (!sheetName.isEmpty()) {
/* load stylesheet */
if (sheetName.left(1) == ":") {
/* internal stylesheet */
file.setFileName(":/qss/stylesheet/" + sheetName.mid(1) + ".qss");
@ -445,8 +454,16 @@ void Rshare::loadStyleSheet(const QString &sheetName)
}
}
if (file.open(QFile::ReadOnly)) {
styleSheet += QLatin1String(file.readAll());
styleSheet += QLatin1String(file.readAll()) + "\n";
file.close();
/* load language depended stylesheet */
QFileInfo fileInfo(file.fileName());
file.setFileName(fileInfo.path() + "/" + fileInfo.baseName() + "_" + locale + ".lqss");
if (file.open(QFile::ReadOnly)) {
styleSheet += QLatin1String(file.readAll()) + "\n";
file.close();
}
}
}
qApp->setStyleSheet(styleSheet);