Commit 582b767a901a647a7d909acf879bce32410b8ce1

Authored by Imanol-Mikel Barba Sabariego
1 parent d880a06e

git-svn-id: svn://imanolbarba.net/PAD@43 c2ee353e-ed0d-4329-bf56-03aec153487f

QChatClient/QChatClient.pro.user
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3   -<!-- Written by QtCreator 2.7.1, 2013-12-27T07:31:56. -->
  3 +<!-- Written by QtCreator 2.7.1, 2013-12-27T14:12:38. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
... ... @@ -51,9 +51,9 @@
51 51 <data>
52 52 <variable>ProjectExplorer.Project.Target.0</variable>
53 53 <valuemap type="QVariantMap">
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>
  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">{430bae4e-c8d6-488c-936e-c89fd5587cd0}</value>
57 57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
... ... @@ -242,12 +242,205 @@
242 242 </valuemap>
243 243 </data>
244 244 <data>
  245 + <variable>ProjectExplorer.Project.Target.1</variable>
  246 + <valuemap type="QVariantMap">
  247 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-qt4</value>
  248 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-qt4</value>
  249 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">{09071c90-33f0-49f1-8c3d-15bcbd81cbe2}</value>
  250 + <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
  251 + <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
  252 + <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
  253 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
  254 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
  255 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  256 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  257 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
  258 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  259 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
  260 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
  261 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
  262 + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
  263 + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
  264 + </valuemap>
  265 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
  266 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  267 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  268 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  269 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  270 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  271 + <value type="QString">-w</value>
  272 + <value type="QString">-r</value>
  273 + </valuelist>
  274 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
  275 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
  276 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  277 + </valuemap>
  278 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
  279 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
  280 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  281 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
  282 + </valuemap>
  283 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
  284 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  285 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  286 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  287 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  288 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  289 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  290 + <value type="QString">-w</value>
  291 + <value type="QString">-r</value>
  292 + </valuelist>
  293 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
  294 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
  295 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  296 + </valuemap>
  297 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
  298 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
  299 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  300 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
  301 + </valuemap>
  302 + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
  303 + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
  304 + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
  305 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
  306 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  307 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
  308 + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
  309 + <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/imanol/devel/eclipse/PAD/build-QChatClient-Desktop_qt4-Debug</value>
  310 + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
  311 + </valuemap>
  312 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
  313 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
  314 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  315 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  316 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
  317 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  318 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
  319 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
  320 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
  321 + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
  322 + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
  323 + </valuemap>
  324 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
  325 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  326 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  327 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  328 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  329 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  330 + <value type="QString">-w</value>
  331 + <value type="QString">-r</value>
  332 + </valuelist>
  333 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
  334 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
  335 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  336 + </valuemap>
  337 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
  338 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
  339 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  340 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
  341 + </valuemap>
  342 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
  343 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  344 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  345 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  346 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  347 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  348 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  349 + <value type="QString">-w</value>
  350 + <value type="QString">-r</value>
  351 + </valuelist>
  352 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
  353 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
  354 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  355 + </valuemap>
  356 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
  357 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
  358 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  359 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
  360 + </valuemap>
  361 + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
  362 + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
  363 + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
  364 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
  365 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  366 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
  367 + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
  368 + <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/imanol/devel/eclipse/PAD/build-QChatClient-Desktop_qt4-Release</value>
  369 + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
  370 + </valuemap>
  371 + <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
  372 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
  373 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
  374 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
  375 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
  376 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  377 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
  378 + </valuemap>
  379 + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
  380 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
  381 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  382 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
  383 + </valuemap>
  384 + <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
  385 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
  386 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
  387 + <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
  388 + <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
  389 + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
  390 + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
  391 + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
  392 + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
  393 + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
  394 + <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
  395 + <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
  396 + <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
  397 + <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
  398 + <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
  399 + <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
  400 + <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
  401 + <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
  402 + <value type="int">0</value>
  403 + <value type="int">1</value>
  404 + <value type="int">2</value>
  405 + <value type="int">3</value>
  406 + <value type="int">4</value>
  407 + <value type="int">5</value>
  408 + <value type="int">6</value>
  409 + <value type="int">7</value>
  410 + <value type="int">8</value>
  411 + <value type="int">9</value>
  412 + <value type="int">10</value>
  413 + <value type="int">11</value>
  414 + <value type="int">12</value>
  415 + <value type="int">13</value>
  416 + <value type="int">14</value>
  417 + </valuelist>
  418 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QChatClient</value>
  419 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  420 + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/imanol/devel/eclipse/PAD/QChatClient/QChatClient.pro</value>
  421 + <value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value>
  422 + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
  423 + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">QChatClient.pro</value>
  424 + <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
  425 + <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
  426 + <valuelist type="QVariantList" key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"/>
  427 + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
  428 + <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
  429 + <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
  430 + <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
  431 + <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
  432 + <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
  433 + </valuemap>
  434 + <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
  435 + </valuemap>
  436 + </data>
  437 + <data>
245 438 <variable>ProjectExplorer.Project.TargetCount</variable>
246   - <value type="int">1</value>
  439 + <value type="int">2</value>
247 440 </data>
248 441 <data>
249 442 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
250   - <value type="QString">{fd24a9a9-cdbc-49b3-845c-b174fda2a7ac}</value>
  443 + <value type="QString">{0fd5067a-d849-4d4e-9457-800baef2de83}</value>
