-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
52 lines (42 loc) · 1.09 KB
/
main.cpp
File metadata and controls
52 lines (42 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// main.cpp
// DocChain
//
// Created by Chung-kaiYang on 01/13/18.
// Copyright © 2018 Chung-kaiYang. All rights reserved.
//
#include <QtWidgets/QApplication>
#include "block.h"
#include "factory.h"
#include "blockChain.h"
#include "talk.h"
#include "crypto.h"
#include "dialog.h"
using namespace std;
enum USER_COMMAND
{
USER_COMMAND_QUIT = 0,
USER_COMMAND_ADD_BLOCK = 1,
USER_COMMAND_LIST_BLOCKCHAIN = 2,
USER_COMMAND_MAX
};
void* create_talk(void *talkClass)
{
pthread_detach(pthread_self());
((talk*)talkClass)->connect();
pthread_exit(0);
}
int main(int argc, char *argv[]){
QApplication app(argc, argv);
dialog* dialog = factory::GetDialog(&app);
dialog->show();
pthread_t thread;
talk* talkObject = factory::GetTalk();
pthread_create(&thread, NULL , create_talk, (void*) talkObject);
dialog->appendLog("Welcome to blockchain demo program @ Clark Yang!");
factory::GetBlockChain();
talk::BroadcastPublicKey();
talk::Broadcast(REMOTE_COMMAND_GET_PUBKEY);
talk::Broadcast(REMOTE_COMMAND_GET_ALL);
return app.exec();
}