added notification when distant chat has undelivered messages. Updated the text to remove technical terms such as tunnels

This commit is contained in:
csoler 2019-10-26 22:57:13 +02:00
parent 56fa3edd77
commit ea9f88a32f
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
6 changed files with 124 additions and 53 deletions

View file

@ -113,6 +113,7 @@ ChatWidget::ChatWidget(QWidget *parent)
ui->searchButton->setIconSize(iconSize);
ui->sendButton->setFixedHeight(iconHeight);
ui->sendButton->setIconSize(iconSize);
ui->typingLabel->setMaximumHeight(QFontMetricsF(font()).height()*1.2);
//Initialize search
iCharToStartSearch=Settings->getChatSearchCharToStartSearch();

View file

@ -7,16 +7,25 @@
<x>0</x>
<y>0</y>
<width>667</width>
<height>334</height>
<height>528</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="1" column="0">
<layout class="QHBoxLayout" name="textChatHLayout">
<property name="spacing">
@ -37,7 +46,16 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="chatTextFrameVLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -113,7 +131,16 @@
<enum>QFrame::Box</enum>
</property>
<layout class="QHBoxLayout" name="infoFrameHLayout">
<property name="margin">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
@ -238,12 +265,6 @@ border-image: url(:/images/closepressed.png)
</item>
<item>
<widget class="QLabel" name="typingLabel">
<property name="maximumSize">
<size>
<width>400</width>
<height>18</height>
</size>
</property>
<property name="margin">
<number>0</number>
</property>
@ -291,7 +312,7 @@ border-image: url(:/images/closepressed.png)
<height>30</height>
</size>
</property>
<property name="placeholderText" stdset="0">
<property name="placeholderText">
<string>Type a message here</string>
</property>
</widget>
@ -311,7 +332,16 @@ border-image: url(:/images/closepressed.png)
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="toolBarFrameHLayout">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@ -520,7 +550,7 @@ border-image: url(:/images/closepressed.png)
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../WikiPoos/Wiki_images.qrc">
<normaloff>:/images/arrow-left.png</normaloff>:/images/arrow-left.png</iconset>
</property>
<property name="autoRaise">
@ -546,7 +576,7 @@ border-image: url(:/images/closepressed.png)
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../WikiPoos/Wiki_images.qrc">
<normaloff>:/images/arrow-right.png</normaloff>:/images/arrow-right.png</iconset>
</property>
<property name="autoRaise">
@ -583,7 +613,16 @@ border-image: url(:/images/closepressed.png)
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="pluginButtonFrameHLayout">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
</layout>
@ -675,7 +714,16 @@ border-image: url(:/images/closepressed.png)
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="titleBarFrameHLayout">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@ -756,7 +804,16 @@ border-image: url(:/images/closepressed.png)
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="pluginTitleFrameHLayout">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
</layout>
@ -998,6 +1055,7 @@ border-image: url(:/images/closepressed.png)
</customwidget>
</customwidgets>
<resources>
<include location="../WikiPoos/Wiki_images.qrc"/>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>

View file

@ -111,7 +111,7 @@ void PopupDistantChatDialog::updateDisplay()
switch(tinfo.status)
{
case RS_DISTANT_CHAT_STATUS_UNKNOWN:
//std::cerr << "Unknown hash. Error!" << std::endl;
_status_label->setIcon(QIcon(IMAGE_GRY_LED));
msg = tr("Remote status unknown.");
_status_label->setToolTip(msg);
@ -124,31 +124,31 @@ void PopupDistantChatDialog::updateDisplay()
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED:
std::cerr << "Chat remotely closed. " << std::endl;
_status_label->setIcon(QIcon(IMAGE_RED_LED));
_status_label->setToolTip(
QObject::tr("Distant peer has closed the chat") );
getChatWidget()->updateStatusString(
"%1", tr( "The person you are talking to has deleted the"
" secured chat tunnel." ), true );
getChatWidget()->blockSending(tr( "The chat partner deleted the secure"
" tunnel, messages will be delivered"
" as soon as possible"));
_status_label->setToolTip( QObject::tr("Distant peer has closed the chat") );
getChatWidget()->updateStatusString("%1", tr( "Your partner closed the conversation." ), true );
getChatWidget()->blockSending(tr( "Your partner closed the conversation."));
setPeerStatus(RS_STATUS_OFFLINE) ;
break ;
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN:
//std::cerr << "Tunnel asked. Waiting for reponse. " << std::endl;
_status_label->setIcon(QIcon(IMAGE_YEL_LED));
msg = QObject::tr( "Tunnel is pending... Messages will be delivered as"
" soon as possible" );
msg = QObject::tr( "Tunnel is pending");
if(tinfo.pending_items > 0)
msg += QObject::tr("(some undelivered messages)") ; // we cannot use the pending_items count because it accounts for ACKS and keep alive packets as well.
_status_label->setToolTip(msg);
getChatWidget()->updateStatusString("%1", msg, true);
getChatWidget()->blockSending(msg);
setPeerStatus(RS_STATUS_OFFLINE);
break;
case RS_DISTANT_CHAT_STATUS_CAN_TALK:
//std::cerr << "Tunnel is ok and data is transmitted." << std::endl;
_status_label->setIcon(QIcon(IMAGE_GRN_LED));
msg = QObject::tr( "Secured tunnel is working. "
"Messages are delivered immediately!" );
msg = QObject::tr( "End-to-end encrypted conversation established");
_status_label->setToolTip(msg);
getChatWidget()->unblockSending();
setPeerStatus(RS_STATUS_ONLINE);
@ -158,17 +158,15 @@ void PopupDistantChatDialog::updateDisplay()
void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
{
//std::cerr << "Closing window => closing distant chat for hash " << _pid << std::endl;
DistantChatPeerInfo tinfo ;
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
if(tinfo.status != RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED)
{
QString msg = tr("Closing this window will end the conversation, notify the peer and remove the encrypted tunnel.") ;
QString msg = tr("Closing this window will end the conversation. Unsent messages will be dropped.") ;
if(QMessageBox::Ok == QMessageBox::critical(NULL,tr("Kill the tunnel?"),msg, QMessageBox::Ok | QMessageBox::Cancel))
if(QMessageBox::Ok == QMessageBox::critical(NULL,tr("Close conversation?"),msg, QMessageBox::Ok | QMessageBox::Cancel))
rsMsgs->closeDistantChatConnexion(_tunnel_id) ;
else
{