From a8c4b3b107d26b5419a9a96e0a06783697a4c71c Mon Sep 17 00:00:00 2001 From: thunder2 Date: Tue, 18 May 2010 18:02:51 +0000 Subject: [PATCH] - moved the chat setting to the section [Chat] - cleaned some comments of the settings classes git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2940 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/PeersDialog.cpp | 31 +++++-------------- .../src/gui/chat/PopupChatDialog.cpp | 6 ++-- retroshare-gui/src/gui/settings/ChatPage.cpp | 12 +++---- retroshare-gui/src/gui/settings/rsettings.cpp | 2 +- retroshare-gui/src/gui/settings/rsettings.h | 6 ++-- .../src/gui/settings/rsharesettings.cpp | 4 +-- .../src/gui/settings/rsharesettings.h | 5 ++- 7 files changed, 23 insertions(+), 43 deletions(-) diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 39e49330f..92aaf5fc7 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -51,24 +51,6 @@ #include #include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include /* Images for context menu icons */ @@ -167,17 +149,16 @@ PeersDialog::PeersDialog(QWidget *parent) pxm.fill(_currentColor); ui.colorChatButton->setIcon(pxm); - RshareSettings settings; + RSettings settings(QString("Chat")); + mCurrentFont.fromString(settings.value(QString::fromUtf8("ChatScreenFont")).toString()); ui.lineEdit->setFont(mCurrentFont); - setChatInfo(tr("Welcome to RetroShare's group chat."), - QString::fromUtf8("blue")); - - QStringList him; + setChatInfo(tr("Welcome to RetroShare's group chat."), QString::fromUtf8("blue")); if (settings.value(QString::fromUtf8("GroupChat_History"), true).toBool()) { + QStringList him; historyKeeper.getMessages(him, "", "THIS", 8); foreach(QString mess, him) ui.msgText->append(mess); @@ -1034,8 +1015,10 @@ void PeersDialog::insertChat() RsChat::embedHtml(doc, body, defEmbedAhref); // embed smileys + settings.beginGroup("Chat"); if (settings.value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool()) RsChat::embedHtml(doc, body, defEmbedImg); + settings.endGroup(); msgContents = doc.toString(-1); // -1 removes any annoying carriage return misinterpreted by QTextEdit extraTxt += msgContents; @@ -1305,7 +1288,9 @@ void PeersDialog::setFont() ui.lineEdit->setFont(mCurrentFont); ui.lineEdit->setTextColor(_currentColor); RshareSettings settings; + settings.beginGroup("Chat"); settings.setValue(QString::fromUtf8("ChatScreenFont"), mCurrentFont.toString()); + settings.endGroup(); ui.lineEdit->setFocus(); diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index 0258c5579..f20561fd3 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -291,7 +291,7 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci) std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() << std::endl; #endif - RshareSettings settings; + RSettings settings(QString("Chat")); if (settings.value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool()) { QHashIterator i(smileys); @@ -301,8 +301,8 @@ std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() << foreach(QString code, i.key().split("|")) message.replace(code, ""); } - } - + } + history /*<< nickColor << color << font << fontSize*/ << timestamp << name << message; QString formatMsg = loadEmptyStyle()/*.replace(nickColor) diff --git a/retroshare-gui/src/gui/settings/ChatPage.cpp b/retroshare-gui/src/gui/settings/ChatPage.cpp index 1c7447d46..bfeaa1764 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.cpp +++ b/retroshare-gui/src/gui/settings/ChatPage.cpp @@ -21,17 +21,13 @@ #include "rsiface/rspeers.h" //for rsPeers variable #include "rsiface/rsiface.h" -#include "rsharesettings.h" #include -#include #include #include "ChatPage.h" -#include -#include -#include +#include "RSettings.h" /** Constructor */ ChatPage::ChatPage(QWidget * parent, Qt::WFlags flags) @@ -56,13 +52,13 @@ ChatPage::closeEvent (QCloseEvent * event) bool ChatPage::save(QString &errmsg) { - RshareSettings settings; + RSettings settings(QString("Chat")); settings.setValue(QString::fromUtf8("Emoteicons_PrivatChat"), emotePrivatChat()); settings.setValue(QString::fromUtf8("Emoteicons_GroupChat"), emoteGroupChat()); settings.setValue(QString::fromUtf8("GroupChat_History"), groupchatHistory()); settings.setValue(QString::fromUtf8("ChatScreenFont"), fontTempChat.toString()); - + return true; } @@ -70,7 +66,7 @@ ChatPage::save(QString &errmsg) void ChatPage::load() { - RshareSettings settings; + RSettings settings(QString("Chat")); ui.checkBox_emoteprivchat->setChecked(settings.value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool()); ui.checkBox_emotegroupchat->setChecked(settings.value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool()); diff --git a/retroshare-gui/src/gui/settings/rsettings.cpp b/retroshare-gui/src/gui/settings/rsettings.cpp index ea2be7661..60b21c021 100644 --- a/retroshare-gui/src/gui/settings/rsettings.cpp +++ b/retroshare-gui/src/gui/settings/rsettings.cpp @@ -81,7 +81,7 @@ RSettings::defaultValue(const QString &key) const return QVariant(); } -/** Resets all of Vidalia's settings. */ +/** Resets all settings. */ void RSettings::reset() { diff --git a/retroshare-gui/src/gui/settings/rsettings.h b/retroshare-gui/src/gui/settings/rsettings.h index dcdf9c2e5..8461b9d94 100644 --- a/retroshare-gui/src/gui/settings/rsettings.h +++ b/retroshare-gui/src/gui/settings/rsettings.h @@ -33,16 +33,16 @@ class RSettings : public QSettings public: /** Default constructor. The optional parameter group can be used to - * set a prefix that will be prepended to keys specified to VSettings in + * set a prefix that will be prepended to keys specified to RSettings in * value() and setValue(). */ RSettings(const QString group = QString()); /** Default constructor. The optional parameter group can be used to - * set a prefix that will be prepended to keys specified to VSettings in + * set a prefix that will be prepended to keys specified to RSettings in * value() and setValue(). */ RSettings(std::string fileName, const QString group = QString()); - /** Resets all of Vidalia's settings. */ + /** Resets all settings. */ static void reset(); /** Returns the saved value associated with key. If no value has been diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index 42de2d6b9..e1de7600d 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -252,7 +252,7 @@ void RshareSettings::setNotifyFlags(uint flags) setValue(SETTING_NOTIFY_FLAGS, flags); } -/** Returns true if Vidalia is set to run on system boot. */ +/** Returns true if RetroShare is set to run on system boot. */ bool RshareSettings::runRetroshareOnBoot() { @@ -268,7 +268,7 @@ RshareSettings::runRetroshareOnBoot() #endif } -/** If run is set to true, then Vidalia will run on system boot. */ +/** If run is set to true, then RetroShare will run on system boot. */ void RshareSettings::setRunRetroshareOnBoot(bool run) { diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h index e6a2caf9c..6439c6897 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.h +++ b/retroshare-gui/src/gui/settings/rsharesettings.h @@ -38,8 +38,7 @@ class QTableWidget; class QToolBar; class QMainWindow; -/** Handles saving and restoring RShares's settings, such as the - * location of Tor, the control port, etc. +/** Handles saving and restoring RShares's settings * * NOTE: Qt 4.1 documentation states that constructing a QSettings object is * "very fast", so we shouldn't need to create a global instance of this @@ -75,7 +74,7 @@ public: /** Returns true if RetroShare's main window should be visible when the * application starts. */ bool showMainWindowAtStart(); - /** Sets whether to show Vidalia's main window when the application starts. */ + /** Sets whether to show main window when the application starts. */ void setShowMainWindowAtStart(bool show); /** Returns true if RetroShare should start on system boot. */