251 444 </data>
252 445 <data>
253 446 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
... ...
QChatClient/chatroom.cpp
... ... @@ -38,7 +38,7 @@ void sendThread(Socket* s, Chatroom* chat)
38 38 send = '0' + send;
39 39 if(send.substr(1) != "/exit" && send.substr(1) != "/disconnect")
40 40 {
41   - chat->putMsgToPrintQueue(chat->getNickname().toStdString().append(": ").append(send.substr(1)));
  41 + chat->putMsgToPrintQueue(chat->getNickname().toStdString().append(": ").append(send.substr(1)),MSG_USER);
42 42 }
43 43 }
44 44 msgLock->unlock();
... ... @@ -77,23 +77,24 @@ void recvThread(Socket* s, Chatroom* chat)
77 77 }
78 78 catch(SocketException &e)
79 79 {
80   - chat->setConnected(false);
  80 + chat->toggleConnected(false);
81 81 cout << e.description() << endl;
82 82 msgListNotEmpty.notify_all();
83   - chat->close();
  83 + string msg = "Connection to server lost";
  84 + chat->putMsgToPrintQueue(msg,MSG_STATUS);
84 85 break;
85 86 }
86 87 if(recv == "DISC_OK")
87 88 {
88 89 cout << "Disconnecting" << endl;
89   - chat->setConnected(false);
  90 + chat->toggleConnected(false);
90 91 msgListNotEmpty.notify_all();
91 92 break;
92 93 }
93 94 else if(recv == "EXIT_OK")
94 95 {
95 96 cout << "Exiting" << endl;
96   - chat->setConnected(false);
  97 + chat->toggleConnected(true);
97 98 msgListNotEmpty.notify_all();
98 99 chat->close();
99 100 break;
... ... @@ -105,7 +106,7 @@ void recvThread(Socket* s, Chatroom* chat)
105 106 }
106 107 else
107 108 {
108   - chat->putMsgToPrintQueue(recv);
  109 + chat->putMsgToPrintQueue(recv,MSG_USER);
109 110 }
110 111 }
111 112 }
... ... @@ -137,8 +138,11 @@ Chatroom::Chatroom(QWidget *parent) :
137 138 connect(ui->inputText,SIGNAL(msgReady()),this,SLOT(sendMsg()));
138 139 connect(ui->sendButton,SIGNAL(clicked()),this,SLOT(sendMsg()));
139 140 connect(this,SIGNAL(messagesToPrint()),this,SLOT(printMsg()));
  141 + connect(this,SIGNAL(serverMessagesToPrint()),this,SLOT(printServerMsg()));
  142 + connect(this,SIGNAL(statusMessagesToPrint()),this,SLOT(printStatusMsg()));
140 143 connect(ui->userList,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(launchChatWindow(QModelIndex)));
141 144 connect(this,SIGNAL(createChat(QString)),this,SLOT(newChat(QString)));
  145 + connect(this,SIGNAL(toggleConnected(bool)),this,SLOT(setConnected(bool)));
142 146 }
143 147  
144 148 void Chatroom::closeEvent(QCloseEvent *event)
... ... @@ -156,6 +160,12 @@ void Chatroom::closeEvent(QCloseEvent *event)
156 160 ui->inputText->setReadOnly(true);
157 161 recv->join();
158 162 send->join();
  163 + map<string,void*>::iterator it;
  164 + for(it = activeChats.begin(); it != activeChats.end(); it++)
  165 + {
  166 + ChatWindow* chat = (ChatWindow*) it->second;
  167 + chat->close();
  168 + }
159 169 ui->chatText->printServerMsg("Disconnected");
160 170 send = NULL;
161 171 recv = NULL;
... ... @@ -174,6 +184,20 @@ void Chatroom::setConnected(bool status)
174 184 {
175 185 myMutex.lock();
176 186 connected = status;
  187 + if(status == false)
  188 + {
  189 + ui->chatText->printServerMsg("Disconnected");
  190 + this->ui->inputText->setReadOnly(true);
  191 + this->ui->sendButton->setDisabled(true);
  192 + this->ui->actionDisconnect->setDisabled(true);
  193 + }
  194 + else if(status == true)
  195 + {
  196 + this->ui->inputText->setReadOnly(false);
  197 + this->ui->sendButton->setDisabled(false);
  198 + this->ui->actionDisconnect->setDisabled(false);
  199 + ui->chatText->printServerMsg("Connected to chatroom");
  200 + }
177 201 myMutex.unlock();
178 202 }
179 203  
... ... @@ -240,11 +264,27 @@ void Chatroom::launchChatWindow(QModelIndex index)
240 264 }
241 265 }
242 266  
243   -void Chatroom::putMsgToPrintQueue(string &msg)
  267 +void Chatroom::putMsgToPrintQueue(string &msg, int type)
244 268 {
245 269 printMutex.lock();
246   - printQueue.push_back(msg);
247   - emit messagesToPrint();
  270 + if(type == MSG_USER)
  271 + {
  272 + printQueue.push_back(msg);
  273 + emit messagesToPrint();
  274 + return;
  275 + }
  276 + else if(type == MSG_SERVER)
  277 + {
  278 + printServerQueue.push_back(msg);
  279 + emit serverMessagesToPrint();
  280 + return;
  281 + }
  282 + else if(type == MSG_STATUS)
  283 + {
  284 + printStatusQueue.push_back(msg);
  285 + emit statusMessagesToPrint();
  286 + return;
  287 + }
248 288 }
249 289  
250 290 void Chatroom::printMsg()
... ... @@ -258,6 +298,28 @@ void Chatroom::printMsg()
258 298 printMutex.unlock();
259 299 }
260 300  
  301 +void Chatroom::printServerMsg()
  302 +{
  303 + while(!printServerQueue.empty())
  304 + {
  305 + string msg = printServerQueue.front();
  306 + ui->chatText->printServerMsg(msg);
  307 + printServerQueue.pop_front();
  308 + }
  309 + printMutex.unlock();
  310 +}
  311 +
  312 +void Chatroom::printStatusMsg()
  313 +{
  314 + while(!printStatusQueue.empty())
  315 + {
  316 + string msg = printStatusQueue.front();
  317 + ui->chatText->printStatusMsg(msg);
  318 + printStatusQueue.pop_front();
  319 + }
  320 + printMutex.unlock();
  321 +}
  322 +
261 323 void Chatroom::putMsgToSendQueue(QString& msg)
262 324 {
263 325 msgMutex.lock();
... ... @@ -302,10 +364,6 @@ void Chatroom::disconnectChatroom()
302 364 msgMutex.lock();
303 365 sendQueue.clear();
304 366 sendQueue.push_back("/disconnect");
305   - ui->chatText->printServerMsg("Disconnected");
306   - this->ui->inputText->setReadOnly(true);
307   - this->ui->sendButton->setDisabled(true);
308   - this->ui->actionDisconnect->setDisabled(true);
309 367 msgMutex.unlock();
310 368 msgListNotEmpty.notify_all();
311 369 }
... ... @@ -323,11 +381,7 @@ void Chatroom::startSession()
323 381 {
324 382 return;
325 383 }
326   - connected = true;
327   - this->ui->inputText->setReadOnly(false);
328   - this->ui->sendButton->setDisabled(false);
329   - this->ui->actionDisconnect->setDisabled(false);
330   - ui->chatText->printServerMsg("Connected to chatroom");
  384 + setConnected(true);
331 385 recv = new std::thread(recvThread,&s,this);
332 386 send = new std::thread(sendThread,&s,this);
333 387 }
... ...
QChatClient/chatroom.h
... ... @@ -11,6 +11,10 @@
11 11 #include "chatwindow.h"
12 12 #include "Socket.h"
13 13  
  14 +#define MSG_USER 0
  15 +#define MSG_STATUS 1
  16 +#define MSG_SERVER 2
  17 +
14 18 namespace Ui {
15 19 class Chatroom;
16 20 }
... ... @@ -22,13 +26,12 @@ class Chatroom : public QMainWindow
22 26 public:
23 27 explicit Chatroom(QWidget *parent = 0);
24 28 bool getConnected();
25   - void setConnected(bool status);
26 29 QString getNickname();
27 30 void setNickname(QString nick);
28 31 void updateUserList(QString userlist);
29 32 void relayMsg(string msg);
30 33 void removeChat(QString &nickname);
31   - void putMsgToPrintQueue(string& msg);
  34 + void putMsgToPrintQueue(string& msg, int type);
32 35 void putMsgToSendQueue(QString& msg);
33 36 ~Chatroom();
34 37  
... ... @@ -40,16 +43,14 @@ private:
40 43 std::thread *recv;
41 44 QString nickname;
42 45 list<string> printQueue;
  46 + list<string> printServerQueue;
  47 + list<string> printStatusQueue;
43 48 map<string,void*> activeChats;
44 49 std::mutex chatMutex;
45 50 unique_lock<std::mutex>* chatLock;
46 51 std::condition_variable chatCreated;
47 52 string getSender(string msg);
48 53  
49   -private slots:
50   - void newChat(QString peerNick);
51   -
52   -
53 54 protected:
54 55 void closeEvent(QCloseEvent *event);
55 56  
... ... @@ -58,13 +59,20 @@ public slots:
58 59 void sendMsg();
59 60 void disconnectChatroom();
60 61 void launchChatWindow(QModelIndex index);
  62 + void setConnected(bool status);
61 63  
62 64 private slots:
63   - void printMsg();
  65 + void printMsg();
  66 + void printServerMsg();
  67 + void printStatusMsg();
  68 + void newChat(QString peerNick);
64 69  
65 70 signals:
66 71 void messagesToPrint();
  72 + void serverMessagesToPrint();
  73 + void statusMessagesToPrint();
67 74 void createChat(QString sender);
  75 + void toggleConnected(bool status);
68 76  
69 77 };
70 78  
... ...
build-QChatClient-Desktop-Debug/Makefile
1 1 #############################################################################
2 2 # Makefile for building: QChatClient
3   -# Generated by qmake (3.0) (Qt 5.0.2) on: vie dic 27 07:18:49 2013
  3 +# Generated by qmake (3.0) (Qt 5.0.2) on: vie dic 27 14:11:32 2013
