Browse Source

add hush/sd emoji, scroll to the end of chat after clicking new contact

pull/170/head
DenioD 4 years ago
parent
commit
ab2140b72d
  1. 4
      application.qrc
  2. BIN
      res/emoji/SD.png
  3. BIN
      res/emoji/hush-money-white.png
  4. 4
      src/Chat/Helper/ChatDelegator.h
  5. 3
      src/addressbook.cpp
  6. 5
      src/controller.cpp
  7. 32
      src/emoji.ui
  8. 12
      src/mainwindow.cpp

4
application.qrc

@ -80,8 +80,8 @@
<file>res/emoji/smiling-face-with-sunglasses.png</file>
<file>res/emoji/stuck-out.png</file>
<file>res/emoji/sweet_smile.png</file>
<file>res/emoji/hush-money-white.png</file>
<file>res/emoji/SD.png</file>
</qresource>
<qresource prefix="/translations">
<file>res/silentdragonlite_de.qm</file>

BIN
res/emoji/SD.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
res/emoji/hush-money-white.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

4
src/Chat/Helper/ChatDelegator.h

@ -72,6 +72,8 @@ inline void ListViewDelegate::paint(QPainter *painter, QStyleOptionViewItem cons
bodydoc.setHtml(bodytext.replace(":sunglass:", "<img src=':/emoji/res/emoji/smiling-face-with-sunglasses.png'>"));
bodydoc.setHtml(bodytext.replace(":stuck_out:", "<img src=':/emoji/res/emoji/stuck-out.png'>"));
bodydoc.setHtml(bodytext.replace(";p", "<img src=':/emoji/res/emoji/stuck-out.png'>"));
bodydoc.setHtml(bodytext.replace(":hush_white:", "<img src=':/emoji/res/emoji/hush-money-white.png'>"));
bodydoc.setHtml(bodytext.replace(":sd:", "<img src=':/emoji/res/emoji/SD.png'>"));
qreal contentswidth = option.rect.width() * d_widthfraction - d_horizontalmargin - d_pointerwidth - d_leftpadding - d_rightpadding;
bodydoc.setTextWidth(contentswidth);
qreal bodyheight = bodydoc.size().height();
@ -216,6 +218,8 @@ inline QSize ListViewDelegate::sizeHint(QStyleOptionViewItem const &option, QMod
bodydoc.setHtml(bodytext.replace(":sunglass:", "<img src=':/emoji/res/emoji/smiling-face-with-sunglasses.png'>"));
bodydoc.setHtml(bodytext.replace(":stuck_out:", "<img src=':/emoji/res/emoji/stuck-out.png'>"));
bodydoc.setHtml(bodytext.replace(";p", "<img src=':/emoji/res/emoji/stuck-out.png'>"));
bodydoc.setHtml(bodytext.replace(":hush_white:", "<img src=':/emoji/res/emoji/hush-money-white.png'>"));
bodydoc.setHtml(bodytext.replace(":sd:", "<img src=':/emoji/res/emoji/SD.png'>"));
// the width of the contents are the (a fraction of the window width) minus (margins + padding + width of the bubble's tail)
qreal contentswidth = option.rect.width() * d_widthfraction - d_horizontalmargin - d_pointerwidth - d_leftpadding - d_rightpadding;

3
src/addressbook.cpp

@ -250,6 +250,9 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
);
parent->ui->listChat->verticalScrollBar()->setValue(
parent->ui->listChat->verticalScrollBar()->maximum());
});
// AddressBook::getInstance()->addAddressLabel(newLabel, ab.addr->text(), cid);

5
src/controller.cpp

@ -101,6 +101,9 @@ void Controller::setConnection(Connection* c)
ui->listContactWidget
);
ui->listChat->verticalScrollBar()->setValue(
ui->listChat->verticalScrollBar()->maximum());
}
std::string Controller::encryptDecrypt(std::string toEncrypt)
@ -1482,6 +1485,8 @@ void Controller::refreshChat(QListView *listWidget, QLabel *label)
void Controller::refreshContacts(QListView *listWidget)
{
contactModel->renderContactList(listWidget);
ui->listChat->verticalScrollBar()->setValue(
ui->listChat->verticalScrollBar()->maximum());
}
// If the wallet is encrpyted and locked, we need to unlock it

32
src/emoji.ui

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>261</width>
<height>152</height>
<height>150</height>
</rect>
</property>
<property name="windowTitle">
@ -300,6 +300,36 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="hush_white">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/emoji/res/emoji/hush-money-white.png</normalon>
</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="sd">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/emoji/res/emoji/SD.png</normalon>
</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>

12
src/mainwindow.cpp

@ -2721,6 +2721,18 @@ QObject::connect(emoji.stuck_out, &QPushButton::clicked, [&] () {
emojiDialog.close();
});
QObject::connect(emoji.hush_white, &QPushButton::clicked, [&] () {
ui->memoTxtChat->insertHtml(":hush_white:");
emojiDialog.close();
});
QObject::connect(emoji.sd, &QPushButton::clicked, [&] () {
ui->memoTxtChat->insertHtml(":sd:");
emojiDialog.close();
});
emojiDialog.exec();

Loading…
Cancel
Save