mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-08 06:56:02 -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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include "common/vmessagebox.h"
|
#include "common/vmessagebox.h"
|
||||||
|
|
||||||
@ -52,7 +52,7 @@
|
|||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
||||||
|
|
||||||
/* Images for context menu icons */
|
/* Images for context menu icons */
|
||||||
#define IMAGE_REMOVEFRIEND ":/images/removefriend16.png"
|
#define IMAGE_REMOVEFRIEND ":/images/removefriend16.png"
|
||||||
#define IMAGE_EXPIORTFRIEND ":/images/exportpeers_16x16.png"
|
#define IMAGE_EXPIORTFRIEND ":/images/exportpeers_16x16.png"
|
||||||
#define IMAGE_CHAT ":/images/chat.png"
|
#define IMAGE_CHAT ":/images/chat.png"
|
||||||
@ -62,43 +62,46 @@
|
|||||||
#define IMAGE_OFFLINE ":/images/dhidden.png"
|
#define IMAGE_OFFLINE ":/images/dhidden.png"
|
||||||
/* Images for Status icons */
|
/* Images for Status icons */
|
||||||
#define IMAGE_ON ":/images/contract_hover.png"
|
#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
|
* #define MSG_DEBUG 1
|
||||||
*****/
|
*****/
|
||||||
|
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
MessengerWindow::MessengerWindow(QWidget * parent)
|
MessengerWindow::MessengerWindow(QWidget * parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
RshareSettings config;
|
RshareSettings config;
|
||||||
config.loadWidgetInformation(this);
|
config.loadWidgetInformation(this);
|
||||||
|
|
||||||
connect( ui.messengertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messengertreeWidgetCostumPopupMenu( QPoint ) ) );
|
connect( ui.messengertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messengertreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
connect( ui.avatarButton, SIGNAL(clicked()), SLOT(changeAvatarClicked()));
|
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();
|
ui.messengertreeWidget->header()->hide();
|
||||||
|
|
||||||
/* Set header resize modes and initial section sizes */
|
/* Set header resize modes and initial section sizes */
|
||||||
ui.messengertreeWidget->setColumnCount(1);
|
ui.messengertreeWidget->setColumnCount(1);
|
||||||
|
|
||||||
QHeaderView * _header = ui.messengertreeWidget->header () ;
|
QHeaderView * _header = ui.messengertreeWidget->header () ;
|
||||||
_header->setResizeMode (0, QHeaderView::Interactive);
|
_header->setResizeMode (0, QHeaderView::Interactive);
|
||||||
//_header->setResizeMode (1, QHeaderView::Interactive);
|
//_header->setResizeMode (1, QHeaderView::Interactive);
|
||||||
//_header->setResizeMode (2, QHeaderView::Interactive);
|
//_header->setResizeMode (2, QHeaderView::Interactive);
|
||||||
//_header->setResizeMode (3, QHeaderView::Interactive);
|
//_header->setResizeMode (3, QHeaderView::Interactive);
|
||||||
|
|
||||||
_header->resizeSection ( 0, 200 );
|
_header->resizeSection ( 0, 200 );
|
||||||
|
|
||||||
//LogoBar
|
//LogoBar
|
||||||
_rsLogoBarmessenger = NULL;
|
_rsLogoBarmessenger = NULL;
|
||||||
_rsLogoBarmessenger = new LogoBar(ui.logoframe);
|
_rsLogoBarmessenger = new LogoBar(ui.logoframe);
|
||||||
@ -126,38 +129,38 @@ MessengerWindow::MessengerWindow(QWidget * parent)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point )
|
void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point )
|
||||||
{
|
{
|
||||||
|
|
||||||
QMenu contextMnu( this );
|
QMenu contextMnu( this );
|
||||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||||
|
|
||||||
chatAct = new QAction(QIcon(IMAGE_CHAT), tr( "Chat" ), this );
|
chatAct = new QAction(QIcon(IMAGE_CHAT), tr( "Chat" ), this );
|
||||||
connect( chatAct , SIGNAL( triggered() ), this, SLOT( chatfriend2() ) );
|
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() ) );
|
connect( sendMessageAct , SIGNAL( triggered() ), this, SLOT( sendMessage() ) );
|
||||||
|
|
||||||
connectfriendAct = new QAction( tr( "Connect To Friend" ), this );
|
connectfriendAct = new QAction( tr( "Connect To Friend" ), this );
|
||||||
connect( connectfriendAct , SIGNAL( triggered() ), this, SLOT( connectfriend2() ) );
|
connect( connectfriendAct , SIGNAL( triggered() ), this, SLOT( connectfriend2() ) );
|
||||||
|
|
||||||
/************ Do we want these options here???
|
/************ 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() ) );
|
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() ) );
|
connect( exportfriendAct , SIGNAL( triggered() ), this, SLOT( exportfriend2() ) );
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*********/
|
*********/
|
||||||
|
|
||||||
removefriend2Act = new QAction(QIcon(IMAGE_REMOVEFRIEND), tr( "Remove Friend" ), this );
|
removefriend2Act = new QAction(QIcon(IMAGE_REMOVEFRIEND), tr( "Remove Friend" ), this );
|
||||||
connect( removefriend2Act , SIGNAL( triggered() ), this, SLOT( removefriend2() ) );
|
connect( removefriend2Act , SIGNAL( triggered() ), this, SLOT( removefriend2() ) );
|
||||||
|
|
||||||
|
|
||||||
contextMnu.clear();
|
contextMnu.clear();
|
||||||
contextMnu.addAction( chatAct);
|
contextMnu.addAction( chatAct);
|
||||||
contextMnu.addAction( sendMessageAct);
|
contextMnu.addAction( sendMessageAct);
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
@ -168,14 +171,14 @@ void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point )
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
contextMnu.addAction( configurefriendAct);
|
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. */
|
/* 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;
|
bool isOnline;
|
||||||
QTreeWidgetItem *i = getCurrentPeer(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 */
|
/* GUI stuff -> don't do anything directly with Control */
|
||||||
void MessengerWindow::configurefriend2()
|
void MessengerWindow::configurefriend2()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Overloads the default show */
|
/** Overloads the default show */
|
||||||
void MessengerWindow::show()
|
void MessengerWindow::show()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!this->isVisible()) {
|
if (!this->isVisible()) {
|
||||||
QWidget::show();
|
QWidget::show();
|
||||||
} else {
|
} else {
|
||||||
QWidget::activateWindow();
|
QWidget::activateWindow();
|
||||||
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
||||||
QWidget::raise();
|
QWidget::raise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessengerWindow::closeEvent (QCloseEvent * event)
|
void MessengerWindow::closeEvent (QCloseEvent * event)
|
||||||
{
|
{
|
||||||
RshareSettings config;
|
RshareSettings config;
|
||||||
config.saveWidgetInformation(this);
|
config.saveWidgetInformation(this);
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
@ -367,7 +370,7 @@ void MessengerWindow::setChatDialog(PeersDialog *cd)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MessengerWindow::chatfriend2()
|
void MessengerWindow::chatfriend2()
|
||||||
{
|
{
|
||||||
bool isOnline;
|
bool isOnline;
|
||||||
QTreeWidgetItem *i = getCurrentPeer(isOnline);
|
QTreeWidgetItem *i = getCurrentPeer(isOnline);
|
||||||
@ -463,7 +466,7 @@ QTreeWidgetItem *MessengerWindow::getCurrentPeer(bool &isOnline)
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessengerWindow::removefriend2()
|
void MessengerWindow::removefriend2()
|
||||||
{
|
{
|
||||||
bool isOnline;
|
bool isOnline;
|
||||||
QTreeWidgetItem *c = getCurrentPeer(isOnline);
|
QTreeWidgetItem *c = getCurrentPeer(isOnline);
|
||||||
@ -527,5 +530,5 @@ void MessengerWindow::updateAvatar()
|
|||||||
|
|
||||||
LogoBar & MessengerWindow::getLogoBar() const {
|
LogoBar & MessengerWindow::getLogoBar() const {
|
||||||
return *_rsLogoBarmessenger;
|
return *_rsLogoBarmessenger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ PeersDialog::PeersDialog(QWidget *parent)
|
|||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
|
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||||
|
connect( ui.peertreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend()));
|
||||||
|
|
||||||
/* hide the Tree +/- */
|
/* hide the Tree +/- */
|
||||||
ui.peertreeWidget -> setRootIsDecorated( false );
|
ui.peertreeWidget -> setRootIsDecorated( false );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user