4 4 # Project: ../QChatClient/QChatClient.pro
5 5 # Template: app
6 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
... ... @@ -86,14 +86,8 @@ DIST = /usr/share/qt5/mkspecs/features/spec_pre.prf \
86 86 /usr/share/qt5/mkspecs/modules/qt_lib_opengl.pri \
87 87 /usr/share/qt5/mkspecs/modules/qt_lib_platformsupport.pri \
88 88 /usr/share/qt5/mkspecs/modules/qt_lib_printsupport.pri \
89   - /usr/share/qt5/mkspecs/modules/qt_lib_qml.pri \
90   - /usr/share/qt5/mkspecs/modules/qt_lib_qmldevtools.pri \
91   - /usr/share/qt5/mkspecs/modules/qt_lib_qmltest.pri \
92   - /usr/share/qt5/mkspecs/modules/qt_lib_quick.pri \
93   - /usr/share/qt5/mkspecs/modules/qt_lib_quickparticles.pri \
94 89 /usr/share/qt5/mkspecs/modules/qt_lib_sql.pri \
95 90 /usr/share/qt5/mkspecs/modules/qt_lib_testlib.pri \
96   - /usr/share/qt5/mkspecs/modules/qt_lib_v8.pri \
97 91 /usr/share/qt5/mkspecs/modules/qt_lib_widgets.pri \
98 92 /usr/share/qt5/mkspecs/modules/qt_lib_xml.pri \
99 93 /usr/share/qt5/mkspecs/features/qt_functions.prf \
... ... @@ -173,14 +167,8 @@ Makefile: ../QChatClient/QChatClient.pro /usr/share/qt5/mkspecs/linux-g++-64/qma
173 167 /usr/share/qt5/mkspecs/modules/qt_lib_opengl.pri \
174 168 /usr/share/qt5/mkspecs/modules/qt_lib_platformsupport.pri \
175 169 /usr/share/qt5/mkspecs/modules/qt_lib_printsupport.pri \
176   - /usr/share/qt5/mkspecs/modules/qt_lib_qml.pri \
177   - /usr/share/qt5/mkspecs/modules/qt_lib_qmldevtools.pri \
178   - /usr/share/qt5/mkspecs/modules/qt_lib_qmltest.pri \
179   - /usr/share/qt5/mkspecs/modules/qt_lib_quick.pri \
180   - /usr/share/qt5/mkspecs/modules/qt_lib_quickparticles.pri \
181 170 /usr/share/qt5/mkspecs/modules/qt_lib_sql.pri \
182 171 /usr/share/qt5/mkspecs/modules/qt_lib_testlib.pri \
183   - /usr/share/qt5/mkspecs/modules/qt_lib_v8.pri \
184 172 /usr/share/qt5/mkspecs/modules/qt_lib_widgets.pri \
185 173 /usr/share/qt5/mkspecs/modules/qt_lib_xml.pri \
186 174 /usr/share/qt5/mkspecs/features/qt_functions.prf \
... ... @@ -230,14 +218,8 @@ Makefile: ../QChatClient/QChatClient.pro /usr/share/qt5/mkspecs/linux-g++-64/qma
230 218 /usr/share/qt5/mkspecs/modules/qt_lib_opengl.pri:
231 219 /usr/share/qt5/mkspecs/modules/qt_lib_platformsupport.pri:
232 220 /usr/share/qt5/mkspecs/modules/qt_lib_printsupport.pri:
233   -/usr/share/qt5/mkspecs/modules/qt_lib_qml.pri:
234   -/usr/share/qt5/mkspecs/modules/qt_lib_qmldevtools.pri:
235   -/usr/share/qt5/mkspecs/modules/qt_lib_qmltest.pri:
236   -/usr/share/qt5/mkspecs/modules/qt_lib_quick.pri:
237   -/usr/share/qt5/mkspecs/modules/qt_lib_quickparticles.pri:
238 221 /usr/share/qt5/mkspecs/modules/qt_lib_sql.pri:
239 222 /usr/share/qt5/mkspecs/modules/qt_lib_testlib.pri:
240   -/usr/share/qt5/mkspecs/modules/qt_lib_v8.pri:
241 223 /usr/share/qt5/mkspecs/modules/qt_lib_widgets.pri:
242 224 /usr/share/qt5/mkspecs/modules/qt_lib_xml.pri:
243 225 /usr/share/qt5/mkspecs/features/qt_functions.prf:
... ... @@ -1673,7 +1655,53 @@ loginscreen.o: ../QChatClient/loginscreen.cpp ../QChatClient/loginscreen.h \
1673 1655 ../QChatClient/chatwindow.h \
1674 1656 ../QChatClient/Socket.h \
1675 1657 ../QChatClient/SocketException.h \
1676   - ui_loginscreen.h
  1658 + ui_loginscreen.h \
  1659 + /usr/include/qt5/QtCore/QVariant \
  1660 + /usr/include/qt5/QtWidgets/QAction \
  1661 + /usr/include/qt5/QtWidgets/qaction.h \
  1662 + /usr/include/qt5/QtWidgets/qactiongroup.h \
  1663 + /usr/include/qt5/QtWidgets/QApplication \
  1664 + /usr/include/qt5/QtWidgets/qapplication.h \
  1665 + /usr/include/qt5/QtCore/qcoreapplication.h \
  1666 + /usr/include/qt5/QtCore/qeventloop.h \
  1667 + /usr/include/qt5/QtWidgets/qdesktopwidget.h \
  1668 + /usr/include/qt5/QtGui/qguiapplication.h \
  1669 + /usr/include/qt5/QtGui/qinputmethod.h \
  1670 + /usr/include/qt5/QtWidgets/QButtonGroup \
  1671 + /usr/include/qt5/QtWidgets/qbuttongroup.h \
  1672 + /usr/include/qt5/QtWidgets/QGridLayout \
  1673 + /usr/include/qt5/QtWidgets/qgridlayout.h \
  1674 + /usr/include/qt5/QtWidgets/qlayout.h \
  1675 + /usr/include/qt5/QtWidgets/qlayoutitem.h \
  1676 + /usr/include/qt5/QtWidgets/qboxlayout.h \
  1677 + /usr/include/qt5/QtWidgets/QHeaderView \
  1678 + /usr/include/qt5/QtWidgets/qheaderview.h \
  1679 + /usr/include/qt5/QtWidgets/qabstractitemview.h \
  1680 + /usr/include/qt5/QtWidgets/qabstractscrollarea.h \
  1681 + /usr/include/qt5/QtWidgets/qframe.h \
  1682 + /usr/include/qt5/QtCore/qitemselectionmodel.h \
  1683 + /usr/include/qt5/QtWidgets/qabstractitemdelegate.h \
  1684 + /usr/include/qt5/QtWidgets/qstyleoption.h \
  1685 + /usr/include/qt5/QtWidgets/qabstractspinbox.h \
  1686 + /usr/include/qt5/QtGui/qvalidator.h \
  1687 + /usr/include/qt5/QtWidgets/qslider.h \
  1688 + /usr/include/qt5/QtWidgets/qabstractslider.h \
  1689 + /usr/include/qt5/QtWidgets/qstyle.h \
  1690 + /usr/include/qt5/QtWidgets/qtabbar.h \
  1691 + /usr/include/qt5/QtWidgets/qrubberband.h \
  1692 + /usr/include/qt5/QtWidgets/QLabel \
  1693 + /usr/include/qt5/QtWidgets/qlabel.h \
  1694 + /usr/include/qt5/QtWidgets/QLineEdit \
  1695 + /usr/include/qt5/QtWidgets/qlineedit.h \
  1696 + /usr/include/qt5/QtGui/qtextcursor.h \
  1697 + /usr/include/qt5/QtGui/qtextformat.h \
  1698 + /usr/include/qt5/QtGui/qpen.h \
  1699 + /usr/include/qt5/QtGui/qtextoption.h \
  1700 + /usr/include/qt5/QtWidgets/QPushButton \
  1701 + /usr/include/qt5/QtWidgets/qpushbutton.h \
  1702 + /usr/include/qt5/QtWidgets/qabstractbutton.h \
  1703 + /usr/include/qt5/QtWidgets/QSpacerItem \
  1704 + /usr/include/qt5/QtWidgets/QWidget
