Added additional description field for add rules, links & infos

This commit is contained in:
defnax 2024-09-12 21:38:39 +02:00
parent e888e89437
commit 343e033d01
5 changed files with 124 additions and 70 deletions

View File

@ -917,6 +917,13 @@ void ChatLobbyWidget::showBlankPage(ChatLobbyId id, bool subscribed /*= false*/)
ui.lobbysec_lineEdit->setText( (( (*it).lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED)?tr("No anonymous IDs"):tr("Anonymous IDs accepted")) );
ui.lobbypeers_lineEdit->setText( QString::number((*it).total_number_of_peers) );
QString formatDescription = QString::fromUtf8(it->lobby_topic.c_str());
unsigned int formatFlag = RSHTML_FORMATTEXT_EMBED_LINKS;
formatDescription = RsHtml().formatText(NULL, formatDescription, formatFlag);
ui.lobbydesc_textBrowser->setText(formatDescription);
QString text = tr("You're subscribed to this chat room; Double click to show window and chat.") ;
if (!subscribed)
{
@ -940,6 +947,7 @@ void ChatLobbyWidget::showBlankPage(ChatLobbyId id, bool subscribed /*= false*/)
ui.lobbytype_lineEdit->clear();
ui.lobbypeers_lineEdit->clear();
ui.lobbysec_lineEdit->clear();
ui.lobbydesc_textBrowser->clear();
QString text = tr("No chat room selected. \nSelect chat rooms at left to show details.\nDouble click a chat room to enter and chat.") ;
ui.info_Label_Lobby->setText(text) ;

View File

@ -259,17 +259,10 @@
<property name="topMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lobbyname_label">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<item row="4" column="1">
<widget class="QLabel" name="lobbysec_lineEdit">
<property name="text">
<string>Chat room Name:</string>
<string>TextLabel</string>
</property>
</widget>
</item>
@ -293,17 +286,29 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lobbyid_label">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
<item row="3" column="1">
<widget class="QLabel" name="lobbytype_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Chat room Id:</string>
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="lobbypeers_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
@ -320,8 +325,8 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lobbytopic_label">
<item row="3" column="0">
<widget class="QLabel" name="lobbytype_label">
<property name="font">
<font>
<pointsize>12</pointsize>
@ -330,7 +335,35 @@
</font>
</property>
<property name="text">
<string>Topic:</string>
<string>Type:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lobbyname_label">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Chat room Name:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lobbyid_label">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Chat room Id:</string>
</property>
</widget>
</item>
@ -350,8 +383,8 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lobbytype_label">
<item row="5" column="0">
<widget class="QLabel" name="lobbypeers_label">
<property name="font">
<font>
<pointsize>12</pointsize>
@ -360,20 +393,7 @@
</font>
</property>
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="lobbytype_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
<string>Peers:</string>
</property>
</widget>
</item>
@ -391,15 +411,33 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="lobbysec_lineEdit">
<property name="text">
<string>TextLabel</string>
<item row="6" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="title">
<string>Room infos</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextBrowser" name="lobbydesc_textBrowser">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lobbypeers_label">
<item row="2" column="0">
<widget class="QLabel" name="lobbytopic_label">
<property name="font">
<font>
<pointsize>12</pointsize>
@ -408,35 +446,12 @@
</font>
</property>
<property name="text">
<string>Peers:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="lobbypeers_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
<string>Topic:</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="info_Label_Lobby">
<property name="text">
<string notr="true">TextLabel</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="lobbyInfoVSpacer">
<property name="orientation">
@ -450,6 +465,16 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="info_Label_Lobby">
<property name="text">
<string notr="true">TextLabel</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -998,7 +998,10 @@ void ChatWidget::scrollToAnchor(QString anchor)
void ChatWidget::setWelcomeMessage(QString &text)
{
ui->textBrowser->setText(text);
unsigned int formatTextFlag = RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_OPTIMIZE;
QString formattedWelcomeMessage = RsHtml().formatText(ui->textBrowser->document(), text, formatTextFlag);
ui->textBrowser->setText(formattedWelcomeMessage);
}
void ChatWidget::addChatMsg(bool incoming, const QString &name, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, MsgType chatType)

View File

@ -129,6 +129,8 @@ void CreateLobbyDialog::createLobby()
// create chat lobby !!
std::string lobby_name = ui->lobbyName_LE->text().toUtf8().constData() ;
std::string lobby_topic = ui->lobbyTopic_LE->text().toUtf8().constData() ;
std::string lobby_description = ui->lobbyDescription_TE->toPlainText().toUtf8().constData() ;
std::string lobby_topicwithdesc = lobby_topic + "\n" + lobby_description;
// set nick name !
RsGxsId gxs_id ;
@ -149,7 +151,7 @@ void CreateLobbyDialog::createLobby()
if(ui->pgp_signed_CB->isChecked())
lobby_flags |= RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ;
ChatLobbyId id = rsMsgs->createChatLobby(lobby_name,gxs_id, lobby_topic, shareList, lobby_flags);
ChatLobbyId id = rsMsgs->createChatLobby(lobby_name,gxs_id, lobby_topicwithdesc, shareList, lobby_flags);
std::cerr << "gui: Created chat room " << std::hex << id << std::dec << std::endl ;

View File

@ -149,6 +149,22 @@
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Room info</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="lobbyDescription_TE">
<property name="placeholderText">
<string>Add additional room rules, links &amp; infos</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="roomVSpacer">
<property name="orientation">