|
1 | 1 | #include <QApplication> |
2 | 2 | #include "ChessCommon.hpp" |
3 | | - |
| 3 | +#include "clientConnect.hpp" |
4 | 4 |
|
5 | 5 | void* checkForUpdates(void* threadArg); |
6 | 6 |
|
7 | 7 | int main(int argc, char *argv[]){ |
8 | 8 |
|
9 | 9 | QApplication app(argc, argv); |
10 | 10 | std::string server_IP; |
| 11 | +// if(argc>1) { |
| 12 | +// server_IP = argv[1]; |
| 13 | +// } else { |
| 14 | +// std::cout << "Enter IP addr to connect to : "; |
| 15 | +// std::cin >> server_IP; |
| 16 | +// } |
11 | 17 |
|
12 | | - if(argc>1) { |
13 | | - server_IP = argv[1]; |
14 | | - } else { |
15 | | - std::cout << "Enter IP addr to connect to : "; |
16 | | - std::cin >> server_IP; |
17 | | - } |
18 | 18 |
|
| 19 | + clientConnect dialog; |
| 20 | + QObject::connect(&dialog, &clientConnect::exportIP6, [=](const std::string ip){ |
19 | 21 |
|
20 | | - // Initialise the Client Game Object with args |
21 | | - // (#serverIP, #serverPort, Affiliation) |
22 | | - // { true/false : white/black } |
23 | | - ChessClient* Client = new ChessClient(server_IP, 60000, false); |
| 22 | + // Initialise the Client Game Object with args |
| 23 | + // (#serverIP, #serverPort, Affiliation) |
| 24 | + // { true/false : white/black } |
| 25 | + ChessClient* Client = new ChessClient(server_IP, 60000, false); |
24 | 26 |
|
25 | | - // create new thread for this. |
26 | | - pthread_t clientThread; |
27 | | - int rc = pthread_create(&clientThread, NULL, checkForUpdates, (void*)Client); |
28 | | - |
| 27 | + // create new thread for this. |
| 28 | + pthread_t clientThread; |
| 29 | + int rc = pthread_create(&clientThread, NULL, checkForUpdates, (void*)Client); |
| 30 | + }); |
| 31 | + |
| 32 | + dialog.show(); |
29 | 33 | // GUI runs in main thread |
30 | 34 | app.exec(); |
31 | 35 |
|
|
0 commit comments