Added Chat Settings

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2845 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-05-03 21:17:36 +00:00
parent 73a64c9269
commit 8feeb2adb3
12 changed files with 774 additions and 10 deletions

View File

@ -229,6 +229,7 @@ HEADERS += rshare.h \
gui/settings/FileAssociationsPage.h \
gui/settings/SoundPage.h \
gui/settings/TransferPage.h \
gui/settings/ChatPage.h \
gui/settings/AddFileAssociationDialog.h \
gui/toaster/MessageToaster.h \
gui/toaster/OnlineToaster.h \
@ -323,6 +324,7 @@ FORMS += gui/StartDialog.ui \
gui/settings/AppearancePage.ui \
gui/settings/TransferPage.ui \
gui/settings/SoundPage.ui \
gui/settings/ChatPage.ui \
gui/toaster/CallToaster.ui \
gui/toaster/ChatToaster.ui \
gui/toaster/MessageToaster.ui \
@ -435,6 +437,7 @@ SOURCES += main.cpp \
gui/settings/FileAssociationsPage.cpp \
gui/settings/SoundPage.cpp \
gui/settings/TransferPage.cpp \
gui/settings/ChatPage.cpp \
gui/settings/AddFileAssociationDialog.cpp \
gui/statusbar/peerstatus.cpp \
gui/statusbar/natstatus.cpp \

View File

