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 <variant>.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
This commit is contained in:
thunder2 2010-09-07 23:19:27 +00:00
parent f254a7ae24
commit 20887fc93b
11 changed files with 367 additions and 100 deletions

View File

@ -34,6 +34,8 @@
#include "gui/settings/rsharesettings.h"
#include "gui/notifyqt.h"
#include <retroshare/rsinit.h>
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<ChatStyleInfo> &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;
}

View File

@ -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<ChatStyleInfo> &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;

View File

@ -457,18 +457,21 @@
<file>qss/chat/private/hincoming.htm</file>
<file>qss/chat/private/houtgoing.htm</file>
<file>qss/chat/private/main.css</file>
<file>qss/chat/private/variants/Standard.css</file>
<file>qss/chat/public/info.xml</file>
<file>qss/chat/public/incoming.htm</file>
<file>qss/chat/public/outgoing.htm</file>
<file>qss/chat/public/hincoming.htm</file>
<file>qss/chat/public/houtgoing.htm</file>
<file>qss/chat/public/main.css</file>
<file>qss/chat/public/variants/Standard.css</file>
<file>qss/chat/history/info.xml</file>
<file>qss/chat/history/incoming.htm</file>
<file>qss/chat/history/outgoing.htm</file>
<file>qss/chat/history/hincoming.htm</file>
<file>qss/chat/history/houtgoing.htm</file>
<file>qss/chat/history/main.css</file>
<file>qss/chat/history/variants/Standard.css</file>
<file>smileys/angry.png</file>
<file>smileys/beer.png</file>
<file>smileys/cake.png</file>

View File

@ -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<ChatStyleInfo> styles;
QList<ChatStyleInfo>::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<ChatStyleInfo>(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<ChatStyleInfo>(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<ChatStyleInfo>(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<ChatStyleInfo>(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<ChatStyleInfo>(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<ChatStyleInfo>(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<ChatStyleInfo>(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);
}

View File

@ -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;

View File

@ -667,25 +667,56 @@
<attribute name="title">
<string>Public</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_1">
<layout class="QVBoxLayout" name="publicLayout_1">
<item>
<layout class="QHBoxLayout" name="publicListLayout">
<layout class="QHBoxLayout" name="publiclLayout_2">
<item>
<layout class="QVBoxLayout" name="publicLayout_3">
<item>
<widget class="QListWidget" name="publicList">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Ignored">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<width>170</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="publicLayout_4">
<item>
<widget class="QLabel" name="publicLabelVariant">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Variant</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="publicComboBoxVariant">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="publicPreview">
<property name="sizePolicy">
@ -771,25 +802,56 @@
<attribute name="title">
<string>Private</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="privateLayout_1">
<item>
<layout class="QHBoxLayout" name="privateListLayout">
<layout class="QHBoxLayout" name="privatelLayout_2">
<item>
<layout class="QVBoxLayout" name="privateLayout_3">
<item>
<widget class="QListWidget" name="privateList">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Ignored">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<width>170</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="privateLayout_4">
<item>
<widget class="QLabel" name="privateLabelVariant">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Variant</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="privateComboBoxVariant">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="privatePreview">
<property name="sizePolicy">
@ -875,25 +937,56 @@
<attribute name="title">
<string>History</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="historyLayout_1">
<item>
<layout class="QHBoxLayout" name="historyListLayout">
<layout class="QHBoxLayout" name="historylLayout_2">
<item>
<layout class="QVBoxLayout" name="historyLayout_3">
<item>
<widget class="QListWidget" name="historyList">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Ignored">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<width>170</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="historyLayout_4">
<item>
<widget class="QLabel" name="historyLabelVariant">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Variant</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="historyComboBoxVariant">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="historyPreview">
<property name="sizePolicy">

View File

@ -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. */

View File

@ -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);