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

This commit is contained in:
DenioD
2020-06-22 11:13:10 +02:00
parent 5907b40f1c
commit ab2140b72d
8 changed files with 57 additions and 3 deletions

View File

@@ -80,8 +80,8 @@
<file>res/emoji/smiling-face-with-sunglasses.png</file> <file>res/emoji/smiling-face-with-sunglasses.png</file>
<file>res/emoji/stuck-out.png</file> <file>res/emoji/stuck-out.png</file>
<file>res/emoji/sweet_smile.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>
<qresource prefix="/translations"> <qresource prefix="/translations">
<file>res/silentdragonlite_de.qm</file> <file>res/silentdragonlite_de.qm</file>

BIN
res/emoji/SD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -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(":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(":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(";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; qreal contentswidth = option.rect.width() * d_widthfraction - d_horizontalmargin - d_pointerwidth - d_leftpadding - d_rightpadding;
bodydoc.setTextWidth(contentswidth); bodydoc.setTextWidth(contentswidth);
qreal bodyheight = bodydoc.size().height(); 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(":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(":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(";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) // 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; qreal contentswidth = option.rect.width() * d_widthfraction - d_horizontalmargin - d_pointerwidth - d_leftpadding - d_rightpadding;

View File

@@ -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); // AddressBook::getInstance()->addAddressLabel(newLabel, ab.addr->text(), cid);

View File

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

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>261</width> <width>261</width>
<height>152</height> <height>150</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -300,6 +300,36 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
</layout> </layout>

View File

@@ -2721,6 +2721,18 @@ QObject::connect(emoji.stuck_out, &QPushButton::clicked, [&] () {
emojiDialog.close(); 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(); emojiDialog.exec();