1677 1705 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o loginscreen.o ../QChatClient/loginscreen.cpp
1678 1706  
1679 1707 chatroom.o: ../QChatClient/chatroom.cpp ../QChatClient/chatroom.h \
... ... @@ -1796,7 +1824,69 @@ chatroom.o: ../QChatClient/chatroom.cpp ../QChatClient/chatroom.h \
1796 1824 ../QChatClient/Socket.h \
1797 1825 ../QChatClient/SocketException.h \
1798 1826 ../QChatClient/chatwindow.h \
1799   - ui_chatroom.h
  1827 + ui_chatroom.h \
  1828 + /usr/include/qt5/QtCore/QVariant \
  1829 + /usr/include/qt5/QtWidgets/QAction \
  1830 + /usr/include/qt5/QtWidgets/qaction.h \
  1831 + /usr/include/qt5/QtWidgets/qactiongroup.h \
  1832 + /usr/include/qt5/QtWidgets/QApplication \
  1833 + /usr/include/qt5/QtWidgets/qapplication.h \
  1834 + /usr/include/qt5/QtCore/qcoreapplication.h \
  1835 + /usr/include/qt5/QtCore/qeventloop.h \
  1836 + /usr/include/qt5/QtWidgets/qdesktopwidget.h \
  1837 + /usr/include/qt5/QtGui/qguiapplication.h \
  1838 + /usr/include/qt5/QtGui/qinputmethod.h \
  1839 + /usr/include/qt5/QtWidgets/QButtonGroup \
  1840 + /usr/include/qt5/QtWidgets/qbuttongroup.h \
  1841 + /usr/include/qt5/QtWidgets/QGridLayout \
  1842 + /usr/include/qt5/QtWidgets/qgridlayout.h \
  1843 + /usr/include/qt5/QtWidgets/qlayout.h \
  1844 + /usr/include/qt5/QtWidgets/qlayoutitem.h \
  1845 + /usr/include/qt5/QtWidgets/qboxlayout.h \
  1846 + /usr/include/qt5/QtWidgets/QHeaderView \
  1847 + /usr/include/qt5/QtWidgets/qheaderview.h \
  1848 + /usr/include/qt5/QtWidgets/qabstractitemview.h \
  1849 + /usr/include/qt5/QtWidgets/qabstractscrollarea.h \
  1850 + /usr/include/qt5/QtWidgets/qframe.h \
  1851 + /usr/include/qt5/QtCore/qitemselectionmodel.h \
  1852 + /usr/include/qt5/QtWidgets/qabstractitemdelegate.h \
  1853 + /usr/include/qt5/QtWidgets/qstyleoption.h \
  1854 + /usr/include/qt5/QtWidgets/qabstractspinbox.h \
  1855 + /usr/include/qt5/QtGui/qvalidator.h \
  1856 + /usr/include/qt5/QtWidgets/qslider.h \
  1857 + /usr/include/qt5/QtWidgets/qabstractslider.h \
  1858 + /usr/include/qt5/QtWidgets/qstyle.h \
  1859 + /usr/include/qt5/QtWidgets/qtabbar.h \
  1860 + /usr/include/qt5/QtWidgets/qrubberband.h \
  1861 + /usr/include/qt5/QtWidgets/QListWidget \
  1862 + /usr/include/qt5/QtWidgets/qlistwidget.h \
  1863 + /usr/include/qt5/QtWidgets/qlistview.h \
  1864 + /usr/include/qt5/QtWidgets/QMenu \
  1865 + /usr/include/qt5/QtWidgets/qmenu.h \
  1866 + /usr/include/qt5/QtWidgets/QMenuBar \
  1867 + /usr/include/qt5/QtWidgets/qmenubar.h \
  1868 + /usr/include/qt5/QtWidgets/QPushButton \
  1869 + /usr/include/qt5/QtWidgets/qpushbutton.h \
  1870 + /usr/include/qt5/QtWidgets/qabstractbutton.h \
  1871 + /usr/include/qt5/QtWidgets/QSplitter \
  1872 + /usr/include/qt5/QtWidgets/qsplitter.h \
  1873 + /usr/include/qt5/QtWidgets/QWidget \
  1874 + ../QChatClient/chatinputtext.h \
  1875 + /usr/include/qt5/QtWidgets/QTextEdit \
  1876 + /usr/include/qt5/QtWidgets/qtextedit.h \
  1877 + /usr/include/qt5/QtGui/qtextdocument.h \
  1878 + /usr/include/qt5/QtGui/qtextoption.h \
  1879 + /usr/include/qt5/QtGui/qtextcursor.h \
  1880 + /usr/include/qt5/QtGui/qtextformat.h \
  1881 + /usr/include/qt5/QtGui/qpen.h \
  1882 + /usr/include/qt5/QtGui/QKeyEvent \
  1883 + ../QChatClient/chatwidget.h \
  1884 + /usr/include/qt5/QtWidgets/QFileDialog \
  1885 + /usr/include/qt5/QtWidgets/qfiledialog.h \
  1886 + /usr/include/qt5/QtCore/qdir.h \
  1887 + /usr/include/qt5/QtCore/qfileinfo.h \
  1888 + /usr/include/qt5/QtCore/QFile \
  1889 + /usr/include/qt5/QtCore/QTextStream
