mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
Added two internal stylesheets:
- qss.default - This file is used as default for all stylesheets (e.g. the frames of the AvatarWidget) and can be overloaded from the selected stylesheet - Standard.qss - The standard stylesheet for the current look of RetroShare. More internal stylesheets can be added. The plan is to move nearly all internal stylesheets to the files Standard.qss/qss.default. After that the "empty" stylesheet should represent the system theme of the os. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5467 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3f2ab9259d
commit
9279838d65
8 changed files with 119 additions and 95 deletions
|
@ -364,17 +364,54 @@ void Rshare::loadStyleSheet(const QString &sheetName)
|
|||
{
|
||||
QString styleSheet;
|
||||
|
||||
/* load the default stylesheet */
|
||||
QFile file(":/qss/stylesheet/qss.default");
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
styleSheet = QLatin1String(file.readAll()) + "\n";
|
||||
file.close();
|
||||
}
|
||||
|
||||
if (!sheetName.isEmpty()) {
|
||||
/** extern Stylesheets **/
|
||||
QFile file(QApplication::applicationDirPath() + "/qss/" + sheetName.toLower() + ".qss");
|
||||
QString fileName;
|
||||
|
||||
if (sheetName.left(1) == ":") {
|
||||
/* internal stylesheet */
|
||||
fileName = ":/qss/stylesheet/" + sheetName.mid(1) + ".qss";
|
||||
} else {
|
||||
/* external stylesheet */
|
||||
fileName = QApplication::applicationDirPath() + "/qss/" + sheetName + ".qss";
|
||||
}
|
||||
|
||||
file.setFileName(fileName);
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
styleSheet = QLatin1String(file.readAll());
|
||||
styleSheet += QLatin1String(file.readAll());
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
qApp->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
/** get list of available stylesheets **/
|
||||
void Rshare::getAvailableStyleSheets(QMap<QString, QString> &styleSheets)
|
||||
{
|
||||
QFileInfoList fileInfoList = QDir(":/qss/stylesheet/").entryInfoList(QStringList("*.qss"));
|
||||
QFileInfo fileInfo;
|
||||
foreach (fileInfo, fileInfoList) {
|
||||
if (fileInfo.isFile()) {
|
||||
QString name = fileInfo.baseName();
|
||||
styleSheets.insert(QString("%1 (%2)").arg(name, tr("built-in")), ":" + name);
|
||||
}
|
||||
}
|
||||
|
||||
fileInfoList = QDir(applicationDirPath() + "/qss/").entryInfoList(QStringList("*.qss"));
|
||||
foreach (fileInfo, fileInfoList) {
|
||||
if (fileInfo.isFile()) {
|
||||
QString name = fileInfo.baseName();
|
||||
styleSheets.insert(name, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Rshare::refreshStyleSheet(QWidget *widget, bool processChildren)
|
||||
{
|
||||
if (widget != NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue