mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-23 22:49:37 -05:00
* set Text Alignments for some columns to Center
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@838 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f8e6e853a0
commit
fb7541135e
@ -17,14 +17,14 @@
|
||||
* 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"
|
||||
|
||||
#include "rshare.h"
|
||||
#include "PeersDialog.h"
|
||||
#include "common/vmessagebox.h"
|
||||
|
||||
#include "rshare.h"
|
||||
#include "PeersDialog.h"
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsstatus.h"
|
||||
@ -38,9 +38,9 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <QTextCodec>
|
||||
#include <QTextEdit>
|
||||
#include <QTextCursor>
|
||||
#include <QTextCodec>
|
||||
#include <QTextEdit>
|
||||
#include <QTextCursor>
|
||||
#include <QTextList>
|
||||
#include <QTextStream>
|
||||
#include <QTextDocumentFragment>
|
||||
@ -56,7 +56,7 @@
|
||||
#include <QtGui/QKeyEvent>
|
||||
|
||||
|
||||
/* 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_PEERINFO ":/images/peerdetails_16x16.png"
|
||||
@ -65,38 +65,38 @@
|
||||
/* Images for Status icons */
|
||||
#define IMAGE_ONLINE ":/images/user/identity24.png"
|
||||
#define IMAGE_OFFLINE ":/images/user/identityoffline24.png"
|
||||
#define IMAGE_OFFLINE2 ":/images/user/identitylightgrey24.png"
|
||||
|
||||
#define IMAGE_OFFLINE2 ":/images/user/identitylightgrey24.png"
|
||||
|
||||
|
||||
/******
|
||||
* #define PEERS_DEBUG 1
|
||||
*****/
|
||||
|
||||
|
||||
/** Constructor */
|
||||
PeersDialog::PeersDialog(QWidget *parent)
|
||||
/** Constructor */
|
||||
PeersDialog::PeersDialog(QWidget *parent)
|
||||
: MainPage(parent), chatDialog(NULL)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||
|
||||
/* hide the Tree +/- */
|
||||
ui.peertreeWidget -> setRootIsDecorated( false );
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * _header = ui.peertreeWidget->header () ;
|
||||
_header->setResizeMode (0, QHeaderView::Custom);
|
||||
_header->setResizeMode (1, QHeaderView::Interactive);
|
||||
QHeaderView * _header = ui.peertreeWidget->header () ;
|
||||
_header->setResizeMode (0, QHeaderView::Custom);
|
||||
_header->setResizeMode (1, QHeaderView::Interactive);
|
||||
_header->setResizeMode (2, QHeaderView::Interactive);
|
||||
/*_header->setResizeMode (3, QHeaderView::Interactive);
|
||||
/*_header->setResizeMode (3, QHeaderView::Interactive);
|
||||
_header->setResizeMode (4, QHeaderView::Interactive);
|
||||
_header->setResizeMode (5, QHeaderView::Interactive);
|
||||
_header->setResizeMode (5, QHeaderView::Interactive);
|
||||
_header->setResizeMode (6, QHeaderView::Interactive);
|
||||
_header->setResizeMode (7, QHeaderView::Interactive);*/
|
||||
|
||||
|
||||
_header->setResizeMode (7, QHeaderView::Interactive);*/
|
||||
|
||||
|
||||
_header->resizeSection ( 0, 25 );
|
||||
_header->resizeSection ( 1, 100 );
|
||||
_header->resizeSection ( 2, 100 );
|
||||
@ -120,14 +120,14 @@ PeersDialog::PeersDialog(QWidget *parent)
|
||||
|
||||
connect(ui.lineEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) ));
|
||||
connect(ui.Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg()));
|
||||
connect(ui.emoticonBtn, SIGNAL(clicked()), this, SLOT(smileyWidgetgroupchat()));
|
||||
connect(ui.emoticonBtn, SIGNAL(clicked()), this, SLOT(smileyWidgetgroupchat()));
|
||||
|
||||
|
||||
//connect( ui.msgSendList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgSendListCostumPopupMenu( QPoint ) ) );
|
||||
connect( ui.msgText, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayInfoChatMenu(const QPoint&)));
|
||||
|
||||
connect(ui.textboldChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||
connect(ui.textunderlineChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||
connect(ui.textboldChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||
connect(ui.textunderlineChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||
connect(ui.textitalicChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||
connect(ui.fontsButton, SIGNAL(clicked()), this, SLOT(getFont()));
|
||||
connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
||||
@ -135,7 +135,7 @@ PeersDialog::PeersDialog(QWidget *parent)
|
||||
ui.fontsButton->setIcon(QIcon(QString(":/images/fonts.png")));
|
||||
|
||||
_currentColor = Qt::black;
|
||||
QPixmap pxm(24,24);
|
||||
QPixmap pxm(24,24);
|
||||
pxm.fill(_currentColor);
|
||||
ui.colorChatButton->setIcon(pxm);
|
||||
|
||||
@ -144,23 +144,23 @@ PeersDialog::PeersDialog(QWidget *parent)
|
||||
|
||||
setChatInfo(tr("Welcome to RetroShare's group chat."), QString::fromUtf8("blue"));
|
||||
|
||||
QMenu * grpchatmenu = new QMenu();
|
||||
QMenu * grpchatmenu = new QMenu();
|
||||
grpchatmenu->addAction(ui.actionClearChat);
|
||||
ui.menuButton->setMenu(grpchatmenu);
|
||||
|
||||
_underline = false;
|
||||
_underline = false;
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(insertChat()));
|
||||
timer->start(500); /* half a second */
|
||||
|
||||
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void PeersDialog::setChatDialog(ChatDialog *cd)
|
||||
{
|
||||
@ -168,32 +168,32 @@ void PeersDialog::setChatDialog(ChatDialog *cd)
|
||||
}
|
||||
|
||||
|
||||
void PeersDialog::peertreeWidgetCostumPopupMenu( 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 PeersDialog::peertreeWidgetCostumPopupMenu( 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( chatfriend() ) );
|
||||
|
||||
msgAct = new QAction(QIcon(IMAGE_MSG), tr( "Message Friend" ), this );
|
||||
msgAct = new QAction(QIcon(IMAGE_MSG), tr( "Message Friend" ), this );
|
||||
connect( msgAct , SIGNAL( triggered() ), this, SLOT( msgfriend() ) );
|
||||
|
||||
connectfriendAct = new QAction( tr( "Connect To Friend" ), this );
|
||||
connect( connectfriendAct , SIGNAL( triggered() ), this, SLOT( connectfriend() ) );
|
||||
connectfriendAct = new QAction( tr( "Connect To Friend" ), this );
|
||||
connect( connectfriendAct , SIGNAL( triggered() ), this, SLOT( connectfriend() ) );
|
||||
|
||||
configurefriendAct = new QAction(QIcon(IMAGE_PEERINFO), tr( "Peer Details" ), this );
|
||||
configurefriendAct = new QAction(QIcon(IMAGE_PEERINFO), tr( "Peer Details" ), this );
|
||||
connect( configurefriendAct , SIGNAL( triggered() ), this, SLOT( configurefriend() ) );
|
||||
|
||||
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( exportfriend() ) );
|
||||
|
||||
removefriendAct = new QAction(QIcon(IMAGE_REMOVEFRIEND), tr( "Remove Friend" ), this );
|
||||
connect( removefriendAct , SIGNAL( triggered() ), this, SLOT( removefriend() ) );
|
||||
removefriendAct = new QAction(QIcon(IMAGE_REMOVEFRIEND), tr( "Remove Friend" ), this );
|
||||
connect( removefriendAct , SIGNAL( triggered() ), this, SLOT( removefriend() ) );
|
||||
|
||||
|
||||
contextMnu.clear();
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction( chatAct);
|
||||
contextMnu.addAction( msgAct);
|
||||
contextMnu.addSeparator();
|
||||
@ -201,10 +201,10 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point )
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addAction( connectfriendAct);
|
||||
contextMnu.addAction( exportfriendAct);
|
||||
contextMnu.addAction( removefriendAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
contextMnu.addAction( removefriendAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* get the list of peers from the RsIface. */
|
||||
@ -267,6 +267,7 @@ void PeersDialog::insertPeers()
|
||||
|
||||
//item -> setText(1, status);
|
||||
item -> setText(1, QString::fromStdString(detail.autoconnect));
|
||||
item -> setTextAlignment(1, Qt::AlignCenter | Qt::AlignVCenter );
|
||||
|
||||
/* (1) Person */
|
||||
item -> setText(2, QString::fromStdString(detail.name));
|
||||
@ -418,7 +419,7 @@ void PeersDialog::exportfriend()
|
||||
|
||||
}
|
||||
|
||||
void PeersDialog::chatfriend()
|
||||
void PeersDialog::chatfriend()
|
||||
{
|
||||
QTreeWidgetItem *i = getCurrentPeer();
|
||||
|
||||
@ -522,7 +523,7 @@ QTreeWidgetItem *PeersDialog::getCurrentPeer()
|
||||
*/
|
||||
|
||||
|
||||
void PeersDialog::removefriend()
|
||||
void PeersDialog::removefriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
#ifdef PEERS_DEBUG
|
||||
@ -543,7 +544,7 @@ void PeersDialog::removefriend()
|
||||
}
|
||||
|
||||
|
||||
void PeersDialog::allowfriend()
|
||||
void PeersDialog::allowfriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
#ifdef PEERS_DEBUG
|
||||
@ -556,7 +557,7 @@ void PeersDialog::allowfriend()
|
||||
}
|
||||
|
||||
|
||||
void PeersDialog::connectfriend()
|
||||
void PeersDialog::connectfriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
#ifdef PEERS_DEBUG
|
||||
@ -576,7 +577,7 @@ void PeersDialog::connectfriend()
|
||||
}
|
||||
}
|
||||
|
||||
void PeersDialog::setaddressfriend()
|
||||
void PeersDialog::setaddressfriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
#ifdef PEERS_DEBUG
|
||||
@ -591,7 +592,7 @@ void PeersDialog::setaddressfriend()
|
||||
*/
|
||||
}
|
||||
|
||||
void PeersDialog::trustfriend()
|
||||
void PeersDialog::trustfriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
#ifdef PEERS_DEBUG
|
||||
@ -606,7 +607,7 @@ void PeersDialog::trustfriend()
|
||||
|
||||
|
||||
/* GUI stuff -> don't do anything directly with Control */
|
||||
void PeersDialog::configurefriend()
|
||||
void PeersDialog::configurefriend()
|
||||
{
|
||||
/* display Dialog */
|
||||
#ifdef PEERS_DEBUG
|
||||
@ -675,7 +676,7 @@ void PeersDialog::insertChat()
|
||||
|
||||
extraTxt += QString::fromStdWString(it->msg);
|
||||
|
||||
/* add it everytime */
|
||||
/* add it everytime */
|
||||
currenttxt += extraTxt;
|
||||
|
||||
QHashIterator<QString, QString> i(smileys);
|
||||
@ -887,47 +888,47 @@ void PeersDialog::setFont()
|
||||
ui.lineEdit->setFont(mCurrentFont);
|
||||
ui.lineEdit->setTextColor(_currentColor);
|
||||
|
||||
ui.lineEdit->setFocus();
|
||||
ui.lineEdit->setFocus();
|
||||
|
||||
}
|
||||
|
||||
void PeersDialog::underline()
|
||||
{
|
||||
_underline = !_underline;
|
||||
ui.lineEdit->setFontUnderline(_underline);
|
||||
{
|
||||
_underline = !_underline;
|
||||
ui.lineEdit->setFontUnderline(_underline);
|
||||
}
|
||||
|
||||
|
||||
// Update Chat Info information
|
||||
// Update Chat Info information
|
||||
void PeersDialog::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("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + info + QString::fromUtf8("</i></font>"));
|
||||
}
|
||||
|
||||
{
|
||||
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("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + info + QString::fromUtf8("</i></font>"));
|
||||
}
|
||||
|
||||
void PeersDialog::on_actionClearChat_triggered()
|
||||
{
|
||||
ui.msgText->clear();
|
||||
}
|
||||
|
||||
{
|
||||
ui.msgText->clear();
|
||||
}
|
||||
|
||||
void PeersDialog::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));
|
||||
{
|
||||
// Log Menu
|
||||
QMenu myChatMenu(this);
|
||||
myChatMenu.addAction(ui.actionClearChat);
|
||||
// XXX: Why mapToGlobal() is not enough?
|
||||
myChatMenu.exec(mapToGlobal(pos)+QPoint(0,80));
|
||||
}
|
||||
|
||||
void PeersDialog::loadEmoticonsgroupchat()
|
||||
{
|
||||
QDir smdir(QApplication::applicationDirPath() + "/emoticons/kopete");
|
||||
QDir smdir(QApplication::applicationDirPath() + "/emoticons/kopete");
|
||||
QFileInfoList sminfo = smdir.entryInfoList(QStringList() << "*.gif" << "*.png", QDir::Files, QDir::Name);
|
||||
foreach(QFileInfo info, sminfo)
|
||||
{
|
||||
@ -940,13 +941,13 @@ void PeersDialog::loadEmoticonsgroupchat()
|
||||
//qDebug(smstring.toAscii());
|
||||
smileys.insert(smstring, info.absoluteFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PeersDialog::smileyWidgetgroupchat()
|
||||
{
|
||||
qDebug("MainWindow::smileyWidget()");
|
||||
QWidget *smWidget = new QWidget;
|
||||
smWidget->setWindowTitle("Emoticons");
|
||||
smWidget->setWindowTitle("Emoticons");
|
||||
smWidget->setWindowIcon(QIcon(QString(":/images/rstray3.png")));
|
||||
smWidget->setFixedSize(256,256);
|
||||
|
||||
@ -974,10 +975,10 @@ void PeersDialog::smileyWidgetgroupchat()
|
||||
}
|
||||
|
||||
smWidget->show();
|
||||
}
|
||||
|
||||
void PeersDialog::addSmileys()
|
||||
{
|
||||
ui.lineEdit->setText(ui.lineEdit->toHtml() + qobject_cast<QPushButton*>(sender())->toolTip());
|
||||
}
|
||||
|
||||
void PeersDialog::addSmileys()
|
||||
{
|
||||
ui.lineEdit->setText(ui.lineEdit->toHtml() + qobject_cast<QPushButton*>(sender())->toolTip());
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, index.data().toString());
|
||||
break;
|
||||
case USTATUS:
|
||||
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, index.data().toString());
|
||||
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignCenter, index.data().toString());
|
||||
break;
|
||||
default:
|
||||
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
|
||||
|
Loading…
Reference in New Issue
Block a user