1800 1890 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatroom.o ../QChatClient/chatroom.cpp
1801 1891  
1802 1892 Socket.o: ../QChatClient/Socket.cpp ../QChatClient/Socket.h \
... ... @@ -2048,7 +2138,67 @@ chatwindow.o: ../QChatClient/chatwindow.cpp ../QChatClient/chatwindow.h \
2048 2138 /usr/include/qt5/QtCore/QRegExp \
2049 2139 ../QChatClient/Socket.h \
2050 2140 ../QChatClient/SocketException.h \
2051   - ui_chatwindow.h
  2141 + ui_chatwindow.h \
  2142 + /usr/include/qt5/QtCore/QVariant \
  2143 + /usr/include/qt5/QtWidgets/QAction \
  2144 + /usr/include/qt5/QtWidgets/qaction.h \
  2145 + /usr/include/qt5/QtWidgets/qactiongroup.h \
  2146 + /usr/include/qt5/QtWidgets/QApplication \
  2147 + /usr/include/qt5/QtWidgets/qapplication.h \
  2148 + /usr/include/qt5/QtCore/qcoreapplication.h \
  2149 + /usr/include/qt5/QtCore/qeventloop.h \
  2150 + /usr/include/qt5/QtWidgets/qdesktopwidget.h \
  2151 + /usr/include/qt5/QtGui/qguiapplication.h \
  2152 + /usr/include/qt5/QtGui/qinputmethod.h \
  2153 + /usr/include/qt5/QtWidgets/QButtonGroup \
  2154 + /usr/include/qt5/QtWidgets/qbuttongroup.h \
  2155 + /usr/include/qt5/QtWidgets/QGridLayout \
  2156 + /usr/include/qt5/QtWidgets/qgridlayout.h \
  2157 + /usr/include/qt5/QtWidgets/qlayout.h \
  2158 + /usr/include/qt5/QtWidgets/qlayoutitem.h \
  2159 + /usr/include/qt5/QtWidgets/qboxlayout.h \
  2160 + /usr/include/qt5/QtWidgets/QHeaderView \
  2161 + /usr/include/qt5/QtWidgets/qheaderview.h \
  2162 + /usr/include/qt5/QtWidgets/qabstractitemview.h \
  2163 + /usr/include/qt5/QtWidgets/qabstractscrollarea.h \
  2164 + /usr/include/qt5/QtWidgets/qframe.h \
  2165 + /usr/include/qt5/QtCore/qitemselectionmodel.h \
  2166 + /usr/include/qt5/QtWidgets/qabstractitemdelegate.h \
  2167 + /usr/include/qt5/QtWidgets/qstyleoption.h \
  2168 + /usr/include/qt5/QtWidgets/qabstractspinbox.h \
  2169 + /usr/include/qt5/QtGui/qvalidator.h \
  2170 + /usr/include/qt5/QtWidgets/qslider.h \
  2171 + /usr/include/qt5/QtWidgets/qabstractslider.h \
  2172 + /usr/include/qt5/QtWidgets/qstyle.h \
  2173 + /usr/include/qt5/QtWidgets/qtabbar.h \
  2174 + /usr/include/qt5/QtWidgets/qrubberband.h \
  2175 + /usr/include/qt5/QtWidgets/QMenu \
  2176 + /usr/include/qt5/QtWidgets/qmenu.h \
  2177 + /usr/include/qt5/QtWidgets/QMenuBar \
  2178 + /usr/include/qt5/QtWidgets/qmenubar.h \
  2179 + /usr/include/qt5/QtWidgets/QPushButton \
  2180 + /usr/include/qt5/QtWidgets/qpushbutton.h \
  2181 + /usr/include/qt5/QtWidgets/qabstractbutton.h \
  2182 + /usr/include/qt5/QtWidgets/QSpacerItem \
  2183 + /usr/include/qt5/QtWidgets/QSplitter \
  2184 + /usr/include/qt5/QtWidgets/qsplitter.h \
  2185 + /usr/include/qt5/QtWidgets/QWidget \
  2186 + ../QChatClient/chatinputtext.h \
  2187 + /usr/include/qt5/QtWidgets/QTextEdit \
  2188 + /usr/include/qt5/QtWidgets/qtextedit.h \
  2189 + /usr/include/qt5/QtGui/qtextdocument.h \
  2190 + /usr/include/qt5/QtGui/qtextoption.h \
  2191 + /usr/include/qt5/QtGui/qtextcursor.h \
  2192 + /usr/include/qt5/QtGui/qtextformat.h \
  2193 + /usr/include/qt5/QtGui/qpen.h \
  2194 + /usr/include/qt5/QtGui/QKeyEvent \
  2195 + ../QChatClient/chatwidget.h \
  2196 + /usr/include/qt5/QtWidgets/QFileDialog \
  2197 + /usr/include/qt5/QtWidgets/qfiledialog.h \
  2198 + /usr/include/qt5/QtCore/qdir.h \
  2199 + /usr/include/qt5/QtCore/qfileinfo.h \
  2200 + /usr/include/qt5/QtCore/QFile \
  2201 + /usr/include/qt5/QtCore/QTextStream
