mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-09-20 04:44:49 -04:00
Merge pull request #55 from AsamK/install_stylesheets
Install qss and chat stylesheets on Linux
This commit is contained in:
commit
92405128e6
23 changed files with 42 additions and 44 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,4 +5,4 @@ qrc_*.cpp
|
||||||
ui_*.h
|
ui_*.h
|
||||||
Makefile.*
|
Makefile.*
|
||||||
*~
|
*~
|
||||||
|
Thumbs.db
|
||||||
|
|
|
@ -144,35 +144,30 @@ void ChatStyle::styleChanged(int styleType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString getBaseDir()
|
static QStringList getBaseDirList()
|
||||||
{
|
{
|
||||||
// application path
|
// Search chat styles in config dir and data dir (is application dir for portable)
|
||||||
QString baseDir = QString::fromUtf8(RsAccounts::ConfigDirectory().c_str());
|
QStringList baseDirs;
|
||||||
|
baseDirs.append(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()));
|
||||||
|
baseDirs.append(QString::fromUtf8(RsAccounts::DataDirectory().c_str()));
|
||||||
|
|
||||||
#ifdef WIN32
|
return baseDirs;
|
||||||
if (RsInit::isPortable ()) {
|
|
||||||
// application dir for portable version
|
|
||||||
baseDir = QApplication::applicationDirPath();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return baseDir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatStyle::setStylePath(const QString &stylePath, const QString &styleVariant)
|
bool ChatStyle::setStylePath(const QString &stylePath, const QString &styleVariant)
|
||||||
{
|
{
|
||||||
m_styleType = TYPE_UNKNOWN;
|
m_styleType = TYPE_UNKNOWN;
|
||||||
|
|
||||||
m_styleDir.setPath(getBaseDir());
|
foreach (QString dir, getBaseDirList()) {
|
||||||
if (m_styleDir.cd(stylePath) == false) {
|
m_styleDir.setPath(dir);
|
||||||
m_styleDir = QDir("");
|
if (m_styleDir.cd(stylePath)) {
|
||||||
m_styleVariant.clear();
|
m_styleVariant = styleVariant;
|
||||||
return false;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
m_styleDir.setPath("");
|
||||||
m_styleVariant = styleVariant;
|
m_styleVariant.clear();
|
||||||
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatStyle::setStyleFromSettings(enumStyleType styleType)
|
bool ChatStyle::setStyleFromSettings(enumStyleType styleType)
|
||||||
|
@ -471,9 +466,6 @@ static bool getStyleInfo(QString stylePath, QString stylePathRelative, ChatStyle
|
||||||
{
|
{
|
||||||
styles.clear();
|
styles.clear();
|
||||||
|
|
||||||
// base dir
|
|
||||||
QDir baseDir(getBaseDir());
|
|
||||||
|
|
||||||
ChatStyleInfo standardInfo;
|
ChatStyleInfo standardInfo;
|
||||||
QString stylePath;
|
QString stylePath;
|
||||||
|
|
||||||
|
@ -516,25 +508,27 @@ static bool getStyleInfo(QString stylePath, QString stylePathRelative, ChatStyle
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir dir(baseDir);
|
foreach (QDir baseDir, getBaseDirList()) {
|
||||||
if (dir.cd("stylesheets") == false) {
|
QDir dir(baseDir);
|
||||||
// no user styles available
|
if (dir.cd("stylesheets") == false) {
|
||||||
return true;
|
// no user styles available here
|
||||||
}
|
|
||||||
|
|
||||||
// get all style directories
|
|
||||||
QFileInfoList dirList = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name);
|
|
||||||
|
|
||||||
// iterate style directories and get info
|
|
||||||
for (QFileInfoList::iterator it = dirList.begin(); it != dirList.end(); ++it) {
|
|
||||||
QDir styleDir = QDir(it->absoluteFilePath());
|
|
||||||
if (styleDir.cd(stylePath) == false) {
|
|
||||||
// no user styles available
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ChatStyleInfo info;
|
|
||||||
if (getStyleInfo(styleDir.absolutePath(), baseDir.relativeFilePath(styleDir.absolutePath()), info)) {
|
// get all style directories
|
||||||
styles.append(info);
|
QFileInfoList dirList = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name);
|
||||||
|
|
||||||
|
// iterate style directories and get info
|
||||||
|
for (QFileInfoList::iterator it = dirList.begin(); it != dirList.end(); ++it) {
|
||||||
|
QDir styleDir = QDir(it->absoluteFilePath());
|
||||||
|
if (styleDir.cd(stylePath) == false) {
|
||||||
|
// no user styles available
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ChatStyleInfo info;
|
||||||
|
if (getStyleInfo(styleDir.absolutePath(), baseDir.relativeFilePath(styleDir.absolutePath()), info)) {
|
||||||
|
styles.append(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -116,9 +116,13 @@ unix {
|
||||||
target.path = "$${PREFIX}/bin"
|
target.path = "$${PREFIX}/bin"
|
||||||
INSTALLS += target
|
INSTALLS += target
|
||||||
|
|
||||||
sound_files.path="$${DATA_DIR}/sounds"
|
data_files.path="$${DATA_DIR}/"
|
||||||
sound_files.files=sounds/*
|
data_files.files=sounds qss
|
||||||
INSTALLS += sound_files
|
INSTALLS += data_files
|
||||||
|
|
||||||
|
style_files.path="$${DATA_DIR}/stylesheets"
|
||||||
|
style_files.files=gui/qss/chat/Bubble gui/qss/chat/Bubble_Compact
|
||||||
|
INSTALLS += style_files
|
||||||
}
|
}
|
||||||
|
|
||||||
linux-g++ {
|
linux-g++ {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue