mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 15:57:08 -05:00
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:
parent
a60422069c
commit
a96c467419
@ -424,6 +424,7 @@ void Rshare::resetLanguageAndStyle()
|
|||||||
|
|
||||||
void Rshare::loadStyleSheet(const QString &sheetName)
|
void Rshare::loadStyleSheet(const QString &sheetName)
|
||||||
{
|
{
|
||||||
|
QString locale = QLocale().name();
|
||||||
QString styleSheet;
|
QString styleSheet;
|
||||||
|
|
||||||
/* load the default stylesheet */
|
/* load the default stylesheet */
|
||||||
@ -433,7 +434,15 @@ void Rshare::loadStyleSheet(const QString &sheetName)
|
|||||||
file.close();
|
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()) {
|
if (!sheetName.isEmpty()) {
|
||||||
|
/* load stylesheet */
|
||||||
if (sheetName.left(1) == ":") {
|
if (sheetName.left(1) == ":") {
|
||||||
/* internal stylesheet */
|
/* internal stylesheet */
|
||||||
file.setFileName(":/qss/stylesheet/" + sheetName.mid(1) + ".qss");
|
file.setFileName(":/qss/stylesheet/" + sheetName.mid(1) + ".qss");
|
||||||
@ -445,8 +454,16 @@ void Rshare::loadStyleSheet(const QString &sheetName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (file.open(QFile::ReadOnly)) {
|
if (file.open(QFile::ReadOnly)) {
|
||||||
styleSheet += QLatin1String(file.readAll());
|
styleSheet += QLatin1String(file.readAll()) + "\n";
|
||||||
file.close();
|
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);
|
qApp->setStyleSheet(styleSheet);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user