-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
20 lines (16 loc) · 712 Bytes
/
main.cpp
File metadata and controls
20 lines (16 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <QApplication>
#include "LoginWindow.h"
#include "ChatWindow.h"
int main(int argc, char *argv[]) {
QSettings settings("HostInfo.ini", QSettings::IniFormat);
QString host = settings.value("HostInfo/host", "127.0.0.1").toString();
int port = settings.value("HostInfo/port", 1234).toInt();
HostInfo hostInfo{host, port};
QApplication app{argc, argv};
LoginWindow loginWindow{hostInfo};
loginWindow.show();
ChatWindow chatWindow;
QObject::connect(&loginWindow, &LoginWindow::LoginSuccess, &chatWindow, &ChatWindow::Init);
QObject::connect(&chatWindow, &ChatWindow::ConnectionLost, &loginWindow, &LoginWindow::OnConnectionLost);
return QApplication::exec();
}