diff --git a/retroshare-gui/src/gui/chat/AvatarFrame.ui b/retroshare-gui/src/gui/chat/AvatarFrame.ui deleted file mode 100644 index 2c7358f2c..000000000 --- a/retroshare-gui/src/gui/chat/AvatarFrame.ui +++ /dev/null @@ -1,126 +0,0 @@ - - AvatarFrame - - - - 0 - 0 - 88 - 300 - - - - Form - - - - 9 - - - 6 - - - - - - 5 - 5 - 0 - 0 - - - - - 70 - 16 - - - - - 70 - 16777215 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 70 - 70 - - - - - 70 - 70 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 0 - - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - - - true - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/chat/AvatarWidget.ui b/retroshare-gui/src/gui/chat/AvatarWidget.ui deleted file mode 100644 index cc4ba7270..000000000 --- a/retroshare-gui/src/gui/chat/AvatarWidget.ui +++ /dev/null @@ -1,74 +0,0 @@ - - - - - AvatarWidget - - - - 0 - 0 - 120 - 126 - - - - - 70 - 70 - - - - Form - - - - 0 - - - 4 - - - - - - 5 - 0 - 0 - 0 - - - - - - - Qt::AlignCenter - - - - - - - - 1 - 1 - 0 - 0 - - - - - - - false - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/chat/ChatAvatarFrame.cpp b/retroshare-gui/src/gui/chat/ChatAvatarFrame.cpp deleted file mode 100644 index 71b5b66ef..000000000 --- a/retroshare-gui/src/gui/chat/ChatAvatarFrame.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006,2007 crypton - * - * 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 "ChatAvatarFrame.h" -#include "ChatAvatarWidget.h" - -#include - -#include - -ChatAvatarFrame::ChatAvatarFrame(QWidget * parent) - : QWidget(parent) { - - ui.setupUi(this); - setMinimumWidth(70); - QGridLayout * glayout = dynamic_cast(ui.remoteAvatarFrame->layout()); - glayout->setSpacing(0); - glayout->setMargin(0); -} - -void ChatAvatarFrame::setUserPixmap(QPixmap pixmap) { - - QPixmap background = QPixmap(":images/avatar_background.png"); - - if (!pixmap.isNull()) { - QPainter painter(&background); - painter.drawPixmap(5, 5, pixmap.scaled(60, 60, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); - painter.end(); - ui.userAvatar->setPixmap(background); - } else { - ui.userAvatar->setPixmap(background); - } -} - -void ChatAvatarFrame::addRemoteContact(const QString & id, const QString & displayName, const QString & contactId, QPixmap avatar) { - - if (!_contactIdList.indexOf(id)) { - return; - } else { - _contactIdList.append(id); - } - - ChatAvatarWidget * avatarWidget = new ChatAvatarWidget( - ui.remoteAvatarFrame, id, avatar, displayName, contactId, ChatAvatarWidget::BIG); - avatarWidget->setupPixmap(avatar); - - _widgetList.append(avatarWidget); - QGridLayout * glayout = dynamic_cast(ui.remoteAvatarFrame->layout()); - glayout->addWidget(avatarWidget, glayout->count(), 0); - - ui.remoteAvatarFrame->setMinimumSize(0, glayout->count() * 70); -} - -void ChatAvatarFrame::removeRemoteContact(const QString & contactId) { - - for (int i = 0; i < _widgetList.size(); i++) { - if (_widgetList[i]->getContactId() == contactId) { - QGridLayout * glayout = dynamic_cast(ui.remoteAvatarFrame->layout()); - glayout->removeWidget(_widgetList[i]); - glayout->update(); - delete _widgetList[i]; - _widgetList.removeAt(i); - } - } - _contactIdList.removeAll(contactId); -} - -void ChatAvatarFrame::updateContact(const QString & id, QPixmap avatar, const QString & displayName) { - for(int i = 0; i < _widgetList.size(); i++) { - ChatAvatarWidget * chatAvatarWidget = _widgetList[i]; - if (chatAvatarWidget->getContactId() == id) { - chatAvatarWidget->setupPixmap(avatar); - chatAvatarWidget->setToolTip(displayName); - } - } -} diff --git a/retroshare-gui/src/gui/chat/ChatAvatarFrame.h b/retroshare-gui/src/gui/chat/ChatAvatarFrame.h deleted file mode 100644 index 635dab541..000000000 --- a/retroshare-gui/src/gui/chat/ChatAvatarFrame.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006,2007 crypton - * - * 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 CHATAVATARFRAME_H -#define CHATAVATARFRAME_H - -#include "ui_AvatarFrame.h" - -#include -#include -#include - -class QHBoxLayout; -class ChatAvatarWidget; - - -class ChatAvatarFrame : public QWidget { - Q_OBJECT -public: - - ChatAvatarFrame(QWidget * parent); - - void setUserPixmap(QPixmap pixmap); - - void addRemoteContact(const QString & id, const QString & displayName, const QString & contactId, QPixmap avatar); - - void removeRemoteContact(const QString & contactId); - - void updateContact(const QString & id, QPixmap avatar, const QString & displayName); - -private: - - typedef QList WidgetList; - - WidgetList _widgetList; - - QVBoxLayout * _layout; - - Ui::AvatarFrame ui; - - QStringList _contactIdList; -}; - -#endif //CHATAVATARFRAME_H diff --git a/retroshare-gui/src/gui/chat/ChatAvatarWidget.cpp b/retroshare-gui/src/gui/chat/ChatAvatarWidget.cpp deleted file mode 100644 index 27a67d1ba..000000000 --- a/retroshare-gui/src/gui/chat/ChatAvatarWidget.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006,2007 crypton - * - * 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 "ChatAvatarWidget.h" - -#include - -//#include - - - -ChatAvatarWidget::ChatAvatarWidget(QWidget * parent, const QString & id, - QPixmap picture, const QString & nickname, const QString & contactId, OWPictureMode pmode, NicknameMode nmode) - : QWidget(parent), _pictureMode(pmode), _nicknameMode(nmode), _contactId(id) { - - ui.setupUi(this); - //setupPixmap(picture); - setToolTip(nickname); - //setupNickname(contactId); - /* - if (_nicknameMode != NONE) { - setupNickname(nickname); - } else { - _ui.nicknameLabel->hide(); - }*/ -} - -void ChatAvatarWidget::setupPixmap(QPixmap pixmap) { - - //TODO:: resize fond_avatar.png - QPixmap background = QPixmap(":/images/avatar_background.png"); - QPixmap defaultAvatar = QPixmap(":/images/nopic.png"); - //QPixmap defaultAvatar(QString::fromStdString(AvatarList::getInstance().getDefaultAvatar().getFullPath())); - QPainter painter(&background); - - if (!pixmap.isNull()) { - switch (_pictureMode) { - case HUGE: - painter.drawPixmap(0, 0, pixmap.scaled(96, 96, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); - ui.pictureLabel->resize(96, 96); - setMinimumSize(96, 96); - break; - case BIG: - painter.drawPixmap(5, 5, pixmap.scaled(60, 60, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); - ui.pictureLabel->resize(70, 70); - setMinimumSize(70, 70); - break; - case MEDIUM: - painter.drawPixmap(0, 0, pixmap.scaled(48, 48, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); - ui.pictureLabel->resize(48, 48); - setMinimumSize(48, 48); - break; - case SMALL: - painter.drawPixmap(0, 0, pixmap.scaled(24, 24, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); - ui.pictureLabel->resize(24, 24); - setMinimumSize(24, 24); - break; - case TINY: - painter.drawPixmap(0, 0, pixmap.scaled(12, 12, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); - ui.pictureLabel->resize(12, 12); - setMinimumSize(12, 12); - break; - //default: - //LOG_WARN("unknown picture mode: " + String::fromNumber(_pictureMode)); - } - } else { - painter.drawPixmap(5, 5, defaultAvatar.scaled(60, 60, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); - ui.pictureLabel->resize(70, 70); - setMinimumSize(70, 70); - } - - painter.end(); - ui.pictureLabel->setPixmap(background); -} - -void ChatAvatarWidget::setupNickname(const QString & nickname) { - //TODO: limit string length - QFontMetrics fontMetrics(ui.nicknameLabel->font()); - int width = 60; - QString temp; - for(int i = 0; i < nickname.length(); i++) { - if (fontMetrics.width(temp) > width) { - break; - } - temp += nickname[i]; - } - ui.nicknameLabel->setText(temp); -} - -void ChatAvatarWidget::setToolTip(const QString & nickname) { - ui.pictureLabel->setToolTip(nickname); -} diff --git a/retroshare-gui/src/gui/chat/ChatAvatarWidget.h b/retroshare-gui/src/gui/chat/ChatAvatarWidget.h deleted file mode 100644 index ce80838a6..000000000 --- a/retroshare-gui/src/gui/chat/ChatAvatarWidget.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006,2007 crypton - * - * 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 CHATAVATARWIDGET_H -#define CHATAVATARWIDGET_H - -#include "ui_AvatarWidget.h" - -#include - - -class ChatAvatarWidget : public QWidget { - Q_OBJECT -public: - - enum OWPictureMode { - HUGE, // 96x96 - BIG, // 60x60 - MEDIUM, // 48x48 - SMALL, // 24x24 - TINY, // 12x12 - }; - - enum NicknameMode { - RIGHT, - LEFT, - TOP, - BOTTOM, - NONE, - }; - - ChatAvatarWidget(QWidget * parent, const QString & id, QPixmap picture, - const QString & nickname, const QString & contactId, OWPictureMode pmode = SMALL, NicknameMode nmode = NONE); - - const QString getContactId() { - return _contactId; - } - - void setupPixmap(QPixmap pixmap); - - void setToolTip(const QString & nickname); - -private: - - void setupNickname(const QString & nickname); - - OWPictureMode _pictureMode; - - NicknameMode _nicknameMode; - - QString _contactId; - - Ui::AvatarWidget ui; -}; - -#endif //CHATAVATARWIDGET_H diff --git a/retroshare-gui/src/gui/chat/ChatWindow.cpp b/retroshare-gui/src/gui/chat/ChatWindow.cpp deleted file mode 100644 index e9e002171..000000000 --- a/retroshare-gui/src/gui/chat/ChatWindow.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006, crypton - * - * 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 - -#include "rshare.h" -#include "ChatWindow.h" -#include "config/gconfig.h" -#include "ChatAvatarFrame.h" -#include "util/Widget.h" - -#include -#include -#include -#include -#include - -#include - -/** Default constructor */ -ChatWindow::ChatWindow(QWidget *parent) - : QMainWindow(parent) - -{ - /* Invoke Qt Designer generated QObject setup routine */ - ui.setupUi(this); - - GConfig config; - config.loadWidgetInformation(this); - - _isAvatarFrameOpened = true; - - //creates sub widgets - _avatarFrame = new ChatAvatarFrame(this); - //// - - - connect(ui.lineEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendChat( ) )); - - connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor())); - - connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(textBold())); - - connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(textUnderline())); - - connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(textItalic())); - - connect(ui.avatarFrameButton, SIGNAL(clicked()), SLOT(avatarFrameButtonClicked())); - - - addAvatarFrame(); - - - - -} - - - -/** - Overloads the default show() slot so we can set opacity*/ - -void -ChatWindow::show() -{ - //loadSettings(); - if(!this->isVisible()) { - QMainWindow::show(); - - } -} - -void ChatWindow::closeEvent (QCloseEvent * event) -{ - - - QMainWindow::closeEvent(event); -} - -void ChatWindow::setColor() -{ - QColor col = QColorDialog::getColor(Qt::green, this); - if (col.isValid()) { - - ui.colorButton->setPalette(QPalette(col)); - QTextCharFormat fmt; - fmt.setForeground(col); - mergeFormatOnWordOrSelection(fmt); - colorChanged(col); - } -} - -void ChatWindow::textBold() -{ - QTextCharFormat fmt; - fmt.setFontWeight(ui.textboldButton->isChecked() ? QFont::Bold : QFont::Normal); - mergeFormatOnWordOrSelection(fmt); -} - -void ChatWindow::textUnderline() -{ - QTextCharFormat fmt; - fmt.setFontUnderline(ui.textunderlineButton->isChecked()); - mergeFormatOnWordOrSelection(fmt); -} - -void ChatWindow::textItalic() -{ - QTextCharFormat fmt; - fmt.setFontItalic(ui.textitalicButton->isChecked()); - mergeFormatOnWordOrSelection(fmt); -} - -void ChatWindow::currentCharFormatChanged(const QTextCharFormat &format) -{ - fontChanged(format.font()); - colorChanged(format.foreground().color()); -} - -void ChatWindow::mergeFormatOnWordOrSelection(const QTextCharFormat &format) -{ - QTextCursor cursor = ui.textBrowser->textCursor(); - if (!cursor.hasSelection()) - cursor.select(QTextCursor::WordUnderCursor); - cursor.mergeCharFormat(format); - ui.textBrowser->mergeCurrentCharFormat(format); -} - -void ChatWindow::fontChanged(const QFont &f) -{ - //comboFont->setCurrentIndex(comboFont->findText(QFontInfo(f).family())); - //comboSize->setCurrentIndex(comboSize->findText(QString::number(f.pointSize()))); - ui.textboldButton->setChecked(f.bold()); - ui.textunderlineButton->setChecked(f.italic()); - ui.textitalicButton->setChecked(f.underline()); -} - - - -void ChatWindow::colorChanged(const QColor &c) -{ - QPixmap pix(16, 16); - pix.fill(c); - ui.colorButton->setIcon(pix); -} - - -void ChatWindow::updateChat() -{ - /* get chat off queue */ - - /* write it out */ - -} - - - -void ChatWindow::addChatMsg() -{ - -} - - -void ChatWindow::sendChat() -{ - -} - - -void ChatWindow::avatarFrameButtonClicked() { - if (_isAvatarFrameOpened) { - removeAvatarFrame(); - } else { - addAvatarFrame(); - } -} - - -void ChatWindow::addAvatarFrame() { - QBoxLayout * glayout = dynamic_cast(layout()); - _avatarFrame->setVisible(true); - //_avatarFrame->setMinimumSize(64, 0); - glayout->insertWidget(1, _avatarFrame); - - _isAvatarFrameOpened = true; - ui.avatarFrameButton->setIcon(QIcon(":images/show_toolbox_frame.png")); - update(); -} - -void ChatWindow::removeAvatarFrame() { - QBoxLayout * glayout = dynamic_cast(layout()); - _avatarFrame->setVisible(false); - _avatarFrame->setMinimumSize(0, 0); - glayout->removeWidget(_avatarFrame); - - _isAvatarFrameOpened = false; - ui.avatarFrameButton->setIcon(QIcon(":images/hide_toolbox_frame.png")); - update(); -} - - -void ChatWindow::updateUserAvatar() { - - QPixmap pixmap; - //std::string myData = _cChatHandler.getCUserProfile().getUserProfile().getIcon().getData(); - //pixmap.loadFromData((uchar *)myData.c_str(), myData.size()); - _avatarFrame->setUserPixmap(pixmap); -} - -//void ChatWindow::updateAvatarFrame() { - -//} diff --git a/retroshare-gui/src/gui/chat/ChatWindow.h b/retroshare-gui/src/gui/chat/ChatWindow.h deleted file mode 100644 index a9aed6837..000000000 --- a/retroshare-gui/src/gui/chat/ChatWindow.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006, crypton - * - * 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 _CHATWINDOW_H -#define _CHATWINDOW_H - - -#include "ui_ChatWindow.h" - -#include "rsiface/rsiface.h" - -#include - -class ChatAvatarFrame; -class QAction; -class QTextEdit; -class QTextCharFormat; -class RetroSyleLabel; - -class ChatWindow : public QMainWindow -{ - Q_OBJECT - -public: - /** Default constructor */ - ChatWindow(QWidget *parent = 0); - /** Default destructor */ - - void updateChat(); - void addChatMsg(); - -public slots: - /** Overloaded QWidget.show */ - void show(); - -protected: - void closeEvent (QCloseEvent * event); - -private slots: - - void setColor(); - - void textBold(); - void textUnderline(); - void textItalic(); - - void sendChat(); - - void currentCharFormatChanged(const QTextCharFormat &format); - - void avatarFrameButtonClicked(); - -private: - - - - void mergeFormatOnWordOrSelection(const QTextCharFormat &format); - void fontChanged(const QFont &f); - - void colorChanged(const QColor &c); - - void addAvatarFrame(); - void removeAvatarFrame(); - //void updateAvatarFrame(); - void updateUserAvatar(); - - bool _isAvatarFrameOpened; - - ChatAvatarFrame * _avatarFrame; - - QAction *actionTextBold; - QAction *actionTextUnderline; - QAction *actionTextItalic; - - //std::string dialogId, dialogName; - //unsigned int lastChatTime; - //std::string lastChatName; - - /** Qt Designer generated object */ - Ui::ChatWindow ui; -}; - -#endif - - - - diff --git a/retroshare-gui/src/gui/chat/ChatWindow.ui b/retroshare-gui/src/gui/chat/ChatWindow.ui deleted file mode 100644 index 1cdc38382..000000000 --- a/retroshare-gui/src/gui/chat/ChatWindow.ui +++ /dev/null @@ -1,282 +0,0 @@ - - ChatWindow - - - - 0 - 0 - 487 - 395 - - - - MainWindow - - - - - 9 - - - 6 - - - - - Qt::Vertical - - - - - 0 - - - 6 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - - 321 - 20 - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - :/images/edit-underline.png - - - true - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - :/images/edit-italic.png - - - true - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - :/images/edit-bold.png - - - true - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - - - - - - - - - - - 0 - - - 0 - - - - - - 14 - 31 - - - - - 14 - 32 - - - - - - - :/images/show_toolbox_frame.png - - - - 14 - 31 - - - - false - - - true - - - - - - - Qt::Vertical - - - - 16 - 509 - - - - - - - - - - 0 - - - 6 - - - - - - - - Send - - - - - - - Search - - - - - - - - - - - Qt::Horizontal - - - 4 - - - - - lineEdit - textboldButton - textunderlineButton - textitalicButton - colorButton - pushButton - pushButton_2 - textBrowser - avatarFrameButton - - - - diff --git a/retroshare-gui/src/gui/chat/UserFrame.ui b/retroshare-gui/src/gui/chat/UserFrame.ui deleted file mode 100644 index 19b31b9d4..000000000 --- a/retroshare-gui/src/gui/chat/UserFrame.ui +++ /dev/null @@ -1,61 +0,0 @@ - - - - - UserFrame - - - - 0 - 0 - 120 - 116 - - - - - 60 - 60 - - - - Form - - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 0 - - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/chat/backup/ChatDialog.cpp b/retroshare-gui/src/gui/chat/backup/ChatDialog.cpp deleted file mode 100644 index 90bb43ca5..000000000 --- a/retroshare-gui/src/gui/chat/backup/ChatDialog.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006, crypton - * - * 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 - -#include "rshare.h" -#include "ChatDialog.h" - -#include "rsiface/rsiface.h" -#include "chat/PopupChatDialog.h" -#include "chat/ChatWindow.h" -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/** Constructor */ -ChatDialog::ChatDialog(QWidget *parent) -: MainPage(parent) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); - - connect(ui.lineEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendMsg( ) )); - - connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor())); - - connect(ui.textboldChatButton, SIGNAL(clicked()), this, SLOT(textBold())); - - connect(ui.textunderlineChatButton, SIGNAL(clicked()), this, SLOT(textUnderline())); - - connect(ui.textitalicChatButton, SIGNAL(clicked()), this, SLOT(textItalic())); - - connect( ui.msgSendList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgSendListCostumPopupMenu( QPoint ) ) ); - -// connect(ui.msgSendList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ), -// this, SLOT(toggleSendItem( QTreeWidgetItem *, int ) )); - - loadInitMsg(); - - /* Hide platform specific features */ -#ifdef Q_WS_WIN - -#endif -} - -void ChatDialog::msgSendListCostumPopupMenu( QPoint point ) -{ - - QMenu contextMnu( this ); - QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier ); - - privchatAct = new QAction(QIcon(), tr( "Chat" ), this ); - connect( privchatAct , SIGNAL( triggered() ), this, SLOT( privchat() ) ); - - contextMnu.clear(); - contextMnu.addAction( privchatAct); - contextMnu.exec( mevent->globalPos() ); -} -int ChatDialog::loadInitMsg() -{ - std::ostringstream out; - - //out << std::endl; - //out << std::endl; - //out << std::endl; - out << "Welcome to Retroshare's group chat."; - out << std::endl; - out << std::endl; - - QString txt = QString::fromStdString(out.str()); - ui.msgText->setPlainText(txt); - ui.msgText->setTextColor(Qt::gray); - - - return 1; -} - - - -void ChatDialog::insertChat() -{ - rsiface->lockData(); /* Lock Interface */ - - /* get a link to the table */ - QTextEdit *msgWidget = ui.msgText; - std::list newchat = rsiface->getChatNew(); - std::list::iterator it; - - rsiface->unlockData(); /* Unlock Interface */ - -static std::string lastChatName(""); -static int lastChatTime = 0; - - QString currenttxt = msgWidget->toPlainText(); - - /* determine how many spaces to add */ - int n = msgWidget->width(); - /* now spaces = (width - txt width) / (pixel / space) - */ - - std::cerr << "Width is : " << n << std::endl; - n -= 256; /* 220 pixels for name */ - if (n > 0) - { - n = 2 + n / 10; - } - else - { - n = 1; - } - - std::cerr << "Space count : " << n << std::endl; - - std::string spaces(" "); - - - /* add in lines at the bottom */ - std::ostringstream out; - int ts = time(NULL); - for(it = newchat.begin(); it != newchat.end(); it++) - { - /* are they private? */ - if (it->chatflags & RS_CHAT_PRIVATE) - { - ChatWindow *pcd = getPrivateChat(it->rsid, it->name, true); - pcd->addChatMsg(&(*it)); - } - - - if ((it->name == lastChatName) && (ts - lastChatTime < 60)) - { - /* no name */ - } - else - { - for(int i = 0; i < n; i++) - { - out << spaces; - } - - out << "<" << it -> name << " Said @" << ts << ">" << std::endl; - } - - if (it->chatflags & RS_CHAT_PRIVATE) - out << "[P] "; - out << it -> msg << std::endl; - - /* - */ - lastChatName = it -> name; - lastChatTime = ts; - } - - QString extra = QString::fromStdString(out.str()); - currenttxt += extra; - - msgWidget->setPlainText(currenttxt); - - std::cerr << " Added Text: " << std::endl; - std::cerr << out.str() << std::endl; - QScrollBar *qsb = msgWidget->verticalScrollBar(); - qsb -> setValue(qsb->maximum()); - -} - - - - -void ChatDialog::sendMsg() -{ - QLineEdit *lineWidget = ui.lineEdit; - - ChatInfo ci; - ci.msg = lineWidget->text().toStdString(); - ci.chatflags = RS_CHAT_PUBLIC; - - rsicontrol -> ChatSend(ci); - lineWidget -> setText(QString("")); - - /* redraw send list */ - insertSendList(); - - -} - -void ChatDialog::insertSendList() -{ - rsiface->lockData(); /* Lock Interface */ - - std::map::const_iterator it; - const std::map &friends = - rsiface->getFriendMap(); - - /* get a link to the table */ - QTreeWidget *sendWidget = ui.msgSendList; - - /* remove old items ??? */ - sendWidget->clear(); - sendWidget->setColumnCount(6); - - QList items; - for(it = friends.begin(); it != friends.end(); it++) - { - /* if offline, don't add */ - if ((it -> second.connectString == "Online" ) || - (it -> second.connectString == "Yourself")) - { - /* ok */ - } - else - { - continue; - } - - /* make a widget per friend */ - QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0); - - - /* add all the labels */ - /* (0) Person */ - item -> setText(0, QString::fromStdString(it->second.name)); - /* () Org */ - item -> setText(1, QString::fromStdString(it->second.org)); - /* () Location */ - item -> setText(2, QString::fromStdString(it->second.loc)); - /* () Country */ - item -> setText(3, QString::fromStdString(it->second.country)); - { - std::ostringstream out; - out << it->second.id; - item -> setText(4, QString::fromStdString(out.str())); - } - - item -> setText(5, "Friend"); - - //item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - item -> setFlags(Qt::ItemIsUserCheckable); - - item -> setCheckState(0, Qt::Checked); - /**** NOT SELECTABLE AT THE MOMENT - if (it ->second.inChat) - { - item -> setCheckState(0, Qt::Checked); - } - else - { - item -> setCheckState(0, Qt::Unchecked); - } - ************/ - - - /* add to the list */ - items.append(item); - } - - /* add the items in! */ - sendWidget->insertTopLevelItems(0, items); - - rsiface->unlockData(); /* UnLock Interface */ - - sendWidget->update(); /* update display */ -} - - -/* to toggle the state */ - - -void ChatDialog::toggleSendItem( QTreeWidgetItem *item, int col ) -{ - std::cerr << "ToggleSendItem()" << std::endl; - - /* extract id */ - std::string id = (item -> text(4)).toStdString(); - - /* get state */ - bool inChat = (Qt::Checked == item -> checkState(0)); /* alway column 0 */ - - /* call control fns */ - - rsicontrol -> SetInChat(id, inChat); - return; -} - -void ChatDialog::setColor() -{ - QColor col = QColorDialog::getColor(Qt::green, this); - if (col.isValid()) { - - ui.colorChatButton->setPalette(QPalette(col)); - QTextCharFormat fmt; - fmt.setForeground(col); - mergeFormatOnWordOrSelection(fmt); - colorChanged(col); - } -} - -void ChatDialog::textBold() -{ - QTextCharFormat fmt; - fmt.setFontWeight(ui.textboldChatButton->isChecked() ? QFont::Bold : QFont::Normal); - mergeFormatOnWordOrSelection(fmt); -} - -void ChatDialog::textUnderline() -{ - QTextCharFormat fmt; - fmt.setFontUnderline(ui.textunderlineChatButton->isChecked()); - mergeFormatOnWordOrSelection(fmt); -} - -void ChatDialog::textItalic() -{ - QTextCharFormat fmt; - fmt.setFontItalic(ui.textitalicChatButton->isChecked()); - mergeFormatOnWordOrSelection(fmt); -} - -void ChatDialog::currentCharFormatChanged(const QTextCharFormat &format) -{ - fontChanged(format.font()); - colorChanged(format.foreground().color()); -} - -void ChatDialog::mergeFormatOnWordOrSelection(const QTextCharFormat &format) -{ - QTextCursor cursor = ui.msgText->textCursor(); - if (!cursor.hasSelection()) - cursor.select(QTextCursor::WordUnderCursor); - cursor.mergeCharFormat(format); - ui.msgText->mergeCurrentCharFormat(format); -} - -void ChatDialog::fontChanged(const QFont &f) -{ - //comboFont->setCurrentIndex(comboFont->findText(QFontInfo(f).family())); - //comboSize->setCurrentIndex(comboSize->findText(QString::number(f.pointSize()))); - ui.textboldChatButton->setChecked(f.bold()); - ui.textunderlineChatButton->setChecked(f.italic()); - ui.textitalicChatButton->setChecked(f.underline()); -} - - - -void ChatDialog::colorChanged(const QColor &c) -{ - QPixmap pix(16, 16); - pix.fill(c); - ui.colorChatButton->setIcon(pix); -} - - -void ChatDialog::privchat() -{ - -} - - - -ChatWindow *ChatDialog::getPrivateChat(std::string id, std::string name, bool show ) -{ - /* see if it exists already */ - ChatWindow *popupchatdialog = NULL; - - std::map::iterator it; - if (chatDialogs.end() != (it = chatDialogs.find(id))) - { - /* exists already */ - popupchatdialog = it->second; - } - else - { - popupchatdialog = new ChatWindow(id, name); - chatDialogs[id] = popupchatdialog; - } - - if (show) - { - popupchatdialog->show(); - } - - return popupchatdialog; - -} - -void ChatDialog::clearOldChats() -{ - /* nothing yet */ - -} - - diff --git a/retroshare-gui/src/gui/chat/backup/ChatDialog.h b/retroshare-gui/src/gui/chat/backup/ChatDialog.h deleted file mode 100644 index b3996b26c..000000000 --- a/retroshare-gui/src/gui/chat/backup/ChatDialog.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006, crypton - * - * 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 _CHATDIALOG_H -#define _CHATDIALOG_H - -#include "mainpage.h" -#include "ui_ChatDialog.h" - -#include "chat/ChatWindow.h" - -class QAction; -class QTextEdit; -class QTextCharFormat; - -class ChatDialog : public MainPage -{ - Q_OBJECT - -public: - /** Default Constructor */ - ChatDialog(QWidget *parent = 0); - /** Default Destructor */ - -void insertChat(); -ChatWindow *getPrivateChat(std::string id, std::string name, bool show); -void clearOldChats(); - -int loadInitMsg(); - -private slots: - -void toggleSendItem( QTreeWidgetItem *item, int col ); - - /** Create the context popup menu and it's submenus */ - void msgSendListCostumPopupMenu( QPoint point ); - - void setColor(); - - void textBold(); - void textUnderline(); - void textItalic(); - - void currentCharFormatChanged(const QTextCharFormat &format); - - void insertSendList(); - void sendMsg(); - - void privchat(); - -private: - - void mergeFormatOnWordOrSelection(const QTextCharFormat &format); - void fontChanged(const QFont &f); - - void colorChanged(const QColor &c); - - QAction *actionTextBold; - QAction *actionTextUnderline; - QAction *actionTextItalic; - - /** Define the popup menus for the Context menu */ - QMenu* contextMnu; - /** Defines the actions for the context menu */ - QAction* privchatAct; - - QTreeView *msgSendList; - - - std::map chatDialogs; - - - - /** Qt Designer generated object */ - Ui::ChatDialog ui; -}; - -#endif - diff --git a/retroshare-gui/src/gui/chat/backup/ChatWindow2.cpp b/retroshare-gui/src/gui/chat/backup/ChatWindow2.cpp deleted file mode 100644 index 84c501bf4..000000000 --- a/retroshare-gui/src/gui/chat/backup/ChatWindow2.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006, crypton - * - * 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 - -#include "rshare.h" -#include "ChatWindow.h" -#include "config/gconfig.h" -#include "ChatAvatarFrame.h" - -#include -#include -#include -#include -#include - - -/* Define the format used for displaying the date and time */ -#define DATETIME_FMT "MMM dd hh:mm:ss" - -#include - - -/** Default constructor */ -ChatWindow::ChatWindow(std::string id, std::string name, - QWidget *parent, Qt::WFlags flags) - : QMainWindow(parent, flags), dialogId(id), dialogName(name), - lastChatTime(0), lastChatName("") -{ - /* Invoke Qt Designer generated QObject setup routine */ - ui.setupUi(this); - - GConfig config; - config.loadWidgetInformation(this); - - _isAvatarFrameOpened = true; - - //creates sub widgets - _avatarFrame = new QtChatAvatarFrame(this); - //// - - - connect(ui.lineEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendChat( ) )); - - connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor())); - - connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(textBold())); - - connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(textUnderline())); - - connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(textItalic())); - - connect(ui.avatarFrameButton, SIGNAL(clicked()), SLOT(avatarFrameButtonClicked())); - - - addAvatarFrame(); - - // Create the status bar - std::ostringstream statusstr; - statusstr << "Chatting with: " << dialogName << " !!! " << id; - statusBar()->showMessage(QString::fromStdString(statusstr.str())); - ui.textBrowser->setOpenExternalLinks ( false ); - -} - - - -/** - Overloads the default show() slot so we can set opacity*/ - -void -ChatWindow::show() -{ - //loadSettings(); - if(!this->isVisible()) { - QMainWindow::show(); - - } -} - -void ChatWindow::closeEvent (QCloseEvent * event) -{ - - - QMainWindow::closeEvent(event); -} - -void ChatWindow::setColor() -{ - QColor col = QColorDialog::getColor(Qt::green, this); - if (col.isValid()) { - - ui.colorButton->setPalette(QPalette(col)); - QTextCharFormat fmt; - fmt.setForeground(col); - mergeFormatOnWordOrSelection(fmt); - colorChanged(col); - } -} - -void ChatWindow::textBold() -{ - QTextCharFormat fmt; - fmt.setFontWeight(ui.textboldButton->isChecked() ? QFont::Bold : QFont::Normal); - mergeFormatOnWordOrSelection(fmt); -} - -void ChatWindow::textUnderline() -{ - QTextCharFormat fmt; - fmt.setFontUnderline(ui.textunderlineButton->isChecked()); - mergeFormatOnWordOrSelection(fmt); -} - -void ChatWindow::textItalic() -{ - QTextCharFormat fmt; - fmt.setFontItalic(ui.textitalicButton->isChecked()); - mergeFormatOnWordOrSelection(fmt); -} - -void ChatWindow::currentCharFormatChanged(const QTextCharFormat &format) -{ - fontChanged(format.font()); - colorChanged(format.foreground().color()); -} - -void ChatWindow::mergeFormatOnWordOrSelection(const QTextCharFormat &format) -{ - QTextCursor cursor = ui.textBrowser->textCursor(); - if (!cursor.hasSelection()) - cursor.select(QTextCursor::WordUnderCursor); - cursor.mergeCharFormat(format); - ui.textBrowser->mergeCurrentCharFormat(format); -} - -void ChatWindow::fontChanged(const QFont &f) -{ - //comboFont->setCurrentIndex(comboFont->findText(QFontInfo(f).family())); - //comboSize->setCurrentIndex(comboSize->findText(QString::number(f.pointSize()))); - ui.textboldButton->setChecked(f.bold()); - ui.textunderlineButton->setChecked(f.italic()); - ui.textitalicButton->setChecked(f.underline()); -} - - - -void ChatWindow::colorChanged(const QColor &c) -{ - QPixmap pix(16, 16); - pix.fill(c); - ui.colorButton->setIcon(pix); -} - - -void ChatWindow::updateChat() -{ - /* get chat off queue */ - - /* write it out */ - -} - - - -void ChatWindow::addChatMsg(ChatInfo *ci) -{ - QTextBrowser *msgWidget = ui.textBrowser; - - QString currenttxt = msgWidget->toHtml(); - - /* determine how many spaces to add */ - int n = msgWidget->width(); - /* now spaces = (width - txt width) / (pixel / space) - */ - - std::cerr << "Width is : " << n << std::endl; - n -= 256; /* 220 pixels for name */ - if (n > 0) - { - n = 2 + n / 10; - } - else - { - n = 1; - } - - std::cerr << "Space count : " << n << std::endl; - - std::string spaces(" "); - - - /* add in lines at the bottom */ - std::ostringstream out; - int ts = time(NULL); - if ((ci->name == lastChatName) && (ts - lastChatTime < 60)) - { - /* no name */ - } - else - { - for(int i = 0; i < n; i++) - { - out << spaces; - } - - out << "[" << ci->name << " Said @" << ts << "]" << std::endl; - out << "
" << std::endl; - - } - out << ci -> msg << std::endl; - lastChatTime = ts; - lastChatName = ci->name; - - QString extra = QString::fromStdString(out.str()); - currenttxt += extra; - - msgWidget->setHtml(currenttxt); - - std::cerr << " Added Text: " << std::endl; - std::cerr << out.str() << std::endl; - QScrollBar *qsb = msgWidget->verticalScrollBar(); - qsb -> setValue(qsb->maximum()); -} - - -void ChatWindow::sendChat() -{ - QTextEdit *lineWidget = ui.lineEdit; - - ChatInfo ci; - - { - rsiface->lockData(); /* Lock Interface */ - const RsConfig &conf = rsiface->getConfig(); - - ci.rsid = conf.ownId; - ci.name = conf.ownName; - - rsiface->unlockData(); /* Unlock Interface */ - } - - ci.msg = lineWidget->documentTitle().toStdString(); - ci.chatflags = RS_CHAT_PRIVATE; - - addChatMsg(&ci); - - /* put proper destination */ - ci.rsid = dialogId; - ci.name = dialogName; - - rsicontrol -> ChatSend(ci); - lineWidget -> setText(QString("")); - - /* redraw send list */ -} - - -void ChatWindow::avatarFrameButtonClicked() { - if (_isAvatarFrameOpened) { - removeAvatarFrame(); - } else { - addAvatarFrame(); - } -} - - -void ChatWindow::addAvatarFrame() { - QBoxLayout * glayout = dynamic_cast(layout()); - _avatarFrame->setVisible(true); - //_avatarFrame->setMinimumSize(64, 0); - glayout->insertWidget(1, _avatarFrame); - - _isAvatarFrameOpened = true; - ui.avatarFrameButton->setIcon(QIcon(":images/show_toolbox_frame.png")); - update(); -} - -void ChatWindow::removeAvatarFrame() { - QBoxLayout * glayout = dynamic_cast(layout()); - _avatarFrame->setVisible(false); - _avatarFrame->setMinimumSize(0, 0); - glayout->removeWidget(_avatarFrame); - - _isAvatarFrameOpened = false; - ui.avatarFrameButton->setIcon(QIcon(":images/hide_toolbox_frame.png")); - update(); -} - - -void ChatWindow::updateUserAvatar() { - - QPixmap pixmap; - //std::string myData = _cChatHandler.getCUserProfile().getUserProfile().getIcon().getData(); - //pixmap.loadFromData((uchar *)myData.c_str(), myData.size()); - _avatarFrame->setUserPixmap(pixmap); -} - -//void ChatWindow::updateAvatarFrame() { -// QMutexLocker locker(&_mutex); - - //QtContactList * qtContactList = _qtrs->getQtContactList(); - //CContactList & cContactList = qtrsContactList->getCContactList(); - - //IMContactSet imContactSet = _imChatSession->getIMContactSet(); - //IMContactSet::iterator it; - //for (it = imContactSet.begin(); it != imContactSet.end(); it++) { - - //std::string contactId = cContactList.findContactThatOwns(*it); - //ContactProfile profile = cContactList.getContactProfile(contactId); - - //std::string data = profile.getIcon().getData(); - //QPixmap pixmap; - //pixmap.loadFromData((uchar *)data.c_str(), data.size()); - //_avatarFrame->addRemoteContact( - //QString::fromStdString(contactId), - //QString::fromStdString(profile.getDisplayName()), - //QString::fromStdString((*it).getContactId()), - //pixmap - //); - //} -//} diff --git a/retroshare-gui/src/gui/chat/backup/ChatWindow2.h b/retroshare-gui/src/gui/chat/backup/ChatWindow2.h deleted file mode 100644 index 541b6c94c..000000000 --- a/retroshare-gui/src/gui/chat/backup/ChatWindow2.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006, crypton - * - * 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 _CHATWINDOW_H -#define _CHATWINDOW_H - - -#include "ui_ChatWindow.h" - -#include "rsiface/rsiface.h" - -#include - -class ChatAvatarFrame; -class QAction; -class QTextEdit; -class QTextCharFormat; - -class ChatWindow : public QMainWindow -{ - Q_OBJECT - -public: - /** Default constructor */ - ChatWindow(std::string id, std::string name, - QWidget *parent = 0, Qt::WFlags flags = 0); - /** Default destructor */ - - void updateChat(); - void addChatMsg(ChatInfo *ci); - -public slots: - /** Overloaded QWidget.show */ - void show(); - -protected: - void closeEvent (QCloseEvent * event); - -private slots: - - void setColor(); - - void textBold(); - void textUnderline(); - void textItalic(); - - void sendChat(); - - void currentCharFormatChanged(const QTextCharFormat &format); - - void avatarFrameButtonClicked(); - -private: - - - - void mergeFormatOnWordOrSelection(const QTextCharFormat &format); - void fontChanged(const QFont &f); - - void colorChanged(const QColor &c); - - void addAvatarFrame(); - void removeAvatarFrame(); - //void updateAvatarFrame(); - void updateUserAvatar(); - - bool _isAvatarFrameOpened; - - ChatAvatarFrame * _avatarFrame; - - QAction *actionTextBold; - QAction *actionTextUnderline; - QAction *actionTextItalic; - - std::string dialogId, dialogName; - unsigned int lastChatTime; - std::string lastChatName; - - /** Qt Designer generated object */ - Ui::ChatWindow ui; -}; - -#endif - - - -