mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-07 16:45:11 -04:00
Added change nick name to the chat lobby dialog.
Optimized layout of the chat dialogs. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4862 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a811218d63
commit
8431e7b3af
9 changed files with 650 additions and 713 deletions
|
@ -21,6 +21,7 @@
|
|||
****************************************************************/
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "ChatLobbyDialog.h"
|
||||
#include "ChatTabWidget.h"
|
||||
|
@ -40,6 +41,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::WF
|
|||
ui.setupUi(this);
|
||||
|
||||
connect(ui.participantsFrameButton, SIGNAL(toggled(bool)), this, SLOT(showParticipantsFrame(bool)));
|
||||
connect(ui.actionChangeNickname, SIGNAL(triggered()), this, SLOT(changeNickname()));
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::init(const std::string &peerId, const QString &title)
|
||||
|
@ -50,6 +52,8 @@ void ChatLobbyDialog::init(const std::string &peerId, const QString &title)
|
|||
rsMsgs->getNickNameForChatLobby(lobbyId, nickName);
|
||||
ui.chatWidget->setName(QString::fromUtf8(nickName.c_str()));
|
||||
|
||||
ui.chatWidget->addToolsAction(ui.actionChangeNickname);
|
||||
|
||||
lastUpdateListTime = 0;
|
||||
|
||||
/* Hide or show the participants frames */
|
||||
|
@ -98,10 +102,26 @@ void ChatLobbyDialog::processSettings(bool load)
|
|||
Settings->endGroup();
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::setNickName(const QString& nick)
|
||||
void ChatLobbyDialog::setNickname(const QString &nickname)
|
||||
{
|
||||
rsMsgs->setNickNameForChatLobby(lobbyId, nick.toUtf8().constData());
|
||||
ui.chatWidget->setName(nick);
|
||||
rsMsgs->setNickNameForChatLobby(lobbyId, nickname.toUtf8().constData());
|
||||
ui.chatWidget->setName(nickname);
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::changeNickname()
|
||||
{
|
||||
QInputDialog dialog;
|
||||
dialog.setWindowTitle(tr("Change nick name"));
|
||||
dialog.setLabelText(tr("Please enter your new nick name"));
|
||||
dialog.setWindowIcon(QIcon(":/images/rstray3.png"));
|
||||
|
||||
std::string nickName;
|
||||
rsMsgs->getNickNameForChatLobby(lobbyId, nickName);
|
||||
dialog.setTextValue(QString::fromUtf8(nickName.c_str()));
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
setNickname(dialog.textValue());
|
||||
}
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
virtual void showDialog(uint chatflags);
|
||||
virtual ChatWidget *getChatWidget();
|
||||
virtual bool hasPeerStatus() { return false; }
|
||||
void setNickname(const QString &nickname);
|
||||
|
||||
private slots:
|
||||
void showParticipantsFrame(bool show);
|
||||
|
@ -56,7 +57,7 @@ protected:
|
|||
virtual void addIncomingChatMsg(const ChatInfo& info);
|
||||
|
||||
protected slots:
|
||||
void setNickName(const QString&);
|
||||
void changeNickname();
|
||||
|
||||
private:
|
||||
void updateParticipantsList();
|
||||
|
|
|
@ -24,7 +24,10 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -34,13 +37,7 @@
|
|||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="4">
|
||||
<item>
|
||||
<widget class="QFrame" name="leftsideframe">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
|
@ -111,7 +108,7 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="4">
|
||||
<item>
|
||||
<widget class="QFrame" name="participantsFrame">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
|
@ -128,20 +125,20 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="participantsList">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QListWidget{
|
||||
|
@ -155,19 +152,31 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="4">
|
||||
<widget class="ChatWidget" name="chatWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="chatLayout">
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<widget class="ChatWidget" name="chatWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="actionChangeNickname">
|
||||
<property name="text">
|
||||
<string>Change nick name</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
@ -133,7 +133,7 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
|
|||
this->peerId = peerId;
|
||||
this->title = title;
|
||||
|
||||
ui->friendnamelabel->setText(title);
|
||||
ui->titleLabel->setText(title);
|
||||
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
setName(QString::fromUtf8(rsPeers->getPeerName(ownId).c_str()));
|
||||
|
@ -166,6 +166,8 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
|
|||
// currently not possible
|
||||
ui->actionDeleteChatHistory->setVisible(false);
|
||||
ui->actionMessageHistory->setVisible(false);
|
||||
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
if (rsHistory->getEnable(false)) {
|
||||
|
@ -586,6 +588,11 @@ void ChatWidget::setCurrentFileName(const QString &fileName)
|
|||
|
||||
void ChatWidget::updateStatus(const QString &peer_id, int status)
|
||||
{
|
||||
if (isChatLobby) {
|
||||
// updateTitle is used
|
||||
return;
|
||||
}
|
||||
|
||||
/* set font size for status */
|
||||
if (peer_id.toStdString() == peerId) {
|
||||
// the peers status has changed
|
||||
|
@ -619,7 +626,7 @@ void ChatWidget::updateStatus(const QString &peer_id, int status)
|
|||
}
|
||||
|
||||
QString statusString("<span style=\"font-size:11pt; font-weight:500;""\">%1</span>");
|
||||
ui->friendnamelabel->setText(peerName + " (" + statusString.arg(StatusDefs::name(status)) + ")") ;
|
||||
ui->titleLabel->setText(peerName + " (" + statusString.arg(StatusDefs::name(status)) + ")") ;
|
||||
|
||||
peerStatus = status;
|
||||
|
||||
|
@ -631,6 +638,16 @@ void ChatWidget::updateStatus(const QString &peer_id, int status)
|
|||
// ignore status change
|
||||
}
|
||||
|
||||
void ChatWidget::updateTitle()
|
||||
{
|
||||
if (!isChatLobby) {
|
||||
// updateStatus is used
|
||||
return;
|
||||
}
|
||||
|
||||
ui->titleLabel->setText(name + "@" + title);
|
||||
}
|
||||
|
||||
void ChatWidget::updatePeersCustomStateString(const QString& peer_id, const QString& status_string)
|
||||
{
|
||||
std::string stdPeerId = peer_id.toStdString();
|
||||
|
@ -665,6 +682,7 @@ void ChatWidget::updateStatusString(const QString &statusMask, const QString &st
|
|||
void ChatWidget::setName(const QString &name)
|
||||
{
|
||||
this->name = name;
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
bool ChatWidget::setStyle()
|
||||
|
|
|
@ -84,6 +84,7 @@ protected:
|
|||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
void updateTitle();
|
||||
|
||||
private slots:
|
||||
void pasteLink();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -24,7 +24,10 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -34,13 +37,7 @@
|
|||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="4">
|
||||
<item>
|
||||
<widget class="QFrame" name="leftsideframe">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
|
@ -111,7 +108,7 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="4">
|
||||
<item>
|
||||
<widget class="QFrame" name="avatarframe">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
|
@ -128,20 +125,14 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<item>
|
||||
<widget class="AvatarWidget" name="avatarWidget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
|
@ -157,7 +148,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item>
|
||||
<spacer name="myspacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -170,7 +161,7 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item>
|
||||
<widget class="AvatarWidget" name="ownAvatarWidget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
|
@ -189,15 +180,22 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="4">
|
||||
<widget class="ChatWidget" name="chatWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="chatLayout">
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<widget class="ChatWidget" name="chatWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -209,18 +207,18 @@
|
|||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>AvatarWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/common/AvatarWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ChatWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">gui/chat/ChatWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AvatarWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/common/AvatarWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue