diff --git a/retroshare-gui/src/gui/ChatDialog.cpp b/retroshare-gui/src/gui/ChatDialog.cpp index 2b62ac2b1..26ea198f4 100644 --- a/retroshare-gui/src/gui/ChatDialog.cpp +++ b/retroshare-gui/src/gui/ChatDialog.cpp @@ -52,14 +52,15 @@ ChatDialog::ChatDialog(QWidget *parent) /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); + setupsendActions(); + setWindowIcon(QIcon(QString(":/images/rstray3.png"))); //connect(ui.lineEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendMsg( ) )); connect(ui.Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg())); - connect(ui.actionSend, SIGNAL( triggered (bool)), this, SLOT( sendMsg( ) ) ); - ui.actionSend->setShortcut(Qt::CTRL + Qt::SHIFT); - + connect( ui.msgSendList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgSendListCostumPopupMenu( QPoint ) ) ); + connect( ui.msgText, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayInfoChatMenu(const QPoint&))); #ifdef CHAT_IMPROVEMENTS connect(ui.textboldChatButton, SIGNAL(clicked()), this, SLOT(setFont())); @@ -75,7 +76,7 @@ ChatDialog::ChatDialog(QWidget *parent) // connect(ui.msgSendList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ), // this, SLOT(toggleSendItem( QTreeWidgetItem *, int ) )); - loadInitMsg(); + //loadInitMsg(); /* hide the Tree +/- */ ui.msgSendList -> setRootIsDecorated( false ); @@ -88,7 +89,9 @@ ChatDialog::ChatDialog(QWidget *parent) pxm.fill(textColor); ui.colorChatButton->setIcon(pxm); - QFont font = QFont("Comic Sans MS", 10); + QFont font = QFont("Comic Sans MS", 10); + + setChatInfo(tr("Welcome to RetroShare's group chat."), QString::fromUtf8("blue")); /* Hide platform specific features */ @@ -111,22 +114,22 @@ void ChatDialog::msgSendListCostumPopupMenu( QPoint point ) contextMnu.exec( mevent->globalPos() ); } -int ChatDialog::loadInitMsg() +/*int ChatDialog::loadInitMsg() { std::ostringstream out; //out << std::endl; //out << std::endl; //out << std::endl; - out << " Welcome to:"; - out << "
" << std::endl; - out << " Retroshare's group chat.
"; + //out << " Welcome to:"; + //out << "
" << std::endl; + //out << " Retroshare's group chat.
"; QString txt = QString::fromStdString(out.str()); ui.msgText->setHtml(txt); return 1; -} +}*/ @@ -351,6 +354,38 @@ void ChatDialog::setFont() } - +void ChatDialog::setupsendActions() +{ + QAction *a; + + a = new QAction(this); + a->setShortcut(Qt::CTRL + Qt::Key_S); + connect(a, SIGNAL(triggered()), this, SLOT(sendMsg())); + +} + +// Update Chat Info information +void ChatDialog::setChatInfo(QString info, QColor color) { + static unsigned int nbLines = 0; + ++nbLines; + // Check log size, clear it if too big + if(nbLines > 200) { + ui.msgText->clear(); + nbLines = 1; + } + ui.msgText->append(QString::fromUtf8("")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8(" - ") + info + QString::fromUtf8("")); +} + +void ChatDialog::on_actionClearChat_triggered() { + ui.msgText->clear(); +} + +void ChatDialog::displayInfoChatMenu(const QPoint& pos) { + // Log Menu + QMenu myChatMenu(this); + myChatMenu.addAction(ui.actionClearChat); + // XXX: Why mapToGlobal() is not enough? + myChatMenu.exec(mapToGlobal(pos)+QPoint(0,80)); +} diff --git a/retroshare-gui/src/gui/ChatDialog.h b/retroshare-gui/src/gui/ChatDialog.h index 5b029925a..7b1439ddc 100644 --- a/retroshare-gui/src/gui/ChatDialog.h +++ b/retroshare-gui/src/gui/ChatDialog.h @@ -44,7 +44,11 @@ void insertChat(); PopupChatDialog *getPrivateChat(std::string id, std::string name, bool show); void clearOldChats(); -int loadInitMsg(); +//int loadInitMsg(); + +public slots: + + void setChatInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText)); private slots: @@ -62,6 +66,11 @@ void toggleSendItem( QTreeWidgetItem *item, int col ); void setFont(); void getFont(); + void setupsendActions(); + + void on_actionClearChat_triggered(); + void displayInfoChatMenu(const QPoint& pos); + private: diff --git a/retroshare-gui/src/gui/ChatDialog.ui b/retroshare-gui/src/gui/ChatDialog.ui index 42e5864ec..ce9a3ea49 100644 --- a/retroshare-gui/src/gui/ChatDialog.ui +++ b/retroshare-gui/src/gui/ChatDialog.ui @@ -625,6 +625,9 @@ 0 + + Qt::CustomContextMenu + false @@ -1007,6 +1010,11 @@ Send + + + ClearChat + + textboldChatButton diff --git a/retroshare-gui/src/gui/LanguageDialog.cpp b/retroshare-gui/src/gui/LanguageDialog.cpp deleted file mode 100644 index 451005bb5..000000000 --- a/retroshare-gui/src/gui/LanguageDialog.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2006-2008, crypton - * Copyright (c) 2006, Matt Edman, Justin Hipple - * - * 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 "rshare.h" -#include "LanguageDialog.h" - - -/** Constructor */ -LanguageDialog::LanguageDialog(QWidget *parent) -: QWidget(parent) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); - - /* Create RshareSettings object */ - _settings = new RshareSettings(); - - - /* Populate combo boxes */ - foreach (QString code, LanguageSupport::languageCodes()) { - ui.cmboxLanguage->addItem(QIcon(":/images/flags/" + code + ".png"), - LanguageSupport::languageName(code), - code); - } - - connect(ui.ok_Button, SIGNAL(clicked( bool )), this, SLOT( save(QString &errmsg)) ); - connect(ui.cancel_Button, SIGNAL(clicked( bool )), this, SLOT( cancellanguage()) ); - - -} - -/** Destructor */ -LanguageDialog::~LanguageDialog() -{ - delete _settings; -} - -/** Saves the changes on this page */ -bool -LanguageDialog::save(QString &errmsg) -{ - Q_UNUSED(errmsg); - QString languageCode = - LanguageSupport::languageCode(ui.cmboxLanguage->currentText()); - - _settings->setLanguageCode(languageCode); - - -} - -/** Loads the settings for this page */ -void -LanguageDialog::load() -{ - int index = ui.cmboxLanguage->findData(_settings->getLanguageCode()); - ui.cmboxLanguage->setCurrentIndex(index); - - -} - -/** Cancel and close the Language Window. */ -void -LanguageDialog::cancellanguage() -{ - - QWidget::close(); -} - diff --git a/retroshare-gui/src/gui/LanguageDialog.h b/retroshare-gui/src/gui/LanguageDialog.h deleted file mode 100644 index 34e366b9f..000000000 --- a/retroshare-gui/src/gui/LanguageDialog.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2006-2008, crypton - * Copyright (c) 2006, Matt Edman, Justin Hipple - * - * 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 _LANGUAGEDIALOG_H -#define _LANGUAGEDIALOG_H -#include -#include -#include -#include - -#include -#include - -#include "ui_LanguageDialog.h" - -class LanguageDialog : public QWidget -{ - Q_OBJECT - -public: - /** Default Constructor */ - LanguageDialog(QWidget *parent = 0); - /** Default Destructor */ - ~LanguageDialog(); - /** Saves the changes on this page */ - bool save(QString &errmsg); - /** Loads the settings for this page */ - void load(); - - -private slots: - void cancellanguage(); - - -private: - /** A RetroShare Settings object used for saving/loading settings */ - RshareSettings* _settings; - - - - /** Qt Designer generated object */ - Ui::LanguageDialog ui; -}; - -#endif - diff --git a/retroshare-gui/src/gui/LanguageDialog.ui b/retroshare-gui/src/gui/LanguageDialog.ui deleted file mode 100644 index e410d2989..000000000 --- a/retroshare-gui/src/gui/LanguageDialog.ui +++ /dev/null @@ -1,616 +0,0 @@ - - LanguageDialog - - - - 0 - 0 - 290 - 132 - - - - - - - - - 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 - 10 - 50 - false - false - false - false - - - - Qt::NoContextMenu - - - RetroShare Language - - - - - 190 - 100 - 75 - 23 - - - - Cancel - - - - - - 60 - 60 - 208 - 26 - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - - 300 - 16 - - - - - - - - - 200 - 0 - - - - Qt::NoContextMenu - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Choose the language used in RetroShare</p></body></html> - - - false - - - - 24 - 16 - - - - - - - - - - 100 - 100 - 75 - 23 - - - - OK - - - false - - - true - - - - - - 60 - 20 - 191 - 20 - - - - Qt::NoContextMenu - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;">Please select a language</p></body></html> - - - - - cmboxLanguage - - - - - -