@ -0,0 +1,61 @@ |
|||
b ContactDataStore::dump() |
|||
r |
|||
n |
|||
q |
|||
b ContactDataStore::dump() |
|||
r |
|||
n |
|||
c |
|||
./build.sh |
|||
$(./build.sh) |
|||
$(./build.sh) |
|||
q |
|||
r |
|||
q |
|||
r |
|||
b ContactDataStore::dump() |
|||
r |
|||
n |
|||
b ContactItem::toJson() |
|||
r |
|||
c |
|||
n |
|||
q |
|||
b ContactItem::toJson() |
|||
r |
|||
n |
|||
c |
|||
c |
|||
c |
|||
c |
|||
c |
|||
c |
|||
c |
|||
c |
|||
q |
|||
b FileSystem::writeContacts(QString file, json j) |
|||
b FileSystem::writeContacts |
|||
r |
|||
q |
|||
b FileSystem::writeContacts |
|||
r |
|||
b ContactDataStore::dump() |
|||
r |
|||
c |
|||
n |
|||
q |
|||
b FileSystem::writeContacts |
|||
r |
|||
n |
|||
q |
|||
r |
|||
b FileEncryption::encrypt |
|||
r |
|||
s |
|||
n |
|||
q |
|||
b FileSystem::readContactsOldFormat |
|||
r |
|||
n |
|||
c |
|||
q |
@ -0,0 +1,5 @@ |
|||
Compiling SilentDragonLite 1.2.2 with 4 threads... |
|||
g++ -c -include bin/SilentDragonLite -pipe -g -std=gnu++1y -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQAPPLICATION_CLASS=QApplication -D_FORTIFY_SOURCE=2 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -Isrc/3rdparty -Isrc -Isingleapplication -Ires -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtWebSockets -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -Ibin -Isrc -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o bin/mainwindow.o src/mainwindow.cpp |
|||
g++ -c -include bin/SilentDragonLite -pipe -g -std=gnu++1y -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQAPPLICATION_CLASS=QApplication -D_FORTIFY_SOURCE=2 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -Isrc/3rdparty -Isrc -Isingleapplication -Ires -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtWebSockets -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -Ibin -Isrc -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o bin/sendtab.o src/sendtab.cpp |
|||
g++ -c -include bin/SilentDragonLite -pipe -g -std=gnu++1y -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQAPPLICATION_CLASS=QApplication -D_FORTIFY_SOURCE=2 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -Isrc/3rdparty -Isrc -Isingleapplication -Ires -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtWebSockets -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -Ibin -Isrc -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o bin/addressbook.o src/addressbook.cpp |
|||
g++ -c -include bin/SilentDragonLite -pipe -g -std=gnu++1y -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQAPPLICATION_CLASS=QApplication -D_FORTIFY_SOURCE=2 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -Isrc/3rdparty -Isrc -Isingleapplication -Ires -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtWebSockets -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -Ibin -Isrc -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o bin/addresscombo.o src/addresscombo.cpp |
@ -0,0 +1,2 @@ |
|||
break FileSystem::readContactsOldFormat |
|||
|
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 140 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 604 B |
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,139 @@ |
|||
/* |
|||
Theme: Midnight Qt |
|||
Version: 1.0.2 |
|||
Reference: https://doc.qt.io/qt-5/stylesheet-reference.html |
|||
|
|||
Author: Charles Sharpe |
|||
Date: Apr. 23, 2020 |
|||
Website: https://www.csharpe.me |
|||
License: https://opensource.org/licenses/MIT |
|||
*/ |
|||
|
|||
QWidget, QMainWindow, QMenuBar, QMenu, QDialog, QTabWidget, QTableView, QTableView::item, QScrollArea, QGroupBox, QPlainTextEdit, QLineEdit, QLabel, MainWindow |
|||
{ |
|||
background-color: #111; |
|||
color: #fff; |
|||
} |
|||
|
|||
QPushButton { |
|||
padding: 10px 15px; |
|||
} |
|||
|
|||
QPushButton:hover { |
|||
background: #222; |
|||
} |
|||
|
|||
QLineEdit, QRadioButton::indicator::unchecked, QCheckBox::indicator::unchecked { |
|||
background: #222; |
|||
border: 1px solid #333; |
|||
border-radius: 3px; |
|||
} |
|||
|
|||
QLineEdit { |
|||
font-size: 12px; |
|||
} |
|||
|
|||
QLineEdit:focus { |
|||
border: 1px solid #9d8400; |
|||
} |
|||
|
|||
QWidget QLabel { |
|||
font-size: 11pt; |
|||
} |
|||
|
|||
QWidget QCheckBox { |
|||
font-weight: bold; |
|||
} |
|||
|
|||
QTabWidget QTabBar::tab { |
|||
min-height: 15px; |
|||
padding: 15px 25px; |
|||
border: 1px ridge #222; |
|||
left: 1px; /* Fix 1px alignment */ |
|||
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #333, stop: 1 #111); |
|||
} |
|||
|
|||
QTabWidget QTabBar::tab:selected { |
|||
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #555, stop: 1 #111); |
|||
color:#fff; |
|||
border: 1px ridge #222; |
|||
border-bottom: 0px; /* Overwrites border-bottom */ |
|||
} |
|||
|
|||
QTabWidget QTabBar::tab:hover { |
|||
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #555, stop: 1 #111); |
|||
} |
|||
|
|||
QHeaderView { /* Table Header */ |
|||
background-color:#111; |
|||
} |
|||
|
|||
QHeaderView::section { /* Table Header Sections */ |
|||
qproperty-alignment:center; |
|||
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #333, stop: 1 #111); |
|||
color:#fff; |
|||
min-height:25px; |
|||
font-weight:bold; |
|||
font-size:12px; |
|||
outline:0; |
|||
border:1px ridge #222; |
|||
padding: 2px 5px; |
|||
} |
|||
|
|||
QHeaderView::section:last { |
|||
border-right: 0px ridge #222; |
|||
} |
|||
|
|||
QScrollArea { |
|||
background:transparent; |
|||
border:0px; |
|||
} |
|||
|
|||
QTableView { /* Table - has to be selected as a class otherwise it throws off QCalendarWidget */ |
|||
background:#111; |
|||
} |
|||
|
|||
QTableView::item { /* Table Item */ |
|||
background-color:#111; |
|||
border:1px solid #222; |
|||
font-size:12px; |
|||
} |
|||
|
|||
QTableView::item:selected { /* Table Item Selected */ |
|||
background-color:#fff; |
|||
color:#000; |
|||
} |
|||
|
|||
QMenuBar { |
|||
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #222, stop: 1 #111); |
|||
color: #fff; |
|||
} |
|||
|
|||
QMenuBar::item { |
|||
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #222, stop: 1 #111); |
|||
color: #fff; |
|||
padding: 5px 7px; |
|||
margin: 0px; |
|||
} |
|||
|
|||
QMenuBar::item:selected { |
|||
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #333, stop: 1 #111); |
|||
} |
|||
|
|||
QMenu { |
|||
border:1px solid #222; |
|||
} |
|||
|
|||
QMenu::item { |
|||
padding: 7px 15px; |
|||
} |
|||
|
|||
QMenu::item:selected { |
|||
background: #222; |
|||
} |
|||
|
|||
QMenu::separator { |
|||
height: 1px; |
|||
margin: 3px 7px 3px 7px; /* space at ends of separator */ |
|||
background: #222; |
|||
} |
After Width: | Height: | Size: 174 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 812 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 636 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 655 B |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 808 B |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 406 KiB |
After Width: | Height: | Size: 1.0 MiB |
After Width: | Height: | Size: 1015 KiB |
After Width: | Height: | Size: 406 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 1006 B |
@ -0,0 +1,101 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
|
|||
#include "Chat.h" |
|||
#include "../addressbook.h" |
|||
#include "../DataStore/DataStore.h" |
|||
Chat::Chat() {} |
|||
|
|||
ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QTextEdit(parent) { |
|||
QObject::connect(this, &QTextEdit::textChanged, this, &ChatMemoEdit::updateDisplayChat); |
|||
} |
|||
|
|||
void ChatMemoEdit::updateDisplayChat() { |
|||
QString txt = this->toPlainText(); |
|||
if (lenDisplayLabelchat) |
|||
lenDisplayLabelchat->setText(QString::number(txt.toUtf8().size()) + "/" + QString::number(maxlenchat)); |
|||
|
|||
if (txt.toUtf8().size() <= maxlenchat) { |
|||
// Everything is fine
|
|||
if (sendChatButton) |
|||
sendChatButton->setEnabled(true); |
|||
|
|||
if (lenDisplayLabelchat) |
|||
lenDisplayLabelchat->setStyleSheet(""); |
|||
} |
|||
else { |
|||
// Overweight
|
|||
if (sendChatButton) |
|||
sendChatButton->setEnabled(false); |
|||
|
|||
if (lenDisplayLabelchat) |
|||
lenDisplayLabelchat->setStyleSheet("color: red;"); |
|||
} |
|||
} |
|||
|
|||
void ChatMemoEdit::setMaxLenChat(int len) { |
|||
this->maxlenchat = len; |
|||
updateDisplayChat(); |
|||
} |
|||
|
|||
void ChatMemoEdit::SetSendChatButton(QPushButton* button) { |
|||
this->sendChatButton = button; |
|||
} |
|||
|
|||
void ChatMemoEdit::setLenDisplayLabelChat(QLabel* label) { |
|||
this->lenDisplayLabelchat = label; |
|||
} |
|||
|
|||
void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label) |
|||
{ |
|||
|
|||
QStandardItemModel *chat = new QStandardItemModel(); |
|||
DataStore::getChatDataStore()->dump(); // test to see if the chat items in datastore are correctly dumped to json
|
|||
for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) |
|||
{ |
|||
for (auto &c : DataStore::getChatDataStore()->getAllMemos()) |
|||
{ |
|||
|
|||
if ( |
|||
(p.getName() == ui->contactNameMemo->text().trimmed()) && |
|||
(p.getPartnerAddress() == c.second.getAddress()) && |
|||
(c.second.isOutgoing() == true)) |
|||
{ |
|||
|
|||
QStandardItem *Items = new QStandardItem(c.second.toChatLine()); |
|||
|
|||
Items->setData(OUTGOING, Qt::UserRole + 1); |
|||
chat->appendRow(Items); |
|||
ui->listChat->setModel(chat); |
|||
|
|||
|
|||
} |
|||
else |
|||
{ |
|||
ui->listChat->setModel(chat); |
|||
} |
|||
|
|||
if ( |
|||
(p.getName() == ui->contactNameMemo->text().trimmed()) && |
|||
(p.getMyAddress() == c.second.getAddress()) && |
|||
(c.second.isOutgoing() == false) && |
|||
(c.second.getCid() == p.getCid()) |
|||
) |
|||
{ |
|||
QStandardItem *Items1 = new QStandardItem(c.second.toChatLine()); |
|||
Items1->setData(INCOMING, Qt::UserRole + 1); |
|||
chat->appendRow(Items1); |
|||
ui->listChat->setModel(chat); |
|||
|
|||
|
|||
} |
|||
else |
|||
{ |
|||
|
|||
ui->listChat->setModel(chat); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
@ -0,0 +1,34 @@ |
|||
#ifndef CHAT_H |
|||
#define CHAT_H |
|||
|
|||
#include <QString> |
|||
#include <QStandardItemModel> |
|||
#include <QAbstractItemDelegate> |
|||
#include <QPainter> |
|||
#include <map> |
|||
#include <vector> |
|||
#include <QListView> |
|||
#include "precompiled.h" |
|||
#include "mainwindow.h" |
|||
#include "controller.h" |
|||
#include "settings.h" |
|||
#include "camount.h" |
|||
|
|||
#include "../Model/ChatItem.h" |
|||
|
|||
|
|||
class Chat // Chat Controller
|
|||
{ |
|||
private: |
|||
QTableView* parent; |
|||
Ui::MainWindow* ui; |
|||
MainWindow* main; |
|||
std::map<QString, QString> cidMap; |
|||
std::map<QString, QString> requestZaddrMap; |
|||
public: |
|||
Chat(); |
|||
void renderChatBox(Ui::MainWindow* ui, QListView *view, QLabel *label); // action
|
|||
|
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,193 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
|
|||
#ifndef CHATDELEGATOR_H |
|||
#define CHATDELEGATOR_H |
|||
|
|||
#include <QString> |
|||
#include <QStandardItemModel> |
|||
#include <QAbstractItemDelegate> |
|||
#include <QPainter> |
|||
|
|||
enum RenderType |
|||
{ |
|||
OUTGOING=0, |
|||
INCOMING=1, |
|||
INDATE=2, |
|||
OUTDATE=3 |
|||
}; |
|||
|
|||
class ListViewDelegate : public QAbstractItemDelegate |
|||
{ |
|||
int d_radius; |
|||
int d_toppadding; |
|||
int d_bottompadding; |
|||
int d_leftpadding; |
|||
int d_rightpadding; |
|||
int d_verticalmargin; |
|||
int d_horizontalmargin; |
|||
int d_pointerwidth; |
|||
int d_pointerheight; |
|||
float d_widthfraction; |
|||
public: |
|||
inline ListViewDelegate(QObject *parent = nullptr); |
|||
|
|||
protected: |
|||
inline void paint(QPainter *painter, QStyleOptionViewItem const &option, QModelIndex const &index) const; |
|||
inline QSize sizeHint(QStyleOptionViewItem const &option, QModelIndex const &index) const; |
|||
}; |
|||
|
|||
inline ListViewDelegate::ListViewDelegate(QObject *parent): QAbstractItemDelegate(parent), d_radius(5), d_toppadding(5), d_bottompadding(3), d_leftpadding(5), d_rightpadding(5), d_verticalmargin(5), d_horizontalmargin(10), d_pointerwidth(4), d_pointerheight(17), d_widthfraction(.6) |
|||
{ |
|||
|
|||
} |
|||
|
|||
inline void ListViewDelegate::paint(QPainter *painter, QStyleOptionViewItem const &option, QModelIndex const &index) const |
|||
{ |
|||
QTextDocument bodydoc; |
|||
QTextOption textOption(bodydoc.defaultTextOption()); |
|||
textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); |
|||
bodydoc.setDefaultTextOption(textOption); |
|||
bodydoc.setDefaultFont(QFont("Roboto", 12)); |
|||
QString bodytext(index.data(Qt::DisplayRole).toString()); |
|||
bodydoc.setHtml(bodytext); |
|||
qreal contentswidth = option.rect.width() * d_widthfraction - d_horizontalmargin - d_pointerwidth - d_leftpadding - d_rightpadding; |
|||
bodydoc.setTextWidth(contentswidth); |
|||
qreal bodyheight = bodydoc.size().height(); |
|||
int outgoing = index.data(Qt::UserRole + 1).toInt(); |
|||
int outdate = index.data(Qt::UserRole + 1).toInt(); |
|||
painter->save(); |
|||
painter->setRenderHint(QPainter::Antialiasing); |
|||
|
|||
// uncomment to see the area provided to paint this item
|
|||
|
|||
//painter->drawRect(option.rect);
|
|||
|
|||
painter->translate(option.rect.left() + d_horizontalmargin, option.rect.top() + ((index.row() == 0) ? d_verticalmargin : 0)); |
|||
|
|||
QColor bgcolor("#ffffff"); |
|||
switch(outgoing) |
|||
{ |
|||
case INDATE: |
|||
bgcolor = "transparent"; |
|||
break; |
|||
|
|||
case OUTDATE: |
|||
bgcolor = "transparent"; |
|||
break; |
|||
|
|||
case OUTGOING: |
|||
bgcolor = "#f8f9fa"; |
|||
break; |
|||
|
|||
default: |
|||
case INCOMING: |
|||
bgcolor = "#535353"; |
|||
break; |
|||
} |
|||
|
|||
// create chat bubble
|
|||
QPainterPath pointie; |
|||
|
|||
// left bottom
|
|||
pointie.moveTo(0, bodyheight + d_toppadding + d_bottompadding); |
|||
|
|||
// right bottom
|
|||
pointie.lineTo(0 + contentswidth + d_pointerwidth + d_leftpadding + d_rightpadding - d_radius, |
|||
bodyheight + d_toppadding + d_bottompadding); |
|||
pointie.arcTo(0 + contentswidth + d_pointerwidth + d_leftpadding + d_rightpadding - 2 * d_radius, |
|||
bodyheight + d_toppadding + d_bottompadding - 2 * d_radius, |
|||
2 * d_radius, 2 * d_radius, 270, 90); |
|||
|
|||
// right top
|
|||
pointie.lineTo(0 + contentswidth + d_pointerwidth + d_leftpadding + d_rightpadding, 0 + d_radius); |
|||
pointie.arcTo(0 + contentswidth + d_pointerwidth + d_leftpadding + d_rightpadding - 2 * d_radius, 0, |
|||
2 * d_radius, 2 * d_radius, 0, 90); |
|||
|
|||
// left top
|
|||
pointie.lineTo(0 + d_pointerwidth + d_radius, 0); |
|||
pointie.arcTo(0 + d_pointerwidth, 0, 2 * d_radius, 2 * d_radius, 90, 90); |
|||
|
|||
// left bottom almost (here is the pointie)
|
|||
pointie.lineTo(0 + d_pointerwidth, bodyheight + d_toppadding + d_bottompadding - d_pointerheight); |
|||
pointie.closeSubpath(); |
|||
|
|||
// rotate bubble for outgoing messages
|
|||
if ((outgoing == OUTGOING) || (outdate == OUTDATE)) |
|||
{ |
|||
painter->translate(option.rect.width() - pointie.boundingRect().width() - d_horizontalmargin - d_pointerwidth, 0); |
|||
painter->translate(pointie.boundingRect().center()); |
|||
painter->rotate(180); |
|||
painter->translate(-pointie.boundingRect().center()); |
|||
} |
|||
|
|||
// now paint it!
|
|||
painter->setPen(QPen(bgcolor)); |
|||
painter->drawPath(pointie); |
|||
painter->fillPath(pointie, QBrush(bgcolor)); |
|||
|
|||
// rotate back or painter is going to paint the text rotated...
|
|||
if ((outgoing == OUTGOING) || (outdate == OUTDATE)) |
|||
{ |
|||
painter->translate(pointie.boundingRect().center()); |
|||
painter->rotate(-180); |
|||
painter->translate(-pointie.boundingRect().center()); |
|||
} |
|||
|
|||
// set text color used to draw message body
|
|||
QAbstractTextDocumentLayout::PaintContext ctx; |
|||
switch(outgoing) |
|||
{ |
|||
case INDATE: |
|||
ctx.palette.setColor(QPalette::Text, QColor("Black")); |
|||
break; |
|||
|
|||
case OUTDATE: |
|||
ctx.palette.setColor(QPalette::Text, QColor("Black")); |
|||
break; |
|||
|
|||
case OUTGOING: |
|||
ctx.palette.setColor(QPalette::Text, QColor("Black")); |
|||
break; |
|||
|
|||
default: |
|||
case INCOMING: |
|||
ctx.palette.setColor(QPalette::Text, QColor("whitesmoke")); |
|||
break; |
|||
} |
|||
|
|||
|
|||
// draw body text
|
|||
painter->translate((outgoing == OUTGOING ? 0 : d_pointerwidth) + d_leftpadding, 0); |
|||
painter->translate((outdate == OUTDATE ? 0 : d_pointerwidth) + d_leftpadding, 0); |
|||
bodydoc.documentLayout()->draw(painter, ctx); |
|||
|
|||
painter->restore(); |
|||
} |
|||
|
|||
inline QSize ListViewDelegate::sizeHint(QStyleOptionViewItem const &option, QModelIndex const &index) const |
|||
{ |
|||
QTextDocument bodydoc; |
|||
QTextOption textOption(bodydoc.defaultTextOption()); |
|||
textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); |
|||
bodydoc.setDefaultTextOption(textOption); |
|||
bodydoc.setDefaultFont(QFont("Roboto", 12)); |
|||
QString bodytext(index.data(Qt::DisplayRole).toString()); |
|||
bodydoc.setHtml(bodytext); |
|||
|
|||
// 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; |
|||
|
|||
// set this available width on the text document
|
|||
bodydoc.setTextWidth(contentswidth); |
|||
|
|||
QSize size(bodydoc.idealWidth() + d_horizontalmargin + d_pointerwidth + d_leftpadding + d_rightpadding, |
|||
bodydoc.size().height() + d_bottompadding + d_toppadding + d_verticalmargin + 1); // I dont remember why +1, haha, might not be necessary
|
|||
|
|||
if (index.row() == 0) // have extra margin at top of first item
|
|||
size += QSize(0, d_verticalmargin); |
|||
|
|||
return size; |
|||
} |
|||
|
|||
#endif |
@ -0,0 +1,28 @@ |
|||
#include "ChatIDGenerator.h" |
|||
|
|||
ChatIDGenerator* ChatIDGenerator::getInstance() |
|||
{ |
|||
if(ChatIDGenerator::instance == nullptr) |
|||
ChatIDGenerator::instance = new ChatIDGenerator(); |
|||
|
|||
return ChatIDGenerator::instance; |
|||
} |
|||
|
|||
QString ChatIDGenerator::generateID(ChatItem item) |
|||
{ |
|||
QString key = QString::number(item.getTimestamp()) + QString("-"); |
|||
key += QString( |
|||
QCryptographicHash::hash( |
|||
QString( |
|||
QString::number(item.getTimestamp()) + |
|||
item.getAddress() + |
|||
item.getContact() + |
|||
item.getMemo() |
|||
).toUtf8(), |
|||
QCryptographicHash::Md5 |
|||
).toHex() |
|||
); |
|||
return key; |
|||
} |
|||
|
|||
ChatIDGenerator* ChatIDGenerator::instance = nullptr; |
@ -0,0 +1,18 @@ |
|||
#ifndef CHATIDGENERATOR_H |
|||
#define CHATIDGENERATOR_H |
|||
|
|||
#include <QString> |
|||
#include <QUuid> |
|||
#include "../../Model/ChatItem.h" |
|||
|
|||
class ChatIDGenerator |
|||
{ |
|||
private: |
|||
static ChatIDGenerator* instance; |
|||
|
|||
public: |
|||
static ChatIDGenerator* getInstance(); |
|||
QString generateID(ChatItem item); |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,114 @@ |
|||
#include "FileEncryption.h" |
|||
|
|||
void FileEncryption::showConfig() |
|||
{ |
|||
qInfo() << FILEENCRYPTION_CHUNK_SIZE; |
|||
} |
|||
|
|||
int FileEncryption::encrypt(QString target_file, QString source_file, const unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]) |
|||
{ |
|||
unsigned char plain_data[FILEENCRYPTION_CHUNK_SIZE]; |
|||
unsigned char cipher_data[FILEENCRYPTION_CHUNK_SIZE + crypto_secretstream_xchacha20poly1305_ABYTES]; |
|||
unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES]; |
|||
crypto_secretstream_xchacha20poly1305_state state; |
|||
FILE *target, *source; |
|||
unsigned long long cipher_len; |
|||
size_t rlen; |
|||
int eof; |
|||
unsigned char tag; |
|||
|
|||
if(!FileEncryption::exists(source_file.toStdString())) |
|||
{ |
|||
qDebug() << "File not exits" << source_file; |
|||
return -1; |
|||
} |
|||
|
|||
source = fopen(source_file.toStdString().c_str(), "rb"); |
|||
target = fopen(target_file.toStdString().c_str(), "wb"); |
|||
crypto_secretstream_xchacha20poly1305_init_push(&state, header, key); |
|||
fwrite(header, 1, sizeof header, target); |
|||
do |
|||
{ |
|||
rlen = fread(plain_data, 1, sizeof plain_data, source); |
|||
eof = feof(source); |
|||
tag = eof ? crypto_secretstream_xchacha20poly1305_TAG_FINAL : 0; |
|||
crypto_secretstream_xchacha20poly1305_push( |
|||
&state, |
|||
cipher_data, |
|||
&cipher_len, |
|||
plain_data, |
|||
rlen, |
|||
NULL, |
|||
0, |
|||
tag |
|||
); |
|||
|
|||
fwrite(cipher_data, 1, (size_t) cipher_len, target); |
|||
} |
|||
while (! eof); |
|||
|
|||
fclose(target); |
|||
fclose(source); |
|||
return 0; |
|||
} |
|||
|
|||
int FileEncryption::decrypt(QString target_file, QString source_file, const unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]) |
|||
{ |
|||
unsigned char buf_in[FILEENCRYPTION_CHUNK_SIZE + crypto_secretstream_xchacha20poly1305_ABYTES]; |
|||
unsigned char buf_out[FILEENCRYPTION_CHUNK_SIZE]; |
|||
unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES]; |
|||
crypto_secretstream_xchacha20poly1305_state st; |
|||
FILE *fp_t, *fp_s; |
|||
unsigned long long out_len; |
|||
size_t rlen; |
|||
int eof; |
|||
int ret = -1; |
|||
unsigned char tag; |
|||
|
|||
if(!FileEncryption::exists(source_file.toStdString())) |
|||
{ |
|||
qDebug() << "File not exits" << source_file; |
|||
return -1; |
|||
} |
|||
|
|||
fp_s = fopen(source_file.toStdString().c_str(), "rb"); |
|||
fp_t = fopen(target_file.toStdString().c_str(), "wb"); |
|||
fread(header, 1, sizeof header, fp_s); |
|||
if (crypto_secretstream_xchacha20poly1305_init_pull(&st, header, key) != 0) |
|||
{ |
|||
goto ret; /* incomplete header */ |
|||
} |
|||
|
|||
do |
|||
{ |
|||
rlen = fread(buf_in, 1, sizeof buf_in, fp_s); |
|||
eof = feof(fp_s); |
|||
if (crypto_secretstream_xchacha20poly1305_pull( |
|||
&st, |
|||
buf_out, |
|||
&out_len, |
|||
&tag, |
|||
buf_in, |
|||
rlen, |
|||
NULL, |
|||
0 |
|||
) != 0) |
|||
{ |
|||
goto ret; /* corrupted chunk */ |
|||
} |
|||
|
|||
if (tag == crypto_secretstream_xchacha20poly1305_TAG_FINAL && ! eof) |
|||
{ |
|||
goto ret; /* premature end (end of file reached before the end of the stream) */ |
|||
} |
|||
|
|||
fwrite(buf_out, 1, (size_t) out_len, fp_t); |
|||
} |
|||
while (! eof); |
|||
ret = 0; |
|||
|
|||
ret: |
|||
fclose(fp_t); |
|||
fclose(fp_s); |
|||
return ret; |
|||
} |
@ -0,0 +1,24 @@ |
|||
#ifndef FILEENCRYPTION_H |
|||
#define FILEENCRYPTION_H |
|||
#include <stdio.h> |
|||
#include <sodium.h> |
|||
#include <QString> |
|||
#include <fstream> |
|||
|
|||
#define FILEENCRYPTION_CHUNK_SIZE 4096 |
|||
|
|||
class FileEncryption |
|||
{ |
|||
private: |
|||
inline static bool exists (const std::string& name) { |
|||
std::ifstream f(name.c_str()); |
|||
return f.good(); |
|||
} |
|||
public: |
|||
static void showConfig(); |
|||
static int encrypt(QString target_file, QString source_file, const unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]); |
|||
static int decrypt(QString target_file, QString source_file, const unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]); |
|||
}; |
|||
|
|||
|
|||
#endif |
@ -0,0 +1,60 @@ |
|||
#include "passwd.h" |
|||
|
|||
void PASSWD::show_hex_buff(unsigned char buf[]) |
|||
{ |
|||
int i; |
|||
for (uint8_t i=0; i < crypto_secretstream_xchacha20poly1305_KEYBYTES; i++) |
|||
printf("%02X ", buf[i]); |
|||
printf("\n"); |
|||
} |
|||
|
|||
const unsigned char* PASSWD::key(QString password) |
|||
{ |
|||
|
|||
int length = password.length(); |
|||
|
|||
char *sequence = NULL; |
|||
sequence = new char[length+1]; |
|||
strncpy(sequence, password.toLocal8Bit(), length +1); |
|||
|
|||
#define MESSAGE ((const unsigned char *) sequence) |
|||
#define MESSAGE_LEN length |
|||
|
|||
unsigned char hash[crypto_secretstream_xchacha20poly1305_KEYBYTES]; |
|||
|
|||
crypto_hash_sha256(hash, MESSAGE, MESSAGE_LEN); |
|||
|
|||
qDebug()<<"Generating SaltHash from password: " <<sequence; |
|||
|
|||
|
|||
/////////we use the Hash of the Password as Salt, not perfect but still a good solution.
|
|||
|
|||
#define PASSWORD sequence |
|||
#define KEY_LEN crypto_box_SEEDBYTES |
|||
|
|||
unsigned char key[KEY_LEN]; |
|||
|
|||
if (crypto_pwhash |
|||
(key, sizeof key, PASSWORD, strlen(PASSWORD), hash, |
|||
crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE, |
|||
crypto_pwhash_ALG_DEFAULT) != 0) { |
|||
/* out of memory */ |
|||
} |
|||
|
|||
qDebug()<<"Generating cryptographic key from password: " <<sequence; |
|||
|
|||
|
|||
// crypto_generichash(blacke2hash, sizeof hash, MESSAGE, MESSAGE_LEN, NULL, 0);
|
|||
|
|||
//for(uint8_t i = 0; i < crypto_secretstream_xchacha20poly1305_KEYBYTES/2; i++)
|
|||
// hash[i] = blacke2hash[i];
|
|||
|
|||
// for(uint8_t i = crypto_secretstream_xchacha20poly1305_KEYBYTES/2; i < crypto_secretstream_xchacha20poly1305_KEYBYTES; i++)
|
|||
// hash[i] = sha256hash[i];
|
|||
|
|||
// delete[] sha256hash;
|
|||
//delete[] blacke2hash;
|
|||
qDebug()<<"secret key generated:\n"; |
|||
PASSWD::show_hex_buff(key); |
|||
return key; |
|||
} |
@ -0,0 +1,14 @@ |
|||
#ifndef PASSWD_H |
|||
#define PASSWD_H |
|||
#include <stdio.h> |
|||
#include <sodium.h> |
|||
#include <QString> |
|||
|
|||
class PASSWD |
|||
{ |
|||
public: |
|||
static void show_hex_buff(unsigned char buf[]); |
|||
static const unsigned char* key(QString); |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,127 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
|
|||
#include "ChatDataStore.h" |
|||
#include "addressbook.h" |
|||
#include "chatmodel.h" |
|||
|
|||
|
|||
ChatDataStore* ChatDataStore::getInstance() |
|||
{ |
|||
if(!ChatDataStore::instanced) |
|||
{ |
|||
ChatDataStore::instanced = true; |
|||
ChatDataStore::instance = new ChatDataStore(); |
|||
} |
|||
|
|||
return ChatDataStore::instance; |
|||
} |
|||
|
|||
void ChatDataStore::clear() |
|||
{ |
|||
this->data.clear(); |
|||
} |
|||
|
|||
|
|||
void ChatDataStore::setData(QString key, ChatItem value) |
|||
{ |
|||
this->data[key] = value; |
|||
} |
|||
|
|||
ChatItem ChatDataStore::getData(QString key) |
|||
{ |
|||
return this->data[key]; |
|||
} |
|||
|
|||
QString ChatDataStore::getPassword() |
|||
{ |
|||
|
|||
return _password; |
|||
} |
|||
|
|||
void ChatDataStore::setPassword(QString password) |
|||
{ |
|||
|
|||
_password = password; |
|||
} |
|||
|
|||
QString ChatDataStore::dump() |
|||
{ |
|||
json chats; |
|||
chats["count"] = this->data.size(); |
|||
json j = {}; |
|||
for (auto &c: this->data) |
|||
{ |
|||
j.push_back(c.second.toJson()); |
|||
} |
|||
chats["chatitems"] = j; |
|||
return QString::fromStdString(chats.dump()); |
|||
} |
|||
|
|||
std::map<QString, ChatItem> ChatDataStore::getAllRawChatItems() |
|||
{ |
|||
return this->data; |
|||
} |
|||
|
|||
std::map<QString, ChatItem> ChatDataStore::getAllNewContactRequests() |
|||
{ |
|||
std::map<QString, ChatItem> filteredItems; |
|||
|
|||
for(auto &c: this->data) |
|||
{ |
|||
if ( |
|||
(c.second.isOutgoing() == false) && |
|||
(c.second.getType() == "Cont") && |
|||
(c.second.isContact() == false) && |
|||
(c.second.getMemo().startsWith("{")) |
|||
|
|||
) |
|||
|
|||
{ |
|||
filteredItems[c.first] = c.second; |
|||
} |
|||
} |
|||
return filteredItems; |
|||
} |
|||
|
|||
std::map<QString, ChatItem> ChatDataStore::getAllOldContactRequests() |
|||
{ |
|||
std::map<QString, ChatItem> filteredItems; |
|||
|
|||
for(auto &c: this->data) |
|||
{ |
|||
if ( |
|||
(c.second.isOutgoing() == false) && |
|||
(c.second.getType() == "Cont") && |
|||
(c.second.isContact() == true) && |
|||
(c.second.getMemo().startsWith("{")) |
|||
) |
|||
{ |
|||
filteredItems[c.first] = c.second; |
|||
} |
|||
} |
|||
return filteredItems; |
|||
} |
|||
|
|||
std::map<QString, ChatItem> ChatDataStore::getAllMemos() |
|||
{ |
|||
std::map<QString, ChatItem> filteredItems; |
|||
for(auto &c: this->data) |
|||
{ |
|||
if ( |
|||
|
|||
(c.second.getMemo().startsWith("{") == false) && |
|||
(c.second.getMemo().isEmpty() == false) |
|||
|
|||
|
|||
) |
|||
{ |
|||
filteredItems[c.first] = c.second; |
|||
} |
|||
} |
|||
return filteredItems; |
|||
} |
|||
|
|||
|
|||
ChatDataStore* ChatDataStore::instance = nullptr; |
|||
bool ChatDataStore::instanced = false; |
@ -0,0 +1,44 @@ |
|||
#ifndef CHATDATASTORE_H |
|||
#define CHATDATASTORE_H |
|||
#include "../chatmodel.h" |
|||
using json = nlohmann::json; |
|||
|
|||
class ChatDataStore |
|||
{ |
|||
private: |
|||
static bool instanced; |
|||
static ChatDataStore* instance; |
|||
Ui::MainWindow* ui; |
|||
MainWindow* main; |
|||
std::map<QString, ChatItem> data; |
|||
ChatDataStore() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public: |
|||
static ChatDataStore* getInstance(); |
|||
void clear(); |
|||
void setData(QString key, ChatItem value); |
|||
ChatItem getData(QString key); |
|||
std::map<QString, ChatItem> getAllRawChatItems(); |
|||
std::map<QString, ChatItem> getAllNewContactRequests(); |
|||
std::map<QString, ChatItem> getAllOldContactRequests(); |
|||
std::map<QString, ChatItem> getAllMemos(); |
|||
QString getPassword(); |
|||
|
|||
void setPassword(QString Password); |
|||
QString _password; |
|||
|
|||
QString dump(); |
|||
|
|||
~ChatDataStore() |
|||
{ |
|||
ChatDataStore::instanced = false; |
|||
ChatDataStore::instance = nullptr; |
|||
} |
|||
}; |
|||
|
|||
|
|||
|
|||
#endif |
@ -0,0 +1,50 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
|
|||
#include "ContactDataStore.h" |
|||
#include <string> |
|||
|
|||
ContactDataStore* ContactDataStore::getInstance() |
|||
{ |
|||
if(!ContactDataStore::instanced) |
|||
{ |
|||
ContactDataStore::instanced = true; |
|||
ContactDataStore::instance = new ContactDataStore(); |
|||
} |
|||
|
|||
return ContactDataStore::instance; |
|||
} |
|||
|
|||
void ContactDataStore::clear() |
|||
{ |
|||
this->data.clear(); |
|||
} |
|||
|
|||
|
|||
void ContactDataStore::setData(QString key, ContactItem value) |
|||
{ |
|||
this->data[key] = value; |
|||
} |
|||
|
|||
ContactItem ContactDataStore::getData(QString key) |
|||
{ |
|||
return this->data[key]; |
|||
} |
|||
|
|||
QString ContactDataStore::dump() |
|||
{ |
|||
json contacts; |
|||
contacts["count"] = this->data.size(); |
|||
json j = {}; |
|||
for (auto &c: this->data) |
|||
{ |
|||
qDebug() << c.second.toQTString(); |
|||
c.second.toJson(); |
|||
j.push_back(c.second.toJson()); |
|||
} |
|||
contacts["contacts"] = j; |
|||
return QString::fromStdString(contacts.dump(4)); |
|||
} |
|||
|
|||
ContactDataStore* ContactDataStore::instance = nullptr; |
|||
bool ContactDataStore::instanced = false; |
@ -0,0 +1,34 @@ |
|||
#ifndef CONTACTDATASTORE_H |
|||
#define CONTACTDATASTORE_H |
|||
#include "../Model/ContactItem.h" |
|||
#include <string> |
|||
using json = nlohmann::json; |
|||
|
|||
class ContactDataStore |
|||
{ |
|||
private: |
|||
static bool instanced; |
|||
static ContactDataStore* instance; |
|||
std::map<QString, ContactItem> data; |
|||
ContactDataStore() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public: |
|||
static ContactDataStore* getInstance(); |
|||
void clear(); |
|||
void setData(QString key, ContactItem value); |
|||
ContactItem getData(QString key); |
|||
QString dump(); |
|||
|
|||
~ContactDataStore() |
|||
{ |
|||
ContactDataStore::instanced = false; |
|||
ContactDataStore::instance = nullptr; |
|||
} |
|||
}; |
|||
|
|||
|
|||
|
|||
#endif |
@ -0,0 +1,58 @@ |
|||
#ifndef DATASTORE_H |
|||
#define DATASTORE_H |
|||
|
|||
#include <QString> |
|||
#include <map> |
|||
|
|||
template <class T> |
|||
class DataStore |
|||
{ |
|||
private: |
|||
static bool instanced; |
|||
static DataStore<T>* instance; |
|||
std::map<QString, T> data; |
|||
DataStore() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public: |
|||
static DataStore<T>* getInstance() |
|||
{ |
|||
if(!DataStore<T>::instanced) |
|||
{ |
|||
DataStore<T>::instanced = true; |
|||
DataStore<T>::instance = new DataStore<T>(); |
|||
} |
|||
|
|||
return DataStore<T>::instance; |
|||
} |
|||
|
|||
void clear(); |
|||
void setData(QString key, T value); |
|||
QString getData(QString key); |
|||
|
|||
~DataStore() |
|||
{ |
|||
DataStore<T>::instanced = false; |
|||
} |
|||
}; |
|||
|
|||
template <class T> |
|||
void DataStore<T>::clear() |
|||
{ |
|||
this->data.clear(); |
|||
} |
|||
|
|||
template <class T> |
|||
void DataStore<T>::setData(QString key, T value) |
|||
{ |
|||
this->data[key] = value; |
|||
} |
|||
|
|||
template <class T> |
|||
QString DataStore<T>::getData(QString key) |
|||
{ |
|||
return this->data[key]; |
|||
} |
|||
#endif |
@ -0,0 +1,16 @@ |
|||
#include "DataStore.h" |
|||
|
|||
SietchDataStore* DataStore::getSietchDataStore() |
|||
{ |
|||
return SietchDataStore::getInstance(); |
|||
} |
|||
|
|||
ChatDataStore* DataStore::getChatDataStore() |
|||
{ |
|||
return ChatDataStore::getInstance(); |
|||
} |
|||
|
|||
ContactDataStore* DataStore::getContactDataStore() |
|||
{ |
|||
return ContactDataStore::getInstance(); |
|||
} |
@ -0,0 +1,16 @@ |
|||
#ifndef DATASTORE_H |
|||
#define DATASTORE_H |
|||
|
|||
#include "SietchDataStore.h" |
|||
#include "ChatDataStore.h" |
|||
#include "ContactDataStore.h" |
|||
|
|||
class DataStore |
|||
{ |
|||
public: |
|||
static SietchDataStore* getSietchDataStore(); |
|||
static ChatDataStore* getChatDataStore(); |
|||
static ContactDataStore* getContactDataStore(); |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,35 @@ |
|||
#include "SietchDataStore.h" |
|||
|
|||
SietchDataStore* SietchDataStore::getInstance() |
|||
{ |
|||
if(!SietchDataStore::instanced) |
|||
{ |
|||
SietchDataStore::instanced = true; |
|||
SietchDataStore::instance = new SietchDataStore(); |
|||
} |
|||
|
|||
return SietchDataStore::instance; |
|||
} |
|||
|
|||
void SietchDataStore::clear() |
|||
{ |
|||
this->data.clear(); |
|||
} |
|||
|
|||
void SietchDataStore::setData(QString key, QString value) |
|||
{ |
|||
this->data[key] = value; |
|||
} |
|||
|
|||
QString SietchDataStore::getData(QString key) |
|||
{ |
|||
return this->data[key]; |
|||
} |
|||
|
|||
QString SietchDataStore::dump() |
|||
{ |
|||
return ""; |
|||
} |
|||
|
|||
SietchDataStore* SietchDataStore::instance = nullptr; |
|||
bool SietchDataStore::instanced = false; |
@ -0,0 +1,31 @@ |
|||
#ifndef SIETCHDATASTORE_H |
|||
#define SIETCHDATASTORE_H |
|||
|
|||
using json = nlohmann::json; |
|||
|
|||
class SietchDataStore |
|||
{ |
|||
private: |
|||
static bool instanced; |
|||
static SietchDataStore* instance; |
|||
std::map<QString, QString> data; |
|||
SietchDataStore() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public: |
|||
static SietchDataStore* getInstance(); |
|||
void clear(); |
|||
void setData(QString key, QString value); |
|||
QString getData(QString key); |
|||
QString dump(); |
|||
|
|||
~SietchDataStore() |
|||
{ |
|||
SietchDataStore::instanced = false; |
|||
SietchDataStore::instance = nullptr; |
|||
} |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,127 @@ |
|||
#include "FileSystem.h" |
|||
|
|||
#include <QString> |
|||
#include <QList> |
|||
|
|||
FileSystem::FileSystem() |
|||
{ |
|||
} |
|||
|
|||
FileSystem* FileSystem::getInstance() |
|||
{ |
|||
if(!FileSystem::instanced) |
|||
{ |
|||
FileSystem::instanced = true; |
|||
FileSystem::instance = new FileSystem(); |
|||
FileEncryption::showConfig(); |
|||
} |
|||
|
|||
return FileSystem::instance; |
|||
} |
|||
|
|||
/*QList<ContactItem> FileSystem::readContacts(QString file)
|
|||
{ |
|||
//return this->readContactsOldFormat(file); //will be called if addresses are in the old dat-format
|
|||
|
|||
QFile _file(file); |
|||
if (_file.exists()) |
|||
{ |
|||
std::ifstream f(file.toStdString().c_str(), std::ios::binary); |
|||
if(f.is_open()) |
|||
{ |
|||
std::vector<unsigned char> buffer(std::istreambuf_iterator<char>(f), {}); |
|||
//todo covert to string to use is as json to feed the data store in addressbook
|
|||
} |
|||
|
|||
f.close(); |
|||
} |
|||
else |
|||
{ |
|||
qInfo() << file << "not exist"; |
|||
} |
|||
} |
|||
|
|||
void FileSystem::writeContacts(QString file, QString data) |
|||
{ |
|||
qDebug() << data; |
|||
QFile _file(file); |
|||
if (_file.exists()) |
|||
{ |
|||
std::ofstream f(file.toStdString().c_str()); |
|||
if(f.is_open()) |
|||
{ |
|||
//ENCRYPT HERE
|
|||
|
|||
f << data.toStdString(); |
|||
} |
|||
|
|||
f.close(); |
|||
} |
|||
else |
|||
{ |
|||
qInfo() << file << "not exist"; |
|||
} |
|||
} |
|||
|
|||
void FileSystem::writeContactsOldFormat(QString file, QList<ContactItem> contacts) |
|||
{ |
|||
QFile _file(file); |
|||
_file.open(QIODevice::ReadWrite | QIODevice::Truncate); |
|||
QDataStream out(&_file); // we will serialize the data into the file
|
|||
QList<QList<QString>> _contacts; |
|||
for(auto &item: contacts) |
|||
{ |
|||
QList<QString> c; |
|||
c.push_back(item.getName()); |
|||
c.push_back(item.getPartnerAddress()); |
|||
c.push_back(item.getMyAddress()); |
|||
c.push_back(item.getCid()); |
|||
c.push_back(item.getAvatar()); |
|||
_contacts.push_back(c); |
|||
} |
|||
out << QString("v0") << _contacts; |
|||
_file.close(); |
|||
} |
|||
|
|||
QList<ContactItem> FileSystem::readContactsOldFormat(QString file) |
|||
{ |
|||
QList<ContactItem> contacts; |
|||
QFile _file(file); |
|||
if (_file.exists()) |
|||
{ |
|||
contacts.clear(); |
|||
_file.open(QIODevice::ReadOnly); |
|||
QDataStream in(&_file); // read the data serialized from the file
|
|||
QString version; |
|||
in >> version; |
|||
qDebug() << "Read " << version << " Hush contacts from disk..."; |
|||
qDebug() << "Detected old addressbook format"; |
|||
QList<QList<QString>> stuff; |
|||
in >> stuff; |
|||
//qDebug() << "Stuff: " << stuff;
|
|||
for (int i=0; i < stuff.size(); i++) |
|||
{ |
|||
ContactItem contact = ContactItem(stuff[i][0],stuff[i][1], stuff[i][2], stuff[i][3],stuff[i][4]); |
|||
contacts.push_back(contact); |
|||
|
|||
} |
|||
|
|||
_file.close(); |
|||
} |
|||
else |
|||
{ |
|||
qDebug() << "No Hush contacts found on disk!"; |
|||
} |
|||
|
|||
return contacts; |
|||
} |
|||
|
|||
FileSystem::~FileSystem() |
|||
{ |
|||
this->instance = nullptr; |
|||
this->instanced = false; |
|||
delete this->instance; |
|||
}*/ |
|||
|
|||
FileSystem *FileSystem::instance = nullptr; |
|||
bool FileSystem::instanced = false; |
@ -0,0 +1,31 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
#ifndef FILESYSTEM_H |
|||
#define FILESYSTEM_H |
|||
|
|||
#include <QString> |
|||
#include <QList> |
|||
#include "../Model/ContactItem.h" |
|||
#include "../Crypto/FileEncryption.h" |
|||
#include <fstream> |
|||
using json = nlohmann::json; |
|||
class FileSystem |
|||
{ |
|||
private: |
|||
static bool instanced; |
|||
static FileSystem* instance; |
|||
FileSystem(); |
|||
|
|||
public: |
|||
static FileSystem* getInstance(); |
|||
QList<ContactItem> readContacts(QString file); |
|||
void writeContacts(QString file, QString data); |
|||
|
|||
//converter
|
|||
QList<ContactItem> readContactsOldFormat(QString file); |
|||
void writeContactsOldFormat(QString file, QList<ContactItem> contacts); |
|||
~FileSystem(); |
|||
|
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,11 @@ |
|||
#ifndef LOGCONTEXT_H |
|||
#define LOGCONTEXT_H |
|||
|
|||
#include <string> |
|||
class LogContext |
|||
{ |
|||
public: |
|||
virtual void log(std::string message) {}; |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,18 @@ |
|||
#ifndef LOGCRITICAL_H |
|||
#define LOGCRITICAL_H |
|||
|
|||
#include "LogType.h" |
|||
#include "LogStrategy.h" |
|||
#include "LogWriter.h" |
|||
|
|||
class LogCritical : public LogStrategy |
|||
{ |
|||
public: |
|||
void log(std::string message) |
|||
{ |
|||
LogWriter* lw = LogWriter::getInstance(); |
|||
lw->write(LogType::CRITICAL, message); |
|||
} |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,18 @@ |
|||
#ifndef LOGDEBUG_H |
|||
#define LOGDEBUG_H |
|||
|
|||
#include "LogType.h" |
|||
#include "LogStrategy.h" |
|||
#include "LogWriter.h" |
|||
|
|||
class LogDebug : public LogStrategy |
|||
{ |
|||
public: |
|||
void log(std::string message) |
|||
{ |
|||
LogWriter* lw = LogWriter::getInstance(); |
|||
lw->write(LogType::DEBUG, message); |
|||
} |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,18 @@ |
|||
#ifndef LOGERROR_H |
|||
#define LOGERROR_H |
|||
|
|||
#include "LogType.h" |
|||
#include "LogStrategy.h" |
|||
#include "LogWriter.h" |
|||
|
|||
class LogError : public LogStrategy |
|||
{ |
|||
public: |
|||
void log(std::string message) |
|||
{ |
|||
LogWriter* lw = LogWriter::getInstance(); |
|||
lw->write(LogType::ERROR, message); |
|||
} |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,18 @@ |
|||
#ifndef LOGFATAL_H |
|||
#define LOGFATAL_H |
|||
|
|||
#include "LogType.h" |
|||
#include "LogStrategy.h" |
|||
#include "LogWriter.h" |
|||
|
|||
class LogFatal : public LogStrategy |
|||
{ |
|||
public: |
|||
void log(std::string message) |
|||
{ |
|||
LogWriter* lw = LogWriter::getInstance(); |
|||
lw->write(LogType::FATAL, message); |
|||
} |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,18 @@ |
|||
#ifndef LOGINFO_H |
|||
#define LOGINFO_H |
|||
|
|||
#include "LogType.h" |
|||
#include "LogStrategy.h" |
|||
#include "LogWriter.h" |
|||
|
|||
class LogInfo : public LogStrategy |
|||
{ |
|||
public: |
|||
void log(std::string message) |
|||
{ |
|||
LogWriter* lw = LogWriter::getInstance(); |
|||
lw->write(LogType::INFO, message); |
|||
} |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,11 @@ |
|||
#ifndef LOGSTRATEGY_H |
|||
#define LOGSTRATEGY_H |
|||
|
|||
#include <string> |
|||
class LogStrategy |
|||
{ |
|||
public: |
|||
virtual void log(std::string message) {}; |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,18 @@ |
|||
#ifndef LOGSUCCESS_H |
|||
#define LOGSUCCESS_H |
|||
|
|||
#include "LogType.h" |
|||
#include "LogStrategy.h" |
|||
#include "LogWriter.h" |
|||
|
|||
class LogSuccess : public LogStrategy |
|||
{ |
|||
public: |
|||
void log(std::string message) |
|||
{ |
|||
LogWriter* lw = LogWriter::getInstance(); |
|||
lw->write(LogType::SUCCESS, message); |
|||
} |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,47 @@ |
|||
#ifndef LOGTYPE_H |
|||
#define LOGTYPE_H |
|||
|
|||
#include <string> |
|||
|
|||
class LogType |
|||
{ |
|||
public: |
|||
enum TYPE { |
|||
INFO = 0, |
|||
DEBUG = 1, |
|||
SUCCESS = 2, |
|||
WARNING = 3, |
|||
ERROR = 4, |
|||
FATAL = 5, |
|||
CRITICAL = 6 |
|||
}; |
|||
|
|||
static std::string enum2String(int type) |
|||
{ |
|||
switch (type) |
|||
{ |
|||
default: |
|||
case 0: |
|||
return "INFO"; |
|||
|
|||
case 1: |
|||
return "DEBUG"; |
|||
|
|||
case 2: |
|||
return "SUCCESS"; |
|||
|
|||
case 3: |
|||
return "WARNING"; |
|||
|
|||
case 4: |
|||
return "ERROR"; |
|||
|
|||
case 5: |
|||
return "FATAL"; |
|||
|
|||
case 6: |
|||
return "CRITICAL"; |
|||
} |
|||
} |
|||
}; |
|||
#endif |
@ -0,0 +1,18 @@ |
|||
#ifndef LOGWARNING_H |
|||
#define LOGWARNING_H |
|||
|
|||
#include "LogType.h" |
|||
#include "LogStrategy.h" |
|||
#include "LogWriter.h" |
|||
|
|||
class LogWarning : public LogStrategy |
|||
{ |
|||
public: |
|||
void log(std::string message) |
|||
{ |
|||
LogWriter* lw = LogWriter::getInstance(); |
|||
lw->write(LogType::WARNING, message); |
|||
} |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,35 @@ |
|||
#include "LogWriter.h" |
|||
|
|||
LogWriter* LogWriter::getInstance() |
|||
{ |
|||
if(instance == nullptr) |
|||
instance = new LogWriter(); |
|||
|
|||
return instance; |
|||
} |
|||
|
|||
void LogWriter::setLogFile(std::string file) |
|||
{ |
|||
this->logfile = file; |
|||
} |
|||
|
|||
void LogWriter::write(LogType::TYPE type, std::string message) |
|||
{ |
|||
std::ofstream writer(this->logfile, std::ios::out | std::ios::app); |
|||
if(writer.good()) |
|||
{ |
|||
time_t now = time(0); |
|||
tm *ltm = localtime(&now); |
|||
std::stringstream ss; |
|||
ss << "[" << LogType::enum2String(type) << "] " << |
|||
ltm->tm_mon << "-" << |
|||
ltm->tm_mday << "-" << |
|||
(1900 + ltm->tm_year) << " " << |
|||
ltm->tm_hour << ":" << |
|||
ltm->tm_min << ":" << |
|||
ltm->tm_sec << " > " << message; |
|||
writer << ss.str() << "\n"; |
|||
} |
|||
|
|||
writer.close(); |
|||
} |
@ -0,0 +1,22 @@ |
|||
#ifndef LOGWRITER_H |
|||
#define LOGWRITER_H |
|||
|
|||
#include <string> |
|||
#include <fstream> |
|||
#include <sstream> |
|||
#include <ctime> |
|||
#include "LogType.h" |
|||
|
|||
class LogWriter |
|||
{ |
|||
public: |
|||
static LogWriter* getInstance(); |
|||
std::string logfile = ""; |
|||
void setLogFile(std::string file); |
|||
void write(LogType::TYPE t, std::string message); |
|||
|
|||
private: |
|||
static LogWriter* instance; |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,25 @@ |
|||
#ifndef LOGGER_H |
|||
#define LOGGER_H |
|||
|
|||
#include "LogContext.h" |
|||
#include "LogStrategy.h" |
|||
#include "LogWriter.h" |
|||
|
|||
class Logger : LogContext |
|||
{ |
|||
private: |
|||
LogStrategy * strategy = nullptr; |
|||
|
|||
public: |
|||
Logger(LogStrategy * strategy) |
|||
{ |
|||
this->strategy = strategy; |
|||
} |
|||
|
|||
void log(std::string message) |
|||
{ |
|||
this->strategy->log(message); |
|||
} |
|||
}; |
|||
LogWriter* LogWriter::instance = nullptr; |
|||
#endif |
@ -0,0 +1,84 @@ |
|||
#ifndef SIMPLELOGGER_H |
|||
#define SIMPLELOGGER_H |
|||
|
|||
#include "Logger.h" |
|||
#include "LogInfo.h" |
|||
#include "LogDebug.h" |
|||
#include "LogSuccess.h" |
|||
#include "LogWarning.h" |
|||
#include "LogError.h" |
|||
#include "LogFatal.h" |
|||
#include "LogCrtitical.h" |
|||
#include "LogWriter.h" |
|||
|
|||
class SimpleLogger |
|||
{ |
|||
public: |
|||
SimpleLogger() |
|||
{ |
|||
LogWriter::getInstance()->setLogFile("log.txt"); |
|||
} |
|||
|
|||
SimpleLogger(std::string logFile) |
|||
{ |
|||
LogWriter::getInstance()->setLogFile(logFile); |
|||
} |
|||
|
|||
void logInfo(std::string message) |
|||
{ |
|||
Logger* logger = nullptr; |
|||
LogStrategy* li = new LogInfo(); |
|||
logger = new Logger(li); |
|||
logger->log(message); |
|||
} |
|||
|
|||
void logDebug(std::string message) |
|||
{ |
|||
Logger* logger = nullptr; |
|||
LogStrategy* li = new LogDebug(); |
|||
logger = new Logger(li); |
|||
logger->log(message); |
|||
} |
|||
|
|||
void logSuccess(std::string message) |
|||
{ |
|||
Logger* logger = nullptr; |
|||
LogStrategy* li = new LogSuccess(); |
|||
logger = new Logger(li); |
|||
logger->log(message); |
|||
} |
|||
|
|||
void logWarning(std::string message) |
|||
{ |
|||
Logger* logger = nullptr; |
|||
LogStrategy* li = new LogWarning(); |
|||
logger = new Logger(li); |
|||
logger->log(message); |
|||
} |
|||
|
|||
void logError(std::string message) |
|||
{ |
|||
Logger* logger = nullptr; |
|||
LogStrategy* li = new LogError(); |
|||
logger = new Logger(li); |
|||
logger->log(message); |
|||
} |
|||
|
|||
void logFatal(std::string message) |
|||
{ |
|||
Logger* logger = nullptr; |
|||
LogStrategy* li = new LogFatal(); |
|||
logger = new Logger(li); |
|||
logger->log(message); |
|||
} |
|||
|
|||
void logCritical(std::string message) |
|||
{ |
|||
Logger* logger = nullptr; |
|||
LogStrategy* li = new LogCritical(); |
|||
logger = new Logger(li); |
|||
logger->log(message); |
|||
} |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,14 @@ |
|||
#include "SimpleLogger.h" |
|||
|
|||
int main(int argc, char** argv) |
|||
{ |
|||
SimpleLogger sl = SimpleLogger("/tmp/simplelog.log"); |
|||
sl.logInfo("test info"); |
|||
sl.logDebug("test debug"); |
|||
sl.logSuccess("test success"); |
|||
sl.logWarning("test warning"); |
|||
sl.logError("test error"); |
|||
sl.logFatal("test fatal"); |
|||
sl.logCritical("test critical"); |
|||
return 0; |
|||
} |
@ -0,0 +1,206 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
|
|||
#include "ChatItem.h" |
|||
|
|||
ChatItem::ChatItem() {} |
|||
|
|||
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize, bool iscontact) |
|||
{ |
|||
_timestamp = timestamp; |
|||
_address = address; |
|||
_contact = contact; |
|||
_memo = memo; |
|||
_requestZaddr = requestZaddr; |
|||
_type = type; |
|||
_cid = cid; |
|||
_txid = txid; |
|||
_confirmations = confirmations; |
|||
_outgoing = false; |
|||
_notarize = notarize; |
|||
_iscontact = iscontact; |
|||
} |
|||
|
|||
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize, bool iscontact) |
|||
{ |
|||
_timestamp = timestamp; |
|||
_address = address; |
|||
_contact = contact; |
|||
_memo = memo; |
|||
_requestZaddr = requestZaddr; |
|||
_type = type; |
|||
_cid = cid; |
|||
_txid = txid; |
|||
_confirmations = confirmations; |
|||
_outgoing = outgoing; |
|||
_notarize = notarize; |
|||
_iscontact = iscontact; |
|||
|
|||
} |
|||
|
|||
long ChatItem::getTimestamp() |
|||
{ |
|||
return _timestamp; |
|||
} |
|||
|
|||
QString ChatItem::getAddress() |
|||
{ |
|||
return _address; |
|||
} |
|||
|
|||
QString ChatItem::getContact() |
|||
{ |
|||
return _contact; |
|||
} |
|||
|
|||
QString ChatItem::getMemo() |
|||
{ |
|||
return _memo; |
|||
} |
|||
|
|||
QString ChatItem::getRequestZaddr() |
|||
{ |
|||
return _requestZaddr; |
|||
} |
|||
QString ChatItem::getType() |
|||
{ |
|||
return _type; |
|||
} |
|||
|
|||
QString ChatItem::getCid() |
|||
{ |
|||
return _cid; |
|||
} |
|||
|
|||
QString ChatItem::getTxid() |
|||
{ |
|||
return _txid; |
|||
} |
|||
int ChatItem::getConfirmations() |
|||
{ |
|||
return _confirmations; |
|||
} |
|||
|
|||
bool ChatItem::isOutgoing() |
|||
{ |
|||
return _outgoing; |
|||
} |
|||
|
|||
bool ChatItem::isNotarized() |
|||
{ |
|||
return _notarize; |
|||
} |
|||
|
|||
bool ChatItem::isContact() |
|||
{ |
|||
return _iscontact; |
|||
} |
|||
|
|||
void ChatItem::setTimestamp(long timestamp) |
|||
{ |
|||
_timestamp = timestamp; |
|||
} |
|||
|
|||
void ChatItem::setAddress(QString address) |
|||
{ |
|||
_address = address; |
|||
} |
|||
|
|||
void ChatItem::setContact(QString contact) |
|||
{ |
|||
_contact = contact; |
|||
} |
|||
|
|||
void ChatItem::setMemo(QString memo) |
|||
{ |
|||
_memo = memo; |
|||
} |
|||
|
|||
void ChatItem::setRequestZaddr(QString requestZaddr) |
|||
{ |
|||
_requestZaddr = requestZaddr; |
|||
} |
|||
|
|||
void ChatItem::setType(QString type) |
|||
{ |
|||
_type = type; |
|||
} |
|||
|
|||
void ChatItem::setCid(QString cid) |
|||
{ |
|||
_cid = cid; |
|||
} |
|||
void ChatItem::setTxid(QString txid) |
|||
{ |
|||
_txid = txid; |
|||
} |
|||
void ChatItem::setConfirmations(int confirmations) |
|||
{ |
|||
_confirmations = confirmations; |
|||
} |
|||
|
|||
void ChatItem::toggleOutgo() |
|||
{ |
|||
_outgoing = true; |
|||
} |
|||
void ChatItem::notarized() |
|||
{ |
|||
_notarize = false; |
|||
} |
|||
|
|||
void ChatItem::contact(bool iscontact) |
|||
{ |
|||
_iscontact = iscontact; |
|||
} |
|||
|
|||
|
|||
QString ChatItem::toChatLine() |
|||
{ |
|||
QDateTime myDateTime; |
|||
QString lock; |
|||
myDateTime.setTime_t(_timestamp); |
|||
|
|||
if (_notarize == true) |
|||
|
|||
{ |
|||
|
|||
lock = "<b> <img src=':/icons/res/lock_orange.png'><b>"; |
|||
|
|||
}else{ |
|||
|
|||
lock = "<b> <img src=':/icons/res/unlocked.png'><b>"; |
|||
} |
|||
if ((_confirmations > 0) && (_notarize == false)) |
|||
|
|||
{ |
|||
|
|||
lock = "<b> <img src=':/icons/res/lock_green.png'><b>"; |
|||
} |
|||
|
|||
|
|||
QString line = QString("<small>") + myDateTime.toString("yyyy-MM-dd hh:mm"); |
|||
line += QString(lock) + QString("</small>"); |
|||
line +=QString("<p>") + _memo.toHtmlEscaped() + QString("</p>"); |
|||
return line; |
|||
} |
|||
|
|||
json ChatItem::toJson() |
|||
{ |
|||
json j; |
|||
j["_timestamp"] = _timestamp; |
|||
j["_address"] = _address.toStdString(); |
|||
j["_contact"] = _contact.toStdString(); |
|||
j["_memo"] = _memo.toStdString(); |
|||
j["_requestZaddr"] = _requestZaddr.toStdString(); |
|||
j["_type"] = _type.toStdString(); |
|||
j["_cid"] = _cid.toStdString(); |
|||
j["_txid"] = _txid.toStdString(); |
|||
j["_confirmations"] = _confirmations; |
|||
j["_outgoing"] = _outgoing; |
|||
return j; |
|||
} |
|||
|
|||
ChatItem::~ChatItem() |
|||
{ |
|||
|
|||
} |
@ -0,0 +1,60 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
|
|||
#ifndef CHATITEM_H |
|||
#define CHATITEM_H |
|||
|
|||
#include <QString> |
|||
using json = nlohmann::json; |
|||
|
|||
class ChatItem |
|||
{ |
|||
private: |
|||
long _timestamp; |
|||
QString _address; |
|||
QString _contact; |
|||
QString _memo; |
|||
QString _requestZaddr; |
|||
QString _type; |
|||
QString _cid; |
|||
QString _txid; |
|||
int _confirmations; |
|||
bool _outgoing = false; |
|||
bool _notarize = false; |
|||
bool _iscontact = false; |
|||
|
|||
public: |
|||
ChatItem(); |
|||
ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize, bool iscontact); |
|||
ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize, bool iscontact); |
|||
long getTimestamp(); |
|||
QString getAddress(); |
|||
QString getContact(); |
|||
QString getMemo(); |
|||
QString getRequestZaddr(); |
|||
QString getType(); |
|||
QString getCid(); |
|||
QString getTxid(); |
|||
int getConfirmations(); |
|||
bool isOutgoing(); |
|||
bool isdouble(); |
|||
bool isNotarized(); |
|||
bool isContact(); |
|||
void setTimestamp(long timestamp); |
|||
void setAddress(QString address); |
|||
void setContact(QString contact); |
|||
void setMemo(QString memo); |
|||
void setRequestZaddr(QString requestZaddr); |
|||
void setType(QString type); |
|||
void setCid(QString cid); |
|||
void setTxid(QString txid); |
|||
void setConfirmations(int confirmations); |
|||
void toggleOutgo(); |
|||
void notarized(); |
|||
void contact(bool iscontact); |
|||
QString toChatLine(); |
|||
json toJson(); |
|||
~ChatItem(); |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,98 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
#include "ContactItem.h" |
|||
#include "chatmodel.h" |
|||
#include "Model/ChatItem.h" |
|||
#include "controller.h" |
|||
|
|||
ContactItem::ContactItem() {} |
|||
|
|||
ContactItem::ContactItem(QString name, QString partnerAddress) |
|||
{ |
|||
_name = name; |
|||
_partnerAddress = partnerAddress; |
|||
} |
|||
|
|||
ContactItem::ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid) |
|||
{ |
|||
_name = name; |
|||
_myAddress = myAddress; |
|||
_partnerAddress = partnerAddress; |
|||
_cid = cid; |
|||
|
|||
} |
|||
|
|||
ContactItem::ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid, QString avatar) |
|||
{ |
|||
_name = name; |
|||
_myAddress = myAddress; |
|||
_partnerAddress = partnerAddress; |
|||
_cid = cid; |
|||
_avatar = avatar; |
|||
|
|||
} |
|||
|
|||
QString ContactItem::getName() const |
|||
{ |
|||
return _name; |
|||
} |
|||
|
|||
QString ContactItem::getMyAddress() const |
|||
{ |
|||
return _myAddress; |
|||
} |
|||
|
|||
QString ContactItem::getPartnerAddress() const |
|||
{ |
|||
return _partnerAddress; |
|||
} |
|||
|
|||
QString ContactItem::getCid() const |
|||
{ |
|||
return _cid; |
|||
} |
|||
|
|||
QString ContactItem::getAvatar() const |
|||
{ |
|||
return _avatar; |
|||
} |
|||
|
|||
void ContactItem::setName(QString name) |
|||
{ |
|||
_name = name; |
|||
} |
|||
|
|||
void ContactItem::setMyAddress(QString myAddress) |
|||
{ |
|||
_myAddress = myAddress; |
|||
} |
|||
|
|||
void ContactItem::setPartnerAddress(QString partnerAddress) |
|||
{ |
|||
_partnerAddress = partnerAddress; |
|||
} |
|||
|
|||
void ContactItem::setcid(QString cid) |
|||
{ |
|||
_cid = cid; |
|||
} |
|||
void ContactItem::setAvatar(QString avatar) |
|||
{ |
|||
_avatar = avatar; |
|||
} |
|||
|
|||
QString ContactItem::toQTString() |
|||
{ |
|||
return _name + "|" + _partnerAddress + "|" + _myAddress + "|" + _cid + "|" + _avatar; |
|||
} |
|||
|
|||
json ContactItem::toJson() |
|||
{ |
|||
json j; |
|||
j["_myAddress"] = _myAddress.toStdString(); |
|||
j["_partnerAddress"] = _partnerAddress.toStdString(); |
|||
j["_name"] = _name.toStdString(); |
|||
j["_cid"] = _cid.toStdString(); |
|||
j["_avatar"] = _avatar.toStdString(); |
|||
return j; |
|||
} |
@ -0,0 +1,40 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
#ifndef CONTACTITEM_H |
|||
#define CONTACTITEM_H |
|||
|
|||
#include <vector> |
|||
#include <QString> |
|||
#include "mainwindow.h" |
|||
using json = nlohmann::json; |
|||
|
|||
class ContactItem |
|||
{ |
|||
private: |
|||
QString _myAddress; |
|||
QString _partnerAddress; |
|||
QString _name; |
|||
QString _cid; |
|||
QString _avatar; |
|||
QString _pubkey; |
|||
|
|||
public: |
|||
ContactItem(); |
|||
ContactItem(QString name, QString partnerAddress); |
|||
ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid); |
|||
ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid, QString avatar); |
|||
QString getName() const; |
|||
QString getMyAddress() const; |
|||
QString getPartnerAddress() const; |
|||
QString getCid() const; |
|||
QString getAvatar() const; |
|||
void setName(QString name); |
|||
void setMyAddress(QString myAddress); |
|||
void setPartnerAddress(QString partnerAddress); |
|||
void setcid(QString cid); |
|||
void setAvatar(QString avatar); |
|||
QString toQTString(); |
|||
json toJson(); |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,96 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
|
|||
#include "ContactRequest.h" |
|||
|
|||
ContactRequest::ContactRequest() {} |
|||
|
|||
ContactRequest::ContactRequest(QString sender, QString receiver, QString memo, QString cid, QString label, QString avatar) |
|||
{ |
|||
_senderAddress = sender; |
|||
_receiverAddress = receiver; |
|||
_memo = memo; |
|||
_cid = cid; |
|||
_label = label; |
|||
_avatar = avatar; |
|||
} |
|||
|
|||
QString ContactRequest::getSenderAddress() |
|||
{ |
|||
return _senderAddress; |
|||
} |
|||
|
|||
QString ContactRequest::getReceiverAddress() |
|||
{ |
|||
return _receiverAddress; |
|||
} |
|||
|
|||
QString ContactRequest::getMemo() |
|||
{ |
|||
return _memo; |
|||
} |
|||
|
|||
QString ContactRequest::getCid() |
|||
{ |
|||
return _cid; |
|||
} |
|||
|
|||
QString ContactRequest::getLabel() |
|||
{ |
|||
return _label; |
|||
} |
|||
|
|||
QString ContactRequest::getAvatar() |
|||
{ |
|||
return _avatar; |
|||
} |
|||
|
|||
void ContactRequest::setSenderAddress(QString address) |
|||
{ |
|||
_senderAddress = address; |
|||
} |
|||
|
|||
void ContactRequest::setReceiverAddress(QString address) |
|||
{ |
|||
_receiverAddress = address; |
|||
} |
|||
|
|||
void ContactRequest::setMemo(QString memo) |
|||
{ |
|||
_memo = memo; |
|||
} |
|||
|
|||
void ContactRequest::setCid(QString cid) |
|||
{ |
|||
_cid = cid; |
|||
} |
|||
|
|||
void ContactRequest::setLabel(QString label) |
|||
{ |
|||
_label = label; |
|||
} |
|||
|
|||
void ContactRequest::setAvatar(QString avatar) |
|||
{ |
|||
_avatar = avatar; |
|||
} |
|||
|
|||
QString ContactRequest::toString() |
|||
{ |
|||
return "sender: " + _senderAddress + " receiver: " + _receiverAddress + " memo: " + _memo + " cid: " + _cid + " label: " + _label + " avatar: " + _avatar; |
|||
} |
|||
|
|||
void ContactRequest::clear() |
|||
{ |
|||
_senderAddress = ""; |
|||
_receiverAddress = ""; |
|||
_memo = ""; |
|||
_cid = ""; |
|||
_label = ""; |
|||
_avatar = ""; |
|||
} |
|||
|
|||
ContactRequest::~ContactRequest() |
|||
{ |
|||
clear(); |
|||
} |
@ -0,0 +1,40 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
|
|||
#ifndef CONTACTREQUEST_H |
|||
#define CONTACTREQUEST_H |
|||
|
|||
#include <QString> |
|||
using json = nlohmann::json; |
|||
|
|||
class ContactRequest |
|||
{ |
|||
private: |
|||
QString _senderAddress; |
|||
QString _receiverAddress; |
|||
QString _memo; |
|||
QString _cid; |
|||
QString _label; |
|||
QString _avatar; |
|||
|
|||
public: |
|||
ContactRequest(); |
|||
ContactRequest(QString sender, QString receiver, QString memo, QString cid, QString label, QString avatar); |
|||
QString getSenderAddress(); |
|||
QString getReceiverAddress(); |
|||
QString getMemo(); |
|||
QString getCid(); |
|||
QString getLabel(); |
|||
QString getAvatar(); |
|||
void setSenderAddress(QString address); |
|||
void setReceiverAddress(QString contact); |
|||
void setMemo(QString memo); |
|||
void setCid(QString cid); |
|||
void setLabel(QString label); |
|||
void setAvatar(QString avatar); |
|||
QString toString(); |
|||
void clear(); |
|||
~ContactRequest(); |
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1 @@ |
|||
#include "ContactRequestChatItem.h" |
@ -0,0 +1,11 @@ |
|||
#ifdef CONTACTREQUESTCHATITEM_H |
|||
#define CONTACTREQUESTCHATITEM_H |
|||
|
|||
#include "ChatItem.h" |
|||
|
|||
class ContactRequestChatItem : ChatItem |
|||
{ |
|||
|
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,14 @@ |
|||
#include "chatbubbleme.h" |
|||
#include "ui_chatbubbleme.h" |
|||
|
|||
ChatBubbleMe::ChatBubbleMe(QWidget *parent) : |
|||
QWidget(parent), |
|||
ui(new Ui::ChatBubbleMe) |
|||
{ |
|||
ui->setupUi(this); |
|||
} |
|||
|
|||
ChatBubbleMe::~ChatBubbleMe() |
|||
{ |
|||
delete ui; |
|||
} |
@ -0,0 +1,22 @@ |
|||
#ifndef CHATBUBBLEME_H |
|||
#define CHATBUBBLEME_H |
|||
|
|||
#include <QWidget> |
|||
|
|||
namespace Ui { |
|||
class ChatBubbleMe; |
|||
} |
|||
|
|||
class ChatBubbleMe : public QWidget |
|||
{ |
|||
Q_OBJECT |
|||
|
|||
public: |
|||
explicit ChatBubbleMe(QWidget *parent = nullptr); |
|||
~ChatBubbleMe(); |
|||
|
|||
private: |
|||
Ui::ChatBubbleMe *ui; |
|||
}; |
|||
|
|||
#endif // CHATBUBBLEME_H
|
@ -0,0 +1,57 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>ChatBubbleMe</class> |
|||
<widget class="QWidget" name="ChatBubbleMe"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>646</width> |
|||
<height>76</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Form</string> |
|||
</property> |
|||
<property name="styleSheet"> |
|||
<string notr="true">QWidget{ |
|||
background: whitesmoke; |
|||
border: 1px solid #afafaf; |
|||
border-radius: 3px; |
|||
} |
|||
QLabel |
|||
{ |
|||
background: none; |
|||
border: none; |
|||
}</string> |
|||
</property> |
|||
<widget class="QLabel" name="lblMessage"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>10</x> |
|||
<y>30</y> |
|||
<width>611</width> |
|||
<height>41</height> |
|||
</rect> |
|||
</property> |
|||
<property name="text"> |
|||
<string>Lorem ipsum dolor sit amet</string> |
|||
</property> |
|||
</widget> |
|||
<widget class="QLabel" name="lblTimestamp"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>10</x> |
|||
<y>10</y> |
|||
<width>611</width> |
|||
<height>17</height> |
|||
</rect> |
|||
</property> |
|||
<property name="text"> |
|||
<string>12/03/2020 12:34</string> |
|||
</property> |
|||
</widget> |
|||
</widget> |
|||
<resources/> |
|||
<connections/> |
|||
</ui> |
@ -0,0 +1,14 @@ |
|||
#include "chatbubblepartner.h" |
|||
#include "ui_chatbubblepartner.h" |
|||
|
|||
ChatBubblePartner::ChatBubblePartner(QWidget *parent) : |
|||
QWidget(parent), |
|||
ui(new Ui::ChatBubblePartner) |
|||
{ |
|||
ui->setupUi(this); |
|||
} |
|||
|
|||
ChatBubblePartner::~ChatBubblePartner() |
|||
{ |
|||
delete ui; |
|||
} |
@ -0,0 +1,22 @@ |
|||
#ifndef CHATBUBBLEPARTNER_H |
|||
#define CHATBUBBLEPARTNER_H |
|||
|
|||
#include <QWidget> |
|||
|
|||
namespace Ui { |
|||
class ChatBubblePartner; |
|||
} |
|||
|
|||
class ChatBubblePartner : public QWidget |
|||
{ |
|||
Q_OBJECT |
|||
|
|||
public: |
|||
explicit ChatBubblePartner(QWidget *parent = nullptr); |
|||
~ChatBubblePartner(); |
|||
|
|||
private: |
|||
Ui::ChatBubblePartner *ui; |
|||
}; |
|||
|
|||
#endif // CHATBUBBLEPARTNER_H
|
@ -0,0 +1,57 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>ChatBubblePartner</class> |
|||
<widget class="QWidget" name="ChatBubblePartner"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>646</width> |
|||
<height>76</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Form</string> |
|||
</property> |
|||
<property name="styleSheet"> |
|||
<string notr="true">QWidget{ |
|||
background: #c8e1ff; |
|||
border: 1px solid #fefefe; |
|||
border-radius: 3px; |
|||
} |
|||
QLabel |
|||
{ |
|||
background: none; |
|||
border: none; |
|||
}</string> |
|||
</property> |
|||
<widget class="QLabel" name="lblMessage"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>10</x> |
|||
<y>30</y> |
|||
<width>611</width> |
|||
<height>41</height> |
|||
</rect> |
|||
</property> |
|||
<property name="text"> |
|||
<string>Lorem ipsum dolor sit amet</string> |
|||
</property> |
|||
</widget> |
|||
<widget class="QLabel" name="lblTimestamp"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>10</x> |
|||
<y>10</y> |
|||
<width>611</width> |
|||
<height>17</height> |
|||
</rect> |
|||
</property> |
|||
<property name="text"> |
|||
<string>12/03/2020 12:34</string> |
|||
</property> |
|||
</widget> |
|||
</widget> |
|||
<resources/> |
|||
<connections/> |
|||
</ui> |
@ -0,0 +1,76 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
|
|||
#ifndef CHATMODEL_H |
|||
#define CHATMODEL_H |
|||
#include <QString> |
|||
#include <QStandardItemModel> |
|||
#include <QAbstractItemDelegate> |
|||
#include <QPainter> |
|||
#include <map> |
|||
#include <vector> |
|||
#include <QListView> |
|||
#include "precompiled.h" |
|||
#include "mainwindow.h" |
|||
#include "controller.h" |
|||
#include "settings.h" |
|||
#include "camount.h" |
|||
#include "Model/ChatItem.h" |
|||
#include "Model/ContactRequest.h" |
|||
#include "Chat/Helper/ChatDelegator.h" |
|||
#include "Chat/Helper/ChatIDGenerator.h" |
|||
|
|||
|
|||
namespace Ui { |
|||
class MainWindow; |
|||
} |
|||
class ChatModel |
|||
{ |
|||
private: |
|||
std::map<QString, ChatItem> chatItems; |
|||
QTableView* parent; |
|||
Ui::MainWindow* ui; |
|||
MainWindow* main; |
|||
std::map<QString, QString> cidMap; |
|||
std::map<QString, QString> requestZaddrMap; |
|||
std::map<QString, QString> confirmationsMap; |
|||
std::map<int, std::tuple<QString, QString, QString>> sendrequestMap; |
|||
std::map<QString, QString> headerMap; |
|||
std::map<QString, QString> AddressbyLabelMap; |
|||
std::map<QString, QString> OldMemoByTx; |
|||
|
|||
|
|||
public: |
|||
ChatModel() {}; |
|||
ChatModel(std::map<QString, ChatItem> chatItems); |
|||
ChatModel(std::vector<ChatItem> chatItems); |
|||
std::map<QString, ChatItem> getItems(); |
|||
void setItems(std::map<QString, ChatItem> items); |
|||
QString zaddr(); |
|||
void setItems(std::vector<ChatItem> items); |
|||
void triggerRequest(); |
|||
void showMessages(); |
|||
void clear(); |
|||
void addAddressbylabel(QString addr, QString label); |
|||
void addMessage(ChatItem item); |
|||
void addMessage(QString timestamp, ChatItem item); |
|||
void addCid(QString tx, QString cid); |
|||
void addHeader(QString tx, QString headerbytes); |
|||
void addMemo(QString tx, QString memo); |
|||
void addrequestZaddr(QString tx, QString requestZaddr); |
|||
void addconfirmations(QString tx, int confirmation); |
|||
void addSendRequest(int i, QString myAddr, QString cid, QString addr ); |
|||
QString getCidByTx(QString tx); |
|||
QString getHeaderByTx(QString tx); |
|||
QString getrequestZaddrByTx(QString tx); |
|||
QString getConfirmationByTx(QString tx); |
|||
QString getMemoByTx(QString tx); |
|||
QString Addressbylabel(QString addr); |
|||
void killCidCache(); |
|||
void killConfirmationCache(); |
|||
void killrequestZaddrCache(); |
|||
void killMemoCache(); |
|||
|
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,159 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
|
|||
#include "contactmodel.h" |
|||
#include "addressbook.h" |
|||
#include "mainwindow.h" |
|||
#include "chatmodel.h" |
|||
#include "requestdialog.h" |
|||
#include "ui_requestdialog.h" |
|||
#include "ui_hushrequest.h" |
|||
#include "settings.h" |
|||
#include "controller.h" |
|||
|
|||
void ContactModel::addLabel(QString addr, QString label) |
|||
{ |
|||
this->AddressMap[addr] = label; |
|||
} |
|||
|
|||
QString ContactModel::getContactbyAddress(QString addr) |
|||
{ |
|||
for(auto& pair : this->AddressMap) |
|||
{ |
|||
|
|||
} |
|||
|
|||
if(this->AddressMap.count(addr) > 0) |
|||
{ |
|||
return this->AddressMap[addr]; |
|||
} |
|||
|
|||
return QString("0xdeadbeef"); |
|||
} |
|||
|
|||
void ContactModel::renderContactList(QListView* view) |
|||
{ |
|||
QStandardItemModel* contact = new QStandardItemModel(); |
|||
|
|||
for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) |
|||
{ |
|||
QString avatar = c.getAvatar(); |
|||
|
|||
QStandardItem* Items1 = new QStandardItem(c.getName()); |
|||
Items1->setData(QIcon(avatar),Qt::DecorationRole); |
|||
|
|||
contact->appendRow(Items1); |
|||
view->setModel(contact); |
|||
view->setIconSize(QSize(60,70)); |
|||
view->setUniformItemSizes(true); |
|||
view->setDragDropMode(QAbstractItemView::DropOnly); |
|||
view->show(); |
|||
QString addr = c.getPartnerAddress(); |
|||
QString label = c.getName(); |
|||
this->addLabel(addr, label); |
|||
} |
|||
} |
|||
|
|||
void MainWindow::showRequesthush() { |
|||
|
|||
Ui_hushrequest req; |
|||
QDialog d(this); |
|||
req.setupUi(&d); |
|||
Settings::saveRestore(&d); |
|||
|
|||
QString label = ui->contactNameMemo->text(); |
|||
for(auto &p : AddressBook::getInstance()->getAllAddressLabels()) |
|||
{ |
|||
|
|||
if (p.getName() == label) |
|||
|
|||
{ |
|||
|
|||
QString addr = p.getPartnerAddress(); |
|||
QString myzaddr = p.getMyAddress(); |
|||
|
|||
req.txtFrom->setText(addr); |
|||
req.lblAddressInfo->setText(myzaddr); |
|||
// Amount textbox
|
|||
req.txtAmount->setValidator(this->getAmountValidator()); |
|||
QObject::connect(req.txtAmount, &QLineEdit::textChanged, [=] (auto text) { |
|||
CAmount amount = CAmount::fromDecimalString(text); |
|||
if (Settings::getInstance()->get_currency_name() == "USD") { |
|||
req.txtAmountUSD->setText(amount.toDecimalUSDString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "EUR") { |
|||
req.txtAmountUSD->setText(amount.toDecimalEURString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "BTC") { |
|||
req.txtAmountUSD->setText(amount.toDecimalBTCString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "CNY") { |
|||
req.txtAmountUSD->setText(amount.toDecimalCNYString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "RUB") { |
|||
req.txtAmountUSD->setText(amount.toDecimalRUBString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "CAD") { |
|||
req.txtAmountUSD->setText(amount.toDecimalCADString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "SGD") { |
|||
req.txtAmountUSD->setText(amount.toDecimalSGDString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "CHF") { |
|||
req.txtAmountUSD->setText(amount.toDecimalCHFString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "INR") { |
|||
req.txtAmountUSD->setText(amount.toDecimalINRString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "GBP") { |
|||
req.txtAmountUSD->setText(amount.toDecimalGBPString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "AUD") { |
|||
req.txtAmountUSD->setText(amount.toDecimalBTCString()); |
|||
} |
|||
}); |
|||
CAmount amount = CAmount::fromDecimalString(req.txtAmount->text()); |
|||
if (Settings::getInstance()->get_currency_name() == "USD") { |
|||
req.txtAmountUSD->setText(amount.toDecimalUSDString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "EUR") { |
|||
req.txtAmountUSD->setText(amount.toDecimalEURString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "BTC") { |
|||
req.txtAmountUSD->setText(amount.toDecimalBTCString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "CNY") { |
|||
req.txtAmountUSD->setText(amount.toDecimalCNYString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "RUB") { |
|||
req.txtAmountUSD->setText(amount.toDecimalRUBString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "CAD") { |
|||
req.txtAmountUSD->setText(amount.toDecimalCADString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "SGD") { |
|||
req.txtAmountUSD->setText(amount.toDecimalSGDString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "CHF") { |
|||
req.txtAmountUSD->setText(amount.toDecimalCHFString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "INR") { |
|||
req.txtAmountUSD->setText(amount.toDecimalINRString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "GBP") { |
|||
req.txtAmountUSD->setText(amount.toDecimalGBPString()); |
|||
} else if (Settings::getInstance()->get_currency_name() == "AUD") { |
|||
req.txtAmountUSD->setText(amount.toDecimalBTCString()); |
|||
} |
|||
req.txtMemo->setAcceptButton(req.buttonBox->button(QDialogButtonBox::Ok)); |
|||
req.txtMemo->setLenDisplayLabel(req.lblMemoLen); |
|||
req.txtMemo->setMaxLen(400); |
|||
|
|||
req.txtFrom->setFocus(); |
|||
|
|||
|
|||
} |
|||
} |
|||
if (d.exec() == QDialog::Accepted) { |
|||
// Construct a hush Payment URI with the data and pay it immediately.
|
|||
CAmount amount = CAmount::fromDecimalString(req.txtAmount->text()); |
|||
QString memoURI = "hush:" + req.lblAddressInfo->text() |
|||
+ "?amt=" + amount.toDecimalString() |
|||
+ "&memo=" + QUrl::toPercentEncoding(req.txtMemo->toPlainText()); |
|||
|
|||
QString sendURI = "hush:" + AddressBook::addressFromAddressLabel(req.txtFrom->text()) |
|||
+ "?amt=0.0001" |
|||
+ "&memo=" + QUrl::toPercentEncoding(memoURI); |
|||
|
|||
// If the disclosed address in the memo doesn't have a balance, it will automatically fallback to the default
|
|||
// sapling address
|
|||
this->payhushURI(sendURI, req.lblAddressInfo->text()); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
|
@ -0,0 +1,27 @@ |
|||
// Copyright 2019-2020 The Hush developers
|
|||
// GPLv3
|
|||
#ifndef CONTACTMODEL_H |
|||
#define CONTACTMODEL_H |
|||
|
|||
#include "Model/ContactItem.h" |
|||
#include <QListWidget> |
|||
#include "mainwindow.h" |
|||
|
|||
|
|||
class ContactModel |
|||
|
|||
{ |
|||
public: |
|||
MainWindow* main; |
|||
std::map<QString, QString> AddressMap; |
|||
|
|||
QString getContactbyAddress(QString addr); |
|||
void addLabel(QString addr, QString label); |
|||
|
|||
ContactModel() {} |
|||
void renderContactList(QListView* view); |
|||
|
|||
|
|||
}; |
|||
|
|||
#endif |
@ -0,0 +1,491 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>Dialog</class> |
|||
<widget class="QDialog" name="Dialog"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>780</width> |
|||
<height>351</height> |
|||
</rect> |
|||
</property> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>780</width> |
|||
<height>351</height> |
|||
</size> |
|||
</property> |
|||
<property name="maximumSize"> |
|||
<size> |
|||
<width>780</width> |
|||
<height>351</height> |
|||
</size> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Send Contact Request</string> |
|||
</property> |
|||
<layout class="QGridLayout" name="gridLayout"> |
|||
<item row="0" column="0" colspan="6"> |
|||
<layout class="QHBoxLayout" name="horizontalLayout_3"> |
|||
<property name="sizeConstraint"> |
|||
<enum>QLayout::SetMaximumSize</enum> |
|||
</property> |
|||
<item alignment="Qt::AlignLeft"> |
|||
<widget class="QLabel" name="label_3"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Insert a nickname for your contact:</span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<spacer name="horizontalSpacer_4"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="sizeType"> |
|||
<enum>QSizePolicy::Fixed</enum> |
|||
</property> |
|||
<property name="sizeHint" stdset="0"> |
|||
<size> |
|||
<width>40</width> |
|||
<height>20</height> |
|||
</size> |
|||
</property> |
|||
</spacer> |
|||
</item> |
|||
<item> |
|||
<widget class="QLabel" name="label_6"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Choose an avatar for your contact:</span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<spacer name="horizontalSpacer_5"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="sizeHint" stdset="0"> |
|||
<size> |
|||
<width>40</width> |
|||
<height>20</height> |
|||
</size> |
|||
</property> |
|||
</spacer> |
|||
</item> |
|||
</layout> |
|||
</item> |
|||
<item row="8" column="0" colspan="2"> |
|||
<widget class="QLabel" name="label_2"> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Insert a memo for your request:</span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="6" column="0" colspan="6"> |
|||
<layout class="QHBoxLayout" name="horizontalLayout"> |
|||
<property name="spacing"> |
|||
<number>6</number> |
|||
</property> |
|||
<property name="sizeConstraint"> |
|||
<enum>QLayout::SetMaximumSize</enum> |
|||
</property> |
|||
<item> |
|||
<widget class="QLabel" name="label_4"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Your HushChat Address:</span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<widget class="QPushButton" name="newZaddr"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string>Create New Address</string> |
|||
</property> |
|||
<property name="autoDefault"> |
|||
<bool>false</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<spacer name="horizontalSpacer"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="sizeHint" stdset="0"> |
|||
<size> |
|||
<width>40</width> |
|||
<height>20</height> |
|||
</size> |
|||
</property> |
|||
</spacer> |
|||
</item> |
|||
</layout> |
|||
</item> |
|||
<item row="5" column="0" colspan="6"> |
|||
<widget class="QLineEdit" name="zaddr"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>650</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="4" column="0" colspan="3"> |
|||
<widget class="QLabel" name="label"> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Insert the address of your contact:</span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="7" column="0" colspan="5" alignment="Qt::AlignLeft"> |
|||
<widget class="QLabel" name="myzaddr"> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>650</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
<property name="maximumSize"> |
|||
<size> |
|||
<width>650</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" color:#d3d7cf;">Generate your HushChat Address - please wait a second - </span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="3" column="0" colspan="6"> |
|||
<layout class="QHBoxLayout" name="horizontalLayout_2"> |
|||
<property name="sizeConstraint"> |
|||
<enum>QLayout::SetMaximumSize</enum> |
|||
</property> |
|||
<item> |
|||
<widget class="QLineEdit" name="labelRequest"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>250</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
<property name="maxLength"> |
|||
<number>25</number> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<spacer name="horizontalSpacer_3"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="sizeType"> |
|||
<enum>QSizePolicy::Fixed</enum> |
|||
</property> |
|||
<property name="sizeHint" stdset="0"> |
|||
<size> |
|||
<width>40</width> |
|||
<height>20</height> |
|||
</size> |
|||
</property> |
|||
</spacer> |
|||
</item> |
|||
<item> |
|||
<widget class="QComboBox" name="comboBoxAvatar"> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>0</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
<item> |
|||
<property name="text"> |
|||
<string>SDLogo</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/SDLogo.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Duke</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Duke.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Denio</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Denio.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Berg</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Berg.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Stag</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Stag.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Sharpee</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Sharpee.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Elsa</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<normalon>:/icons/res/Elsa.png</normalon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Yoda</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Yoda.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Garfield</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Garfield.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Snoopy</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Snoopy.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Popey</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Popey.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Pinguin</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Pinguin.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Mickey</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Mickey.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<spacer name="horizontalSpacer_2"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="sizeType"> |
|||
<enum>QSizePolicy::Expanding</enum> |
|||
</property> |
|||
<property name="sizeHint" stdset="0"> |
|||
<size> |
|||
<width>40</width> |
|||
<height>20</height> |
|||
</size> |
|||
</property> |
|||
</spacer> |
|||
</item> |
|||
</layout> |
|||
</item> |
|||
<item row="11" column="0"> |
|||
<widget class="QLabel" name="memoSizeChat"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string>0/512</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="9" column="0" colspan="6"> |
|||
<widget class="QTextEdit" name="memorequest"> |
|||
<property name="placeholderText"> |
|||
<string>Add a memo to your request</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="11" column="3"> |
|||
<widget class="QPushButton" name="cancel"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="baseSize"> |
|||
<size> |
|||
<width>100</width> |
|||
<height>0</height> |
|||
</size> |
|||
</property> |
|||
<property name="text"> |
|||
<string>Cancel</string> |
|||
</property> |
|||
<property name="autoDefault"> |
|||
<bool>false</bool> |
|||
</property> |
|||
<property name="flat"> |
|||
<bool>false</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="11" column="4" colspan="2"> |
|||
<widget class="QPushButton" name="sendRequestButton"> |
|||
<property name="text"> |
|||
<string>Add Contact and Send Request</string> |
|||
</property> |
|||
<property name="autoDefault"> |
|||
<bool>false</bool> |
|||
</property> |
|||
<property name="flat"> |
|||
<bool>false</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>cancel</sender> |
|||
<signal>clicked()</signal> |
|||
<receiver>Dialog</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>396</x> |
|||
<y>262</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>389</x> |
|||
<y>207</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>sendRequestButton</sender> |
|||
<signal>clicked()</signal> |
|||
<receiver>Dialog</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>536</x> |
|||
<y>262</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>389</x> |
|||
<y>207</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
@ -0,0 +1,132 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>deposithush</class> |
|||
<widget class="QDialog" name="deposithush"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>792</width> |
|||
<height>650</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Deposit Hush</string> |
|||
</property> |
|||
<layout class="QGridLayout" name="gridLayout"> |
|||
<item row="0" column="0" colspan="2"> |
|||
<widget class="QTextBrowser" name="textBrowser"> |
|||
<property name="maximumSize"> |
|||
<size> |
|||
<width>16777215</width> |
|||
<height>71</height> |
|||
</size> |
|||
</property> |
|||
<property name="html"> |
|||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> |
|||
<html><head><meta name="qrichtext" content="1" /><style type="text/css"> |
|||
p, li { white-space: pre-wrap; } |
|||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> |
|||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:16pt;">Please use the following hush address to transfer funds to SilentDragonLite. You can either copy the address or use the QR Code. </span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="1" column="0" colspan="2"> |
|||
<widget class="QLabel" name="label"> |
|||
<property name="text"> |
|||
<string><html><head/><body><p align="center">QR Code of your Hush Address</p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="3" column="0" colspan="2"> |
|||
<widget class="QLabel" name="label_2"> |
|||
<property name="text"> |
|||
<string><html><head/><body><p align="center"><span style=" text-decoration: underline;">Your Hush Address </span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="4" column="0" colspan="2"> |
|||
<widget class="QLabel" name="zaddr"> |
|||
<property name="text"> |
|||
<string>Hush zaddr</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="5" column="0"> |
|||
<widget class="QPushButton" name="CopyAddress"> |
|||
<property name="text"> |
|||
<string>Copy Address</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="6" column="1"> |
|||
<widget class="QDialogButtonBox" name="buttonBox"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="standardButtons"> |
|||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="2" column="0" colspan="2"> |
|||
<widget class="QRCodeLabel" name="qrcodeDisplayDeposit"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="styleSheet"> |
|||
<string notr="true">background-color: #fff</string> |
|||
</property> |
|||
<property name="text"> |
|||
<string/> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<customwidgets> |
|||
<customwidget> |
|||
<class>QRCodeLabel</class> |
|||
<extends>QLabel</extends> |
|||
<header>qrcodelabel.h</header> |
|||
</customwidget> |
|||
</customwidgets> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>accepted()</signal> |
|||
<receiver>deposithush</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>248</x> |
|||
<y>254</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>157</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>rejected()</signal> |
|||
<receiver>deposithush</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>316</x> |
|||
<y>260</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>286</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
@ -0,0 +1,72 @@ |
|||
<ui version="4.0" > |
|||
<author></author> |
|||
<comment></comment> |
|||
<exportmacro></exportmacro> |
|||
<class>Dialog</class> |
|||
<widget class="QDialog" name="Dialog" > |
|||
<property name="geometry" > |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>400</width> |
|||
<height>300</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle" > |
|||
<string>Dialog</string> |
|||
</property> |
|||
<widget class="QDialogButtonBox" name="buttonBox" > |
|||
<property name="geometry" > |
|||
<rect> |
|||
<x>30</x> |
|||
<y>240</y> |
|||
<width>341</width> |
|||
<height>32</height> |
|||
</rect> |
|||
</property> |
|||
<property name="orientation" > |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="standardButtons" > |
|||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|||
</property> |
|||
</widget> |
|||
</widget> |
|||
<pixmapfunction></pixmapfunction> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>accepted()</signal> |
|||
<receiver>Dialog</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel" > |
|||
<x>248</x> |
|||
<y>254</y> |
|||
</hint> |
|||
<hint type="destinationlabel" > |
|||
<x>157</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>rejected()</signal> |
|||
<receiver>Dialog</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel" > |
|||
<x>316</x> |
|||
<y>260</y> |
|||
</hint> |
|||
<hint type="destinationlabel" > |
|||
<x>286</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
|||
|
@ -0,0 +1,156 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>hushrequest</class> |
|||
<widget class="QDialog" name="hushrequest"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>663</width> |
|||
<height>529</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Request Payment</string> |
|||
</property> |
|||
<layout class="QGridLayout" name="gridLayout"> |
|||
<item row="0" column="0"> |
|||
<widget class="QLabel" name="lblPixmap"> |
|||
<property name="text"> |
|||
<string>TextLabel</string> |
|||
</property> |
|||
<property name="alignment"> |
|||
<set>Qt::AlignCenter</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="0" column="1"> |
|||
<widget class="QLabel" name="lblHeader"> |
|||
<property name="text"> |
|||
<string>Request payment from a Sapling address. You'll send a hush 0.0001 transaction to the address with a hush payment URI. The memo will be included in the transaction when the address pays you.</string> |
|||
</property> |
|||
<property name="wordWrap"> |
|||
<bool>true</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="1" column="0"> |
|||
<widget class="QLabel" name="lblAddress"> |
|||
<property name="text"> |
|||
<string>Request From</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="1" column="1"> |
|||
<spacer name="horizontalSpacer"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="sizeHint" stdset="0"> |
|||
<size> |
|||
<width>541</width> |
|||
<height>20</height> |
|||
</size> |
|||
</property> |
|||
</spacer> |
|||
</item> |
|||
<item row="2" column="0" colspan="2"> |
|||
<widget class="QLabel" name="txtFrom"> |
|||
<property name="text"> |
|||
<string>zaddr</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="3" column="0"> |
|||
<widget class="QLabel" name="lblAmount"> |
|||
<property name="text"> |
|||
<string>Amount in </string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="4" column="0" colspan="2"> |
|||
<widget class="QLineEdit" name="txtAmount"> |
|||
<property name="alignment"> |
|||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
|||
</property> |
|||
<property name="placeholderText"> |
|||
<string>Amount</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="5" column="0"> |
|||
<widget class="QLabel" name="txtAmountUSD"> |
|||
<property name="text"> |
|||
<string>Amount USD</string> |
|||
</property> |
|||
<property name="alignment"> |
|||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="6" column="0"> |
|||
<widget class="QLabel" name="label_3"> |
|||
<property name="text"> |
|||
<string>Memo</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="6" column="1"> |
|||
<widget class="QLabel" name="lblMemoLen"> |
|||
<property name="text"> |
|||
<string notr="true">0 / 512</string> |
|||
</property> |
|||
<property name="alignment"> |
|||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="7" column="0" colspan="2"> |
|||
<widget class="MemoEdit" name="txtMemo"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="8" column="0"> |
|||
<widget class="QLabel" name="label_2"> |
|||
<property name="text"> |
|||
<string>My Address</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="8" column="1"> |
|||
<widget class="QLabel" name="lblAddressInfo"> |
|||
<property name="text"> |
|||
<string>The recipient will see this address in the "to" field when they pay your request.</string> |
|||
</property> |
|||
<property name="alignment"> |
|||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="9" column="1"> |
|||
<widget class="QDialogButtonBox" name="buttonBox"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="standardButtons"> |
|||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<customwidgets> |
|||
<customwidget> |
|||
<class>MemoEdit</class> |
|||
<extends>QPlainTextEdit</extends> |
|||
<header>memoedit.h</header> |
|||
</customwidget> |
|||
</customwidgets> |
|||
<resources/> |
|||
<connections/> |
|||
</ui> |
@ -0,0 +1,175 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>removeencryption</class> |
|||
<widget class="QDialog" name="removeencryption"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>400</width> |
|||
<height>300</height> |
|||
</rect> |
|||
</property> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>400</width> |
|||
<height>300</height> |
|||
</size> |
|||
</property> |
|||
<property name="maximumSize"> |
|||
<size> |
|||
<width>400</width> |
|||
<height>300</height> |
|||
</size> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Decrypt Your Wallet</string> |
|||
</property> |
|||
<layout class="QGridLayout" name="gridLayout"> |
|||
<item row="5" column="0" colspan="4"> |
|||
<widget class="Line" name="line"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="0" column="0" colspan="4"> |
|||
<widget class="QLabel" name="label_2"> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-size:14pt; color:#ef2929;">WARNING:</span> If you remove your wallet.dat encryption, all your transactions and contacts are plaintext on disk!<br/><br/>Messages sent and received are always encrypted.</p></body></html></string> |
|||
</property> |
|||
<property name="alignment"> |
|||
<set>Qt::AlignCenter</set> |
|||
</property> |
|||
<property name="wordWrap"> |
|||
<bool>true</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="3" column="2" colspan="2"> |
|||
<widget class="QLineEdit" name="txtPassword"> |
|||
<property name="echoMode"> |
|||
<enum>QLineEdit::Password</enum> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="2" column="2"> |
|||
<widget class="QLabel" name="label"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-style:italic;">16 letters minimum</span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="6" column="2" colspan="2" alignment="Qt::AlignRight"> |
|||
<widget class="QDialogButtonBox" name="buttonBox"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="standardButtons"> |
|||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="3" column="0" colspan="2"> |
|||
<widget class="QLabel" name="label_3"> |
|||
<property name="text"> |
|||
<string>Encryption Passphrase:</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="4" column="0" colspan="2"> |
|||
<widget class="QLabel" name="label_4"> |
|||
<property name="text"> |
|||
<string>Confirm Passphrase:</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="1" column="0" colspan="4"> |
|||
<widget class="Line" name="line_2"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="4" column="2" colspan="2"> |
|||
<widget class="QLineEdit" name="txtConfirmPassword"> |
|||
<property name="echoMode"> |
|||
<enum>QLineEdit::Password</enum> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="2" column="0" colspan="2"> |
|||
<widget class="QLabel" name="lblPasswordMatch"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="styleSheet"> |
|||
<string notr="true">color: red;</string> |
|||
</property> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-style:italic;">Passphrase don't match</span></p></body></html></string> |
|||
</property> |
|||
<property name="alignment"> |
|||
<set>Qt::AlignCenter</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>accepted()</signal> |
|||
<receiver>removeencryption</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>248</x> |
|||
<y>254</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>157</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>rejected()</signal> |
|||
<receiver>removeencryption</receiver> |
|||
<slot>close()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>316</x> |
|||
<y>260</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>286</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
@ -0,0 +1,473 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>requestDialog</class> |
|||
<widget class="QDialog" name="requestDialog"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>850</width> |
|||
<height>495</height> |
|||
</rect> |
|||
</property> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>850</width> |
|||
<height>495</height> |
|||
</size> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Incoming Contact Request</string> |
|||
</property> |
|||
<layout class="QGridLayout" name="gridLayout"> |
|||
<item row="0" column="1"> |
|||
<widget class="QLabel" name="label_3"> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Memo of the request</span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="1" column="1" colspan="6"> |
|||
<widget class="QListView" name="requestMemo"> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>500</width> |
|||
<height>231</height> |
|||
</size> |
|||
</property> |
|||
<property name="verticalScrollBarPolicy"> |
|||
<enum>Qt::ScrollBarAlwaysOff</enum> |
|||
</property> |
|||
<property name="horizontalScrollBarPolicy"> |
|||
<enum>Qt::ScrollBarAlwaysOff</enum> |
|||
</property> |
|||
<property name="sizeAdjustPolicy"> |
|||
<enum>QAbstractScrollArea::AdjustToContents</enum> |
|||
</property> |
|||
<property name="editTriggers"> |
|||
<set>QAbstractItemView::NoEditTriggers</set> |
|||
</property> |
|||
<property name="resizeMode"> |
|||
<enum>QListView::Adjust</enum> |
|||
</property> |
|||
<property name="modelColumn"> |
|||
<number>0</number> |
|||
</property> |
|||
<property name="uniformItemSizes"> |
|||
<bool>false</bool> |
|||
</property> |
|||
<property name="wordWrap"> |
|||
<bool>true</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="0" column="0"> |
|||
<widget class="QLabel" name="label"> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Open requests</span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="3" column="0" rowspan="8"> |
|||
<widget class="QListView" name="requestContactOld"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>225</width> |
|||
<height>190</height> |
|||
</size> |
|||
</property> |
|||
<property name="mouseTracking"> |
|||
<bool>true</bool> |
|||
</property> |
|||
<property name="editTriggers"> |
|||
<set>QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set> |
|||
</property> |
|||
<property name="alternatingRowColors"> |
|||
<bool>false</bool> |
|||
</property> |
|||
<property name="selectionMode"> |
|||
<enum>QAbstractItemView::SingleSelection</enum> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="4" column="4" colspan="3"> |
|||
<widget class="QLineEdit" name="requestZaddr"> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>351</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
<property name="maximumSize"> |
|||
<size> |
|||
<width>351</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="4" column="1" colspan="3"> |
|||
<widget class="QLabel" name="label_8"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string>Request from:</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="6" column="4" colspan="2"> |
|||
<widget class="QLineEdit" name="requestLabel"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>0</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
<property name="maxLength"> |
|||
<number>25</number> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="10" column="3"> |
|||
<widget class="QLabel" name="zaddrnew"> |
|||
<property name="text"> |
|||
<string/> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="10" column="6"> |
|||
<widget class="QPushButton" name="pushButton"> |
|||
<property name="text"> |
|||
<string>Add New Contact</string> |
|||
</property> |
|||
<property name="autoDefault"> |
|||
<bool>false</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="10" column="2"> |
|||
<widget class="QLabel" name="requestCID"> |
|||
<property name="text"> |
|||
<string/> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="7" column="1" colspan="3"> |
|||
<widget class="QLabel" name="label_6"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string><html><head/><body><p>Choose an avatar for your contact:</p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="5" column="1" colspan="2"> |
|||
<widget class="QLabel" name="label_7"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string>My Zaddr:</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="10" column="1"> |
|||
<widget class="QLabel" name="zaddrold"> |
|||
<property name="text"> |
|||
<string notr="true"/> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="10" column="5"> |
|||
<widget class="QPushButton" name="cancel"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="baseSize"> |
|||
<size> |
|||
<width>100</width> |
|||
<height>0</height> |
|||
</size> |
|||
</property> |
|||
<property name="text"> |
|||
<string>Cancel</string> |
|||
</property> |
|||
<property name="autoDefault"> |
|||
<bool>false</bool> |
|||
</property> |
|||
<property name="flat"> |
|||
<bool>false</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="7" column="4"> |
|||
<widget class="QComboBox" name="comboBoxAvatar"> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>106</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
<property name="maximumSize"> |
|||
<size> |
|||
<width>106</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
<item> |
|||
<property name="text"> |
|||
<string>SDLogo</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/SDLogo.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Duke</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Duke.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Denio</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Denio.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Berg</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Berg.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Sharpee</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Sharpee.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Elsa</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<normalon>:/icons/res/Elsa.png</normalon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Yoda</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Yoda.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Garfield</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Garfield.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Snoopy</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Snoopy.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Popey</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Popey.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Pinguin</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Pinguin.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Mickey</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Mickey.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
<item> |
|||
<property name="text"> |
|||
<string>Stag</string> |
|||
</property> |
|||
<property name="icon"> |
|||
<iconset> |
|||
<activeon>:/icons/res/Stag.png</activeon> |
|||
</iconset> |
|||
</property> |
|||
</item> |
|||
</widget> |
|||
</item> |
|||
<item row="1" column="0"> |
|||
<widget class="QListView" name="requestContact"> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>225</width> |
|||
<height>231</height> |
|||
</size> |
|||
</property> |
|||
<property name="mouseTracking"> |
|||
<bool>true</bool> |
|||
</property> |
|||
<property name="editTriggers"> |
|||
<set>QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set> |
|||
</property> |
|||
<property name="alternatingRowColors"> |
|||
<bool>false</bool> |
|||
</property> |
|||
<property name="selectionMode"> |
|||
<enum>QAbstractItemView::SingleSelection</enum> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="2" column="0"> |
|||
<widget class="QLabel" name="label_2"> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Recently closed requests</span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="3" column="1" colspan="3"> |
|||
<widget class="QLabel" name="label_4"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html></string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="6" column="1" colspan="3"> |
|||
<widget class="QLabel" name="label_5"> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="text"> |
|||
<string>Give a Nickname:</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="5" column="4" colspan="3"> |
|||
<widget class="QLineEdit" name="requestMyAddr"> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>351</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
<property name="maximumSize"> |
|||
<size> |
|||
<width>351</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>cancel</sender> |
|||
<signal>clicked()</signal> |
|||
<receiver>requestDialog</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>339</x> |
|||
<y>482</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>505</x> |
|||
<y>251</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
@ -0,0 +1,129 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>startup</class> |
|||
<widget class="QDialog" name="startup"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>400</width> |
|||
<height>177</height> |
|||
</rect> |
|||
</property> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>400</width> |
|||
<height>177</height> |
|||
</size> |
|||
</property> |
|||
<property name="maximumSize"> |
|||
<size> |
|||
<width>400</width> |
|||
<height>177</height> |
|||
</size> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>SDL Startup Decryption</string> |
|||
</property> |
|||
<layout class="QFormLayout" name="formLayout"> |
|||
<item row="0" column="0" colspan="2"> |
|||
<widget class="QLabel" name="label_2"> |
|||
<property name="text"> |
|||
<string><html><head/><body><p>If you have forgotten your passphrase, restore your wallet with your seed!</p></body></html></string> |
|||
</property> |
|||
<property name="alignment"> |
|||
<set>Qt::AlignCenter</set> |
|||
</property> |
|||
<property name="wordWrap"> |
|||
<bool>true</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="3" column="0" colspan="2"> |
|||
<widget class="Line" name="line_2"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="6" column="0" colspan="2"> |
|||
<widget class="QLabel" name="label_3"> |
|||
<property name="text"> |
|||
<string>Encryption Passphrase:</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="7" column="1"> |
|||
<widget class="QLineEdit" name="txtPassword"> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>0</width> |
|||
<height>25</height> |
|||
</size> |
|||
</property> |
|||
<property name="echoMode"> |
|||
<enum>QLineEdit::Password</enum> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="9" column="0"> |
|||
<widget class="Line" name="line"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="9" column="1"> |
|||
<widget class="QDialogButtonBox" name="buttonBox"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="standardButtons"> |
|||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>accepted()</signal> |
|||
<receiver>startup</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>248</x> |
|||
<y>254</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>157</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>rejected()</signal> |
|||
<receiver>startup</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>316</x> |
|||
<y>260</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>286</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
@ -1 +1 @@ |
|||
#define APP_VERSION "1.2.2" |
|||
#define APP_VERSION "1.3.2-Chat-Beta" |
|||
|