mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -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
@ -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/>
|
||||
|
Binary file not shown.
@ -1102,7 +1102,12 @@ Do you want to send them a Message instead</source>
|
||||
<context>
|
||||
<name>ChatLobbyDialog</name>
|
||||
<message>
|
||||
<location filename="../gui/chat/ChatLobbyDialog.cpp" line="+147"/>
|
||||
<location filename="../gui/chat/ChatLobbyDialog.cpp" line="+115"/>
|
||||
<source>Please enter your new nick name</source>
|
||||
<translation>Bitte gib deinen neuen Spitznamen ein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+52"/>
|
||||
<location line="+3"/>
|
||||
<source>Lobby management</source>
|
||||
<translation>Lobby Verwaltung</translation>
|
||||
@ -1137,6 +1142,12 @@ Do you want to send them a Message instead</source>
|
||||
<source>Show Participants</source>
|
||||
<translation>Teilnehmer zeigen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/chat/ChatLobbyDialog.ui" line="+177"/>
|
||||
<location filename="../gui/chat/ChatLobbyDialog.cpp" line="-104"/>
|
||||
<source>Change nick name</source>
|
||||
<translation>Ändere Spitznamen</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatLobbyWidget</name>
|
||||
@ -1194,7 +1205,7 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Abonnieren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+240"/>
|
||||
<location line="+244"/>
|
||||
<source>Invitation to chat lobby</source>
|
||||
<translation>Einladung zur Chat Lobby</translation>
|
||||
</message>
|
||||
@ -1423,12 +1434,12 @@ p, li { white-space: pre-wrap; }
|
||||
<translation type="obsolete">Formular</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/chat/ChatWidget.ui" line="+180"/>
|
||||
<location filename="../gui/chat/ChatWidget.ui" line="+131"/>
|
||||
<source>Close</source>
|
||||
<translation>Schliessen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+126"/>
|
||||
<location line="+332"/>
|
||||
<source>Attach a Picture</source>
|
||||
<translation>Bild anhängen</translation>
|
||||
</message>
|
||||
@ -1438,19 +1449,19 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Füge eine Datei für deinen Freund hinzu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+36"/>
|
||||
<location line="+86"/>
|
||||
<source>Send</source>
|
||||
<translation>Senden</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+59"/>
|
||||
<location line="+285"/>
|
||||
<location line="-255"/>
|
||||
<location line="+271"/>
|
||||
<source>Bold</source>
|
||||
<translation>Fett</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-250"/>
|
||||
<location line="+260"/>
|
||||
<location line="-243"/>
|
||||
<location line="+253"/>
|
||||
<source>Underline</source>
|
||||
<translation>Unterstrichen</translation>
|
||||
</message>
|
||||
@ -1461,17 +1472,17 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Kursiv</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-185"/>
|
||||
<location line="-192"/>
|
||||
<source>Font</source>
|
||||
<translation>Schriftart</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+35"/>
|
||||
<location line="+28"/>
|
||||
<source>Text Color</source>
|
||||
<translation>Textfarbe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+160"/>
|
||||
<location line="+174"/>
|
||||
<source>Strike</source>
|
||||
<translation>Durchgestrichen</translation>
|
||||
</message>
|
||||
@ -1512,7 +1523,7 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Löscht den gespeicherten und angezeigten Chat Verlauf</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/chat/ChatWidget.cpp" line="+340"/>
|
||||
<location filename="../gui/chat/ChatWidget.cpp" line="+342"/>
|
||||
<source>Paste RetroShare Link</source>
|
||||
<translation>RetroShare Link einfügen</translation>
|
||||
</message>
|
||||
@ -1547,7 +1558,7 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Text Datei (*.txt );;Alle Dateien (*)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+27"/>
|
||||
<location line="+32"/>
|
||||
<source>apears to be Offline.</source>
|
||||
<translation>ist Offline.</translation>
|
||||
</message>
|
||||
@ -9605,7 +9616,7 @@ p, li { white-space: pre-wrap; }
|
||||
<translation type="obsolete">Textfarbe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/chat/PopupChatDialog.ui" line="+207"/>
|
||||
<location filename="../gui/chat/PopupChatDialog.ui" line="+205"/>
|
||||
<source>Clear offline messages</source>
|
||||
<translation>Entferne offline Nachrichten</translation>
|
||||
</message>
|
||||
|
Loading…
Reference in New Issue
Block a user