mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 00:49:41 -05:00
Fix Chat Style Setting
This commit is contained in:
parent
5ad2342922
commit
3593d71d2f
@ -44,7 +44,7 @@
|
|||||||
#define IMAGE_CHAT_DELETE ":/images/deletemail24.png"
|
#define IMAGE_CHAT_DELETE ":/images/deletemail24.png"
|
||||||
#define IMAGE_CHAT_COPY ":/images/copyrslink.png"
|
#define IMAGE_CHAT_COPY ":/images/copyrslink.png"
|
||||||
|
|
||||||
QString ChatPage::loadStyleInfo(ChatStyle::enumStyleType type, QComboBox *style_CB, QComboBox *comboBox, QString &styleVariant)
|
QString ChatPage::loadStyleInfo(ChatStyle::enumStyleType type, QComboBox *style_CB, QComboBox *var_CB, QString &styleVariant)
|
||||||
{
|
{
|
||||||
QList<ChatStyleInfo> styles;
|
QList<ChatStyleInfo> styles;
|
||||||
QList<ChatStyleInfo>::iterator style;
|
QList<ChatStyleInfo>::iterator style;
|
||||||
@ -96,13 +96,13 @@ QString ChatPage::loadStyleInfo(ChatStyle::enumStyleType type, QComboBox *style_
|
|||||||
|
|
||||||
/* now the combobox should be filled */
|
/* now the combobox should be filled */
|
||||||
|
|
||||||
int index = comboBox->findText(styleVariant);
|
int index = var_CB->findText(styleVariant);
|
||||||
|
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
whileBlocking(comboBox)->setCurrentIndex(index);
|
whileBlocking(var_CB)->setCurrentIndex(index);
|
||||||
} else {
|
} else {
|
||||||
if (comboBox->count()) {
|
if (var_CB->count()) {
|
||||||
whileBlocking(comboBox)->setCurrentIndex(0);
|
whileBlocking(var_CB)->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stylePath;
|
return stylePath;
|
||||||
@ -183,7 +183,7 @@ void ChatPage::updateHistoryParams()
|
|||||||
|
|
||||||
void ChatPage::updatePublicStyle()
|
void ChatPage::updatePublicStyle()
|
||||||
{
|
{
|
||||||
ChatStyleInfo info = ui.publicStyle->itemData(ui.historyStyle->currentIndex(),Qt::UserRole).value<ChatStyleInfo>();
|
ChatStyleInfo info = ui.publicStyle->itemData(ui.publicStyle->currentIndex(),Qt::UserRole).value<ChatStyleInfo>();
|
||||||
|
|
||||||
if (publicStylePath != info.stylePath || publicStyleVariant != ui.publicComboBoxVariant->currentText()) {
|
if (publicStylePath != info.stylePath || publicStyleVariant != ui.publicComboBoxVariant->currentText()) {
|
||||||
Settings->setPublicChatStyle(info.stylePath, ui.publicComboBoxVariant->currentText());
|
Settings->setPublicChatStyle(info.stylePath, ui.publicComboBoxVariant->currentText());
|
||||||
@ -193,7 +193,7 @@ void ChatPage::updatePublicStyle()
|
|||||||
|
|
||||||
void ChatPage::updatePrivateStyle()
|
void ChatPage::updatePrivateStyle()
|
||||||
{
|
{
|
||||||
ChatStyleInfo info = ui.privateStyle->itemData(ui.historyStyle->currentIndex(),Qt::UserRole).value<ChatStyleInfo>();
|
ChatStyleInfo info = ui.privateStyle->itemData(ui.privateStyle->currentIndex(),Qt::UserRole).value<ChatStyleInfo>();
|
||||||
|
|
||||||
if (privateStylePath != info.stylePath || privateStyleVariant != ui.privateComboBoxVariant->currentText()) {
|
if (privateStylePath != info.stylePath || privateStyleVariant != ui.privateComboBoxVariant->currentText()) {
|
||||||
Settings->setPrivateChatStyle(info.stylePath, ui.privateComboBoxVariant->currentText());
|
Settings->setPrivateChatStyle(info.stylePath, ui.privateComboBoxVariant->currentText());
|
||||||
@ -211,7 +211,7 @@ void ChatPage::updateHistoryStyle()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatPage::updateHistoryStorage() { rsHistory->setMaxStorageDuration(ui.max_storage_period->value() * 86400) ; }
|
void ChatPage::updateHistoryStorage() { rsHistory->setMaxStorageDuration(ui.max_storage_period->value() * 86400) ; } //24H
|
||||||
|
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
@ -303,7 +303,7 @@ ChatPage::ChatPage(QWidget * parent, Qt::WindowFlags flags)
|
|||||||
|
|
||||||
for (it = userNotifyList.begin(); it != userNotifyList.end(); ++it)
|
for (it = userNotifyList.begin(); it != userNotifyList.end(); ++it)
|
||||||
{
|
{
|
||||||
UserNotify *userNotify = *it;
|
//UserNotify *userNotify = *it;
|
||||||
|
|
||||||
//To get ChatLobbyUserNotify Settings
|
//To get ChatLobbyUserNotify Settings
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ ChatPage::load()
|
|||||||
whileBlocking(ui.labelChatFontPreview)->setText(fontname[0]);
|
whileBlocking(ui.labelChatFontPreview)->setText(fontname[0]);
|
||||||
whileBlocking(ui.labelChatFontPreview)->setFont(fontTempChat);
|
whileBlocking(ui.labelChatFontPreview)->setFont(fontTempChat);
|
||||||
|
|
||||||
whileBlocking(ui.max_storage_period)->setValue(rsHistory->getMaxStorageDuration()/86400) ;
|
whileBlocking(ui.max_storage_period)->setValue(rsHistory->getMaxStorageDuration()/86400) ;//24H
|
||||||
|
|
||||||
/* Load styles */
|
/* Load styles */
|
||||||
publicStylePath = loadStyleInfo(ChatStyle::TYPE_PUBLIC, ui.publicStyle, ui.publicComboBoxVariant, publicStyleVariant);
|
publicStylePath = loadStyleInfo(ChatStyle::TYPE_PUBLIC, ui.publicStyle, ui.publicComboBoxVariant, publicStyleVariant);
|
||||||
@ -545,8 +545,8 @@ void ChatPage::on_publicList_currentRowChanged(int currentRow)
|
|||||||
whileBlocking(ui.publicComboBoxVariant)->setCurrentIndex(0);
|
whileBlocking(ui.publicComboBoxVariant)->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
whileBlocking(ui.publicAuthor)->clear();
|
ui.publicAuthor->clear();
|
||||||
whileBlocking(ui.publicDescription)->clear();
|
ui.publicDescription->clear();
|
||||||
whileBlocking(ui.publicComboBoxVariant)->clear();
|
whileBlocking(ui.publicComboBoxVariant)->clear();
|
||||||
whileBlocking(ui.publicComboBoxVariant)->setDisabled(true);
|
whileBlocking(ui.publicComboBoxVariant)->setDisabled(true);
|
||||||
}
|
}
|
||||||
@ -557,14 +557,14 @@ void ChatPage::on_publicList_currentRowChanged(int currentRow)
|
|||||||
void ChatPage::on_privateList_currentRowChanged(int currentRow)
|
void ChatPage::on_privateList_currentRowChanged(int currentRow)
|
||||||
{
|
{
|
||||||
if (currentRow != -1) {
|
if (currentRow != -1) {
|
||||||
ChatStyleInfo info = ui.privateStyle->itemData(ui.privateStyle->currentIndex(),Qt::UserRole).value<ChatStyleInfo>();
|
ChatStyleInfo info = ui.privateStyle->itemData(currentRow,Qt::UserRole).value<ChatStyleInfo>();
|
||||||
|
|
||||||
QString author = info.authorName;
|
QString author = info.authorName;
|
||||||
if (info.authorEmail.isEmpty() == false) {
|
if (info.authorEmail.isEmpty() == false) {
|
||||||
author += " (" + info.authorEmail + ")";
|
author += " (" + info.authorEmail + ")";
|
||||||
}
|
}
|
||||||
whileBlocking(ui.privateAuthor)->setText(author);
|
ui.privateAuthor->setText(author);
|
||||||
whileBlocking(ui.privateDescription)->setText(info.styleDescription);
|
ui.privateDescription->setText(info.styleDescription);
|
||||||
|
|
||||||
QStringList variants;
|
QStringList variants;
|
||||||
ChatStyle::getAvailableVariants(info.stylePath, variants);
|
ChatStyle::getAvailableVariants(info.stylePath, variants);
|
||||||
@ -580,8 +580,8 @@ void ChatPage::on_privateList_currentRowChanged(int currentRow)
|
|||||||
whileBlocking(ui.privateComboBoxVariant)->setCurrentIndex(0);
|
whileBlocking(ui.privateComboBoxVariant)->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
whileBlocking(ui.privateAuthor)->clear();
|
ui.privateAuthor->clear();
|
||||||
whileBlocking(ui.privateDescription)->clear();
|
ui.privateDescription->clear();
|
||||||
whileBlocking(ui.privateComboBoxVariant)->clear();
|
whileBlocking(ui.privateComboBoxVariant)->clear();
|
||||||
whileBlocking(ui.privateComboBoxVariant)->setDisabled(true);
|
whileBlocking(ui.privateComboBoxVariant)->setDisabled(true);
|
||||||
}
|
}
|
||||||
@ -592,14 +592,14 @@ void ChatPage::on_privateList_currentRowChanged(int currentRow)
|
|||||||
void ChatPage::on_historyList_currentRowChanged(int currentRow)
|
void ChatPage::on_historyList_currentRowChanged(int currentRow)
|
||||||
{
|
{
|
||||||
if (currentRow != -1) {
|
if (currentRow != -1) {
|
||||||
ChatStyleInfo info = ui.historyStyle->itemData(ui.historyStyle->currentIndex(),Qt::UserRole).value<ChatStyleInfo>();
|
ChatStyleInfo info = ui.historyStyle->itemData(currentRow,Qt::UserRole).value<ChatStyleInfo>();
|
||||||
|
|
||||||
QString author = info.authorName;
|
QString author = info.authorName;
|
||||||
if (info.authorEmail.isEmpty() == false) {
|
if (info.authorEmail.isEmpty() == false) {
|
||||||
author += " (" + info.authorEmail + ")";
|
author += " (" + info.authorEmail + ")";
|
||||||
}
|
}
|
||||||
whileBlocking(ui.historyAuthor)->setText(author);
|
ui.historyAuthor->setText(author);
|
||||||
whileBlocking(ui.historyDescription)->setText(info.styleDescription);
|
ui.historyDescription->setText(info.styleDescription);
|
||||||
|
|
||||||
QStringList variants;
|
QStringList variants;
|
||||||
ChatStyle::getAvailableVariants(info.stylePath, variants);
|
ChatStyle::getAvailableVariants(info.stylePath, variants);
|
||||||
@ -615,8 +615,8 @@ void ChatPage::on_historyList_currentRowChanged(int currentRow)
|
|||||||
whileBlocking(ui.historyComboBoxVariant)->setCurrentIndex(0);
|
whileBlocking(ui.historyComboBoxVariant)->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
whileBlocking(ui.historyAuthor)->clear();
|
ui.historyAuthor->clear();
|
||||||
whileBlocking(ui.historyDescription)->clear();
|
ui.historyDescription->clear();
|
||||||
whileBlocking(ui.historyComboBoxVariant)->clear();
|
whileBlocking(ui.historyComboBoxVariant)->clear();
|
||||||
whileBlocking(ui.historyComboBoxVariant)->setDisabled(true);
|
whileBlocking(ui.historyComboBoxVariant)->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class ChatPage : public ConfigPage
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
ChatPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
ChatPage(QWidget * parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~ChatPage() {}
|
~ChatPage() {}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class ChatPage : public ConfigPage
|
|||||||
private:
|
private:
|
||||||
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);
|
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);
|
||||||
void fillPreview(QComboBox *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser);
|
void fillPreview(QComboBox *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser);
|
||||||
QString loadStyleInfo(ChatStyle::enumStyleType type, QComboBox *style_CB, QComboBox *comboBox, QString &styleVariant);
|
QString loadStyleInfo(ChatStyle::enumStyleType type, QComboBox *style_CB, QComboBox *var_CB, QString &styleVariant);
|
||||||
|
|
||||||
QFont fontTempChat;
|
QFont fontTempChat;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user