2052 2202 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chatwindow.o ../QChatClient/chatwindow.cpp
2053 2203  
2054 2204 chatinputtext.o: ../QChatClient/chatinputtext.cpp ../QChatClient/chatinputtext.h \
... ...
build-QChatClient-Desktop-Debug/QChatClient
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 19  
20 20 QT_BEGIN_MOC_NAMESPACE
21 21 struct qt_meta_stringdata_Chatroom_t {
22   - QByteArrayData data[13];
23   - char stringdata[134];
  22 + QByteArrayData data[20];
  23 + char stringdata[244];
24 24 };
25 25 #define QT_MOC_LITERAL(idx, ofs, len) \
26 26 Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
... ... @@ -32,21 +32,31 @@ static const qt_meta_stringdata_Chatroom_t qt_meta_stringdata_Chatroom = {
32 32 QT_MOC_LITERAL(0, 0, 8),
33 33 QT_MOC_LITERAL(1, 9, 15),
34 34 QT_MOC_LITERAL(2, 25, 0),
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)
  35 +QT_MOC_LITERAL(3, 26, 21),
  36 +QT_MOC_LITERAL(4, 48, 21),
  37 +QT_MOC_LITERAL(5, 70, 10),
  38 +QT_MOC_LITERAL(6, 81, 6),
  39 +QT_MOC_LITERAL(7, 88, 15),
  40 +QT_MOC_LITERAL(8, 104, 6),
  41 +QT_MOC_LITERAL(9, 111, 12),
  42 +QT_MOC_LITERAL(10, 124, 7),
  43 +QT_MOC_LITERAL(11, 132, 18),
  44 +QT_MOC_LITERAL(12, 151, 16),
  45 +QT_MOC_LITERAL(13, 168, 5),
  46 +QT_MOC_LITERAL(14, 174, 12),
  47 +QT_MOC_LITERAL(15, 187, 8),
  48 +QT_MOC_LITERAL(16, 196, 14),
  49 +QT_MOC_LITERAL(17, 211, 14),
  50 +QT_MOC_LITERAL(18, 226, 7),
  51 +QT_MOC_LITERAL(19, 234, 8)
45 52 },
46   - "Chatroom\0messagesToPrint\0\0createChat\0"
47   - "sender\0newChat\0peerNick\0startSession\0"
48   - "sendMsg\0disconnectChatroom\0launchChatWindow\0"
49   - "index\0printMsg\0"
  53 + "Chatroom\0messagesToPrint\0\0"
  54 + "serverMessagesToPrint\0statusMessagesToPrint\0"
  55 + "createChat\0sender\0toggleConnected\0"
  56 + "status\0startSession\0sendMsg\0"
  57 + "disconnectChatroom\0launchChatWindow\0"
  58 + "index\0setConnected\0printMsg\0printServerMsg\0"
  59 + "printStatusMsg\0newChat\0peerNick\0"
