diff --git a/application.qrc b/application.qrc index 9ff3227..b7d5138 100644 --- a/application.qrc +++ b/application.qrc @@ -51,6 +51,7 @@ res/money-mouth.png res/money-outgoing.png res/hush-money-white.png + res/hushdlogo.gif @@ -60,6 +61,18 @@ res/silentdragonlite-animated-startup-dark.gif res/loaderblack.gif res/loaderwhite.gif + + + res/emoji/emoji1.png + res/emoji/laughing.png + res/emoji/money-mouth.png + res/emoji/sweet_smile.png + res/emoji/joy.png + res/emoji/innocent.png + res/emoji/partying_face.png + res/emoji/heart_eyes.png + res/emoji/fire.png + res/silentdragonlite_de.qm diff --git a/res/emoji/emoji1.png b/res/emoji/emoji1.png new file mode 100644 index 0000000..7179819 Binary files /dev/null and b/res/emoji/emoji1.png differ diff --git a/res/emoji/fire.png b/res/emoji/fire.png new file mode 100644 index 0000000..c1b7596 Binary files /dev/null and b/res/emoji/fire.png differ diff --git a/res/emoji/heart_eyes.png b/res/emoji/heart_eyes.png new file mode 100644 index 0000000..de0eed6 Binary files /dev/null and b/res/emoji/heart_eyes.png differ diff --git a/res/emoji/innocent.png b/res/emoji/innocent.png new file mode 100644 index 0000000..c58bd37 Binary files /dev/null and b/res/emoji/innocent.png differ diff --git a/res/emoji/joy.png b/res/emoji/joy.png new file mode 100644 index 0000000..cb80d82 Binary files /dev/null and b/res/emoji/joy.png differ diff --git a/res/emoji/laughing.png b/res/emoji/laughing.png new file mode 100644 index 0000000..701c1de Binary files /dev/null and b/res/emoji/laughing.png differ diff --git a/res/emoji/money-mouth.png b/res/emoji/money-mouth.png new file mode 100644 index 0000000..fc262f4 Binary files /dev/null and b/res/emoji/money-mouth.png differ diff --git a/res/emoji/partying_face.png b/res/emoji/partying_face.png new file mode 100644 index 0000000..625c1e8 Binary files /dev/null and b/res/emoji/partying_face.png differ diff --git a/res/emoji/sweet_smile.png b/res/emoji/sweet_smile.png new file mode 100644 index 0000000..53b9d41 Binary files /dev/null and b/res/emoji/sweet_smile.png differ diff --git a/silentdragon-lite.pro b/silentdragon-lite.pro index 60d9b13..094d7f4 100644 --- a/silentdragon-lite.pro +++ b/silentdragon-lite.pro @@ -14,6 +14,7 @@ QT += widgets QT += websockets + TARGET = SilentDragonLite TEMPLATE = app @@ -121,6 +122,7 @@ HEADERS += \ FORMS += \ src/contactrequest.ui \ src/deposithush.ui \ + src/emoji.ui \ src/encryption.ui \ src/hushrequest.ui \ src/mainwindow.ui \ diff --git a/src/Chat/Helper/ChatDelegator.h b/src/Chat/Helper/ChatDelegator.h index 12f94db..602d0ac 100644 --- a/src/Chat/Helper/ChatDelegator.h +++ b/src/Chat/Helper/ChatDelegator.h @@ -51,6 +51,16 @@ inline void ListViewDelegate::paint(QPainter *painter, QStyleOptionViewItem cons bodydoc.setDefaultFont(QFont("Roboto", 12)); QString bodytext(index.data(Qt::DisplayRole).toString()); bodydoc.setHtml(bodytext.replace("\n", "
")); + bodydoc.setHtml(bodytext.replace(":smiley:", "")); + bodydoc.setHtml(bodytext.replace(":-)", "")); + bodydoc.setHtml(bodytext.replace(":money_mouth:", "")); + bodydoc.setHtml(bodytext.replace(":laughing:", "")); + bodydoc.setHtml(bodytext.replace(":sweet_smile:", "")); + bodydoc.setHtml(bodytext.replace(":joy:", "")); + bodydoc.setHtml(bodytext.replace(":innocent:", "")); + bodydoc.setHtml(bodytext.replace(":partying_face:", "")); + bodydoc.setHtml(bodytext.replace(":heart_eyes:", "")); + bodydoc.setHtml(bodytext.replace(":fire:", "")); qreal contentswidth = option.rect.width() * d_widthfraction - d_horizontalmargin - d_pointerwidth - d_leftpadding - d_rightpadding; bodydoc.setTextWidth(contentswidth); qreal bodyheight = bodydoc.size().height(); @@ -174,6 +184,16 @@ inline QSize ListViewDelegate::sizeHint(QStyleOptionViewItem const &option, QMod bodydoc.setDefaultFont(QFont("Roboto", 12)); QString bodytext(index.data(Qt::DisplayRole).toString()); bodydoc.setHtml(bodytext.replace("\n", "
")); + bodydoc.setHtml(bodytext.replace(":smiley:", "")); + bodydoc.setHtml(bodytext.replace(":-)", "")); + bodydoc.setHtml(bodytext.replace(":money_mouth:", "")); + bodydoc.setHtml(bodytext.replace(":laughing:", "")); + bodydoc.setHtml(bodytext.replace(":sweet_smile:", "")); + bodydoc.setHtml(bodytext.replace(":joy:", "")); + bodydoc.setHtml(bodytext.replace(":innocent:", "")); + bodydoc.setHtml(bodytext.replace(":partying_face:", "")); + bodydoc.setHtml(bodytext.replace(":heart_eyes:", "")); + bodydoc.setHtml(bodytext.replace(":fire:", "")); // the width of the contents are the (a fraction of the window width) minus (margins + padding + width of the bubble's tail) diff --git a/src/connection.cpp b/src/connection.cpp index e584da0..ca8c62e 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -67,7 +67,6 @@ void ConnectionLoader::doAutoConnect() { qDebug() << "Doing autoconnect"; auto config = std::shared_ptr(new ConnectionConfig()); - config->dangerous = false; config->server = Settings::getInstance()->getSettings().server; // Initialize the library @@ -78,7 +77,6 @@ void ConnectionLoader::doAutoConnect() { main->logger->write(QObject::tr("Using existing wallet.")); char* resp = litelib_initialize_existing( - config->dangerous, config->server.toStdString().c_str() ); QString response = litelib_process_response(resp); @@ -93,7 +91,7 @@ void ConnectionLoader::doAutoConnect() else { main->logger->write(QObject::tr("Create/restore wallet.")); - createOrRestore(config->dangerous, config->server); + createOrRestore(config->server); d->show(); } @@ -154,12 +152,12 @@ void ConnectionLoader::doAutoConnect() }); } -void ConnectionLoader::createOrRestore(bool dangerous, QString server) +void ConnectionLoader::createOrRestore(QString server) { // Close the startup dialog, since we'll be showing the wizard d->hide(); // Create a wizard - FirstTimeWizard wizard(dangerous, server); + FirstTimeWizard wizard(server); main->logger->write("Start new Wallet with FirstimeWizard"); wizard.exec(); } diff --git a/src/connection.h b/src/connection.h index a253e2f..9076abd 100644 --- a/src/connection.h +++ b/src/connection.h @@ -10,7 +10,6 @@ class Controller; struct ConnectionConfig { QString server; - bool dangerous; QString proxy; }; @@ -32,7 +31,7 @@ private: void doAutoConnect(); - void createOrRestore(bool dangerous, QString server); + void createOrRestore(QString server); void showError(QString explanation); void showInformation(QString info, QString detail = ""); diff --git a/src/emoji.ui b/src/emoji.ui index fb923db..774681e 100644 --- a/src/emoji.ui +++ b/src/emoji.ui @@ -1,72 +1,142 @@ - - - - - Dialog - - + + + emojiDialog + + 0 0 - 400 - 300 + 261 + 46 - - Dialog + + Emoji - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + + + + + 6 + + + 6 + + + 6 + + + 6 + + + + + + + + + :/emoji/res/emoji/emoji1.png + + + + true + + + + + + + + + + + :/emoji/res/emoji/laughing.png + + + + true + + + + + + + + + + + :/emoji/res/emoji/sweet_smile.png + + + + true + + + + + + + + + + + :/emoji/res/emoji/joy.png + + + + true + + + + + + + + + + + :/emoji/res/emoji/innocent.png + + + + true + + + + + + + + + + + :/emoji/res/emoji/partying_face.png + + + + true + + + + + + + + + + + :/icons/res/money-mouth.png + + + + true + + + + + + - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - + - diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 397baf1..400ee9f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -20,6 +20,7 @@ #include "ui_sendHushTransactionChat.h" #include "ui_contactrequest.h" #include "ui_deposithush.h" +#include "ui_emoji.h" #include "ui_requestContactDialog.h" #include "chatmodel.h" #include "requestdialog.h" @@ -35,6 +36,9 @@ #include "DataStore/DataStore.h" #include "firsttimewizard.h" #include "../lib/silentdragonlitelib.h" +#include +#include +#include #ifdef Q_OS_WIN @@ -2612,3 +2616,67 @@ void MainWindow::on_givemeZaddr_clicked() }); } + +void MainWindow::on_pushButton_clicked() +{ + + QDialog emojiDialog(this); + Ui_emojiDialog emoji; + emoji.setupUi(&emojiDialog); + Settings::saveRestore(&emojiDialog); + +QObject::connect(emoji.smiley, &QPushButton::clicked, [&] () { + ui->memoTxtChat->insertHtml(":smiley:"); + + emojiDialog.close(); +}); + +QObject::connect(emoji.money, &QPushButton::clicked, [&] () { + ui->memoTxtChat->insertHtml(":money_mouth:"); + + emojiDialog.close(); +}); + +QObject::connect(emoji.laughing, &QPushButton::clicked, [&] () { + ui->memoTxtChat->insertHtml(":laughing:"); + + emojiDialog.close(); +}); + +QObject::connect(emoji.sweet_smile, &QPushButton::clicked, [&] () { + ui->memoTxtChat->insertHtml(":sweet_smile:"); + + emojiDialog.close(); +}); + +QObject::connect(emoji.joy, &QPushButton::clicked, [&] () { + ui->memoTxtChat->insertHtml(":joy:"); + + emojiDialog.close(); +}); + +QObject::connect(emoji.innocent, &QPushButton::clicked, [&] () { + ui->memoTxtChat->insertHtml(":innocent:"); + + emojiDialog.close(); +}); + +QObject::connect(emoji.partying_face, &QPushButton::clicked, [&] () { + ui->memoTxtChat->insertHtml(":partying_face:"); + + emojiDialog.close(); +}); + + + emojiDialog.exec(); +} + +void MainWindow::on_comboBox_currentIndexChanged(const QString &arg1) +{ + + Qt::Key key = Qt::Key_1; + QKeyEvent pressEvent = QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier, QKeySequence(key).toString()); + QKeyEvent releaseEvent = QKeyEvent(QEvent::KeyRelease, key, Qt::NoModifier); + QCoreApplication::sendEvent(ui->memoTxtChat, &pressEvent); + QCoreApplication::sendEvent(ui->memoTxtChat, &releaseEvent); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index ca4d8cc..abc44bc 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -111,6 +111,12 @@ private slots: void on_givemeZaddr_clicked(); + // void on_pushButton_clicked(); + + void on_pushButton_clicked(); + + void on_comboBox_currentIndexChanged(const QString &arg1); + private: bool fileExists(QString path); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index f771bc4..77687b1 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1341,8 +1341,8 @@ HushChat - - + + @@ -1546,7 +1546,7 @@ - + QLayout::SetDefaultConstraint @@ -1683,6 +1683,12 @@ 0 + + + 850 + 0 + + false @@ -1708,7 +1714,19 @@ - + + 6 + + + 6 + + + 6 + + + 6 + + @@ -1747,7 +1765,34 @@ - + + + + + 20 + 0 + + + + + + + + :/emoji/res/emoji/emoji1.png + + + + + 17 + 17 + + + + true + + + +