diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index f87d7c841..77f8d612f 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -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 \ diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 68f498538..febd6ef5b 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -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 i(smileys); while(i.hasNext()) { @@ -1018,6 +1022,7 @@ void PeersDialog::insertChat() } } + if ((msgWidget->verticalScrollBar()->maximum() - 30) < msgWidget->verticalScrollBar()->value() ) { msgWidget->append(extraTxt); } else { diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index fbfe834c0..2d791dc10 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -24,6 +24,7 @@ #include "PopupChatDialog.h" #include +#include "rshare.h" #include #include @@ -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 i(smileys); while(i.hasNext()) diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.h b/retroshare-gui/src/gui/chat/PopupChatDialog.h index f9e7b1ae5..e9b97fb51 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.h +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.h @@ -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; diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index 7db98064a..091d69422 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -87,6 +87,7 @@ images/button_cancel.png images/calendar.png images/chat.png + images/chat_24.png images/cancel.png images/close-down.png images/close_normal.png diff --git a/retroshare-gui/src/gui/images/chat_24.png b/retroshare-gui/src/gui/images/chat_24.png new file mode 100644 index 000000000..3a791ba17 Binary files /dev/null and b/retroshare-gui/src/gui/images/chat_24.png differ diff --git a/retroshare-gui/src/gui/settings/ChatPage.cpp b/retroshare-gui/src/gui/settings/ChatPage.cpp new file mode 100644 index 000000000..9a2a4082c --- /dev/null +++ b/retroshare-gui/src/gui/settings/ChatPage.cpp @@ -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 +#include + +#include +#include "ChatPage.h" + +#include +#include +#include + +/** 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(); +} diff --git a/retroshare-gui/src/gui/settings/ChatPage.h b/retroshare-gui/src/gui/settings/ChatPage.h new file mode 100644 index 000000000..2bdddc8b8 --- /dev/null +++ b/retroshare-gui/src/gui/settings/ChatPage.h @@ -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 +#include + +#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 + diff --git a/retroshare-gui/src/gui/settings/ChatPage.ui b/retroshare-gui/src/gui/settings/ChatPage.ui new file mode 100644 index 000000000..fdc77700a --- /dev/null +++ b/retroshare-gui/src/gui/settings/ChatPage.ui @@ -0,0 +1,561 @@ + + + ChatPage + + + + 0 + 0 + 426 + 256 + + + + + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 0 + 0 + 0 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 192 + 192 + 192 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 104 + 104 + 104 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 104 + 104 + 104 + + + + + + + 255 + 255 + 255 + + + + + + + 104 + 104 + 104 + + + + + + + 240 + 240 + 240 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + Arial + 8 + 50 + false + false + false + false + + + + Qt::NoContextMenu + + + + + + Chat Settings + + + + + + Enable Emoticons Privat Chat + + + true + + + + + + + Enable Emoticons Group Chat + + + true + + + + + + + Enable GroupChat History + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index a14156a51..692ff6e86 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -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")); diff --git a/retroshare-gui/src/gui/settings/rsettingswin.h b/retroshare-gui/src/gui/settings/rsettingswin.h index 5932f9b27..5c00a5957 100755 --- a/retroshare-gui/src/gui/settings/rsettingswin.h +++ b/retroshare-gui/src/gui/settings/rsettingswin.h @@ -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); diff --git a/retroshare-gui/src/gui/settings/settings.ui b/retroshare-gui/src/gui/settings/settings.ui index 00a914679..6d9182da1 100755 --- a/retroshare-gui/src/gui/settings/settings.ui +++ b/retroshare-gui/src/gui/settings/settings.ui @@ -131,6 +131,15 @@ :/images/encrypted32.png:/images/encrypted32.png + + + Chat + + + + :/images/chat_24.png:/images/chat_24.png + + Appearance