50 60 };
51 61 #undef QT_MOC_LITERAL
52 62  
... ... @@ -56,36 +66,48 @@ static const uint qt_meta_data_Chatroom[] = {
56 66 7, // revision
57 67 0, // classname
58 68 0, 0, // classinfo
59   - 8, 14, // methods
  69 + 14, 14, // methods
60 70 0, 0, // properties
61 71 0, 0, // enums/sets
62 72 0, 0, // constructors
63 73 0, // flags
64   - 2, // signalCount
  74 + 5, // signalCount
65 75  
66 76 // signals: name, argc, parameters, tag, flags
67   - 1, 0, 54, 2, 0x05,
68   - 3, 1, 55, 2, 0x05,
  77 + 1, 0, 84, 2, 0x05,
  78 + 3, 0, 85, 2, 0x05,
  79 + 4, 0, 86, 2, 0x05,
  80 + 5, 1, 87, 2, 0x05,
  81 + 7, 1, 90, 2, 0x05,
69 82  
70 83 // slots: name, argc, parameters, tag, flags
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,
  84 + 9, 0, 93, 2, 0x0a,
  85 + 10, 0, 94, 2, 0x0a,
  86 + 11, 0, 95, 2, 0x0a,
  87 + 12, 1, 96, 2, 0x0a,
  88 + 14, 1, 99, 2, 0x0a,
  89 + 15, 0, 102, 2, 0x08,
  90 + 16, 0, 103, 2, 0x08,
  91 + 17, 0, 104, 2, 0x08,
  92 + 18, 1, 105, 2, 0x08,
77 93  
78 94 // signals: parameters
79 95 QMetaType::Void,
80   - QMetaType::Void, QMetaType::QString, 4,
  96 + QMetaType::Void,
  97 + QMetaType::Void,
  98 + QMetaType::Void, QMetaType::QString, 6,
  99 + QMetaType::Void, QMetaType::Bool, 8,
81 100  
82 101 // slots: parameters
83   - QMetaType::Void, QMetaType::QString, 6,
84 102 QMetaType::Void,
85 103 QMetaType::Void,
86 104 QMetaType::Void,
87   - QMetaType::Void, QMetaType::QModelIndex, 11,
  105 + QMetaType::Void, QMetaType::QModelIndex, 13,
  106 + QMetaType::Void, QMetaType::Bool, 8,
88 107 QMetaType::Void,
  108 + QMetaType::Void,
  109 + QMetaType::Void,
  110 + QMetaType::Void, QMetaType::QString, 19,
89 111  
90 112 0 // eod
91 113 };
... ... @@ -96,13 +118,19 @@ void Chatroom::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, vo
96 118 Chatroom *_t = static_cast<Chatroom *>(_o);
97 119 switch (_id) {
98 120 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;
  121 + case 1: _t->serverMessagesToPrint(); break;
  122 + case 2: _t->statusMessagesToPrint(); break;
  123 + case 3: _t->createChat((*reinterpret_cast< QString(*)>(_a[1]))); break;
  124 + case 4: _t->toggleConnected((*reinterpret_cast< bool(*)>(_a[1]))); break;
  125 + case 5: _t->startSession(); break;
  126 + case 6: _t->sendMsg(); break;
  127 + case 7: _t->disconnectChatroom(); break;
  128 + case 8: _t->launchChatWindow((*reinterpret_cast< QModelIndex(*)>(_a[1]))); break;
  129 + case 9: _t->setConnected((*reinterpret_cast< bool(*)>(_a[1]))); break;
  130 + case 10: _t->printMsg(); break;
  131 + case 11: _t->printServerMsg(); break;
  132 + case 12: _t->printStatusMsg(); break;
  133 + case 13: _t->newChat((*reinterpret_cast< QString(*)>(_a[1]))); break;
106 134 default: ;
107 135 }
108 136 } else if (_c == QMetaObject::IndexOfMethod) {
... ... @@ -115,9 +143,27 @@ void Chatroom::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, vo
115 143 }
116 144 }
117 145 {
  146 + typedef void (Chatroom::*_t)();
  147 + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::serverMessagesToPrint)) {
  148 + *result = 1;
  149 + }
  150 + }
  151 + {
  152 + typedef void (Chatroom::*_t)();
  153 + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::statusMessagesToPrint)) {
  154 + *result = 2;
  155 + }
  156 + }
  157 + {
118 158 typedef void (Chatroom::*_t)(QString );
119 159 if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::createChat)) {
120   - *result = 1;
  160 + *result = 3;
  161 + }
  162 + }
  163 + {
  164 + typedef void (Chatroom::*_t)(bool );
  165 + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Chatroom::toggleConnected)) {
  166 + *result = 4;
121 167 }
122 168 }
123 169 }
... ... @@ -148,13 +194,13 @@ int Chatroom::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
148 194 if (_id < 0)
149 195 return _id;
150 196 if (_c == QMetaObject::InvokeMetaMethod) {
151   - if (_id < 8)
  197 + if (_id < 14)
152 198 qt_static_metacall(this, _c, _id, _a);
153   - _id -= 8;
  199 + _id -= 14;
154 200 } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
155   - if (_id < 8)
  201 + if (_id < 14)
156 202 *reinterpret_cast<int*>(_a[0]) = -1;
157   - _id -= 8;
  203 + _id -= 14;
158 204 }
159 205 return _id;
160 206 }
... ... @@ -166,9 +212,28 @@ void Chatroom::messagesToPrint()
166 212 }
167 213  
168 214 // SIGNAL 1
  215 +void Chatroom::serverMessagesToPrint()
  216 +{
  217 + QMetaObject::activate(this, &staticMetaObject, 1, 0);
  218 +}
  219 +
  220 +// SIGNAL 2
  221 +void Chatroom::statusMessagesToPrint()
  222 +{
  223 + QMetaObject::activate(this, &staticMetaObject, 2, 0);
  224 +}
  225 +
  226 +// SIGNAL 3
169 227 void Chatroom::createChat(QString _t1)
170 228 {
171 229 void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
172   - QMetaObject::activate(this, &staticMetaObject, 1, _a);
  230 + QMetaObject::activate(this, &staticMetaObject, 3, _a);
  231 +}
  232 +
  233 +// SIGNAL 4
  234 +void Chatroom::toggleConnected(bool _t1)
  235 +{
  236 + void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
  237 + QMetaObject::activate(this, &staticMetaObject, 4, _a);
173 238 }
174 239 QT_END_MOC_NAMESPACE
... ...
build-QChatClient-Desktop-Debug/moc_chatroom.o
No preview for this file type