@ -174,16 +174,20 @@ PeersDialog::PeersDialog(QWidget *parent)
QString::fromUtf8("blue"));
QStringList him;
historyKeeper.getMessages(him, "", "THIS", 8);
foreach(QString mess, him)
ui.msgText->append(mess);
//setChatInfo(mess, "green");
if (_settings->value(QString::fromUtf8("GroupChat_History"), true).toBool())
{
historyKeeper.getMessages(him, "", "THIS", 8);
foreach(QString mess, him)
ui.msgText->append(mess);
}
//setChatInfo(mess, "green");
QMenu * grpchatmenu = new QMenu();
grpchatmenu->addAction(ui.actionClearChat);
grpchatmenu->addAction(ui.actionSave_History);
grpchatmenu->addAction(ui.actionDisable_Emoticons);
//grpchatmenu->addAction(ui.actionDisable_Emoticons);
ui.menuButton->setMenu(grpchatmenu);
_underline = false;
@ -1007,8 +1011,8 @@ void PeersDialog::insertChat()
count ++;
}
if(!ui.actionDisable_Emoticons->isChecked())
{
if (_settings->value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool())
{
QHashIterator<QString, QString> i(smileys);
while(i.hasNext())
{
@ -1018,6 +1022,7 @@ void PeersDialog::insertChat()
}
}
if ((msgWidget->verticalScrollBar()->maximum() - 30) < msgWidget->verticalScrollBar()->value() ) {
msgWidget->append(extraTxt);
} else {

View File

@ -24,6 +24,7 @@
#include "PopupChatDialog.h"
#include <gui/RetroShareLink.h>
#include "rshare.h"
#include <QTextCodec>
#include <QTextEdit>
@ -66,6 +67,9 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
RshareSettings config;
config.loadWidgetInformation(this);
@ -135,7 +139,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
QMenu * toolmenu = new QMenu();
toolmenu->addAction(ui.actionClear_Chat);
toolmenu->addAction(ui.actionSave_Chat_History);
toolmenu->addAction(ui.action_Disable_Emoticons);
//toolmenu->addAction(ui.action_Disable_Emoticons);
ui.pushtoolsButton->setMenu(toolmenu);
@ -303,7 +307,7 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() << std::endl;
#endif
if(!ui.action_Disable_Emoticons->isChecked())
if (_settings->value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool())
{
QHashIterator<QString, QString> i(smileys);
while(i.hasNext())

View File

@ -135,6 +135,9 @@ private:
QStringList history;
QString wholeChat;
QString fileName;
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::PopupChatDialog ui;

View File

@ -87,6 +87,7 @@
<file>images/button_cancel.png</file>
<file>images/calendar.png</file>
<file>images/chat.png</file>
<file>images/chat_24.png</file>
<file>images/cancel.png</file>
<file>images/close-down.png</file>
<file>images/close_normal.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,104 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2010 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "rsiface/rspeers.h" //for rsPeers variable
#include "rsiface/rsiface.h"
#include <QtGui>
#include <QClipboard>
#include <rshare.h>
#include "ChatPage.h"
#include <sstream>
#include <iostream>
#include <set>
/** Constructor */
ChatPage::ChatPage(QWidget * parent, Qt::WFlags flags)
: ConfigPage(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
//connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
//connect(ui.saveButton, SIGNAL(clicked()), this, SLOT(fileSaveAs()));
//loadPublicKey();
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void
ChatPage::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
/** Saves the changes on this page */
bool
ChatPage::save(QString &errmsg)
{
_settings->setValue(QString::fromUtf8("Emoteicons_PrivatChat"), emotePrivatChat());
_settings->setValue(QString::fromUtf8("Emoteicons_GroupChat"), emoteGroupChat());
_settings->setValue(QString::fromUtf8("GroupChat_History"), groupchatHistory());
return true;
}
/** Loads the settings for this page */
void
ChatPage::load()
{
ui.checkBox_emoteprivchat->setChecked(_settings->value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool());
ui.checkBox_emotegroupchat->setChecked(_settings->value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool());
ui.checkBox_groupchathistory->setChecked(_settings->value(QString::fromUtf8("GroupChat_History"), true).toBool());
}
bool ChatPage::emotePrivatChat() const {
if(ui.checkBox_emoteprivchat->isChecked()) return true;
return ui.checkBox_emoteprivchat->isChecked();
}
bool ChatPage::emoteGroupChat() const {
if(ui.checkBox_emotegroupchat->isChecked()) return true;
return ui.checkBox_emotegroupchat->isChecked();
}
bool ChatPage::groupchatHistory() const {
if(ui.checkBox_groupchathistory->isChecked()) return true;
return ui.checkBox_groupchathistory->isChecked();
}

View File

@ -0,0 +1,68 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2010 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CHATPAGE_H
#define _CHATPAGE_H
#include <QFileDialog>
#include <QtGui/QWidget>
#include "rsharesettings.h"
#include "configpage.h"
#include "ui_ChatPage.h"
class ChatPage : public ConfigPage
{
Q_OBJECT
public:
/** Default Constructor */
ChatPage(QWidget * parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
~ChatPage() {}
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
bool emotePrivatChat() const;
bool emoteGroupChat() const;
bool groupchatHistory() const;
private slots:
private:
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
void closeEvent (QCloseEvent * event);
/** Qt Designer generated object */
Ui::ChatPage ui;
};
#endif

View File

@ -0,0 +1,561 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChatPage</class>
<widget class="QWidget" name="ChatPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>426</width>
<height>256</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>8</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Chat Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_emoteprivchat">
<property name="text">
<string>Enable Emoticons Privat Chat</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_emotegroupchat">
<property name="text">
<string>Enable Emoticons Group Chat</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_groupchathistory">
<property name="text">
<string>Enable GroupChat History</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -29,6 +29,7 @@
#include "FileAssociationsPage.h"
#include "SoundPage.h"
#include "TransferPage.h"
#include "ChatPage.h"
#define IMAGE_GENERAL ":/images/kcmsystem24.png"
@ -104,6 +105,7 @@ RSettingsWin::initStackedWidget()
stackedWidget->addWidget(new DirectoriesPage());
stackedWidget->addWidget(new NotifyPage());
stackedWidget->addWidget(new CryptoPage());
stackedWidget->addWidget(new ChatPage());
stackedWidget->addWidget(new AppearancePage());
#ifndef RS_RELEASE_VERSION
stackedWidget->addWidget(new FileAssociationsPage() );
@ -146,6 +148,10 @@ RSettingsWin::setNewPage(int page)
text = tr("Security");
pageicon->setPixmap(QPixmap(":/images/encrypted32.png"));
break;
case Chat:
text = tr("Chat");
pageicon->setPixmap(QPixmap(":/images/chat_24.png"));
break;
case Appearance:
text = tr("Appearance");
pageicon->setPixmap(QPixmap(":/images/looknfeel.png"));

View File

@ -32,7 +32,7 @@ class RSettingsWin: public QDialog, private Ui::Settings
public:
enum PageType { General = 0, Server, Transfer,
Directories, Notify, Security, Appearance, Fileassociations, Sound };
Directories, Notify, Security, Chat, Appearance, Fileassociations, Sound };
static void showYourself(QWidget *parent);
static void postModDirectories(bool update_local);

View File

@ -131,6 +131,15 @@
<normaloff>:/images/encrypted32.png</normaloff>:/images/encrypted32.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Chat</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/chat_24.png</normaloff>:/images/chat_24.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Appearance</string>