Commit 0a21b29ffa7eca8b3fc10b504a726296a2e67abf
1 parent
40eb5e8f
minor bugs left
git-svn-id: svn://imanolbarba.net/PAD@41 c2ee353e-ed0d-4329-bf56-03aec153487f
Showing
36 changed files
with
577 additions
and
390 deletions
JChatServerV2/bin/pad/prac2/Connection.class
No preview for this file type
JChatServerV2/bin/pad/prac2/JChat$1.class
No preview for this file type
JChatServerV2/bin/pad/prac2/JChat.class
No preview for this file type
JChatServerV2/bin/pad/prac2/Server.class
No preview for this file type
JChatServerV2/src/pad/prac2/Connection.java
@@ -126,11 +126,11 @@ public class Connection extends Thread | @@ -126,11 +126,11 @@ public class Connection extends Thread | ||
126 | { | 126 | { |
127 | if(!str.contains(" ")) | 127 | if(!str.contains(" ")) |
128 | { | 128 | { |
129 | - serv.sendTo(this,str.substring(1),"1"); | 129 | + serv.sendTo(this,str.substring(1),""); |
130 | } | 130 | } |
131 | else | 131 | else |
132 | { | 132 | { |
133 | - serv.sendTo(this,"1"+str.substring(1,str.indexOf(' ')),str.substring(str.indexOf(' ')+1)); | 133 | + serv.sendTo(this,str.substring(1,str.indexOf(' ')),str.substring(str.indexOf(' ')+1)); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | catch(ChatException cE) | 136 | catch(ChatException cE) |
JChatServerV2/src/pad/prac2/JChat.java
@@ -16,9 +16,11 @@ public class JChat | @@ -16,9 +16,11 @@ public class JChat | ||
16 | System.out.print("Size of chatroom: "); | 16 | System.out.print("Size of chatroom: "); |
17 | roomSize = in.nextInt(); | 17 | roomSize = in.nextInt(); |
18 | in.close();*/ | 18 | in.close();*/ |
19 | + | ||
19 | ip = "localhost"; | 20 | ip = "localhost"; |
20 | port = 3001; | 21 | port = 3001; |
21 | roomSize = 5; | 22 | roomSize = 5; |
23 | + | ||
22 | final Server serv = new Server(ip,port,roomSize); | 24 | final Server serv = new Server(ip,port,roomSize); |
23 | Runtime.getRuntime().addShutdownHook(new Thread() | 25 | Runtime.getRuntime().addShutdownHook(new Thread() |
24 | { | 26 | { |
JChatServerV2/src/pad/prac2/Server.java
@@ -113,7 +113,7 @@ public class Server | @@ -113,7 +113,7 @@ public class Server | ||
113 | dest = it.next(); | 113 | dest = it.next(); |
114 | if(getNickname(dest).equals(nick)) | 114 | if(getNickname(dest).equals(nick)) |
115 | { | 115 | { |
116 | - dest.sendMessage(msg); | 116 | + dest.sendMessage("1"+msg); |
117 | lock.unlock(); | 117 | lock.unlock(); |
118 | return; | 118 | return; |
119 | } | 119 | } |
@@ -156,7 +156,7 @@ public class Server | @@ -156,7 +156,7 @@ public class Server | ||
156 | conn = it.next(); | 156 | conn = it.next(); |
157 | try | 157 | try |
158 | { | 158 | { |
159 | - conn.sendMessage("USERLIST:"+nickList()); | 159 | + conn.sendMessage("USERLIST"+nickList()); |
160 | } | 160 | } |
161 | catch(IOException ioExc) | 161 | catch(IOException ioExc) |
162 | { | 162 | { |
QChatClient/QChatClient.pro.user
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE QtCreatorProject> | 2 | <!DOCTYPE QtCreatorProject> |
3 | -<!-- Written by QtCreator 2.7.1, 2013-12-25T12:22:15. --> | 3 | +<!-- Written by QtCreator 2.7.1, 2013-12-27T07:19:09. --> |
4 | <qtcreator> | 4 | <qtcreator> |
5 | <data> | 5 | <data> |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -51,9 +51,9 @@ | @@ -51,9 +51,9 @@ | ||
51 | <data> | 51 | <data> |
52 | <variable>ProjectExplorer.Project.Target.0</variable> | 52 | <variable>ProjectExplorer.Project.Target.0</variable> |
53 | <valuemap type="QVariantMap"> | 53 | <valuemap type="QVariantMap"> |
54 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> | ||
55 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> | ||
56 | - <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">{d6a12d1a-dee4-4341-8f4f-e2749eba145e}</value> | 54 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 5.0.1 (qt5)</value> |
55 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 5.0.1 (qt5)</value> | ||
56 | + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">{c01623e0-8a32-406c-bbaa-3e691c0f6afc}</value> | ||
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | 57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | 58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> | 59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
QChatClient/Socket.cpp
@@ -186,4 +186,4 @@ const Socket& Socket::operator >> ( std::string& text ) | @@ -186,4 +186,4 @@ const Socket& Socket::operator >> ( std::string& text ) | ||
186 | message = NULL; | 186 | message = NULL; |
187 | } | 187 | } |
188 | return *this; | 188 | return *this; |
189 | -} | ||
190 | \ No newline at end of file | 189 | \ No newline at end of file |
190 | +} |
QChatClient/chatinputtext.cpp
QChatClient/chatroom.cpp
@@ -2,41 +2,12 @@ | @@ -2,41 +2,12 @@ | ||
2 | #include "ui_chatroom.h" | 2 | #include "ui_chatroom.h" |
3 | 3 | ||
4 | list<QString> sendQueue; | 4 | list<QString> sendQueue; |
5 | - | ||
6 | std::mutex myMutex; | 5 | std::mutex myMutex; |
7 | - | ||
8 | std::mutex msgMutex; | 6 | std::mutex msgMutex; |
7 | +std::mutex printMutex; | ||
9 | unique_lock<std::mutex>* msgLock; | 8 | unique_lock<std::mutex>* msgLock; |
10 | - | ||
11 | std::condition_variable msgListNotEmpty; | 9 | std::condition_variable msgListNotEmpty; |
12 | 10 | ||
13 | -Chatroom::Chatroom(QWidget *parent) : | ||
14 | - QMainWindow(parent), | ||
15 | - ui(new Ui::Chatroom) | ||
16 | -{ | ||
17 | - ui->setupUi(this); | ||
18 | - QList<int> chatSizes; | ||
19 | - QList<int> splitSizes; | ||
20 | - chatSizes.push_front(ui->chatText->height()); | ||
21 | - chatSizes.push_front(100); | ||
22 | - splitSizes.push_front(ui->chatWindow->width()); | ||
23 | - splitSizes.push_front(200); | ||
24 | - ui->chatSplitter->setSizes(chatSizes); | ||
25 | - ui->windowSplitter->setSizes(splitSizes); | ||
26 | - connected = false; | ||
27 | - msgLock = new unique_lock<std::mutex>(msgMutex,std::defer_lock); | ||
28 | - send = NULL; | ||
29 | - recv = NULL; | ||
30 | - | ||
31 | - connect(ui->actionConnect,SIGNAL(triggered()),this,SLOT(startSession())); | ||
32 | - connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(finish())); | ||
33 | - connect(this,SIGNAL(threadsFinished(bool)),this,SLOT(finishThreads(bool))); | ||
34 | - connect(ui->inputText,SIGNAL(msgReady()),this,SLOT(sendMsg())); | ||
35 | - connect(ui->actionDisconnect,SIGNAL(triggered()),this,SLOT(disconnectChatroom())); | ||
36 | - connect(ui->sendButton,SIGNAL(clicked()),this,SLOT(sendMsg())); | ||
37 | - connect(this,SIGNAL(messagesToPrint()),this,SLOT(printMsg())); | ||
38 | -} | ||
39 | - | ||
40 | void sendThread(Socket* s, Chatroom* chat) | 11 | void sendThread(Socket* s, Chatroom* chat) |
41 | { | 12 | { |
42 | string send; | 13 | string send; |
@@ -46,11 +17,11 @@ void sendThread(Socket* s, Chatroom* chat) | @@ -46,11 +17,11 @@ void sendThread(Socket* s, Chatroom* chat) | ||
46 | { | 17 | { |
47 | msgLock->lock(); | 18 | msgLock->lock(); |
48 | msgListNotEmpty.wait(*msgLock); | 19 | msgListNotEmpty.wait(*msgLock); |
20 | + msgLock->unlock(); | ||
49 | if(!chat->getConnected()) | 21 | if(!chat->getConnected()) |
50 | { | 22 | { |
51 | return; | 23 | return; |
52 | } | 24 | } |
53 | - msgLock->unlock(); | ||
54 | } | 25 | } |
55 | msgLock->lock(); | 26 | msgLock->lock(); |
56 | send = sendQueue.front().toStdString(); | 27 | send = sendQueue.front().toStdString(); |
@@ -59,27 +30,31 @@ void sendThread(Socket* s, Chatroom* chat) | @@ -59,27 +30,31 @@ void sendThread(Socket* s, Chatroom* chat) | ||
59 | { | 30 | { |
60 | if(send[0] == '@') | 31 | if(send[0] == '@') |
61 | { | 32 | { |
33 | + chat->relayMsg(send); | ||
62 | send = '1' + send; | 34 | send = '1' + send; |
63 | } | 35 | } |
64 | else | 36 | else |
65 | { | 37 | { |
66 | send = '0' + send; | 38 | send = '0' + send; |
39 | + if(send.substr(1) != "/exit" && send.substr(1) != "/disconnect") | ||
40 | + { | ||
41 | + chat->putMsgToPrintQueue(chat->getNickname().toStdString().append(": ").append(send.substr(1))); | ||
42 | + } | ||
67 | } | 43 | } |
68 | - *s << send; | ||
69 | msgLock->unlock(); | 44 | msgLock->unlock(); |
45 | + *s << send; | ||
70 | send = send.substr(1); | 46 | send = send.substr(1); |
71 | if(send == "/disconnect" || send == "/exit") | 47 | if(send == "/disconnect" || send == "/exit") |
72 | { | 48 | { |
73 | break; | 49 | break; |
74 | } | 50 | } |
75 | - chat->putMsgToPrintQueue(chat->getNickname().toStdString().append(": ").append(send)); | 51 | + |
76 | } | 52 | } |
77 | catch(SocketException& e) | 53 | catch(SocketException& e) |
78 | { | 54 | { |
79 | cout << e.description() << endl; | 55 | cout << e.description() << endl; |
80 | } | 56 | } |
81 | } | 57 | } |
82 | - cout << "sendThread finished" << endl; | ||
83 | } | 58 | } |
84 | 59 | ||
85 | void recvThread(Socket* s, Chatroom* chat) | 60 | void recvThread(Socket* s, Chatroom* chat) |
@@ -92,8 +67,7 @@ void recvThread(Socket* s, Chatroom* chat) | @@ -92,8 +67,7 @@ void recvThread(Socket* s, Chatroom* chat) | ||
92 | *s >> recv; | 67 | *s >> recv; |
93 | if(recv[0] == '1') | 68 | if(recv[0] == '1') |
94 | { | 69 | { |
95 | - recv = recv.substr(1); | ||
96 | - chat->relayMsg(recv); | 70 | + chat->relayMsg(recv.substr(1)); |
97 | continue; | 71 | continue; |
98 | } | 72 | } |
99 | else if(recv[0] == '0') | 73 | else if(recv[0] == '0') |
@@ -106,7 +80,7 @@ void recvThread(Socket* s, Chatroom* chat) | @@ -106,7 +80,7 @@ void recvThread(Socket* s, Chatroom* chat) | ||
106 | chat->setConnected(false); | 80 | chat->setConnected(false); |
107 | cout << e.description() << endl; | 81 | cout << e.description() << endl; |
108 | msgListNotEmpty.notify_all(); | 82 | msgListNotEmpty.notify_all(); |
109 | - emit chat->threadsFinished(false); | 83 | + chat->close(); |
110 | break; | 84 | break; |
111 | } | 85 | } |
112 | if(recv == "DISC_OK") | 86 | if(recv == "DISC_OK") |
@@ -114,7 +88,6 @@ void recvThread(Socket* s, Chatroom* chat) | @@ -114,7 +88,6 @@ void recvThread(Socket* s, Chatroom* chat) | ||
114 | cout << "Disconnecting" << endl; | 88 | cout << "Disconnecting" << endl; |
115 | chat->setConnected(false); | 89 | chat->setConnected(false); |
116 | msgListNotEmpty.notify_all(); | 90 | msgListNotEmpty.notify_all(); |
117 | - emit chat->threadsFinished(false); | ||
118 | break; | 91 | break; |
119 | } | 92 | } |
120 | else if(recv == "EXIT_OK") | 93 | else if(recv == "EXIT_OK") |
@@ -122,15 +95,71 @@ void recvThread(Socket* s, Chatroom* chat) | @@ -122,15 +95,71 @@ void recvThread(Socket* s, Chatroom* chat) | ||
122 | cout << "Exiting" << endl; | 95 | cout << "Exiting" << endl; |
123 | chat->setConnected(false); | 96 | chat->setConnected(false); |
124 | msgListNotEmpty.notify_all(); | 97 | msgListNotEmpty.notify_all(); |
125 | - emit chat->threadsFinished(true); | 98 | + chat->close(); |
126 | break; | 99 | break; |
127 | } | 100 | } |
101 | + else if(recv.substr(0,8) == "USERLIST") | ||
102 | + { | ||
103 | + QString userlist = QString::fromStdString(recv.substr(8)); | ||
104 | + chat->updateUserList(userlist); | ||
105 | + } | ||
128 | else | 106 | else |
129 | { | 107 | { |
130 | chat->putMsgToPrintQueue(recv); | 108 | chat->putMsgToPrintQueue(recv); |
131 | } | 109 | } |
132 | } | 110 | } |
133 | - cout << "recvThread finished" << endl; | 111 | +} |
112 | + | ||
113 | +Chatroom::Chatroom(QWidget *parent) : | ||
114 | + QMainWindow(parent), | ||
115 | + ui(new Ui::Chatroom) | ||
116 | +{ | ||
117 | + ui->setupUi(this); | ||
118 | + QList<int> chatSizes; | ||
119 | + QList<int> splitSizes; | ||
120 | + chatSizes.push_front(ui->chatText->height()); | ||
121 | + chatSizes.push_front(100); | ||
122 | + splitSizes.push_front(ui->chatWindow->width()); | ||
123 | + splitSizes.push_front(200); | ||
124 | + ui->chatSplitter->setSizes(chatSizes); | ||
125 | + ui->windowSplitter->setSizes(splitSizes); | ||
126 | + | ||
127 | + connected = false; | ||
128 | + msgLock = new unique_lock<std::mutex>(msgMutex,std::defer_lock); | ||
129 | + chatLock = new unique_lock<std::mutex>(chatMutex,std::defer_lock); | ||
130 | + send = NULL; | ||
131 | + recv = NULL; | ||
132 | + | ||
133 | + connect(ui->actionConnect,SIGNAL(triggered()),this,SLOT(startSession())); | ||
134 | + connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close())); | ||
135 | + connect(ui->actionDisconnect,SIGNAL(triggered()),this,SLOT(disconnectChatroom())); | ||
136 | + connect(ui->actionSave_chat,SIGNAL(triggered()),ui->chatText,SLOT(saveChatToFile())); | ||
137 | + connect(ui->inputText,SIGNAL(msgReady()),this,SLOT(sendMsg())); | ||
138 | + connect(ui->sendButton,SIGNAL(clicked()),this,SLOT(sendMsg())); | ||
139 | + connect(this,SIGNAL(messagesToPrint()),this,SLOT(printMsg())); | ||
140 | + connect(ui->userList,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(launchChatWindow(QModelIndex))); | ||
141 | + connect(this,SIGNAL(createChat(QString)),this,SLOT(newChat(QString))); | ||
142 | +} | ||
143 | + | ||
144 | +void Chatroom::closeEvent(QCloseEvent *event) | ||
145 | +{ | ||
146 | + if(recv == NULL && send == NULL) | ||
147 | + { | ||
148 | + ui->inputText->setReadOnly(true); | ||
149 | + ui->chatText->printServerMsg("Disconnected"); | ||
150 | + event->accept(); | ||
151 | + return; | ||
152 | + } | ||
153 | + sendQueue.clear(); | ||
154 | + QString exitMsg("/exit"); | ||
155 | + putMsgToSendQueue(exitMsg); | ||
156 | + ui->inputText->setReadOnly(true); | ||
157 | + recv->join(); | ||
158 | + send->join(); | ||
159 | + ui->chatText->printServerMsg("Disconnected"); | ||
160 | + send = NULL; | ||
161 | + recv = NULL; | ||
162 | + event->accept(); | ||
134 | } | 163 | } |
135 | 164 | ||
136 | bool Chatroom::getConnected() | 165 | bool Chatroom::getConnected() |
@@ -148,27 +177,72 @@ void Chatroom::setConnected(bool status) | @@ -148,27 +177,72 @@ void Chatroom::setConnected(bool status) | ||
148 | myMutex.unlock(); | 177 | myMutex.unlock(); |
149 | } | 178 | } |
150 | 179 | ||
151 | -void Chatroom::putMsgToPrintQueue(string &msg) | 180 | +void Chatroom::setNickname(QString nick) |
152 | { | 181 | { |
153 | - printQueue.push_back(msg); | ||
154 | - emit messagesToPrint(); | 182 | + nickname = nick; |
155 | } | 183 | } |
156 | 184 | ||
157 | -string Chatroom::getSender(string& msg) | 185 | +QString Chatroom::getNickname() |
158 | { | 186 | { |
159 | - return msg.substr(5,msg.find(':')-5); | 187 | + return nickname; |
160 | } | 188 | } |
161 | 189 | ||
162 | -void Chatroom::relayMsg(string& msg) | 190 | +void Chatroom::updateUserList(QString userlist) |
163 | { | 191 | { |
164 | - string sender = getSender(msg); | ||
165 | - map<string,ChatWindow>::iterator it = activeChats.begin(); | ||
166 | - if(activeChats.find(sender) == activeChats.end()) | 192 | + ui->userList->clear(); |
193 | + QStringList users = userlist.split('\n',QString::SkipEmptyParts); | ||
194 | + for(int i = 0; i < users.size(); i++) | ||
167 | { | 195 | { |
168 | - //LAUNCH new windowchat | 196 | + ui->userList->addItem(users[i]); |
169 | } | 197 | } |
198 | +} | ||
199 | + | ||
200 | +void Chatroom::relayMsg(string msg) | ||
201 | +{ | ||
202 | + string sender = getSender(msg); | ||
203 | + //AT LEAST SOME FUCKING SANITY CHECK... PLEASE!!! | ||
204 | + map<string,void*>::iterator it = activeChats.begin(); | ||
170 | it = activeChats.find(sender); | 205 | it = activeChats.find(sender); |
171 | - it->second.printMsg(msg); | 206 | + if(it == activeChats.end()) |
207 | + { | ||
208 | + chatLock->lock(); | ||
209 | + emit createChat(QString::fromStdString(sender)); | ||
210 | + chatCreated.wait(*chatLock); | ||
211 | + chatLock->unlock(); | ||
212 | + it = activeChats.find(sender); | ||
213 | + } | ||
214 | + ((ChatWindow*)it->second)->notifyPrint(msg); //NOT GOOD! | ||
215 | +} | ||
216 | + | ||
217 | +void Chatroom::newChat(QString peerNick) | ||
218 | +{ | ||
219 | + ChatWindow* newchat = new ChatWindow(peerNick,this); | ||
220 | + activeChats.insert(std::pair<string,ChatWindow*>(peerNick.toStdString(),newchat)); | ||
221 | + newchat->show(); | ||
222 | + chatCreated.notify_all(); | ||
223 | +} | ||
224 | + | ||
225 | +void Chatroom::removeChat(QString &nickname) | ||
226 | +{ | ||
227 | + ChatWindow* chat = (ChatWindow*)activeChats.find(nickname.toStdString())->second; | ||
228 | + delete chat; | ||
229 | + activeChats.erase(nickname.toStdString()); | ||
230 | +} | ||
231 | + | ||
232 | +void Chatroom::launchChatWindow(QModelIndex index) | ||
233 | +{ | ||
234 | + QString peerNick = ui->userList->model()->data(index).toString(); | ||
235 | + if(activeChats.find(peerNick.toStdString()) == activeChats.end()) | ||
236 | + { | ||
237 | + emit newChat(peerNick); | ||
238 | + } | ||
239 | +} | ||
240 | + | ||
241 | +void Chatroom::putMsgToPrintQueue(string &msg) | ||
242 | +{ | ||
243 | + printMutex.lock(); | ||
244 | + printQueue.push_back(msg); | ||
245 | + emit messagesToPrint(); | ||
172 | } | 246 | } |
173 | 247 | ||
174 | void Chatroom::printMsg() | 248 | void Chatroom::printMsg() |
@@ -179,6 +253,7 @@ void Chatroom::printMsg() | @@ -179,6 +253,7 @@ void Chatroom::printMsg() | ||
179 | ui->chatText->printMsg(msg); | 253 | ui->chatText->printMsg(msg); |
180 | printQueue.pop_front(); | 254 | printQueue.pop_front(); |
181 | } | 255 | } |
256 | + printMutex.unlock(); | ||
182 | } | 257 | } |
183 | 258 | ||
184 | void Chatroom::putMsgToSendQueue(QString& msg) | 259 | void Chatroom::putMsgToSendQueue(QString& msg) |
@@ -189,55 +264,35 @@ void Chatroom::putMsgToSendQueue(QString& msg) | @@ -189,55 +264,35 @@ void Chatroom::putMsgToSendQueue(QString& msg) | ||
189 | msgListNotEmpty.notify_all(); | 264 | msgListNotEmpty.notify_all(); |
190 | } | 265 | } |
191 | 266 | ||
192 | -void Chatroom::setNickname(QString nick) | ||
193 | -{ | ||
194 | - nickname = nick; | ||
195 | -} | ||
196 | - | ||
197 | -QString Chatroom::getNickname() | ||
198 | -{ | ||
199 | - return nickname; | ||
200 | -} | ||
201 | - | ||
202 | -void Chatroom::startSession() | 267 | +void Chatroom::sendMsg() |
203 | { | 268 | { |
204 | - LoginScreen login(&s,this); | ||
205 | - login.exec(); | ||
206 | - int result = login.result(); | ||
207 | - if(result == QDialog::Accepted) | 269 | + QString msg = ui->inputText->toPlainText(); |
270 | + ui->inputText->clear(); | ||
271 | + if(msg == "/disconnect") | ||
208 | { | 272 | { |
209 | - ui->inputText->setReadOnly(false); | 273 | + this->disconnectChatroom(); |
210 | } | 274 | } |
211 | - else if(result == QDialog::Rejected) | 275 | + else if(msg == "/exit") |
212 | { | 276 | { |
213 | - return; | 277 | + this->close(); |
278 | + } | ||
279 | + else | ||
280 | + { | ||
281 | + putMsgToSendQueue(msg); | ||
214 | } | 282 | } |
215 | - connected = true; | ||
216 | - ui->chatText->printServerMsg("Connected to chatroom"); | ||
217 | - recv = new std::thread(recvThread,&s,this); | ||
218 | - send = new std::thread(sendThread,&s,this); | ||
219 | -} | ||
220 | - | ||
221 | -void Chatroom::sendMsg() | ||
222 | -{ | ||
223 | - QString msg = ui->inputText->toPlainText(); | ||
224 | - ui->inputText->clear(); | ||
225 | - putMsgToSendQueue(msg); | ||
226 | } | 283 | } |
227 | 284 | ||
228 | -void Chatroom::finish() | 285 | +string Chatroom::getSender(string msg) |
229 | { | 286 | { |
230 | - if(recv == NULL && send == NULL) | 287 | + cout << msg << endl; |
288 | + if(msg[0] == '@') | ||
231 | { | 289 | { |
232 | - ui->inputText->setReadOnly(true); | ||
233 | - ui->chatText->printServerMsg("Disconnected"); | ||
234 | - this->close(); | 290 | + return msg.substr(1,msg.find(" ")-1); |
291 | + } | ||
292 | + else | ||
293 | + { | ||
294 | + return msg.substr(0,msg.find(":")); | ||
235 | } | 295 | } |
236 | - msgMutex.lock(); | ||
237 | - sendQueue.clear(); | ||
238 | - sendQueue.push_back("/exit"); | ||
239 | - msgMutex.unlock(); | ||
240 | - msgListNotEmpty.notify_all(); | ||
241 | } | 296 | } |
242 | 297 | ||
243 | void Chatroom::disconnectChatroom() | 298 | void Chatroom::disconnectChatroom() |
@@ -245,24 +300,34 @@ void Chatroom::disconnectChatroom() | @@ -245,24 +300,34 @@ void Chatroom::disconnectChatroom() | ||
245 | msgMutex.lock(); | 300 | msgMutex.lock(); |
246 | sendQueue.clear(); | 301 | sendQueue.clear(); |
247 | sendQueue.push_back("/disconnect"); | 302 | sendQueue.push_back("/disconnect"); |
303 | + ui->chatText->printServerMsg("Disconnected"); | ||
304 | + this->ui->inputText->setReadOnly(true); | ||
305 | + this->ui->sendButton->setDisabled(true); | ||
306 | + this->ui->actionDisconnect->setDisabled(true); | ||
248 | msgMutex.unlock(); | 307 | msgMutex.unlock(); |
249 | msgListNotEmpty.notify_all(); | 308 | msgListNotEmpty.notify_all(); |
250 | } | 309 | } |
251 | 310 | ||
252 | -void Chatroom::finishThreads(bool exit) | 311 | +void Chatroom::startSession() |
253 | { | 312 | { |
254 | - myMutex.lock(); | ||
255 | - ui->inputText->setReadOnly(true); | ||
256 | - recv->join(); | ||
257 | - send->join(); | ||
258 | - myMutex.unlock(); | ||
259 | - ui->chatText->printServerMsg("Disconnected"); | ||
260 | - send = NULL; | ||
261 | - recv = NULL; | ||
262 | - if(exit) | 313 | + LoginScreen login(&s,this); |
314 | + login.exec(); | ||
315 | + int result = login.result(); | ||
316 | + if(result == QDialog::Accepted) | ||
263 | { | 317 | { |
264 | - this->close(); | 318 | + ui->inputText->setReadOnly(false); |
319 | + } | ||
320 | + else if(result == QDialog::Rejected) | ||
321 | + { | ||
322 | + return; | ||
265 | } | 323 | } |
324 | + connected = true; | ||
325 | + this->ui->inputText->setReadOnly(false); | ||
326 | + this->ui->sendButton->setDisabled(false); | ||
327 | + this->ui->actionDisconnect->setDisabled(false); | ||
328 | + ui->chatText->printServerMsg("Connected to chatroom"); | ||
329 | + recv = new std::thread(recvThread,&s,this); | ||
330 | + send = new std::thread(sendThread,&s,this); | ||
266 | } | 331 | } |
267 | 332 | ||
268 | Chatroom::~Chatroom() | 333 | Chatroom::~Chatroom() |
@@ -270,6 +335,12 @@ Chatroom::~Chatroom() | @@ -270,6 +335,12 @@ Chatroom::~Chatroom() | ||
270 | delete msgLock; | 335 | delete msgLock; |
271 | delete recv; | 336 | delete recv; |
272 | delete send; | 337 | delete send; |
338 | + map<string,void*>::iterator it; | ||
339 | + for(it = activeChats.begin(); it != activeChats.end(); it++) | ||
340 | + { | ||
341 | + ChatWindow* chat = (ChatWindow*) it->second; | ||
342 | + delete chat; | ||
343 | + } | ||
273 | delete ui; | 344 | delete ui; |
274 | } | 345 | } |
275 | 346 |
QChatClient/chatroom.h
@@ -2,13 +2,14 @@ | @@ -2,13 +2,14 @@ | ||
2 | #define CHATROOM_H | 2 | #define CHATROOM_H |
3 | 3 | ||
4 | #include <QMainWindow> | 4 | #include <QMainWindow> |
5 | -#include "Socket.h" | ||
6 | -#include "loginscreen.h" | 5 | +#include <QModelIndex> |
7 | #include <thread> | 6 | #include <thread> |
8 | #include <mutex> | 7 | #include <mutex> |
9 | #include <condition_variable> | 8 | #include <condition_variable> |
10 | -#include "chatwindow.h" | ||
11 | #include <map> | 9 | #include <map> |
10 | +#include "loginscreen.h" | ||
11 | +#include "chatwindow.h" | ||
12 | +#include "Socket.h" | ||
12 | 13 | ||
13 | namespace Ui { | 14 | namespace Ui { |
14 | class Chatroom; | 15 | class Chatroom; |
@@ -22,37 +23,49 @@ public: | @@ -22,37 +23,49 @@ public: | ||
22 | explicit Chatroom(QWidget *parent = 0); | 23 | explicit Chatroom(QWidget *parent = 0); |
23 | bool getConnected(); | 24 | bool getConnected(); |
24 | void setConnected(bool status); | 25 | void setConnected(bool status); |
25 | - void relayMsg(string& msg); | ||
26 | - void setNickname(QString nick); | ||
27 | QString getNickname(); | 26 | QString getNickname(); |
27 | + void setNickname(QString nick); | ||
28 | + void updateUserList(QString userlist); | ||
29 | + void relayMsg(string msg); | ||
30 | + void removeChat(QString &nickname); | ||
28 | void putMsgToPrintQueue(string& msg); | 31 | void putMsgToPrintQueue(string& msg); |
32 | + void putMsgToSendQueue(QString& msg); | ||
29 | ~Chatroom(); | 33 | ~Chatroom(); |
30 | 34 | ||
35 | +private: | ||
36 | + Ui::Chatroom *ui; | ||
37 | + Socket s; | ||
38 | + bool connected; | ||
39 | + std::thread *send; | ||
40 | + std::thread *recv; | ||
41 | + QString nickname; | ||
42 | + list<string> printQueue; | ||
43 | + map<string,void*> activeChats; | ||
44 | + std::mutex chatMutex; | ||
45 | + unique_lock<std::mutex>* chatLock; | ||
46 | + std::condition_variable chatCreated; | ||
47 | + string getSender(string msg); | ||
48 | + | ||
49 | +private slots: | ||
50 | + void newChat(QString peerNick); | ||
51 | + | ||
52 | + | ||
53 | +protected: | ||
54 | + void closeEvent(QCloseEvent *event); | ||
55 | + | ||
31 | public slots: | 56 | public slots: |
32 | void startSession(); | 57 | void startSession(); |
33 | void sendMsg(); | 58 | void sendMsg(); |
34 | - void printMsg(); | 59 | + void disconnectChatroom(); |
60 | + void launchChatWindow(QModelIndex index); | ||
35 | 61 | ||
36 | private slots: | 62 | private slots: |
37 | - void finishThreads(bool exit); | ||
38 | - void finish(); | ||
39 | - void disconnectChatroom(); | 63 | + void printMsg(); |
40 | 64 | ||
41 | signals: | 65 | signals: |
42 | - void threadsFinished(bool exit); | ||
43 | void messagesToPrint(); | 66 | void messagesToPrint(); |
44 | - | ||
45 | -private: | ||
46 | - Ui::Chatroom *ui; | ||
47 | - map<string,ChatWindow> activeChats; | ||
48 | - bool connected; | ||
49 | - string getSender(string& msg); | ||
50 | - void putMsgToSendQueue(QString& msg); | ||
51 | - std::thread *send; | ||
52 | - std::thread *recv; | ||
53 | - Socket s; | ||
54 | - QString nickname; | ||
55 | - list<string> printQueue; | 67 | + void createChat(QString sender); |
68 | + | ||
56 | }; | 69 | }; |
57 | 70 | ||
58 | void sendThread(Socket* s, Chatroom *chat); | 71 | void sendThread(Socket* s, Chatroom *chat); |
QChatClient/chatroom.ui
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | </property> | 44 | </property> |
45 | <widget class="ChatWidget" name="chatText"> | 45 | <widget class="ChatWidget" name="chatText"> |
46 | <property name="readOnly"> | 46 | <property name="readOnly"> |
47 | - <bool>false</bool> | 47 | + <bool>true</bool> |
48 | </property> | 48 | </property> |
49 | </widget> | 49 | </widget> |
50 | <widget class="chatInputText" name="inputText"> | 50 | <widget class="chatInputText" name="inputText"> |
@@ -92,6 +92,9 @@ | @@ -92,6 +92,9 @@ | ||
92 | </item> | 92 | </item> |
93 | <item row="1" column="0"> | 93 | <item row="1" column="0"> |
94 | <widget class="QPushButton" name="sendButton"> | 94 | <widget class="QPushButton" name="sendButton"> |
95 | + <property name="enabled"> | ||
96 | + <bool>false</bool> | ||
97 | + </property> | ||
95 | <property name="sizePolicy"> | 98 | <property name="sizePolicy"> |
96 | <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | 99 | <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
97 | <horstretch>0</horstretch> | 100 | <horstretch>0</horstretch> |
@@ -120,6 +123,7 @@ | @@ -120,6 +123,7 @@ | ||
120 | </property> | 123 | </property> |
121 | <addaction name="actionConnect"/> | 124 | <addaction name="actionConnect"/> |
122 | <addaction name="actionDisconnect"/> | 125 | <addaction name="actionDisconnect"/> |
126 | + <addaction name="actionSave_chat"/> | ||
123 | <addaction name="actionExit"/> | 127 | <addaction name="actionExit"/> |
124 | </widget> | 128 | </widget> |
125 | <addaction name="menuChat"/> | 129 | <addaction name="menuChat"/> |
@@ -135,10 +139,18 @@ | @@ -135,10 +139,18 @@ | ||
135 | </property> | 139 | </property> |
136 | </action> | 140 | </action> |
137 | <action name="actionDisconnect"> | 141 | <action name="actionDisconnect"> |
142 | + <property name="enabled"> | ||
143 | + <bool>false</bool> | ||
144 | + </property> | ||
138 | <property name="text"> | 145 | <property name="text"> |
139 | <string>Disconnect</string> | 146 | <string>Disconnect</string> |
140 | </property> | 147 | </property> |
141 | </action> | 148 | </action> |
149 | + <action name="actionSave_chat"> | ||
150 | + <property name="text"> | ||
151 | + <string>Save chat...</string> | ||
152 | + </property> | ||
153 | + </action> | ||
142 | </widget> | 154 | </widget> |
143 | <customwidgets> | 155 | <customwidgets> |
144 | <customwidget> | 156 | <customwidget> |
@@ -152,6 +164,12 @@ | @@ -152,6 +164,12 @@ | ||
152 | <header>chatinputtext.h</header> | 164 | <header>chatinputtext.h</header> |
153 | </customwidget> | 165 | </customwidget> |
154 | </customwidgets> | 166 | </customwidgets> |
167 | + <tabstops> | ||
168 | + <tabstop>chatText</tabstop> | ||
169 | + <tabstop>inputText</tabstop> | ||
170 | + <tabstop>userList</tabstop> | ||
171 | + <tabstop>sendButton</tabstop> | ||
172 | + </tabstops> | ||
155 | <resources/> | 173 | <resources/> |
156 | <connections/> | 174 | <connections/> |
157 | </ui> | 175 | </ui> |
QChatClient/chatwidget.cpp
@@ -6,17 +6,40 @@ ChatWidget::ChatWidget(QWidget *parent) : | @@ -6,17 +6,40 @@ ChatWidget::ChatWidget(QWidget *parent) : | ||
6 | 6 | ||
7 | } | 7 | } |
8 | 8 | ||
9 | -void ChatWidget::printServerMsg(const string &str) | 9 | +void ChatWidget::printMsg(const string &str) |
10 | { | 10 | { |
11 | - this->append("<p style=\"font-style:italic;color:gray;line-height:25%;\">" + QString::fromStdString(str) + "</p>"); | 11 | + this->setFontWeight(QFont::Normal); |
12 | + this->setFontItalic(false); | ||
13 | + this->setTextColor(Qt::black); | ||
14 | + this->append(QString::fromStdString(str)); | ||
12 | } | 15 | } |
13 | 16 | ||
14 | -void ChatWidget::printMsg(const string &str) | 17 | +void ChatWidget::printServerMsg(const string &str) |
15 | { | 18 | { |
19 | + this->setFontWeight(QFont::Normal); | ||
20 | + this->setFontItalic(true); | ||
21 | + this->setTextColor(Qt::gray); | ||
16 | this->append(QString::fromStdString(str)); | 22 | this->append(QString::fromStdString(str)); |
17 | } | 23 | } |
18 | 24 | ||
19 | void ChatWidget::printStatusMsg(const string &str) | 25 | void ChatWidget::printStatusMsg(const string &str) |
20 | { | 26 | { |
21 | - this->append("<p style=\"font-weight:bold;line-height:25%;\">" + QString::fromStdString(str) + "</p>"); | 27 | + this->setFontWeight(QFont::Bold); |
28 | + this->setFontItalic(false); | ||
29 | + this->setTextColor(Qt::black); | ||
30 | + this->append(QString::fromStdString(str)); | ||
31 | +} | ||
32 | + | ||
33 | +void ChatWidget::saveChatToFile() | ||
34 | +{ | ||
35 | + QFileDialog fileDialog; | ||
36 | + fileDialog.setFileMode(QFileDialog::AnyFile); | ||
37 | + fileDialog.setAcceptMode(QFileDialog::AcceptSave); | ||
38 | + fileDialog.exec(); | ||
39 | + QString filename = fileDialog.selectedFiles().front(); | ||
40 | + QFile file(filename); | ||
41 | + file.open(QIODevice::WriteOnly | QIODevice::Text); | ||
42 | + QTextStream fileOut(&file); | ||
43 | + fileOut << this->toPlainText() << endl; | ||
44 | + file.close(); | ||
22 | } | 45 | } |
QChatClient/chatwidget.h
@@ -2,6 +2,9 @@ | @@ -2,6 +2,9 @@ | ||
2 | #define CHATWIDGET_H | 2 | #define CHATWIDGET_H |
3 | 3 | ||
4 | #include <QTextEdit> | 4 | #include <QTextEdit> |
5 | +#include <QFileDialog> | ||
6 | +#include <QFile> | ||
7 | +#include <QTextStream> | ||
5 | 8 | ||
6 | using namespace std; | 9 | using namespace std; |
7 | 10 | ||
@@ -10,13 +13,14 @@ class ChatWidget : public QTextEdit | @@ -10,13 +13,14 @@ class ChatWidget : public QTextEdit | ||
10 | Q_OBJECT | 13 | Q_OBJECT |
11 | public: | 14 | public: |
12 | explicit ChatWidget(QWidget *parent = 0); | 15 | explicit ChatWidget(QWidget *parent = 0); |
13 | - void printServerMsg(const string &str); | ||
14 | void printMsg(const string& str); | 16 | void printMsg(const string& str); |
17 | + void printServerMsg(const string &str); | ||
15 | void printStatusMsg(const string& str); | 18 | void printStatusMsg(const string& str); |
16 | 19 | ||
17 | signals: | 20 | signals: |
18 | 21 | ||
19 | public slots: | 22 | public slots: |
23 | + void saveChatToFile(); | ||
20 | 24 | ||
21 | }; | 25 | }; |
22 | 26 |
QChatClient/chatwindow.cpp
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | 3 | ||
4 | using namespace std; | 4 | using namespace std; |
5 | 5 | ||
6 | -ChatWindow::ChatWindow(QString& nickname, QWidget *parent) : | 6 | +ChatWindow::ChatWindow(QString nick, QWidget *parent) : |
7 | QMainWindow(parent), | 7 | QMainWindow(parent), |
8 | ui(new Ui::ChatWindow) | 8 | ui(new Ui::ChatWindow) |
9 | { | 9 | { |
@@ -12,13 +12,48 @@ ChatWindow::ChatWindow(QString& nickname, QWidget *parent) : | @@ -12,13 +12,48 @@ ChatWindow::ChatWindow(QString& nickname, QWidget *parent) : | ||
12 | sizes.push_front(ui->chatText->height()); | 12 | sizes.push_front(ui->chatText->height()); |
13 | sizes.push_front(100); | 13 | sizes.push_front(100); |
14 | ui->splitter->setSizes(sizes); | 14 | ui->splitter->setSizes(sizes); |
15 | - this->setWindowTitle("Chat with " + nickname); | 15 | + |
16 | + nickName = nick; | ||
17 | + myNickname = ((Chatroom*)this->parent())->getNickname(); | ||
18 | + this->setWindowTitle("Chat with " + nick); | ||
19 | + | ||
16 | connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close())); | 20 | connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close())); |
21 | + connect(ui->actionSave_chat,SIGNAL(triggered()),ui->chatText,SLOT(saveChatToFile())); | ||
22 | + connect(ui->inputText,SIGNAL(msgReady()),this,SLOT(sendMsg())); | ||
23 | + connect(ui->sendButton,SIGNAL(clicked()),this,SLOT(sendMsg())); | ||
24 | + connect(this,SIGNAL(msgToPrint(QString)),this,SLOT(printMsg(QString))); | ||
25 | +} | ||
26 | + | ||
27 | +void ChatWindow::notifyPrint(string &msg) | ||
28 | +{ | ||
29 | + emit msgToPrint(QString::fromStdString(msg)); | ||
30 | +} | ||
31 | + | ||
32 | +void ChatWindow::printMsg(QString str) | ||
33 | +{ | ||
34 | + string msg = str.toStdString(); | ||
35 | + if(str[0] == '@') | ||
36 | + { | ||
37 | + ui->chatText->printMsg(myNickname.toStdString() + ":" + msg.substr(msg.find(" "))); | ||
38 | + } | ||
39 | + else | ||
40 | + { | ||
41 | + ui->chatText->printMsg(msg); | ||
42 | + } | ||
43 | +} | ||
44 | + | ||
45 | +void ChatWindow::sendMsg() | ||
46 | +{ | ||
47 | + QString msg = ui->inputText->toPlainText(); | ||
48 | + ui->inputText->clear(); | ||
49 | + msg = "@" + nickName + " " +msg; | ||
50 | + ((Chatroom*)this->parent())->putMsgToSendQueue(msg); | ||
17 | } | 51 | } |
18 | 52 | ||
19 | -void ChatWindow::printMsg(string& str) | 53 | +void ChatWindow::closeEvent(QCloseEvent *event) |
20 | { | 54 | { |
21 | - ui->chatText->printMsg(str); | 55 | + ((Chatroom*)this->parent())->removeChat(this->nickName); |
56 | + event->accept(); | ||
22 | } | 57 | } |
23 | 58 | ||
24 | ChatWindow::~ChatWindow() | 59 | ChatWindow::~ChatWindow() |
QChatClient/chatwindow.h
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | 3 | ||
4 | #include <QMainWindow> | 4 | #include <QMainWindow> |
5 | #include <string> | 5 | #include <string> |
6 | +#include "chatroom.h" | ||
6 | 7 | ||
7 | using namespace std; | 8 | using namespace std; |
8 | 9 | ||
@@ -15,12 +16,27 @@ class ChatWindow : public QMainWindow | @@ -15,12 +16,27 @@ class ChatWindow : public QMainWindow | ||
15 | Q_OBJECT | 16 | Q_OBJECT |
16 | 17 | ||
17 | public: | 18 | public: |
18 | - explicit ChatWindow(QString& nickname,QWidget *parent = 0); | ||
19 | - void printMsg(string& str); | 19 | + explicit ChatWindow(QString nick, QWidget *parent = 0); |
20 | + void notifyPrint(string& msg); | ||
20 | ~ChatWindow(); | 21 | ~ChatWindow(); |
22 | + | ||
23 | +public slots: | ||
24 | + void sendMsg(); | ||
21 | 25 | ||
22 | private: | 26 | private: |
23 | Ui::ChatWindow *ui; | 27 | Ui::ChatWindow *ui; |
28 | + QString nickName; | ||
29 | + QString myNickname; | ||
30 | + | ||
31 | +private slots: | ||
32 | + void printMsg(QString str); | ||
33 | + | ||
34 | +protected: | ||
35 | + void closeEvent(QCloseEvent *event); | ||
36 | + | ||
37 | +signals: | ||
38 | + void msgToPrint(QString msg); | ||
39 | + | ||
24 | }; | 40 | }; |
25 | 41 | ||
26 | #endif // CHATWINDOW_H | 42 | #endif // CHATWINDOW_H |
QChatClient/chatwindow.ui
@@ -92,7 +92,7 @@ | @@ -92,7 +92,7 @@ | ||
92 | </size> | 92 | </size> |
93 | </property> | 93 | </property> |
94 | <property name="readOnly"> | 94 | <property name="readOnly"> |
95 | - <bool>true</bool> | 95 | + <bool>false</bool> |
96 | </property> | 96 | </property> |
97 | </widget> | 97 | </widget> |
98 | </widget> | 98 | </widget> |
@@ -115,6 +115,7 @@ | @@ -115,6 +115,7 @@ | ||
115 | <property name="title"> | 115 | <property name="title"> |
116 | <string>Chat</string> | 116 | <string>Chat</string> |
117 | </property> | 117 | </property> |
118 | + <addaction name="actionSave_chat"/> | ||
118 | <addaction name="actionExit"/> | 119 | <addaction name="actionExit"/> |
119 | </widget> | 120 | </widget> |
120 | <addaction name="menuChat"/> | 121 | <addaction name="menuChat"/> |
@@ -124,6 +125,11 @@ | @@ -124,6 +125,11 @@ | ||
124 | <string>Exit</string> | 125 | <string>Exit</string> |
125 | </property> | 126 | </property> |
126 | </action> | 127 | </action> |
128 | + <action name="actionSave_chat"> | ||
129 | + <property name="text"> | ||
130 | + <string>Save chat...</string> | ||
131 | + </property> | ||
132 | + </action> | ||
127 | </widget> | 133 | </widget> |
128 | <layoutdefault spacing="6" margin="11"/> | 134 | <layoutdefault spacing="6" margin="11"/> |
129 | <customwidgets> | 135 | <customwidgets> |
@@ -138,6 +144,11 @@ | @@ -138,6 +144,11 @@ | ||
138 | <header>chatinputtext.h</header> | 144 | <header>chatinputtext.h</header> |
139 | </customwidget> | 145 | </customwidget> |
140 | </customwidgets> | 146 | </customwidgets> |
147 | + <tabstops> | ||
148 | + <tabstop>chatText</tabstop> | ||
149 | + <tabstop>inputText</tabstop> | ||
150 | + <tabstop>sendButton</tabstop> | ||
151 | + </tabstops> | ||
141 | <resources/> | 152 | <resources/> |
142 | <connections/> | 153 | <connections/> |
143 | </ui> | 154 | </ui> |
QChatClient/loginscreen.cpp
@@ -15,6 +15,12 @@ LoginScreen::LoginScreen(Socket* s, QWidget *parent) : | @@ -15,6 +15,12 @@ LoginScreen::LoginScreen(Socket* s, QWidget *parent) : | ||
15 | connect(ui->cancelButton,SIGNAL(clicked()),this,SLOT(cancelLogin())); | 15 | connect(ui->cancelButton,SIGNAL(clicked()),this,SLOT(cancelLogin())); |
16 | } | 16 | } |
17 | 17 | ||
18 | +bool LoginScreen::validateURL(QString& URL) | ||
19 | +{ | ||
20 | + QRegExp regex("([a-zA-Z.]+|((\\d{1,3}\\.){3}\\d{1,3})):\\d+"); | ||
21 | + return regex.exactMatch(URL); | ||
22 | +} | ||
23 | + | ||
18 | bool LoginScreen::parseURL(QString& URL) | 24 | bool LoginScreen::parseURL(QString& URL) |
19 | { | 25 | { |
20 | if(validateURL(URL)) | 26 | if(validateURL(URL)) |
@@ -32,12 +38,6 @@ bool LoginScreen::parseURL(QString& URL) | @@ -32,12 +38,6 @@ bool LoginScreen::parseURL(QString& URL) | ||
32 | } | 38 | } |
33 | } | 39 | } |
34 | 40 | ||
35 | -bool LoginScreen::validateURL(QString& URL) | ||
36 | -{ | ||
37 | - QRegExp regex("([a-zA-Z.]+|((\\d{1,3}\\.){3}\\d{1,3})):\\d+"); | ||
38 | - return regex.exactMatch(URL); | ||
39 | -} | ||
40 | - | ||
41 | void LoginScreen::connectToChat() | 41 | void LoginScreen::connectToChat() |
42 | { | 42 | { |
43 | QString nick; | 43 | QString nick; |
QChatClient/loginscreen.h
@@ -3,8 +3,9 @@ | @@ -3,8 +3,9 @@ | ||
3 | 3 | ||
4 | #include <QDialog> | 4 | #include <QDialog> |
5 | #include <QRegExp> | 5 | #include <QRegExp> |
6 | -#include "Socket.h" | ||
7 | #include "chatroom.h" | 6 | #include "chatroom.h" |
7 | +#include "Socket.h" | ||
8 | + | ||
8 | 9 | ||
9 | namespace Ui { | 10 | namespace Ui { |
10 | class LoginScreen; | 11 | class LoginScreen; |
@@ -26,9 +27,9 @@ public slots: | @@ -26,9 +27,9 @@ public slots: | ||
26 | 27 | ||
27 | private: | 28 | private: |
28 | Ui::LoginScreen *ui; | 29 | Ui::LoginScreen *ui; |
29 | - int port; | ||
30 | - QString host; | ||
31 | Socket* s; | 30 | Socket* s; |
31 | + QString host; | ||
32 | + int port; | ||
32 | }; | 33 | }; |
33 | 34 | ||
34 | #endif // LOGINSCREEN_H | 35 | #endif // LOGINSCREEN_H |
build-QChatClient-Desktop-Debug/Makefile
1 | ############################################################################# | 1 | ############################################################################# |
2 | # Makefile for building: QChatClient | 2 | # Makefile for building: QChatClient |
3 | -# Generated by qmake (3.0) (Qt 5.0.2) on: miรฉ dic 25 23:23:03 2013 | 3 | +# Generated by qmake (3.0) (Qt 5.0.2) on: vie dic 27 07:18:49 2013 |
4 | # Project: ../QChatClient/QChatClient.pro | 4 | # Project: ../QChatClient/QChatClient.pro |
5 | # Template: app | 5 | # Template: app |
6 | # Command: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake -spec linux-g++-64 CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug -o Makefile ../QChatClient/QChatClient.pro | 6 | # Command: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake -spec linux-g++-64 CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug -o Makefile ../QChatClient/QChatClient.pro |
@@ -414,14 +414,16 @@ moc_loginscreen.cpp: /usr/include/qt5/QtWidgets/QDialog \ | @@ -414,14 +414,16 @@ moc_loginscreen.cpp: /usr/include/qt5/QtWidgets/QDialog \ | ||
414 | /usr/include/qt5/QtGui/qvector2d.h \ | 414 | /usr/include/qt5/QtGui/qvector2d.h \ |
415 | /usr/include/qt5/QtGui/qtouchdevice.h \ | 415 | /usr/include/qt5/QtGui/qtouchdevice.h \ |
416 | /usr/include/qt5/QtCore/QRegExp \ | 416 | /usr/include/qt5/QtCore/QRegExp \ |
417 | - ../QChatClient/Socket.h \ | ||
418 | - ../QChatClient/SocketException.h \ | ||
419 | ../QChatClient/chatroom.h \ | 417 | ../QChatClient/chatroom.h \ |
420 | /usr/include/qt5/QtWidgets/QMainWindow \ | 418 | /usr/include/qt5/QtWidgets/QMainWindow \ |
421 | /usr/include/qt5/QtWidgets/qmainwindow.h \ | 419 | /usr/include/qt5/QtWidgets/qmainwindow.h \ |
422 | /usr/include/qt5/QtWidgets/qtabwidget.h \ | 420 | /usr/include/qt5/QtWidgets/qtabwidget.h \ |
423 | /usr/include/qt5/QtGui/qicon.h \ | 421 | /usr/include/qt5/QtGui/qicon.h \ |
422 | + /usr/include/qt5/QtCore/QModelIndex \ | ||
423 | + /usr/include/qt5/QtCore/qabstractitemmodel.h \ | ||
424 | ../QChatClient/loginscreen.h \ | 424 | ../QChatClient/loginscreen.h \ |
425 | + ../QChatClient/Socket.h \ | ||
426 | + ../QChatClient/SocketException.h \ | ||
425 | ../QChatClient/chatwindow.h \ | 427 | ../QChatClient/chatwindow.h \ |
426 | ../QChatClient/loginscreen.h | 428 | ../QChatClient/loginscreen.h |
427 | /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) ../QChatClient/loginscreen.h -o moc_loginscreen.cpp | 429 | /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) ../QChatClient/loginscreen.h -o moc_loginscreen.cpp |
@@ -536,14 +538,16 @@ moc_chatroom.cpp: /usr/include/qt5/QtWidgets/QMainWindow \ | @@ -536,14 +538,16 @@ moc_chatroom.cpp: /usr/include/qt5/QtWidgets/QMainWindow \ | ||
536 | /usr/include/qt5/QtGui/qtouchdevice.h \ | 538 | /usr/include/qt5/QtGui/qtouchdevice.h \ |
537 | /usr/include/qt5/QtWidgets/qtabwidget.h \ | 539 | /usr/include/qt5/QtWidgets/qtabwidget.h \ |
538 | /usr/include/qt5/QtGui/qicon.h \ | 540 | /usr/include/qt5/QtGui/qicon.h \ |
539 | - ../QChatClient/Socket.h \ | ||
540 | - ../QChatClient/SocketException.h \ | 541 | + /usr/include/qt5/QtCore/QModelIndex \ |
542 | + /usr/include/qt5/QtCore/qabstractitemmodel.h \ | ||
541 | ../QChatClient/loginscreen.h \ | 543 | ../QChatClient/loginscreen.h \ |
542 | /usr/include/qt5/QtWidgets/QDialog \ | 544 | /usr/include/qt5/QtWidgets/QDialog \ |
543 | /usr/include/qt5/QtWidgets/qdialog.h \ | 545 | /usr/include/qt5/QtWidgets/qdialog.h \ |
544 | /usr/include/qt5/QtCore/QRegExp \ | 546 | /usr/include/qt5/QtCore/QRegExp \ |
545 | ../QChatClient/chatroom.h \ | 547 | ../QChatClient/chatroom.h \ |
546 | ../QChatClient/chatwindow.h \ | 548 | ../QChatClient/chatwindow.h \ |
549 | + ../QChatClient/Socket.h \ | ||
550 | + ../QChatClient/SocketException.h \ | ||
547 | ../QChatClient/chatroom.h | 551 | ../QChatClient/chatroom.h |
548 | /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) ../QChatClient/chatroom.h -o moc_chatroom.cpp | 552 | /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) ../QChatClient/chatroom.h -o moc_chatroom.cpp |
549 | 553 | ||
@@ -662,6 +666,13 @@ moc_chatwidget.cpp: /usr/include/qt5/QtWidgets/QTextEdit \ | @@ -662,6 +666,13 @@ moc_chatwidget.cpp: /usr/include/qt5/QtWidgets/QTextEdit \ | ||
662 | /usr/include/qt5/QtGui/qtextcursor.h \ | 666 | /usr/include/qt5/QtGui/qtextcursor.h \ |
663 | /usr/include/qt5/QtGui/qtextformat.h \ | 667 | /usr/include/qt5/QtGui/qtextformat.h \ |
664 | /usr/include/qt5/QtGui/qpen.h \ | 668 | /usr/include/qt5/QtGui/qpen.h \ |
669 | + /usr/include/qt5/QtWidgets/QFileDialog \ | ||
670 | + /usr/include/qt5/QtWidgets/qfiledialog.h \ | ||
671 | + /usr/include/qt5/QtCore/qdir.h \ | ||
672 | + /usr/include/qt5/QtCore/qfileinfo.h \ | ||
673 | + /usr/include/qt5/QtWidgets/qdialog.h \ | ||
674 | + /usr/include/qt5/QtCore/QFile \ | ||
675 | + /usr/include/qt5/QtCore/QTextStream \ | ||
665 | ../QChatClient/chatwidget.h | 676 | ../QChatClient/chatwidget.h |
666 | /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) ../QChatClient/chatwidget.h -o moc_chatwidget.cpp | 677 | /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) ../QChatClient/chatwidget.h -o moc_chatwidget.cpp |
667 | 678 | ||
@@ -775,6 +786,16 @@ moc_chatwindow.cpp: /usr/include/qt5/QtWidgets/QMainWindow \ | @@ -775,6 +786,16 @@ moc_chatwindow.cpp: /usr/include/qt5/QtWidgets/QMainWindow \ | ||
775 | /usr/include/qt5/QtGui/qtouchdevice.h \ | 786 | /usr/include/qt5/QtGui/qtouchdevice.h \ |
776 | /usr/include/qt5/QtWidgets/qtabwidget.h \ | 787 | /usr/include/qt5/QtWidgets/qtabwidget.h \ |
777 | /usr/include/qt5/QtGui/qicon.h \ | 788 | /usr/include/qt5/QtGui/qicon.h \ |
789 | + ../QChatClient/chatroom.h \ | ||
790 | + /usr/include/qt5/QtCore/QModelIndex \ | ||
791 | + /usr/include/qt5/QtCore/qabstractitemmodel.h \ | ||
792 | + ../QChatClient/loginscreen.h \ | ||
793 | + /usr/include/qt5/QtWidgets/QDialog \ | ||
794 | + /usr/include/qt5/QtWidgets/qdialog.h \ | ||
795 | + /usr/include/qt5/QtCore/QRegExp \ | ||
796 | + ../QChatClient/Socket.h \ | ||
797 | + ../QChatClient/SocketException.h \ | ||
798 | + ../QChatClient/chatwindow.h \ | ||
778 | ../QChatClient/chatwindow.h | 799 | ../QChatClient/chatwindow.h |
779 | /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) ../QChatClient/chatwindow.h -o moc_chatwindow.cpp | 800 | /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) ../QChatClient/chatwindow.h -o moc_chatwindow.cpp |
780 | 801 | ||
@@ -1022,6 +1043,13 @@ ui_chatwindow.h: ../QChatClient/chatwindow.ui \ | @@ -1022,6 +1043,13 @@ ui_chatwindow.h: ../QChatClient/chatwindow.ui \ | ||
1022 | /usr/include/qt5/QtGui/qtextcursor.h \ | 1043 | /usr/include/qt5/QtGui/qtextcursor.h \ |
1023 | /usr/include/qt5/QtGui/qtextformat.h \ | 1044 | /usr/include/qt5/QtGui/qtextformat.h \ |
1024 | /usr/include/qt5/QtGui/qpen.h \ | 1045 | /usr/include/qt5/QtGui/qpen.h \ |
1046 | + /usr/include/qt5/QtWidgets/QFileDialog \ | ||
1047 | + /usr/include/qt5/QtWidgets/qfiledialog.h \ | ||
1048 | + /usr/include/qt5/QtCore/qdir.h \ | ||
1049 | + /usr/include/qt5/QtCore/qfileinfo.h \ | ||
1050 | + /usr/include/qt5/QtWidgets/qdialog.h \ | ||
1051 | + /usr/include/qt5/QtCore/QFile \ | ||
1052 | + /usr/include/qt5/QtCore/QTextStream \ | ||
1025 | /usr/include/qt5/QtWidgets/QTextEdit \ | 1053 | /usr/include/qt5/QtWidgets/QTextEdit \ |
1026 | /usr/include/qt5/QtWidgets/qtextedit.h \ | 1054 | /usr/include/qt5/QtWidgets/qtextedit.h \ |
1027 | /usr/include/qt5/QtWidgets/qabstractscrollarea.h \ | 1055 | /usr/include/qt5/QtWidgets/qabstractscrollarea.h \ |
@@ -1261,6 +1289,13 @@ ui_chatroom.h: ../QChatClient/chatroom.ui \ | @@ -1261,6 +1289,13 @@ ui_chatroom.h: ../QChatClient/chatroom.ui \ | ||
1261 | /usr/include/qt5/QtGui/qtextcursor.h \ | 1289 | /usr/include/qt5/QtGui/qtextcursor.h \ |
1262 | /usr/include/qt5/QtGui/qtextformat.h \ | 1290 | /usr/include/qt5/QtGui/qtextformat.h \ |
1263 | /usr/include/qt5/QtGui/qpen.h \ | 1291 | /usr/include/qt5/QtGui/qpen.h \ |
1292 | + /usr/include/qt5/QtWidgets/QFileDialog \ | ||
1293 | + /usr/include/qt5/QtWidgets/qfiledialog.h \ | ||
1294 | + /usr/include/qt5/QtCore/qdir.h \ | ||
1295 | + /usr/include/qt5/QtCore/qfileinfo.h \ | ||
1296 | + /usr/include/qt5/QtWidgets/qdialog.h \ | ||
1297 | + /usr/include/qt5/QtCore/QFile \ | ||
1298 | + /usr/include/qt5/QtCore/QTextStream \ | ||
1264 | /usr/include/qt5/QtWidgets/QTextEdit \ | 1299 | /usr/include/qt5/QtWidgets/QTextEdit \ |
1265 | /usr/include/qt5/QtWidgets/qtextedit.h \ | 1300 | /usr/include/qt5/QtWidgets/qtextedit.h \ |
1266 | /usr/include/qt5/QtWidgets/qabstractscrollarea.h \ | 1301 | /usr/include/qt5/QtWidgets/qabstractscrollarea.h \ |
@@ -1499,14 +1534,16 @@ main.o: ../QChatClient/main.cpp ../QChatClient/loginscreen.h \ | @@ -1499,14 +1534,16 @@ main.o: ../QChatClient/main.cpp ../QChatClient/loginscreen.h \ | ||
1499 | /usr/include/qt5/QtGui/qvector2d.h \ | 1534 | /usr/include/qt5/QtGui/qvector2d.h \ |
1500 | /usr/include/qt5/QtGui/qtouchdevice.h \ | 1535 | /usr/include/qt5/QtGui/qtouchdevice.h \ |
1501 | /usr/include/qt5/QtCore/QRegExp \ | 1536 | /usr/include/qt5/QtCore/QRegExp \ |
1502 | - ../QChatClient/Socket.h \ | ||
1503 | - ../QChatClient/SocketException.h \ | ||
1504 | ../QChatClient/chatroom.h \ | 1537 | ../QChatClient/chatroom.h \ |
1505 | /usr/include/qt5/QtWidgets/QMainWindow \ | 1538 | /usr/include/qt5/QtWidgets/QMainWindow \ |
1506 | /usr/include/qt5/QtWidgets/qmainwindow.h \ | 1539 | /usr/include/qt5/QtWidgets/qmainwindow.h \ |
1507 | /usr/include/qt5/QtWidgets/qtabwidget.h \ | 1540 | /usr/include/qt5/QtWidgets/qtabwidget.h \ |
1508 | /usr/include/qt5/QtGui/qicon.h \ | 1541 | /usr/include/qt5/QtGui/qicon.h \ |
1542 | + /usr/include/qt5/QtCore/QModelIndex \ | ||
1543 | + /usr/include/qt5/QtCore/qabstractitemmodel.h \ | ||
1509 | ../QChatClient/chatwindow.h \ | 1544 | ../QChatClient/chatwindow.h \ |
1545 | + ../QChatClient/Socket.h \ | ||
1546 | + ../QChatClient/SocketException.h \ | ||
1510 | /usr/include/qt5/QtWidgets/QApplication \ | 1547 | /usr/include/qt5/QtWidgets/QApplication \ |
1511 | /usr/include/qt5/QtWidgets/qapplication.h \ | 1548 | /usr/include/qt5/QtWidgets/qapplication.h \ |
1512 | /usr/include/qt5/QtCore/qcoreapplication.h \ | 1549 | /usr/include/qt5/QtCore/qcoreapplication.h \ |
@@ -1626,62 +1663,17 @@ loginscreen.o: ../QChatClient/loginscreen.cpp ../QChatClient/loginscreen.h \ | @@ -1626,62 +1663,17 @@ loginscreen.o: ../QChatClient/loginscreen.cpp ../QChatClient/loginscreen.h \ | ||
1626 | /usr/include/qt5/QtGui/qvector2d.h \ | 1663 | /usr/include/qt5/QtGui/qvector2d.h \ |
1627 | /usr/include/qt5/QtGui/qtouchdevice.h \ | 1664 | /usr/include/qt5/QtGui/qtouchdevice.h \ |
1628 | /usr/include/qt5/QtCore/QRegExp \ | 1665 | /usr/include/qt5/QtCore/QRegExp \ |
1629 | - ../QChatClient/Socket.h \ | ||
1630 | - ../QChatClient/SocketException.h \ | ||
1631 | ../QChatClient/chatroom.h \ | 1666 | ../QChatClient/chatroom.h \ |
1632 | /usr/include/qt5/QtWidgets/QMainWindow \ | 1667 | /usr/include/qt5/QtWidgets/QMainWindow \ |
1633 | /usr/include/qt5/QtWidgets/qmainwindow.h \ | 1668 | /usr/include/qt5/QtWidgets/qmainwindow.h \ |
1634 | /usr/include/qt5/QtWidgets/qtabwidget.h \ | 1669 | /usr/include/qt5/QtWidgets/qtabwidget.h \ |
1635 | /usr/include/qt5/QtGui/qicon.h \ | 1670 | /usr/include/qt5/QtGui/qicon.h \ |
1636 | - ../QChatClient/chatwindow.h \ | ||
1637 | - ui_loginscreen.h \ | ||
1638 | - /usr/include/qt5/QtCore/QVariant \ | ||
1639 | - /usr/include/qt5/QtWidgets/QAction \ | ||
1640 | - /usr/include/qt5/QtWidgets/qaction.h \ | ||
1641 | - /usr/include/qt5/QtWidgets/qactiongroup.h \ | ||
1642 | - /usr/include/qt5/QtWidgets/QApplication \ | ||
1643 | - /usr/include/qt5/QtWidgets/qapplication.h \ | ||
1644 | - /usr/include/qt5/QtCore/qcoreapplication.h \ | ||
1645 | - /usr/include/qt5/QtCore/qeventloop.h \ | ||
1646 | - /usr/include/qt5/QtWidgets/qdesktopwidget.h \ | ||
1647 | - /usr/include/qt5/QtGui/qguiapplication.h \ | ||
1648 | - /usr/include/qt5/QtGui/qinputmethod.h \ | ||
1649 | - /usr/include/qt5/QtWidgets/QButtonGroup \ | ||
1650 | - /usr/include/qt5/QtWidgets/qbuttongroup.h \ | ||
1651 | - /usr/include/qt5/QtWidgets/QGridLayout \ | ||
1652 | - /usr/include/qt5/QtWidgets/qgridlayout.h \ | ||
1653 | - /usr/include/qt5/QtWidgets/qlayout.h \ | ||
1654 | - /usr/include/qt5/QtWidgets/qlayoutitem.h \ | ||
1655 | - /usr/include/qt5/QtWidgets/qboxlayout.h \ | ||
1656 | - /usr/include/qt5/QtWidgets/QHeaderView \ | ||
1657 | - /usr/include/qt5/QtWidgets/qheaderview.h \ | ||
1658 | - /usr/include/qt5/QtWidgets/qabstractitemview.h \ | ||
1659 | - /usr/include/qt5/QtWidgets/qabstractscrollarea.h \ | ||
1660 | - /usr/include/qt5/QtWidgets/qframe.h \ | 1671 | + /usr/include/qt5/QtCore/QModelIndex \ |
1661 | /usr/include/qt5/QtCore/qabstractitemmodel.h \ | 1672 | /usr/include/qt5/QtCore/qabstractitemmodel.h \ |
1662 | - /usr/include/qt5/QtCore/qitemselectionmodel.h \ | ||
1663 | - /usr/include/qt5/QtWidgets/qabstractitemdelegate.h \ | ||
1664 | - /usr/include/qt5/QtWidgets/qstyleoption.h \ | ||
1665 | - /usr/include/qt5/QtWidgets/qabstractspinbox.h \ | ||
1666 | - /usr/include/qt5/QtGui/qvalidator.h \ | ||
1667 | - /usr/include/qt5/QtWidgets/qslider.h \ | ||
1668 | - /usr/include/qt5/QtWidgets/qabstractslider.h \ | ||
1669 | - /usr/include/qt5/QtWidgets/qstyle.h \ | ||
1670 | - /usr/include/qt5/QtWidgets/qtabbar.h \ | ||
1671 | - /usr/include/qt5/QtWidgets/qrubberband.h \ | ||
1672 | - /usr/include/qt5/QtWidgets/QLabel \ | ||
1673 | - /usr/include/qt5/QtWidgets/qlabel.h \ | ||
1674 | - /usr/include/qt5/QtWidgets/QLineEdit \ | ||
1675 | - /usr/include/qt5/QtWidgets/qlineedit.h \ | ||
1676 | - /usr/include/qt5/QtGui/qtextcursor.h \ | ||
1677 | - /usr/include/qt5/QtGui/qtextformat.h \ | ||
1678 | - /usr/include/qt5/QtGui/qpen.h \ | ||
1679 | - /usr/include/qt5/QtGui/qtextoption.h \ | ||
1680 | - /usr/include/qt5/QtWidgets/QPushButton \ | ||
1681 | - /usr/include/qt5/QtWidgets/qpushbutton.h \ | ||
1682 | - /usr/include/qt5/QtWidgets/qabstractbutton.h \ | ||
1683 | - /usr/include/qt5/QtWidgets/QSpacerItem \ | ||
1684 | - /usr/include/qt5/QtWidgets/QWidget | 1673 | + ../QChatClient/chatwindow.h \ |
1674 | + ../QChatClient/Socket.h \ | ||
1675 | + ../QChatClient/SocketException.h \ | ||
1676 | + ui_loginscreen.h | ||
1685 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o loginscreen.o ../QChatClient/loginscreen.cpp | 1677 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o loginscreen.o ../QChatClient/loginscreen.cpp |
1686 | 1678 | ||
1687 | chatroom.o: ../QChatClient/chatroom.cpp ../QChatClient/chatroom.h \ | 1679 | chatroom.o: ../QChatClient/chatroom.cpp ../QChatClient/chatroom.h \ |
@@ -1795,71 +1787,16 @@ chatroom.o: ../QChatClient/chatroom.cpp ../QChatClient/chatroom.h \ | @@ -1795,71 +1787,16 @@ chatroom.o: ../QChatClient/chatroom.cpp ../QChatClient/chatroom.h \ | ||
1795 | /usr/include/qt5/QtGui/qtouchdevice.h \ | 1787 | /usr/include/qt5/QtGui/qtouchdevice.h \ |
1796 | /usr/include/qt5/QtWidgets/qtabwidget.h \ | 1788 | /usr/include/qt5/QtWidgets/qtabwidget.h \ |
1797 | /usr/include/qt5/QtGui/qicon.h \ | 1789 | /usr/include/qt5/QtGui/qicon.h \ |
1798 | - ../QChatClient/Socket.h \ | ||
1799 | - ../QChatClient/SocketException.h \ | 1790 | + /usr/include/qt5/QtCore/QModelIndex \ |
1791 | + /usr/include/qt5/QtCore/qabstractitemmodel.h \ | ||
1800 | ../QChatClient/loginscreen.h \ | 1792 | ../QChatClient/loginscreen.h \ |
1801 | /usr/include/qt5/QtWidgets/QDialog \ | 1793 | /usr/include/qt5/QtWidgets/QDialog \ |
1802 | /usr/include/qt5/QtWidgets/qdialog.h \ | 1794 | /usr/include/qt5/QtWidgets/qdialog.h \ |
1803 | /usr/include/qt5/QtCore/QRegExp \ | 1795 | /usr/include/qt5/QtCore/QRegExp \ |
1796 | + ../QChatClient/Socket.h \ | ||
1797 | + ../QChatClient/SocketException.h \ | ||
1804 | ../QChatClient/chatwindow.h \ | 1798 | ../QChatClient/chatwindow.h \ |
1805 | - ui_chatroom.h \ | ||
1806 | - /usr/include/qt5/QtCore/QVariant \ | ||
1807 | - /usr/include/qt5/QtWidgets/QAction \ | ||
1808 | - /usr/include/qt5/QtWidgets/qaction.h \ | ||
1809 | - /usr/include/qt5/QtWidgets/qactiongroup.h \ | ||
1810 | - /usr/include/qt5/QtWidgets/QApplication \ | ||
1811 | - /usr/include/qt5/QtWidgets/qapplication.h \ | ||
1812 | - /usr/include/qt5/QtCore/qcoreapplication.h \ | ||
1813 | - /usr/include/qt5/QtCore/qeventloop.h \ | ||
1814 | - /usr/include/qt5/QtWidgets/qdesktopwidget.h \ | ||
1815 | - /usr/include/qt5/QtGui/qguiapplication.h \ | ||
1816 | - /usr/include/qt5/QtGui/qinputmethod.h \ | ||
1817 | - /usr/include/qt5/QtWidgets/QButtonGroup \ | ||
1818 | - /usr/include/qt5/QtWidgets/qbuttongroup.h \ | ||
1819 | - /usr/include/qt5/QtWidgets/QGridLayout \ | ||
1820 | - /usr/include/qt5/QtWidgets/qgridlayout.h \ | ||
1821 | - /usr/include/qt5/QtWidgets/qlayout.h \ | ||
1822 | - /usr/include/qt5/QtWidgets/qlayoutitem.h \ | ||
1823 | - /usr/include/qt5/QtWidgets/qboxlayout.h \ | ||
1824 | - /usr/include/qt5/QtWidgets/QHeaderView \ | ||
1825 | - /usr/include/qt5/QtWidgets/qheaderview.h \ | ||
1826 | - /usr/include/qt5/QtWidgets/qabstractitemview.h \ | ||
1827 | - /usr/include/qt5/QtWidgets/qabstractscrollarea.h \ | ||
1828 | - /usr/include/qt5/QtWidgets/qframe.h \ | ||
1829 | - /usr/include/qt5/QtCore/qabstractitemmodel.h \ | ||
1830 | - /usr/include/qt5/QtCore/qitemselectionmodel.h \ | ||
1831 | - /usr/include/qt5/QtWidgets/qabstractitemdelegate.h \ | ||
1832 | - /usr/include/qt5/QtWidgets/qstyleoption.h \ | ||
1833 | - /usr/include/qt5/QtWidgets/qabstractspinbox.h \ | ||
1834 | - /usr/include/qt5/QtGui/qvalidator.h \ | ||
1835 | - /usr/include/qt5/QtWidgets/qslider.h \ | ||
1836 | - /usr/include/qt5/QtWidgets/qabstractslider.h \ | ||
1837 | - /usr/include/qt5/QtWidgets/qstyle.h \ | ||
1838 | - /usr/include/qt5/QtWidgets/qtabbar.h \ | ||
1839 | - /usr/include/qt5/QtWidgets/qrubberband.h \ | ||
1840 | - /usr/include/qt5/QtWidgets/QListWidget \ | ||
1841 | - /usr/include/qt5/QtWidgets/qlistwidget.h \ | ||
1842 | - /usr/include/qt5/QtWidgets/qlistview.h \ | ||
1843 | - /usr/include/qt5/QtWidgets/QMenu \ | ||
1844 | - /usr/include/qt5/QtWidgets/qmenu.h \ | ||
1845 | - /usr/include/qt5/QtWidgets/QMenuBar \ | ||
1846 | - /usr/include/qt5/QtWidgets/qmenubar.h \ | ||
1847 | - /usr/include/qt5/QtWidgets/QPushButton \ | ||
1848 | - /usr/include/qt5/QtWidgets/qpushbutton.h \ | ||
1849 | - /usr/include/qt5/QtWidgets/qabstractbutton.h \ | ||
1850 | - /usr/include/qt5/QtWidgets/QSplitter \ | ||
1851 | - /usr/include/qt5/QtWidgets/qsplitter.h \ | ||
1852 | - /usr/include/qt5/QtWidgets/QWidget \ | ||
1853 | - ../QChatClient/chatinputtext.h \ | ||
1854 | - /usr/include/qt5/QtWidgets/QTextEdit \ | ||
1855 | - /usr/include/qt5/QtWidgets/qtextedit.h \ | ||
1856 | - /usr/include/qt5/QtGui/qtextdocument.h \ | ||
1857 | - /usr/include/qt5/QtGui/qtextoption.h \ | ||
1858 | - /usr/include/qt5/QtGui/qtextcursor.h \ | ||
1859 | - /usr/include/qt5/QtGui/qtextformat.h \ | ||
1860 | - /usr/include/qt5/QtGui/qpen.h \ | ||
1861 | - /usr/include/qt5/QtGui/QKeyEvent \ | ||
1862 | - ../QChatClient/chatwidget.h | 1799 | + ui_chatroom.h |
1863 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatroom.o ../QChatClient/chatroom.cpp | 1800 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatroom.o ../QChatClient/chatroom.cpp |
1864 | 1801 | ||
1865 | Socket.o: ../QChatClient/Socket.cpp ../QChatClient/Socket.h \ | 1802 | Socket.o: ../QChatClient/Socket.cpp ../QChatClient/Socket.h \ |
@@ -1981,7 +1918,14 @@ chatwidget.o: ../QChatClient/chatwidget.cpp ../QChatClient/chatwidget.h \ | @@ -1981,7 +1918,14 @@ chatwidget.o: ../QChatClient/chatwidget.cpp ../QChatClient/chatwidget.h \ | ||
1981 | /usr/include/qt5/QtGui/qtextoption.h \ | 1918 | /usr/include/qt5/QtGui/qtextoption.h \ |
1982 | /usr/include/qt5/QtGui/qtextcursor.h \ | 1919 | /usr/include/qt5/QtGui/qtextcursor.h \ |
1983 | /usr/include/qt5/QtGui/qtextformat.h \ | 1920 | /usr/include/qt5/QtGui/qtextformat.h \ |
1984 | - /usr/include/qt5/QtGui/qpen.h | 1921 | + /usr/include/qt5/QtGui/qpen.h \ |
1922 | + /usr/include/qt5/QtWidgets/QFileDialog \ | ||
1923 | + /usr/include/qt5/QtWidgets/qfiledialog.h \ | ||
1924 | + /usr/include/qt5/QtCore/qdir.h \ | ||
1925 | + /usr/include/qt5/QtCore/qfileinfo.h \ | ||
1926 | + /usr/include/qt5/QtWidgets/qdialog.h \ | ||
1927 | + /usr/include/qt5/QtCore/QFile \ | ||
1928 | + /usr/include/qt5/QtCore/QTextStream | ||
1985 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatwidget.o ../QChatClient/chatwidget.cpp | 1929 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatwidget.o ../QChatClient/chatwidget.cpp |
1986 | 1930 | ||
1987 | chatwindow.o: ../QChatClient/chatwindow.cpp ../QChatClient/chatwindow.h \ | 1931 | chatwindow.o: ../QChatClient/chatwindow.cpp ../QChatClient/chatwindow.h \ |
@@ -2095,62 +2039,16 @@ chatwindow.o: ../QChatClient/chatwindow.cpp ../QChatClient/chatwindow.h \ | @@ -2095,62 +2039,16 @@ chatwindow.o: ../QChatClient/chatwindow.cpp ../QChatClient/chatwindow.h \ | ||
2095 | /usr/include/qt5/QtGui/qtouchdevice.h \ | 2039 | /usr/include/qt5/QtGui/qtouchdevice.h \ |
2096 | /usr/include/qt5/QtWidgets/qtabwidget.h \ | 2040 | /usr/include/qt5/QtWidgets/qtabwidget.h \ |
2097 | /usr/include/qt5/QtGui/qicon.h \ | 2041 | /usr/include/qt5/QtGui/qicon.h \ |
2098 | - ui_chatwindow.h \ | ||
2099 | - /usr/include/qt5/QtCore/QVariant \ | ||
2100 | - /usr/include/qt5/QtWidgets/QAction \ | ||
2101 | - /usr/include/qt5/QtWidgets/qaction.h \ | ||
2102 | - /usr/include/qt5/QtWidgets/qactiongroup.h \ | ||
2103 | - /usr/include/qt5/QtWidgets/QApplication \ | ||
2104 | - /usr/include/qt5/QtWidgets/qapplication.h \ | ||
2105 | - /usr/include/qt5/QtCore/qcoreapplication.h \ | ||
2106 | - /usr/include/qt5/QtCore/qeventloop.h \ | ||
2107 | - /usr/include/qt5/QtWidgets/qdesktopwidget.h \ | ||
2108 | - /usr/include/qt5/QtGui/qguiapplication.h \ | ||
2109 | - /usr/include/qt5/QtGui/qinputmethod.h \ | ||
2110 | - /usr/include/qt5/QtWidgets/QButtonGroup \ | ||
2111 | - /usr/include/qt5/QtWidgets/qbuttongroup.h \ | ||
2112 | - /usr/include/qt5/QtWidgets/QGridLayout \ | ||
2113 | - /usr/include/qt5/QtWidgets/qgridlayout.h \ | ||
2114 | - /usr/include/qt5/QtWidgets/qlayout.h \ | ||
2115 | - /usr/include/qt5/QtWidgets/qlayoutitem.h \ | ||
2116 | - /usr/include/qt5/QtWidgets/qboxlayout.h \ | ||
2117 | - /usr/include/qt5/QtWidgets/QHeaderView \ | ||
2118 | - /usr/include/qt5/QtWidgets/qheaderview.h \ | ||
2119 | - /usr/include/qt5/QtWidgets/qabstractitemview.h \ | ||
2120 | - /usr/include/qt5/QtWidgets/qabstractscrollarea.h \ | ||
2121 | - /usr/include/qt5/QtWidgets/qframe.h \ | 2042 | + ../QChatClient/chatroom.h \ |
2043 | + /usr/include/qt5/QtCore/QModelIndex \ | ||
2122 | /usr/include/qt5/QtCore/qabstractitemmodel.h \ | 2044 | /usr/include/qt5/QtCore/qabstractitemmodel.h \ |
2123 | - /usr/include/qt5/QtCore/qitemselectionmodel.h \ | ||
2124 | - /usr/include/qt5/QtWidgets/qabstractitemdelegate.h \ | ||
2125 | - /usr/include/qt5/QtWidgets/qstyleoption.h \ | ||
2126 | - /usr/include/qt5/QtWidgets/qabstractspinbox.h \ | ||
2127 | - /usr/include/qt5/QtGui/qvalidator.h \ | ||
2128 | - /usr/include/qt5/QtWidgets/qslider.h \ | ||
2129 | - /usr/include/qt5/QtWidgets/qabstractslider.h \ | ||
2130 | - /usr/include/qt5/QtWidgets/qstyle.h \ | ||
2131 | - /usr/include/qt5/QtWidgets/qtabbar.h \ | ||
2132 | - /usr/include/qt5/QtWidgets/qrubberband.h \ | ||
2133 | - /usr/include/qt5/QtWidgets/QMenu \ | ||
2134 | - /usr/include/qt5/QtWidgets/qmenu.h \ | ||
2135 | - /usr/include/qt5/QtWidgets/QMenuBar \ | ||
2136 | - /usr/include/qt5/QtWidgets/qmenubar.h \ | ||
2137 | - /usr/include/qt5/QtWidgets/QPushButton \ | ||
2138 | - /usr/include/qt5/QtWidgets/qpushbutton.h \ | ||
2139 | - /usr/include/qt5/QtWidgets/qabstractbutton.h \ | ||
2140 | - /usr/include/qt5/QtWidgets/QSpacerItem \ | ||
2141 | - /usr/include/qt5/QtWidgets/QSplitter \ | ||
2142 | - /usr/include/qt5/QtWidgets/qsplitter.h \ | ||
2143 | - /usr/include/qt5/QtWidgets/QWidget \ | ||
2144 | - ../QChatClient/chatinputtext.h \ | ||
2145 | - /usr/include/qt5/QtWidgets/QTextEdit \ | ||
2146 | - /usr/include/qt5/QtWidgets/qtextedit.h \ | ||
2147 | - /usr/include/qt5/QtGui/qtextdocument.h \ | ||
2148 | - /usr/include/qt5/QtGui/qtextoption.h \ | ||
2149 | - /usr/include/qt5/QtGui/qtextcursor.h \ | ||
2150 | - /usr/include/qt5/QtGui/qtextformat.h \ | ||
2151 | - /usr/include/qt5/QtGui/qpen.h \ | ||
2152 | - /usr/include/qt5/QtGui/QKeyEvent \ | ||
2153 | - ../QChatClient/chatwidget.h | 2045 | + ../QChatClient/loginscreen.h \ |
2046 | + /usr/include/qt5/QtWidgets/QDialog \ | ||
2047 | + /usr/include/qt5/QtWidgets/qdialog.h \ | ||
2048 | + /usr/include/qt5/QtCore/QRegExp \ | ||
2049 | + ../QChatClient/Socket.h \ | ||
2050 | + ../QChatClient/SocketException.h \ | ||
2051 | + ui_chatwindow.h | ||
2154 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatwindow.o ../QChatClient/chatwindow.cpp | 2052 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatwindow.o ../QChatClient/chatwindow.cpp |
2155 | 2053 | ||
2156 | chatinputtext.o: ../QChatClient/chatinputtext.cpp ../QChatClient/chatinputtext.h \ | 2054 | chatinputtext.o: ../QChatClient/chatinputtext.cpp ../QChatClient/chatinputtext.h \ |
@@ -2269,7 +2167,9 @@ chatinputtext.o: ../QChatClient/chatinputtext.cpp ../QChatClient/chatinputtext.h | @@ -2269,7 +2167,9 @@ chatinputtext.o: ../QChatClient/chatinputtext.cpp ../QChatClient/chatinputtext.h | ||
2269 | /usr/include/qt5/QtGui/qtextcursor.h \ | 2167 | /usr/include/qt5/QtGui/qtextcursor.h \ |
2270 | /usr/include/qt5/QtGui/qtextformat.h \ | 2168 | /usr/include/qt5/QtGui/qtextformat.h \ |
2271 | /usr/include/qt5/QtGui/qpen.h \ | 2169 | /usr/include/qt5/QtGui/qpen.h \ |
2272 | - /usr/include/qt5/QtGui/QKeyEvent | 2170 | + /usr/include/qt5/QtGui/QKeyEvent \ |
2171 | + /usr/include/qt5/QtCore/QTextCodec \ | ||
2172 | + /usr/include/qt5/QtCore/qtextcodec.h | ||
2273 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatinputtext.o ../QChatClient/chatinputtext.cpp | 2173 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatinputtext.o ../QChatClient/chatinputtext.cpp |
2274 | 2174 | ||
2275 | moc_loginscreen.o: moc_loginscreen.cpp | 2175 | moc_loginscreen.o: moc_loginscreen.cpp |
build-QChatClient-Desktop-Debug/QChatClient
No preview for this file type
build-QChatClient-Desktop-Debug/Socket.o
No preview for this file type
build-QChatClient-Desktop-Debug/chatwidget.o
No preview for this file type
build-QChatClient-Desktop-Debug/chatwindow.o
No preview for this file type
build-QChatClient-Desktop-Debug/loginscreen.o
No preview for this file type
build-QChatClient-Desktop-Debug/main.o
No preview for this file type
build-QChatClient-Desktop-Debug/moc_chatroom.cpp
@@ -19,8 +19,8 @@ | @@ -19,8 +19,8 @@ | ||
19 | 19 | ||
20 | QT_BEGIN_MOC_NAMESPACE | 20 | QT_BEGIN_MOC_NAMESPACE |
21 | struct qt_meta_stringdata_Chatroom_t { | 21 | struct qt_meta_stringdata_Chatroom_t { |
22 | - QByteArrayData data[11]; | ||
23 | - char stringdata[118]; | 22 | + QByteArrayData data[13]; |
23 | + char stringdata[134]; | ||
24 | }; | 24 | }; |
25 | #define QT_MOC_LITERAL(idx, ofs, len) \ | 25 | #define QT_MOC_LITERAL(idx, ofs, len) \ |
26 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ | 26 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ |
@@ -32,19 +32,21 @@ static const qt_meta_stringdata_Chatroom_t qt_meta_stringdata_Chatroom = { | @@ -32,19 +32,21 @@ static const qt_meta_stringdata_Chatroom_t qt_meta_stringdata_Chatroom = { | ||
32 | QT_MOC_LITERAL(0, 0, 8), | 32 | QT_MOC_LITERAL(0, 0, 8), |
33 | QT_MOC_LITERAL(1, 9, 15), | 33 | QT_MOC_LITERAL(1, 9, 15), |
34 | QT_MOC_LITERAL(2, 25, 0), | 34 | QT_MOC_LITERAL(2, 25, 0), |
35 | -QT_MOC_LITERAL(3, 26, 4), | ||
36 | -QT_MOC_LITERAL(4, 31, 15), | ||
37 | -QT_MOC_LITERAL(5, 47, 12), | ||
38 | -QT_MOC_LITERAL(6, 60, 7), | ||
39 | -QT_MOC_LITERAL(7, 68, 8), | ||
40 | -QT_MOC_LITERAL(8, 77, 13), | ||
41 | -QT_MOC_LITERAL(9, 91, 6), | ||
42 | -QT_MOC_LITERAL(10, 98, 18) | 35 | +QT_MOC_LITERAL(3, 26, 10), |
36 | +QT_MOC_LITERAL(4, 37, 6), | ||
37 | +QT_MOC_LITERAL(5, 44, 7), | ||
38 | +QT_MOC_LITERAL(6, 52, 8), | ||
39 | +QT_MOC_LITERAL(7, 61, 12), | ||
40 | +QT_MOC_LITERAL(8, 74, 7), | ||
41 | +QT_MOC_LITERAL(9, 82, 18), | ||
42 | +QT_MOC_LITERAL(10, 101, 16), | ||
43 | +QT_MOC_LITERAL(11, 118, 5), | ||
44 | +QT_MOC_LITERAL(12, 124, 8) | ||
43 | }, | 45 | }, |
44 | - "Chatroom\0threadsFinished\0\0exit\0" | ||
45 | - "messagesToPrint\0startSession\0sendMsg\0" | ||
46 | - "printMsg\0finishThreads\0finish\0" | ||
47 | - "disconnectChatroom\0" | 46 | + "Chatroom\0messagesToPrint\0\0createChat\0" |
47 | + "sender\0newChat\0peerNick\0startSession\0" | ||
48 | + "sendMsg\0disconnectChatroom\0launchChatWindow\0" | ||
49 | + "index\0printMsg\0" | ||
48 | }; | 50 | }; |
49 | #undef QT_MOC_LITERAL | 51 | #undef QT_MOC_LITERAL |
50 | 52 | ||
@@ -62,27 +64,27 @@ static const uint qt_meta_data_Chatroom[] = { | @@ -62,27 +64,27 @@ static const uint qt_meta_data_Chatroom[] = { | ||
62 | 2, // signalCount | 64 | 2, // signalCount |
63 | 65 | ||
64 | // signals: name, argc, parameters, tag, flags | 66 | // signals: name, argc, parameters, tag, flags |
65 | - 1, 1, 54, 2, 0x05, | ||
66 | - 4, 0, 57, 2, 0x05, | 67 | + 1, 0, 54, 2, 0x05, |
68 | + 3, 1, 55, 2, 0x05, | ||
67 | 69 | ||
68 | // slots: name, argc, parameters, tag, flags | 70 | // slots: name, argc, parameters, tag, flags |
69 | - 5, 0, 58, 2, 0x0a, | ||
70 | - 6, 0, 59, 2, 0x0a, | ||
71 | - 7, 0, 60, 2, 0x0a, | ||
72 | - 8, 1, 61, 2, 0x08, | ||
73 | - 9, 0, 64, 2, 0x08, | ||
74 | - 10, 0, 65, 2, 0x08, | 71 | + 5, 1, 58, 2, 0x08, |
72 | + 7, 0, 61, 2, 0x0a, | ||
73 | + 8, 0, 62, 2, 0x0a, | ||
74 | + 9, 0, 63, 2, 0x0a, | ||
75 | + 10, 1, 64, 2, 0x0a, | ||
76 | + 12, 0, 67, 2, 0x08, | ||
75 | 77 | ||
76 | // signals: parameters | 78 | // signals: parameters |
77 | - QMetaType::Void, QMetaType::Bool, 3, | ||
78 | QMetaType::Void, | 79 | QMetaType::Void, |
80 | + QMetaType::Void, QMetaType::QString, 4, | ||
79 | 81 | ||
80 | // slots: parameters | 82 | // slots: parameters |
83 | + QMetaType::Void, QMetaType::QString, 6, | ||
81 | QMetaType::Void, | 84 | QMetaType::Void, |
82 | QMetaType::Void, | 85 | QMetaType::Void, |
83 | QMetaType::Void, | 86 | QMetaType::Void, |
84 | - QMetaType::Void, QMetaType::Bool, 3, | ||
85 | - QMetaType::Void, | 87 | + QMetaType::Void, QMetaType::QModelIndex, 11, |
86 | QMetaType::Void, | 88 | QMetaType::Void, |
87 | 89 | ||
88 | 0 // eod | 90 | 0 // eod |
@@ -93,28 +95,28 @@ void Chatroom::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, vo | @@ -93,28 +95,28 @@ void Chatroom::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, vo | ||
93 | if (_c == QMetaObject::InvokeMetaMethod) { | 95 | if (_c == QMetaObject::InvokeMetaMethod) { |
94 | Chatroom *_t = static_cast<Chatroom *>(_o); | 96 | Chatroom *_t = static_cast<Chatroom *>(_o); |
95 | switch (_id) { | 97 | switch (_id) { |
96 | - case 0: _t->threadsFinished((*reinterpret_cast< bool(*)>(_a[1]))); break; | ||
97 | - case 1: _t->messagesToPrint(); break; | ||
98 | - case 2: _t->startSession(); break; | ||
99 | - case 3: _t->sendMsg(); break; | ||
100 | - case 4: _t->printMsg(); break; | ||
101 | - case 5: _t->finishThreads((*reinterpret_cast< bool(*)>(_a[1]))); break; | ||
102 | - case 6: _t->finish(); break; | ||
103 | - case 7: _t->disconnectChatroom(); break; | 98 | + case 0: _t->messagesToPrint(); break; |
99 | + case 1: _t->createChat((*reinterpret_cast< QString(*)>(_a[1]))); break; | ||
100 | + case 2: _t->newChat((*reinterpret_cast< QString(*)>(_a[1]))); break; | ||
101 | + case 3: _t->startSession(); break; | ||
102 | + case 4: _t->sendMsg(); break; | ||
103 | + case 5: _t->disconnectChatroom(); break; | ||
104 | + case 6: _t->launchChatWindow((*reinterpret_cast< QModelIndex(*)>(_a[1]))); break; | ||
105 | + case 7: _t->printMsg(); break; | ||
104 | default: ; | 106 | default: ; |
105 | } | 107 | } |
106 | } else if (_c == QMetaObject::IndexOfMethod) { | 108 | } else if (_c == QMetaObject::IndexOfMethod) { |
107 | int *result = reinterpret_cast<int *>(_a[0]); | 109 | int *result = reinterpret_cast<int *>(_a[0]); |
108 | void **func = reinterpret_cast<void **>(_a[1]); | 110 | void **func = reinterpret_cast<void **>(_a[1]); |
109 | { | 111 | { |
110 | - typedef void (Chatroom::*_t)(bool ); | ||
111 | - if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::threadsFinished)) { | 112 | + typedef void (Chatroom::*_t)(); |
113 | + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::messagesToPrint)) { | ||
112 | *result = 0; | 114 | *result = 0; |
113 | } | 115 | } |
114 | } | 116 | } |
115 | { | 117 | { |
116 | - typedef void (Chatroom::*_t)(); | ||
117 | - if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::messagesToPrint)) { | 118 | + typedef void (Chatroom::*_t)(QString ); |
119 | + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::createChat)) { | ||
118 | *result = 1; | 120 | *result = 1; |
119 | } | 121 | } |
120 | } | 122 | } |
@@ -158,15 +160,15 @@ int Chatroom::qt_metacall(QMetaObject::Call _c, int _id, void **_a) | @@ -158,15 +160,15 @@ int Chatroom::qt_metacall(QMetaObject::Call _c, int _id, void **_a) | ||
158 | } | 160 | } |
159 | 161 | ||
160 | // SIGNAL 0 | 162 | // SIGNAL 0 |
161 | -void Chatroom::threadsFinished(bool _t1) | 163 | +void Chatroom::messagesToPrint() |
162 | { | 164 | { |
163 | - void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; | ||
164 | - QMetaObject::activate(this, &staticMetaObject, 0, _a); | 165 | + QMetaObject::activate(this, &staticMetaObject, 0, 0); |
165 | } | 166 | } |
166 | 167 | ||
167 | // SIGNAL 1 | 168 | // SIGNAL 1 |
168 | -void Chatroom::messagesToPrint() | 169 | +void Chatroom::createChat(QString _t1) |
169 | { | 170 | { |
170 | - QMetaObject::activate(this, &staticMetaObject, 1, 0); | 171 | + void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; |
172 | + QMetaObject::activate(this, &staticMetaObject, 1, _a); | ||
171 | } | 173 | } |
172 | QT_END_MOC_NAMESPACE | 174 | QT_END_MOC_NAMESPACE |
build-QChatClient-Desktop-Debug/moc_chatroom.o
No preview for this file type
build-QChatClient-Desktop-Debug/moc_chatwidget.cpp
@@ -19,8 +19,8 @@ | @@ -19,8 +19,8 @@ | ||
19 | 19 | ||
20 | QT_BEGIN_MOC_NAMESPACE | 20 | QT_BEGIN_MOC_NAMESPACE |
21 | struct qt_meta_stringdata_ChatWidget_t { | 21 | struct qt_meta_stringdata_ChatWidget_t { |
22 | - QByteArrayData data[1]; | ||
23 | - char stringdata[12]; | 22 | + QByteArrayData data[3]; |
23 | + char stringdata[28]; | ||
24 | }; | 24 | }; |
25 | #define QT_MOC_LITERAL(idx, ofs, len) \ | 25 | #define QT_MOC_LITERAL(idx, ofs, len) \ |
26 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ | 26 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ |
@@ -29,9 +29,11 @@ struct qt_meta_stringdata_ChatWidget_t { | @@ -29,9 +29,11 @@ struct qt_meta_stringdata_ChatWidget_t { | ||
29 | ) | 29 | ) |
30 | static const qt_meta_stringdata_ChatWidget_t qt_meta_stringdata_ChatWidget = { | 30 | static const qt_meta_stringdata_ChatWidget_t qt_meta_stringdata_ChatWidget = { |
31 | { | 31 | { |
32 | -QT_MOC_LITERAL(0, 0, 10) | 32 | +QT_MOC_LITERAL(0, 0, 10), |
33 | +QT_MOC_LITERAL(1, 11, 14), | ||
34 | +QT_MOC_LITERAL(2, 26, 0) | ||
33 | }, | 35 | }, |
34 | - "ChatWidget\0" | 36 | + "ChatWidget\0saveChatToFile\0\0" |
35 | }; | 37 | }; |
36 | #undef QT_MOC_LITERAL | 38 | #undef QT_MOC_LITERAL |
37 | 39 | ||
@@ -41,21 +43,31 @@ static const uint qt_meta_data_ChatWidget[] = { | @@ -41,21 +43,31 @@ static const uint qt_meta_data_ChatWidget[] = { | ||
41 | 7, // revision | 43 | 7, // revision |
42 | 0, // classname | 44 | 0, // classname |
43 | 0, 0, // classinfo | 45 | 0, 0, // classinfo |
44 | - 0, 0, // methods | 46 | + 1, 14, // methods |
45 | 0, 0, // properties | 47 | 0, 0, // properties |
46 | 0, 0, // enums/sets | 48 | 0, 0, // enums/sets |
47 | 0, 0, // constructors | 49 | 0, 0, // constructors |
48 | 0, // flags | 50 | 0, // flags |
49 | 0, // signalCount | 51 | 0, // signalCount |
50 | 52 | ||
53 | + // slots: name, argc, parameters, tag, flags | ||
54 | + 1, 0, 19, 2, 0x0a, | ||
55 | + | ||
56 | + // slots: parameters | ||
57 | + QMetaType::Void, | ||
58 | + | ||
51 | 0 // eod | 59 | 0 // eod |
52 | }; | 60 | }; |
53 | 61 | ||
54 | void ChatWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) | 62 | void ChatWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) |
55 | { | 63 | { |
56 | - Q_UNUSED(_o); | ||
57 | - Q_UNUSED(_id); | ||
58 | - Q_UNUSED(_c); | 64 | + if (_c == QMetaObject::InvokeMetaMethod) { |
65 | + ChatWidget *_t = static_cast<ChatWidget *>(_o); | ||
66 | + switch (_id) { | ||
67 | + case 0: _t->saveChatToFile(); break; | ||
68 | + default: ; | ||
69 | + } | ||
70 | + } | ||
59 | Q_UNUSED(_a); | 71 | Q_UNUSED(_a); |
60 | } | 72 | } |
61 | 73 | ||
@@ -83,6 +95,15 @@ int ChatWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) | @@ -83,6 +95,15 @@ int ChatWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) | ||
83 | _id = QTextEdit::qt_metacall(_c, _id, _a); | 95 | _id = QTextEdit::qt_metacall(_c, _id, _a); |
84 | if (_id < 0) | 96 | if (_id < 0) |
85 | return _id; | 97 | return _id; |
98 | + if (_c == QMetaObject::InvokeMetaMethod) { | ||
99 | + if (_id < 1) | ||
100 | + qt_static_metacall(this, _c, _id, _a); | ||
101 | + _id -= 1; | ||
102 | + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { | ||
103 | + if (_id < 1) | ||
104 | + *reinterpret_cast<int*>(_a[0]) = -1; | ||
105 | + _id -= 1; | ||
106 | + } | ||
86 | return _id; | 107 | return _id; |
87 | } | 108 | } |
88 | QT_END_MOC_NAMESPACE | 109 | QT_END_MOC_NAMESPACE |
build-QChatClient-Desktop-Debug/moc_chatwidget.o
No preview for this file type
build-QChatClient-Desktop-Debug/moc_chatwindow.cpp
@@ -19,8 +19,8 @@ | @@ -19,8 +19,8 @@ | ||
19 | 19 | ||
20 | QT_BEGIN_MOC_NAMESPACE | 20 | QT_BEGIN_MOC_NAMESPACE |
21 | struct qt_meta_stringdata_ChatWindow_t { | 21 | struct qt_meta_stringdata_ChatWindow_t { |
22 | - QByteArrayData data[1]; | ||
23 | - char stringdata[12]; | 22 | + QByteArrayData data[7]; |
23 | + char stringdata[49]; | ||
24 | }; | 24 | }; |
25 | #define QT_MOC_LITERAL(idx, ofs, len) \ | 25 | #define QT_MOC_LITERAL(idx, ofs, len) \ |
26 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ | 26 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ |
@@ -29,9 +29,16 @@ struct qt_meta_stringdata_ChatWindow_t { | @@ -29,9 +29,16 @@ struct qt_meta_stringdata_ChatWindow_t { | ||
29 | ) | 29 | ) |
30 | static const qt_meta_stringdata_ChatWindow_t qt_meta_stringdata_ChatWindow = { | 30 | static const qt_meta_stringdata_ChatWindow_t qt_meta_stringdata_ChatWindow = { |
31 | { | 31 | { |
32 | -QT_MOC_LITERAL(0, 0, 10) | 32 | +QT_MOC_LITERAL(0, 0, 10), |
33 | +QT_MOC_LITERAL(1, 11, 10), | ||
34 | +QT_MOC_LITERAL(2, 22, 0), | ||
35 | +QT_MOC_LITERAL(3, 23, 3), | ||
36 | +QT_MOC_LITERAL(4, 27, 7), | ||
37 | +QT_MOC_LITERAL(5, 35, 8), | ||
38 | +QT_MOC_LITERAL(6, 44, 3) | ||
33 | }, | 39 | }, |
34 | - "ChatWindow\0" | 40 | + "ChatWindow\0msgToPrint\0\0msg\0sendMsg\0" |
41 | + "printMsg\0str\0" | ||
35 | }; | 42 | }; |
36 | #undef QT_MOC_LITERAL | 43 | #undef QT_MOC_LITERAL |
37 | 44 | ||
@@ -41,22 +48,50 @@ static const uint qt_meta_data_ChatWindow[] = { | @@ -41,22 +48,50 @@ static const uint qt_meta_data_ChatWindow[] = { | ||
41 | 7, // revision | 48 | 7, // revision |
42 | 0, // classname | 49 | 0, // classname |
43 | 0, 0, // classinfo | 50 | 0, 0, // classinfo |
44 | - 0, 0, // methods | 51 | + 3, 14, // methods |
45 | 0, 0, // properties | 52 | 0, 0, // properties |
46 | 0, 0, // enums/sets | 53 | 0, 0, // enums/sets |
47 | 0, 0, // constructors | 54 | 0, 0, // constructors |
48 | 0, // flags | 55 | 0, // flags |
49 | - 0, // signalCount | 56 | + 1, // signalCount |
57 | + | ||
58 | + // signals: name, argc, parameters, tag, flags | ||
59 | + 1, 1, 29, 2, 0x05, | ||
60 | + | ||
61 | + // slots: name, argc, parameters, tag, flags | ||
62 | + 4, 0, 32, 2, 0x0a, | ||
63 | + 5, 1, 33, 2, 0x08, | ||
64 | + | ||
65 | + // signals: parameters | ||
66 | + QMetaType::Void, QMetaType::QString, 3, | ||
67 | + | ||
68 | + // slots: parameters | ||
69 | + QMetaType::Void, | ||
70 | + QMetaType::Void, QMetaType::QString, 6, | ||
50 | 71 | ||
51 | 0 // eod | 72 | 0 // eod |
52 | }; | 73 | }; |
53 | 74 | ||
54 | void ChatWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) | 75 | void ChatWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) |
55 | { | 76 | { |
56 | - Q_UNUSED(_o); | ||
57 | - Q_UNUSED(_id); | ||
58 | - Q_UNUSED(_c); | ||
59 | - Q_UNUSED(_a); | 77 | + if (_c == QMetaObject::InvokeMetaMethod) { |
78 | + ChatWindow *_t = static_cast<ChatWindow *>(_o); | ||
79 | + switch (_id) { | ||
80 | + case 0: _t->msgToPrint((*reinterpret_cast< QString(*)>(_a[1]))); break; | ||
81 | + case 1: _t->sendMsg(); break; | ||
82 | + case 2: _t->printMsg((*reinterpret_cast< QString(*)>(_a[1]))); break; | ||
83 | + default: ; | ||
84 | + } | ||
85 | + } else if (_c == QMetaObject::IndexOfMethod) { | ||
86 | + int *result = reinterpret_cast<int *>(_a[0]); | ||
87 | + void **func = reinterpret_cast<void **>(_a[1]); | ||
88 | + { | ||
89 | + typedef void (ChatWindow::*_t)(QString ); | ||
90 | + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&ChatWindow::msgToPrint)) { | ||
91 | + *result = 0; | ||
92 | + } | ||
93 | + } | ||
94 | + } | ||
60 | } | 95 | } |
61 | 96 | ||
62 | const QMetaObject ChatWindow::staticMetaObject = { | 97 | const QMetaObject ChatWindow::staticMetaObject = { |
@@ -83,6 +118,22 @@ int ChatWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) | @@ -83,6 +118,22 @@ int ChatWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) | ||
83 | _id = QMainWindow::qt_metacall(_c, _id, _a); | 118 | _id = QMainWindow::qt_metacall(_c, _id, _a); |
84 | if (_id < 0) | 119 | if (_id < 0) |
85 | return _id; | 120 | return _id; |
121 | + if (_c == QMetaObject::InvokeMetaMethod) { | ||
122 | + if (_id < 3) | ||
123 | + qt_static_metacall(this, _c, _id, _a); | ||
124 | + _id -= 3; | ||
125 | + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { | ||
126 | + if (_id < 3) | ||
127 | + *reinterpret_cast<int*>(_a[0]) = -1; | ||
128 | + _id -= 3; | ||
129 | + } | ||
86 | return _id; | 130 | return _id; |
87 | } | 131 | } |
132 | + | ||
133 | +// SIGNAL 0 | ||
134 | +void ChatWindow::msgToPrint(QString _t1) | ||
135 | +{ | ||
136 | + void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; | ||
137 | + QMetaObject::activate(this, &staticMetaObject, 0, _a); | ||
138 | +} | ||
88 | QT_END_MOC_NAMESPACE | 139 | QT_END_MOC_NAMESPACE |
build-QChatClient-Desktop-Debug/moc_chatwindow.o
No preview for this file type
build-QChatClient-Desktop-Debug/moc_loginscreen.o
No preview for this file type
build-QChatClient-Desktop-Debug/ui_chatroom.h
@@ -33,6 +33,7 @@ public: | @@ -33,6 +33,7 @@ public: | ||
33 | QAction *actionConnect; | 33 | QAction *actionConnect; |
34 | QAction *actionExit; | 34 | QAction *actionExit; |
35 | QAction *actionDisconnect; | 35 | QAction *actionDisconnect; |
36 | + QAction *actionSave_chat; | ||
36 | QWidget *centralwidget; | 37 | QWidget *centralwidget; |
37 | QGridLayout *gridLayout_2; | 38 | QGridLayout *gridLayout_2; |
38 | QSplitter *windowSplitter; | 39 | QSplitter *windowSplitter; |
@@ -57,6 +58,9 @@ public: | @@ -57,6 +58,9 @@ public: | ||
57 | actionExit->setObjectName(QStringLiteral("actionExit")); | 58 | actionExit->setObjectName(QStringLiteral("actionExit")); |
58 | actionDisconnect = new QAction(Chatroom); | 59 | actionDisconnect = new QAction(Chatroom); |
59 | actionDisconnect->setObjectName(QStringLiteral("actionDisconnect")); | 60 | actionDisconnect->setObjectName(QStringLiteral("actionDisconnect")); |
61 | + actionDisconnect->setEnabled(false); | ||
62 | + actionSave_chat = new QAction(Chatroom); | ||
63 | + actionSave_chat->setObjectName(QStringLiteral("actionSave_chat")); | ||
60 | centralwidget = new QWidget(Chatroom); | 64 | centralwidget = new QWidget(Chatroom); |
61 | centralwidget->setObjectName(QStringLiteral("centralwidget")); | 65 | centralwidget->setObjectName(QStringLiteral("centralwidget")); |
62 | gridLayout_2 = new QGridLayout(centralwidget); | 66 | gridLayout_2 = new QGridLayout(centralwidget); |
@@ -75,7 +79,7 @@ public: | @@ -75,7 +79,7 @@ public: | ||
75 | chatSplitter->setOrientation(Qt::Vertical); | 79 | chatSplitter->setOrientation(Qt::Vertical); |
76 | chatText = new ChatWidget(chatSplitter); | 80 | chatText = new ChatWidget(chatSplitter); |
77 | chatText->setObjectName(QStringLiteral("chatText")); | 81 | chatText->setObjectName(QStringLiteral("chatText")); |
78 | - chatText->setReadOnly(false); | 82 | + chatText->setReadOnly(true); |
79 | chatSplitter->addWidget(chatText); | 83 | chatSplitter->addWidget(chatText); |
80 | inputText = new chatInputText(chatSplitter); | 84 | inputText = new chatInputText(chatSplitter); |
81 | inputText->setObjectName(QStringLiteral("inputText")); | 85 | inputText->setObjectName(QStringLiteral("inputText")); |
@@ -106,6 +110,7 @@ public: | @@ -106,6 +110,7 @@ public: | ||
106 | 110 | ||
107 | sendButton = new QPushButton(centralwidget); | 111 | sendButton = new QPushButton(centralwidget); |
108 | sendButton->setObjectName(QStringLiteral("sendButton")); | 112 | sendButton->setObjectName(QStringLiteral("sendButton")); |
113 | + sendButton->setEnabled(false); | ||
109 | QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed); | 114 | QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed); |
110 | sizePolicy2.setHorizontalStretch(0); | 115 | sizePolicy2.setHorizontalStretch(0); |
111 | sizePolicy2.setVerticalStretch(0); | 116 | sizePolicy2.setVerticalStretch(0); |
@@ -121,10 +126,14 @@ public: | @@ -121,10 +126,14 @@ public: | ||
121 | menuChat = new QMenu(menuBar); | 126 | menuChat = new QMenu(menuBar); |
122 | menuChat->setObjectName(QStringLiteral("menuChat")); | 127 | menuChat->setObjectName(QStringLiteral("menuChat")); |
123 | Chatroom->setMenuBar(menuBar); | 128 | Chatroom->setMenuBar(menuBar); |
129 | + QWidget::setTabOrder(chatText, inputText); | ||
130 | + QWidget::setTabOrder(inputText, userList); | ||
131 | + QWidget::setTabOrder(userList, sendButton); | ||
124 | 132 | ||
125 | menuBar->addAction(menuChat->menuAction()); | 133 | menuBar->addAction(menuChat->menuAction()); |
126 | menuChat->addAction(actionConnect); | 134 | menuChat->addAction(actionConnect); |
127 | menuChat->addAction(actionDisconnect); | 135 | menuChat->addAction(actionDisconnect); |
136 | + menuChat->addAction(actionSave_chat); | ||
128 | menuChat->addAction(actionExit); | 137 | menuChat->addAction(actionExit); |
129 | 138 | ||
130 | retranslateUi(Chatroom); | 139 | retranslateUi(Chatroom); |
@@ -138,6 +147,7 @@ public: | @@ -138,6 +147,7 @@ public: | ||
138 | actionConnect->setText(QApplication::translate("Chatroom", "Connect...", 0)); | 147 | actionConnect->setText(QApplication::translate("Chatroom", "Connect...", 0)); |
139 | actionExit->setText(QApplication::translate("Chatroom", "Exit", 0)); | 148 | actionExit->setText(QApplication::translate("Chatroom", "Exit", 0)); |
140 | actionDisconnect->setText(QApplication::translate("Chatroom", "Disconnect", 0)); | 149 | actionDisconnect->setText(QApplication::translate("Chatroom", "Disconnect", 0)); |
150 | + actionSave_chat->setText(QApplication::translate("Chatroom", "Save chat...", 0)); | ||
141 | sendButton->setText(QApplication::translate("Chatroom", "Send", 0)); | 151 | sendButton->setText(QApplication::translate("Chatroom", "Send", 0)); |
142 | menuChat->setTitle(QApplication::translate("Chatroom", "Chat", 0)); | 152 | menuChat->setTitle(QApplication::translate("Chatroom", "Chat", 0)); |
143 | } // retranslateUi | 153 | } // retranslateUi |
build-QChatClient-Desktop-Debug/ui_chatwindow.h
@@ -31,6 +31,7 @@ class Ui_ChatWindow | @@ -31,6 +31,7 @@ class Ui_ChatWindow | ||
31 | { | 31 | { |
32 | public: | 32 | public: |
33 | QAction *actionExit; | 33 | QAction *actionExit; |
34 | + QAction *actionSave_chat; | ||
34 | QWidget *centralWidget; | 35 | QWidget *centralWidget; |
35 | QGridLayout *gridLayout; | 36 | QGridLayout *gridLayout; |
36 | QSpacerItem *horizontalSpacer; | 37 | QSpacerItem *horizontalSpacer; |
@@ -50,6 +51,8 @@ public: | @@ -50,6 +51,8 @@ public: | ||
50 | ChatWindow->resize(400, 502); | 51 | ChatWindow->resize(400, 502); |
51 | actionExit = new QAction(ChatWindow); | 52 | actionExit = new QAction(ChatWindow); |
52 | actionExit->setObjectName(QStringLiteral("actionExit")); | 53 | actionExit->setObjectName(QStringLiteral("actionExit")); |
54 | + actionSave_chat = new QAction(ChatWindow); | ||
55 | + actionSave_chat->setObjectName(QStringLiteral("actionSave_chat")); | ||
53 | centralWidget = new QWidget(ChatWindow); | 56 | centralWidget = new QWidget(ChatWindow); |
54 | centralWidget->setObjectName(QStringLiteral("centralWidget")); | 57 | centralWidget->setObjectName(QStringLiteral("centralWidget")); |
55 | centralWidget->setEnabled(true); | 58 | centralWidget->setEnabled(true); |
@@ -100,7 +103,7 @@ public: | @@ -100,7 +103,7 @@ public: | ||
100 | inputText->setMinimumSize(QSize(0, 0)); | 103 | inputText->setMinimumSize(QSize(0, 0)); |
101 | inputText->setMaximumSize(QSize(16777215, 16777215)); | 104 | inputText->setMaximumSize(QSize(16777215, 16777215)); |
102 | inputText->setBaseSize(QSize(0, 0)); | 105 | inputText->setBaseSize(QSize(0, 0)); |
103 | - inputText->setReadOnly(true); | 106 | + inputText->setReadOnly(false); |
104 | splitter->addWidget(inputText); | 107 | splitter->addWidget(inputText); |
105 | 108 | ||
106 | gridLayout_2->addWidget(splitter, 0, 0, 1, 1); | 109 | gridLayout_2->addWidget(splitter, 0, 0, 1, 1); |
@@ -115,8 +118,11 @@ public: | @@ -115,8 +118,11 @@ public: | ||
115 | menuChat = new QMenu(menuBar); | 118 | menuChat = new QMenu(menuBar); |
116 | menuChat->setObjectName(QStringLiteral("menuChat")); | 119 | menuChat->setObjectName(QStringLiteral("menuChat")); |
117 | ChatWindow->setMenuBar(menuBar); | 120 | ChatWindow->setMenuBar(menuBar); |
121 | + QWidget::setTabOrder(chatText, inputText); | ||
122 | + QWidget::setTabOrder(inputText, sendButton); | ||
118 | 123 | ||
119 | menuBar->addAction(menuChat->menuAction()); | 124 | menuBar->addAction(menuChat->menuAction()); |
125 | + menuChat->addAction(actionSave_chat); | ||
120 | menuChat->addAction(actionExit); | 126 | menuChat->addAction(actionExit); |
121 | 127 | ||
122 | retranslateUi(ChatWindow); | 128 | retranslateUi(ChatWindow); |
@@ -128,6 +134,7 @@ public: | @@ -128,6 +134,7 @@ public: | ||
128 | { | 134 | { |
129 | ChatWindow->setWindowTitle(QApplication::translate("ChatWindow", "QChatClient", 0)); | 135 | ChatWindow->setWindowTitle(QApplication::translate("ChatWindow", "QChatClient", 0)); |
130 | actionExit->setText(QApplication::translate("ChatWindow", "Exit", 0)); | 136 | actionExit->setText(QApplication::translate("ChatWindow", "Exit", 0)); |
137 | + actionSave_chat->setText(QApplication::translate("ChatWindow", "Save chat...", 0)); | ||
131 | sendButton->setText(QApplication::translate("ChatWindow", "Send", 0)); | 138 | sendButton->setText(QApplication::translate("ChatWindow", "Send", 0)); |
132 | menuChat->setTitle(QApplication::translate("ChatWindow", "Chat", 0)); | 139 | menuChat->setTitle(QApplication::translate("ChatWindow", "Chat", 0)); |
133 | } // retranslateUi | 140 | } // retranslateUi |