From 20887fc93bee6d268c4074d499887e0cfafb862f Mon Sep 17 00:00:00 2001 From: thunder2 Date: Tue, 7 Sep 2010 23:19:27 +0000 Subject: [PATCH] Changed the path for additional styles to "stylesheets" for Linux in "~/.retroshare" (untested), for Windows in "%APPDATA%\RetroShare" and for the portable version in the appdir. Added variants for styles. Variants are files in the subdir "variants" of the style with the extension .css. The file .css and main.css are matched together. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3456 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/chat/ChatStyle.cpp | 103 ++++++++-- retroshare-gui/src/gui/chat/ChatStyle.h | 4 +- retroshare-gui/src/gui/images.qrc | 3 + .../qss/chat/history/variants/Standard.css | 0 .../qss/chat/private/variants/Standard.css | 0 .../gui/qss/chat/public/variants/Standard.css | 0 retroshare-gui/src/gui/settings/ChatPage.cpp | 129 ++++++++++-- retroshare-gui/src/gui/settings/ChatPage.h | 9 +- retroshare-gui/src/gui/settings/ChatPage.ui | 189 +++++++++++++----- .../src/gui/settings/rsharesettings.cpp | 18 +- .../src/gui/settings/rsharesettings.h | 12 +- 11 files changed, 367 insertions(+), 100 deletions(-) create mode 100644 retroshare-gui/src/gui/qss/chat/history/variants/Standard.css create mode 100644 retroshare-gui/src/gui/qss/chat/private/variants/Standard.css create mode 100644 retroshare-gui/src/gui/qss/chat/public/variants/Standard.css diff --git a/retroshare-gui/src/gui/chat/ChatStyle.cpp b/retroshare-gui/src/gui/chat/ChatStyle.cpp index eaf8ade0a..a0346dc48 100644 --- a/retroshare-gui/src/gui/chat/ChatStyle.cpp +++ b/retroshare-gui/src/gui/chat/ChatStyle.cpp @@ -34,6 +34,8 @@ #include "gui/settings/rsharesettings.h" #include "gui/notifyqt.h" +#include + enum enumGetStyle { GETSTYLE_INCOMING, @@ -62,38 +64,42 @@ void ChatStyle::styleChanged(int styleType) } } -bool ChatStyle::setStylePath(QString stylePath) +bool ChatStyle::setStylePath(QString stylePath, QString styleVariant) { m_styleType = TYPE_UNKNOWN; m_styleDir.setPath(QApplication::applicationDirPath()); if (m_styleDir.cd(stylePath) == false) { m_styleDir = QDir(""); + m_styleVariant.clear(); return false; } + m_styleVariant = styleVariant; + return true; } bool ChatStyle::setStyleFromSettings(enumStyleType styleType) { QString stylePath; + QString styleVariant; switch (styleType) { case TYPE_PUBLIC: - Settings->getPublicChatStyle(stylePath); + Settings->getPublicChatStyle(stylePath, styleVariant); break; case TYPE_PRIVATE: - Settings->getPrivateChatStyle(stylePath); + Settings->getPrivateChatStyle(stylePath, styleVariant); break; case TYPE_HISTORY: - Settings->getHistoryChatStyle(stylePath); + Settings->getHistoryChatStyle(stylePath, styleVariant); break; case TYPE_UNKNOWN: return false; } - bool result = setStylePath(stylePath); + bool result = setStylePath(stylePath, styleVariant); m_styleType = styleType; @@ -248,7 +254,7 @@ void ChatStyle::showSmileyWidget(QWidget *parent, QWidget *button, const char *s smWidget->show(); } -static QString getStyle(QDir &styleDir, enumGetStyle type) +static QString getStyle(QDir &styleDir, QString styleVariant, enumGetStyle type) { QString style; @@ -284,6 +290,18 @@ static QString getStyle(QDir &styleDir, enumGetStyle type) css = fileCss.readAll(); fileCss.close(); } + + if (styleVariant.isEmpty() == false) { + QFile fileCssVariant(QFileInfo(styleDir, "variants/" + styleVariant + ".css").absoluteFilePath()); + QString cssVariant; + if (fileCssVariant.open(QIODevice::ReadOnly)) { + cssVariant = fileCssVariant.readAll(); + fileCssVariant.close(); + + css += "\n" + cssVariant; + } + } + style.replace("%css-style%", css); } @@ -317,16 +335,16 @@ QString ChatStyle::formatMessage(enumFormatMessage type, QString &name, QDateTim switch (type) { case FORMATMSG_INCOMING: - style = getStyle(m_styleDir, GETSTYLE_INCOMING); + style = getStyle(m_styleDir, m_styleVariant, GETSTYLE_INCOMING); break; case FORMATMSG_OUTGOING: - style = getStyle(m_styleDir, GETSTYLE_OUTGOING); + style = getStyle(m_styleDir, m_styleVariant, GETSTYLE_OUTGOING); break; case FORMATMSG_HINCOMING: - style = getStyle(m_styleDir, GETSTYLE_HINCOMING); + style = getStyle(m_styleDir, m_styleVariant, GETSTYLE_HINCOMING); break; case FORMATMSG_HOUTGOING: - style = getStyle(m_styleDir, GETSTYLE_HOUTGOING); + style = getStyle(m_styleDir, m_styleVariant, GETSTYLE_HOUTGOING); break; } @@ -481,10 +499,29 @@ static bool getStyleInfo(QString stylePath, QString stylePathRelative, ChatStyle return true; } +static QString getBaseDir() +{ + // application path + std::string configDir = RsInit::RsConfigDirectory(); + QString baseDir = QString::fromStdString(configDir); + +#ifdef WIN32 + if (RsInit::isPortable ()) { + // application dir for portable version + baseDir = QApplication::applicationDirPath(); + } +#endif + + return baseDir; +} + /*static*/ bool ChatStyle::getAvailableStyles(enumStyleType styleType, QList &styles) { styles.clear(); + // base dir + QDir baseDir(getBaseDir()); + ChatStyleInfo standardInfo; QString stylePath; @@ -494,31 +531,30 @@ static bool getStyleInfo(QString stylePath, QString stylePathRelative, ChatStyle standardInfo.styleDescription = tr("Standard style for public chat"); styles.append(standardInfo); } - stylePath = "style/public"; + stylePath = "stylesheets/public"; break; case TYPE_PRIVATE: if (getStyleInfo(":/qss/chat/private", ":/qss/chat/private", standardInfo)) { standardInfo.styleDescription = tr("Standard style for private chat"); styles.append(standardInfo); } - stylePath = "style/private"; + stylePath = "stylesheets/private"; break; case TYPE_HISTORY: if (getStyleInfo(":/qss/chat/history", ":/qss/chat/history", standardInfo)) { standardInfo.styleDescription = tr("Standard style for history"); styles.append(standardInfo); } - stylePath = "style/history"; + stylePath = "stylesheets/history"; break; case TYPE_UNKNOWN: default: return false; } - // application path - QDir applicationDir(QApplication::applicationDirPath()); - QDir dir(QApplication::applicationDirPath()); + QDir dir(baseDir); if (dir.cd(stylePath) == false) { + // no user styles available return true; } @@ -528,10 +564,43 @@ static bool getStyleInfo(QString stylePath, QString stylePathRelative, ChatStyle // iterate style directories and get info for (QFileInfoList::iterator dir = dirList.begin(); dir != dirList.end(); dir++) { ChatStyleInfo info; - if (getStyleInfo(dir->absoluteFilePath(), applicationDir.relativeFilePath(dir->absoluteFilePath()), info)) { + if (getStyleInfo(dir->absoluteFilePath(), baseDir.relativeFilePath(dir->absoluteFilePath()), info)) { styles.append(info); } } return true; } + +/*static*/ bool ChatStyle::getAvailableVariants(QString stylePath, QStringList &variants) +{ + variants.clear(); + + if (stylePath.isEmpty()) { + return false; + } + + // application path + QDir dir(QApplication::applicationDirPath()); + if (dir.cd(stylePath) == false) { + // style not found + return false; + } + + if (dir.cd("variants") == false) { + // no variants available + return true; + } + + // get all variants + QStringList filters; + filters.append("*.css"); + QFileInfoList fileList = dir.entryInfoList(filters, QDir::Files, QDir::Name); + + // iterate variants + for (QFileInfoList::iterator file = fileList.begin(); file != fileList.end(); file++) { + variants.append(file->baseName()); + } + + return true; +} diff --git a/retroshare-gui/src/gui/chat/ChatStyle.h b/retroshare-gui/src/gui/chat/ChatStyle.h index a0fdca148..592cae586 100644 --- a/retroshare-gui/src/gui/chat/ChatStyle.h +++ b/retroshare-gui/src/gui/chat/ChatStyle.h @@ -82,7 +82,7 @@ public: /* Default destructor */ ~ChatStyle(); - bool setStylePath(QString stylePath); + bool setStylePath(QString stylePath, QString styleVariant); bool setStyleFromSettings(enumStyleType styleType); void loadEmoticons(); @@ -91,6 +91,7 @@ public: void showSmileyWidget(QWidget *parent, QWidget *button, const char *slotAddMethod); static bool getAvailableStyles(enumStyleType styleType, QList &styles); + static bool getAvailableVariants(QString stylePath, QStringList &variants); private slots: void styleChanged(int styleType); @@ -98,6 +99,7 @@ private slots: private: enumStyleType m_styleType; QDir m_styleDir; + QString m_styleVariant; /** store default information for embedding HTML */ RsChat::EmbedInHtmlAhref defEmbedAhref; diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index 6a1cf9e65..e438a10fa 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -457,18 +457,21 @@ qss/chat/private/hincoming.htm qss/chat/private/houtgoing.htm qss/chat/private/main.css + qss/chat/private/variants/Standard.css qss/chat/public/info.xml qss/chat/public/incoming.htm qss/chat/public/outgoing.htm qss/chat/public/hincoming.htm qss/chat/public/houtgoing.htm qss/chat/public/main.css + qss/chat/public/variants/Standard.css qss/chat/history/info.xml qss/chat/history/incoming.htm qss/chat/history/outgoing.htm qss/chat/history/hincoming.htm qss/chat/history/houtgoing.htm qss/chat/history/main.css + qss/chat/history/variants/Standard.css smileys/angry.png smileys/beer.png smileys/cake.png diff --git a/retroshare-gui/src/gui/qss/chat/history/variants/Standard.css b/retroshare-gui/src/gui/qss/chat/history/variants/Standard.css new file mode 100644 index 000000000..e69de29bb diff --git a/retroshare-gui/src/gui/qss/chat/private/variants/Standard.css b/retroshare-gui/src/gui/qss/chat/private/variants/Standard.css new file mode 100644 index 000000000..e69de29bb diff --git a/retroshare-gui/src/gui/qss/chat/public/variants/Standard.css b/retroshare-gui/src/gui/qss/chat/public/variants/Standard.css new file mode 100644 index 000000000..e69de29bb diff --git a/retroshare-gui/src/gui/settings/ChatPage.cpp b/retroshare-gui/src/gui/settings/ChatPage.cpp index 72ef9eb1d..20cca3e8c 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.cpp +++ b/retroshare-gui/src/gui/settings/ChatPage.cpp @@ -27,7 +27,9 @@ #include "gui/notifyqt.h" #include "rsharesettings.h" -static QString loadStyleInfo(ChatStyle::enumStyleType type, QListWidget *listWidget) +#define VARIANT_STANDARD "Standard" + +static QString loadStyleInfo(ChatStyle::enumStyleType type, QListWidget *listWidget, QComboBox *comboBox, QString &styleVariant) { QList styles; QList::iterator style; @@ -38,13 +40,13 @@ static QString loadStyleInfo(ChatStyle::enumStyleType type, QListWidget *listWid switch (type) { case ChatStyle::TYPE_PUBLIC: - Settings->getPublicChatStyle(stylePath); + Settings->getPublicChatStyle(stylePath, styleVariant); break; case ChatStyle::TYPE_PRIVATE: - Settings->getPrivateChatStyle(stylePath); + Settings->getPrivateChatStyle(stylePath, styleVariant); break; case ChatStyle::TYPE_HISTORY: - Settings->getHistoryChatStyle(stylePath); + Settings->getHistoryChatStyle(stylePath, styleVariant); break; case ChatStyle::TYPE_UNKNOWN: return ""; @@ -63,6 +65,16 @@ static QString loadStyleInfo(ChatStyle::enumStyleType type, QListWidget *listWid listWidget->setCurrentItem(activeItem); + /* now the combobox should be filled */ + + int index = comboBox->findText(styleVariant); + if (index != -1) { + comboBox->setCurrentIndex(index); + } else { + if (comboBox->count()) { + comboBox->setCurrentIndex(0); + } + } return stylePath; } @@ -104,8 +116,8 @@ ChatPage::save(QString &errmsg) QListWidgetItem *item = ui.publicList->currentItem(); if (item) { info = qVariantValue(item->data(Qt::UserRole)); - if (publicStylePath != info.stylePath) { - Settings->setPublicChatStyle(info.stylePath); + if (publicStylePath != info.stylePath || publicStyleVariant != ui.publicComboBoxVariant->currentText()) { + Settings->setPublicChatStyle(info.stylePath, ui.publicComboBoxVariant->currentText()); NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PUBLIC); } } @@ -113,8 +125,8 @@ ChatPage::save(QString &errmsg) item = ui.privateList->currentItem(); if (item) { info = qVariantValue(item->data(Qt::UserRole)); - if (privateStylePath != info.stylePath) { - Settings->setPrivateChatStyle(info.stylePath); + if (privateStylePath != info.stylePath || privateStyleVariant != ui.privateComboBoxVariant->currentText()) { + Settings->setPrivateChatStyle(info.stylePath, ui.privateComboBoxVariant->currentText()); NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PRIVATE); } } @@ -122,8 +134,8 @@ ChatPage::save(QString &errmsg) item = ui.historyList->currentItem(); if (item) { info = qVariantValue(item->data(Qt::UserRole)); - if (historyStylePath != info.stylePath) { - Settings->setHistoryChatStyle(info.stylePath); + if (historyStylePath != info.stylePath || historyStyleVariant != ui.historyComboBoxVariant->currentText()) { + Settings->setHistoryChatStyle(info.stylePath, ui.historyComboBoxVariant->currentText()); NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_HISTORY); } } @@ -151,9 +163,9 @@ ChatPage::load() ui.labelChatFontPreview->setFont(fontTempChat); /* Load styles */ - publicStylePath = loadStyleInfo(ChatStyle::TYPE_PUBLIC, ui.publicList); - privateStylePath = loadStyleInfo(ChatStyle::TYPE_PRIVATE, ui.privateList); - historyStylePath = loadStyleInfo(ChatStyle::TYPE_HISTORY, ui.historyList); + publicStylePath = loadStyleInfo(ChatStyle::TYPE_PUBLIC, ui.publicList, ui.publicComboBoxVariant, publicStyleVariant); + privateStylePath = loadStyleInfo(ChatStyle::TYPE_PRIVATE, ui.privateList, ui.privateComboBoxVariant, privateStyleVariant); + historyStylePath = loadStyleInfo(ChatStyle::TYPE_HISTORY, ui.historyList, ui.historyComboBoxVariant, historyStyleVariant); } bool ChatPage::emotePrivatChat() const { @@ -182,10 +194,10 @@ void ChatPage::on_pushButtonChangeChatFont_clicked() } } -void ChatPage::setPreviewMessages(QString &stylePath, QTextBrowser *textBrowser) +void ChatPage::setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser) { ChatStyle style; - style.setStylePath(stylePath); + style.setStylePath(stylePath, styleVariant); style.loadEmoticons(); textBrowser->clear(); @@ -210,12 +222,23 @@ void ChatPage::setPreviewMessages(QString &stylePath, QTextBrowser *textBrowser) textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_OUTGOING, nameOutgoing, timestmp, message, CHAT_FORMATTEXT_EMBED_SMILEYS)); } +void ChatPage::fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser) +{ + QListWidgetItem *item = listWidget->currentItem(); + if (item) { + ChatStyleInfo info = qVariantValue(item->data(Qt::UserRole)); + + setPreviewMessages(info.stylePath, comboBox->currentText(), textBrowser); + } else { + textBrowser->clear(); + } +} + void ChatPage::on_publicList_currentRowChanged(int currentRow) { if (currentRow != -1) { QListWidgetItem *item = ui.publicList->item(currentRow); ChatStyleInfo info = qVariantValue(item->data(Qt::UserRole)); - setPreviewMessages(info.stylePath, ui.publicPreview); QString author = info.authorName; if (info.authorEmail.isEmpty() == false) { @@ -223,11 +246,28 @@ void ChatPage::on_publicList_currentRowChanged(int currentRow) } ui.publicAuthor->setText(author); ui.publicDescription->setText(info.styleDescription); + + QStringList variants; + ChatStyle::getAvailableVariants(info.stylePath, variants); + ui.publicComboBoxVariant->clear(); + ui.publicComboBoxVariant->setEnabled(variants.size() != 0); + ui.publicComboBoxVariant->addItems(variants); + + /* try to find "Standard" */ + int index = ui.publicComboBoxVariant->findText(VARIANT_STANDARD); + if (index != -1) { + ui.publicComboBoxVariant->setCurrentIndex(index); + } else { + ui.publicComboBoxVariant->setCurrentIndex(0); + } } else { - ui.publicPreview->clear(); ui.publicAuthor->clear(); ui.publicDescription->clear(); + ui.publicComboBoxVariant->clear(); + ui.publicComboBoxVariant->setDisabled(true); } + + fillPreview(ui.publicList, ui.publicComboBoxVariant, ui.publicPreview); } void ChatPage::on_privateList_currentRowChanged(int currentRow) @@ -235,7 +275,6 @@ void ChatPage::on_privateList_currentRowChanged(int currentRow) if (currentRow != -1) { QListWidgetItem *item = ui.privateList->item(currentRow); ChatStyleInfo info = qVariantValue(item->data(Qt::UserRole)); - setPreviewMessages(info.stylePath, ui.privatePreview); QString author = info.authorName; if (info.authorEmail.isEmpty() == false) { @@ -243,11 +282,28 @@ void ChatPage::on_privateList_currentRowChanged(int currentRow) } ui.privateAuthor->setText(author); ui.privateDescription->setText(info.styleDescription); + + QStringList variants; + ChatStyle::getAvailableVariants(info.stylePath, variants); + ui.privateComboBoxVariant->clear(); + ui.privateComboBoxVariant->setEnabled(variants.size() != 0); + ui.privateComboBoxVariant->addItems(variants); + + /* try to find "Standard" */ + int index = ui.privateComboBoxVariant->findText(VARIANT_STANDARD); + if (index != -1) { + ui.privateComboBoxVariant->setCurrentIndex(index); + } else { + ui.privateComboBoxVariant->setCurrentIndex(0); + } } else { - ui.privatePreview->clear(); ui.privateAuthor->clear(); ui.privateDescription->clear(); + ui.privateComboBoxVariant->clear(); + ui.privateComboBoxVariant->setDisabled(true); } + + fillPreview(ui.privateList, ui.privateComboBoxVariant, ui.privatePreview); } void ChatPage::on_historyList_currentRowChanged(int currentRow) @@ -255,7 +311,6 @@ void ChatPage::on_historyList_currentRowChanged(int currentRow) if (currentRow != -1) { QListWidgetItem *item = ui.historyList->item(currentRow); ChatStyleInfo info = qVariantValue(item->data(Qt::UserRole)); - setPreviewMessages(info.stylePath, ui.historyPreview); QString author = info.authorName; if (info.authorEmail.isEmpty() == false) { @@ -263,9 +318,41 @@ void ChatPage::on_historyList_currentRowChanged(int currentRow) } ui.historyAuthor->setText(author); ui.historyDescription->setText(info.styleDescription); + + QStringList variants; + ChatStyle::getAvailableVariants(info.stylePath, variants); + ui.historyComboBoxVariant->clear(); + ui.historyComboBoxVariant->setEnabled(variants.size() != 0); + ui.historyComboBoxVariant->addItems(variants); + + /* try to find "Standard" */ + int index = ui.historyComboBoxVariant->findText(VARIANT_STANDARD); + if (index != -1) { + ui.historyComboBoxVariant->setCurrentIndex(index); + } else { + ui.historyComboBoxVariant->setCurrentIndex(0); + } } else { - ui.historyPreview->clear(); ui.historyAuthor->clear(); ui.historyDescription->clear(); + ui.historyComboBoxVariant->clear(); + ui.historyComboBoxVariant->setDisabled(true); } + + fillPreview(ui.historyList, ui.historyComboBoxVariant, ui.historyPreview); +} + +void ChatPage::on_publicComboBoxVariant_currentIndexChanged(int index) +{ + fillPreview(ui.publicList, ui.publicComboBoxVariant, ui.publicPreview); +} + +void ChatPage::on_privateComboBoxVariant_currentIndexChanged(int index) +{ + fillPreview(ui.privateList, ui.privateComboBoxVariant, ui.privatePreview); +} + +void ChatPage::on_historyComboBoxVariant_currentIndexChanged(int index) +{ + fillPreview(ui.historyList, ui.historyComboBoxVariant, ui.historyPreview); } diff --git a/retroshare-gui/src/gui/settings/ChatPage.h b/retroshare-gui/src/gui/settings/ChatPage.h index ba253a879..08b78f24e 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.h +++ b/retroshare-gui/src/gui/settings/ChatPage.h @@ -47,6 +47,9 @@ class ChatPage : public ConfigPage QFont fontTempChat; private slots: + void on_historyComboBoxVariant_currentIndexChanged(int index); + void on_privateComboBoxVariant_currentIndexChanged(int index); + void on_publicComboBoxVariant_currentIndexChanged(int index); void on_pushButtonChangeChatFont_clicked(); void on_publicList_currentRowChanged(int currentRow); void on_privateList_currentRowChanged(int currentRow); @@ -54,11 +57,15 @@ class ChatPage : public ConfigPage private: void closeEvent (QCloseEvent * event); - void setPreviewMessages(QString &stylePath, QTextBrowser *textBrowser); + void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser); + void fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser); QString publicStylePath; + QString publicStyleVariant; QString privateStylePath; + QString privateStyleVariant; QString historyStylePath; + QString historyStyleVariant; /** Qt Designer generated object */ Ui::ChatPage ui; diff --git a/retroshare-gui/src/gui/settings/ChatPage.ui b/retroshare-gui/src/gui/settings/ChatPage.ui index 4dd626fbd..0afe4743f 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.ui +++ b/retroshare-gui/src/gui/settings/ChatPage.ui @@ -667,24 +667,55 @@ Public - + - + - - - - 0 - 0 - - - - - 150 - 16777215 - - - + + + + + + 0 + 0 + + + + + 170 + 16777215 + + + + + + + + + + + 0 + 0 + + + + Variant + + + + + + + + 0 + 0 + + + + + + + @@ -771,24 +802,55 @@ Private - + - + - - - - 0 - 0 - - - - - 150 - 16777215 - - - + + + + + + 0 + 0 + + + + + 170 + 16777215 + + + + + + + + + + + 0 + 0 + + + + Variant + + + + + + + + 0 + 0 + + + + + + + @@ -875,24 +937,55 @@ History - + - + - - - - 0 - 0 - - - - - 150 - 16777215 - - - + + + + + + 0 + 0 + + + + + 170 + 16777215 + + + + + + + + + + + 0 + 0 + + + + Variant + + + + + + + + 0 + 0 + + + + + + + diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index 5f033d2cc..cb3e2d98b 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -299,34 +299,40 @@ void RshareSettings::setChatSendMessageWithCtrlReturn(bool bValue) setValueToGroup("Chat", "SendMessageWithCtrlReturn", bValue); } -void RshareSettings::getPublicChatStyle(QString &stylePath) +void RshareSettings::getPublicChatStyle(QString &stylePath, QString &styleVariant) { stylePath = valueFromGroup("Chat", "StylePublic", ":/qss/chat/public").toString(); + styleVariant = valueFromGroup("Chat", "StylePublicVariant", "").toString(); } -void RshareSettings::setPublicChatStyle(QString stylePath) +void RshareSettings::setPublicChatStyle(QString stylePath, QString styleVariant) { setValueToGroup("Chat", "StylePublic", stylePath); + setValueToGroup("Chat", "StylePublicVariant", styleVariant); } -void RshareSettings::getPrivateChatStyle(QString &stylePath) +void RshareSettings::getPrivateChatStyle(QString &stylePath, QString &styleVariant) { stylePath = valueFromGroup("Chat", "StylePrivate", ":/qss/chat/private").toString(); + styleVariant = valueFromGroup("Chat", "StylePrivateVariant", "").toString(); } -void RshareSettings::setPrivateChatStyle(QString stylePath) +void RshareSettings::setPrivateChatStyle(QString stylePath, QString styleVariant) { setValueToGroup("Chat", "StylePrivate", stylePath); + setValueToGroup("Chat", "StylePrivateVariant", styleVariant); } -void RshareSettings::getHistoryChatStyle(QString &stylePath) +void RshareSettings::getHistoryChatStyle(QString &stylePath, QString &styleVariant) { stylePath = valueFromGroup("Chat", "StyleHistory", ":/qss/chat/history").toString(); + styleVariant = valueFromGroup("Chat", "StylePrivateVariant", "").toString(); } -void RshareSettings::setHistoryChatStyle(QString stylePath) +void RshareSettings::setHistoryChatStyle(QString stylePath, QString styleVariant) { setValueToGroup("Chat", "StyleHistory", stylePath); + setValueToGroup("Chat", "StylePrivateVariant", styleVariant); } /** Returns true if RetroShare is set to run on system boot. */ diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h index a1e1328bc..cad8cc826 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.h +++ b/retroshare-gui/src/gui/settings/rsharesettings.h @@ -123,14 +123,14 @@ public: void setChatSendMessageWithCtrlReturn(bool bValue); /* chat styles */ - void getPublicChatStyle(QString &stylePath); - void setPublicChatStyle(QString stylePath); + void getPublicChatStyle(QString &stylePath, QString &styleVariant); + void setPublicChatStyle(QString stylePath, QString styleVariant); - void getPrivateChatStyle(QString &stylePath); - void setPrivateChatStyle(QString stylePath); + void getPrivateChatStyle(QString &stylePath, QString &styleVariant); + void setPrivateChatStyle(QString stylePath, QString styleVariant); - void getHistoryChatStyle(QString &stylePath); - void setHistoryChatStyle(QString stylePath); + void getHistoryChatStyle(QString &stylePath, QString &styleVariant); + void setHistoryChatStyle(QString stylePath, QString styleVariant); //! Save placement, state and size information of a window. void saveWidgetInformation(QWidget *widget);