Browse Source

Merge pull request #17 from DenioD/chat

Chat
pull/130/head
Strider 4 years ago
committed by GitHub
parent
commit
3a155101de
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      lib/Cargo.lock
  2. 2
      lib/Cargo.toml
  3. 4
      src/chatmodel.cpp
  4. 17
      src/controller.cpp

7
lib/Cargo.lock

@ -1177,7 +1177,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=d3a66550ed8c6216b13002ce6e5b425367f30770)", "silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=37531e4a48fe130f00ed9eeccbba9863e1c8ab59)",
] ]
[[package]] [[package]]
@ -1640,7 +1640,7 @@ dependencies = [
[[package]] [[package]]
name = "silentdragonlitelib" name = "silentdragonlitelib"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/DenioD/silentdragonlite-cli?rev=d3a66550ed8c6216b13002ce6e5b425367f30770#d3a66550ed8c6216b13002ce6e5b425367f30770" source = "git+https://github.com/DenioD/silentdragonlite-cli?rev=37531e4a48fe130f00ed9eeccbba9863e1c8ab59#37531e4a48fe130f00ed9eeccbba9863e1c8ab59"
dependencies = [ dependencies = [
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bellman 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)", "bellman 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
@ -1652,6 +1652,7 @@ dependencies = [
"http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"json 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "json 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing 0.14.2 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)", "pairing 0.14.2 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
@ -2630,7 +2631,7 @@ dependencies = [
"checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35" "checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
"checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0" "checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0"
"checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" "checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=d3a66550ed8c6216b13002ce6e5b425367f30770)" = "<none>" "checksum silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=37531e4a48fe130f00ed9eeccbba9863e1c8ab59)" = "<none>"
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" "checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"

2
lib/Cargo.toml

@ -11,4 +11,4 @@ crate-type = ["staticlib"]
[dependencies] [dependencies]
libc = "0.2.58" libc = "0.2.58"
lazy_static = "1.4.0" lazy_static = "1.4.0"
silentdragonlitelib = { git = "https://github.com/DenioD/silentdragonlite-cli", rev = "d3a66550ed8c6216b13002ce6e5b425367f30770" } silentdragonlitelib = { git = "https://github.com/DenioD/silentdragonlite-cli", rev = "37531e4a48fe130f00ed9eeccbba9863e1c8ab59" }

4
src/chatmodel.cpp

@ -158,8 +158,6 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view)
} }
void MainWindow::renderContactRequest(){ void MainWindow::renderContactRequest(){
Ui_requestDialog requestContact; Ui_requestDialog requestContact;
@ -322,7 +320,6 @@ QString MainWindow::createHeaderMemo(QString type, QString cid, QString zaddr,
} }
// Create a Tx from the current state of the Chat page. // Create a Tx from the current state of the Chat page.
Tx MainWindow::createTxFromChatPage() { Tx MainWindow::createTxFromChatPage() {
Tx tx; Tx tx;
@ -468,7 +465,6 @@ void MainWindow::sendChatButton() {
); );
} }
QString MainWindow::doSendChatTxValidations(Tx tx) { QString MainWindow::doSendChatTxValidations(Tx tx) {
// Check to see if we have enough verified funds to send the Tx. // Check to see if we have enough verified funds to send the Tx.

17
src/controller.cpp

@ -853,7 +853,8 @@ void Controller::refreshTransactions() {
for (auto o: it["outgoing_metadata"].get<json::array_t>()) { for (auto o: it["outgoing_metadata"].get<json::array_t>()) {
QString address; QString address;
address = QString::fromStdString(o["address"]); address = QString::fromStdString(o["address"]);
// Sent items are -ve // Sent items are -ve
@ -883,12 +884,11 @@ void Controller::refreshTransactions() {
memo, memo,
QString(""), QString(""),
QString(""), QString(""),
cid, // we have to set the cid here, its included in our Addressbook for this contact cid,
txid, txid,
true // is an outgoing message true
); );
DataStore::getChatDataStore()->setData(chatModel->generateChatItemID(item), item); DataStore::getChatDataStore()->setData(chatModel->generateChatItemID(item), item);
//chatModel->addMessage(item);
} }
@ -908,7 +908,6 @@ void Controller::refreshTransactions() {
} }
txdata.push_back(TransactionItem{ txdata.push_back(TransactionItem{
"send", datetime, address, txid,confirmations, items "send", datetime, address, txid,confirmations, items
}); });
@ -938,6 +937,7 @@ void Controller::refreshTransactions() {
QString type; QString type;
QString cid; QString cid;
int position;
QString requestZaddr1; QString requestZaddr1;
QString requestZaddr; QString requestZaddr;
@ -982,6 +982,8 @@ void Controller::refreshTransactions() {
}else{ contact = "";} }else{ contact = "";}
position = it["position"].get<json::number_integer_t>();
ChatItem item = ChatItem( ChatItem item = ChatItem(
datetime, datetime,
address, address,
@ -989,12 +991,13 @@ void Controller::refreshTransactions() {
memo, memo,
requestZaddr, requestZaddr,
type, type,
cid, // we have to set the cid here, its included in the headermemo cid,
txid, txid,
false false
); );
DataStore::getChatDataStore()->setData(chatModel->generateChatItemID(item), item); DataStore::getChatDataStore()->setData(chatModel->generateChatItemID(item), item);
//chatModel->addMessage(item);
qDebug() << "Position der Message : " << position;
} }
} }

Loading…
Cancel
Save