mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-19 21:04:32 -05:00
* added doubleclick feature for can start a privat chat without need to use context menu for Friends Dialog and Messenger Window
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@902 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
67706cc73c
commit
78fe71b2f4
@ -17,9 +17,9 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
****************************************************************/
|
||||
|
||||
#include <QFile>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include "common/vmessagebox.h"
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
#include <QHeaderView>
|
||||
|
||||
|
||||
/* Images for context menu icons */
|
||||
/* Images for context menu icons */
|
||||
#define IMAGE_REMOVEFRIEND ":/images/removefriend16.png"
|
||||
#define IMAGE_EXPIORTFRIEND ":/images/exportpeers_16x16.png"
|
||||
#define IMAGE_CHAT ":/images/chat.png"
|
||||
@ -62,43 +62,46 @@
|
||||
#define IMAGE_OFFLINE ":/images/dhidden.png"
|
||||
/* Images for Status icons */
|
||||
#define IMAGE_ON ":/images/contract_hover.png"
|
||||
#define IMAGE_OFF ":/images/expand_hover.png"
|
||||
#define IMAGE_OFF ":/images/expand_hover.png"
|
||||
|
||||
/******
|
||||
* #define MSG_DEBUG 1
|
||||
*****/
|
||||
|
||||
|
||||
/** Constructor */
|
||||
MessengerWindow::MessengerWindow(QWidget * parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
/** Constructor */
|
||||
MessengerWindow::MessengerWindow(QWidget * parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
RshareSettings config;
|
||||
config.loadWidgetInformation(this);
|
||||
|
||||
connect( ui.messengertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messengertreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||
RshareSettings config;
|
||||
config.loadWidgetInformation(this);
|
||||
|
||||
connect( ui.messengertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messengertreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||
|
||||
connect( ui.avatarButton, SIGNAL(clicked()), SLOT(changeAvatarClicked()));
|
||||
connect( ui.addIMAccountButton, SIGNAL(clicked( bool ) ), this , SLOT( addFriend2() ) );
|
||||
connect( ui.addIMAccountButton, SIGNAL(clicked( bool ) ), this , SLOT( addFriend2() ) );
|
||||
|
||||
connect( ui.messengertreeWidget, SIGNAL(itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend2()));
|
||||
|
||||
|
||||
|
||||
/* to hide the header */
|
||||
/* to hide the header */
|
||||
ui.messengertreeWidget->header()->hide();
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
ui.messengertreeWidget->setColumnCount(1);
|
||||
|
||||
QHeaderView * _header = ui.messengertreeWidget->header () ;
|
||||
_header->setResizeMode (0, QHeaderView::Interactive);
|
||||
//_header->setResizeMode (1, QHeaderView::Interactive);
|
||||
QHeaderView * _header = ui.messengertreeWidget->header () ;
|
||||
_header->setResizeMode (0, QHeaderView::Interactive);
|
||||
//_header->setResizeMode (1, QHeaderView::Interactive);
|
||||
//_header->setResizeMode (2, QHeaderView::Interactive);
|
||||
//_header->setResizeMode (3, QHeaderView::Interactive);
|
||||
|
||||
_header->resizeSection ( 0, 200 );
|
||||
|
||||
//_header->setResizeMode (3, QHeaderView::Interactive);
|
||||
|
||||
_header->resizeSection ( 0, 200 );
|
||||
|
||||
//LogoBar
|
||||
_rsLogoBarmessenger = NULL;
|
||||
_rsLogoBarmessenger = new LogoBar(ui.logoframe);
|
||||
@ -126,38 +129,38 @@ MessengerWindow::MessengerWindow(QWidget * parent)
|
||||
#endif
|
||||
}
|
||||
|
||||
void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point )
|
||||
{
|
||||
|
||||
QMenu contextMnu( this );
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
|
||||
chatAct = new QAction(QIcon(IMAGE_CHAT), tr( "Chat" ), this );
|
||||
void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point )
|
||||
{
|
||||
|
||||
QMenu contextMnu( this );
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
|
||||
chatAct = new QAction(QIcon(IMAGE_CHAT), tr( "Chat" ), this );
|
||||
connect( chatAct , SIGNAL( triggered() ), this, SLOT( chatfriend2() ) );
|
||||
|
||||
sendMessageAct = new QAction(QIcon(IMAGE_SENDMESSAGE), tr( "Send Message" ), this );
|
||||
sendMessageAct = new QAction(QIcon(IMAGE_SENDMESSAGE), tr( "Send Message" ), this );
|
||||
connect( sendMessageAct , SIGNAL( triggered() ), this, SLOT( sendMessage() ) );
|
||||
|
||||
connectfriendAct = new QAction( tr( "Connect To Friend" ), this );
|
||||
connect( connectfriendAct , SIGNAL( triggered() ), this, SLOT( connectfriend2() ) );
|
||||
connectfriendAct = new QAction( tr( "Connect To Friend" ), this );
|
||||
connect( connectfriendAct , SIGNAL( triggered() ), this, SLOT( connectfriend2() ) );
|
||||
|
||||
/************ Do we want these options here???
|
||||
*
|
||||
*
|
||||
configurefriendAct = new QAction( tr( "Configure Friend" ), this );
|
||||
configurefriendAct = new QAction( tr( "Configure Friend" ), this );
|
||||
connect( configurefriendAct , SIGNAL( triggered() ), this, SLOT( configurefriend2() ) );
|
||||
|
||||
exportfriendAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Export Friend" ), this );
|
||||
exportfriendAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Export Friend" ), this );
|
||||
connect( exportfriendAct , SIGNAL( triggered() ), this, SLOT( exportfriend2() ) );
|
||||
*
|
||||
*
|
||||
*********/
|
||||
|
||||
removefriend2Act = new QAction(QIcon(IMAGE_REMOVEFRIEND), tr( "Remove Friend" ), this );
|
||||
connect( removefriend2Act , SIGNAL( triggered() ), this, SLOT( removefriend2() ) );
|
||||
removefriend2Act = new QAction(QIcon(IMAGE_REMOVEFRIEND), tr( "Remove Friend" ), this );
|
||||
connect( removefriend2Act , SIGNAL( triggered() ), this, SLOT( removefriend2() ) );
|
||||
|
||||
|
||||
contextMnu.clear();
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction( chatAct);
|
||||
contextMnu.addAction( sendMessageAct);
|
||||
contextMnu.addSeparator();
|
||||
@ -168,14 +171,14 @@ void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point )
|
||||
*
|
||||
*
|
||||
contextMnu.addAction( configurefriendAct);
|
||||
contextMnu.addAction( exportfriendAct);
|
||||
contextMnu.addAction( exportfriendAct);
|
||||
*
|
||||
*
|
||||
****/
|
||||
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* get the list of peers from the RsIface. */
|
||||
@ -287,13 +290,13 @@ void MessengerWindow::exportfriend2()
|
||||
}
|
||||
|
||||
|
||||
void MessengerWindow::allowfriend2()
|
||||
void MessengerWindow::allowfriend2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MessengerWindow::connectfriend2()
|
||||
void MessengerWindow::connectfriend2()
|
||||
{
|
||||
bool isOnline;
|
||||
QTreeWidgetItem *i = getCurrentPeer(isOnline);
|
||||
@ -316,12 +319,12 @@ void MessengerWindow::connectfriend2()
|
||||
}
|
||||
}
|
||||
|
||||
void MessengerWindow::setaddressfriend2()
|
||||
void MessengerWindow::setaddressfriend2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MessengerWindow::trustfriend2()
|
||||
void MessengerWindow::trustfriend2()
|
||||
{
|
||||
|
||||
}
|
||||
@ -329,28 +332,28 @@ void MessengerWindow::trustfriend2()
|
||||
|
||||
|
||||
/* GUI stuff -> don't do anything directly with Control */
|
||||
void MessengerWindow::configurefriend2()
|
||||
void MessengerWindow::configurefriend2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** Overloads the default show */
|
||||
void MessengerWindow::show()
|
||||
{
|
||||
|
||||
if (!this->isVisible()) {
|
||||
QWidget::show();
|
||||
} else {
|
||||
QWidget::activateWindow();
|
||||
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
||||
QWidget::raise();
|
||||
}
|
||||
|
||||
/** Overloads the default show */
|
||||
void MessengerWindow::show()
|
||||
{
|
||||
|
||||
if (!this->isVisible()) {
|
||||
QWidget::show();
|
||||
} else {
|
||||
QWidget::activateWindow();
|
||||
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
||||
QWidget::raise();
|
||||
}
|
||||
}
|
||||
|
||||
void MessengerWindow::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
RshareSettings config;
|
||||
RshareSettings config;
|
||||
config.saveWidgetInformation(this);
|
||||
|
||||
hide();
|
||||
@ -367,7 +370,7 @@ void MessengerWindow::setChatDialog(PeersDialog *cd)
|
||||
|
||||
|
||||
|
||||
void MessengerWindow::chatfriend2()
|
||||
void MessengerWindow::chatfriend2()
|
||||
{
|
||||
bool isOnline;
|
||||
QTreeWidgetItem *i = getCurrentPeer(isOnline);
|
||||
@ -463,7 +466,7 @@ QTreeWidgetItem *MessengerWindow::getCurrentPeer(bool &isOnline)
|
||||
return item;
|
||||
}
|
||||
|
||||
void MessengerWindow::removefriend2()
|
||||
void MessengerWindow::removefriend2()
|
||||
{
|
||||
bool isOnline;
|
||||
QTreeWidgetItem *c = getCurrentPeer(isOnline);
|
||||
@ -527,5 +530,5 @@ void MessengerWindow::updateAvatar()
|
||||
|
||||
LogoBar & MessengerWindow::getLogoBar() const {
|
||||
return *_rsLogoBarmessenger;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,7 @@ PeersDialog::PeersDialog(QWidget *parent)
|
||||
ui.setupUi(this);
|
||||
|
||||
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||
connect( ui.peertreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend()));
|
||||
|
||||
/* hide the Tree +/- */
|
||||
ui.peertreeWidget -> setRootIsDecorated( false );
|
||||
|
Loading…
Reference in New Issue
Block a user