9f17d59e
陈明泉
no message
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include "ishowmain.h"
#include "ui_main.h"
#include "ui_incomingcall.h"
#include "ui_homecenter.h"
#include "iwebrequest.h"
#include <QDebug>
#include <QApplication>
#include <QStackedWidget>
#include "isettingwidget.h"
#include <QLibrary>
#include <QFile>
#include <QTimer>
#include <QMessageBox>
#include <QDateTime>
|
d6ba1152
陈明泉
1.3.1PC老师端正式上线发布版;
|
15
16
|
#include <QDesktopServices>
#include <QUrl>
|
9f17d59e
陈明泉
no message
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include "userinfotip.h"
#include "downloadfile.h"
#include <QtWebKitWidgets>
#include "mywidget.h"
#include "GlobalSetting.h"
#include "gotyecpp/gotyemsg.h"
IShowMain::IShowMain(QWidget *parent) :
QWidget(parent)
,ui(new Ui::IShowMain)
,uiHome(new Ui::HomeCenterWidget),
uiIncoming(new Ui::IncomingCallWidget)
{
userInfoTip = NULL;
ui->setupUi(this);
connect(ui->pushButtonMin, SIGNAL(clicked()), this, SIGNAL(hideMain()));
connect(ui->pushButtonClose, SIGNAL(clicked()), parent, SLOT(on_pushButtonClose_clicked()));
connect(ui->pushButtonMax, SIGNAL(clicked()), this, SIGNAL(showMainMax()));
connect(ui->pushButtonMenuHome, SIGNAL(clicked()), SLOT(showHome()));
connect(ui->pushButtonCourses, SIGNAL(clicked()), SLOT(showCourses()));
connect(ui->pushButtonCourses, SIGNAL(clicked()), this, SLOT(buttonChecked()));
|
6e10e93e
陈明泉
no message
|
45
|
ui->pushButtonCourses->setFocusPolicy(Qt::NoFocus);
|
9f17d59e
陈明泉
no message
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// ui->pushButtonCourses->hide();
connect(ui->pushButtonMenuHome, SIGNAL(clicked()), this, SLOT(buttonChecked()));
connect(ui->pushButtonMenuMessage, SIGNAL(clicked()), this, SLOT(buttonChecked()));
// connect(ui->pushButtonMenuMessage, SIGNAL(clicked()), this, SLOT(showIncomingCall()));
//界面置顶切换需要的配置
//InitAPIVar();
ui->pushButtonMenuHome->setChecked(true);
currentButton = ui->pushButtonMenuHome;
QWidget *centerHome = new QWidget();
uiHome->setupUi(centerHome);
QWidget *centerCalling = new QWidget();
uiIncoming->setupUi(centerCalling);
ishowCourses = new IshowCourses(this);
|
6e10e93e
陈明泉
no message
|
64
|
connect(this, SIGNAL(showMainMax()), ishowCourses, SLOT(showMainMaximized()));
|
9f17d59e
陈明泉
no message
|
65
66
67
68
69
70
71
72
73
74
75
76
77
|
uiChatArea = new Ui::msgChatArea();
centerChatArea = new QWidget();
uiChatArea->setupUi(centerChatArea);
QFile source(":Images/style/styleMsg.html");
// QFile source("D:/QTest/jquery-lightbox-0.5/styletest.html");
source.open(QIODevice::ReadOnly);
uiChatArea->webView->setHtml(QString::fromUtf8(source.readAll().constData()));
source.close();
uiChatArea->textEdit->installEventFilter(this);
uiChatArea->pushButton->setFocusPolicy(Qt::NoFocus);
uiChatArea->webView->setFocusPolicy(Qt::NoFocus);
uiChatArea->listWidget->setFocusPolicy(Qt::NoFocus);
|
6e10e93e
陈明泉
no message
|
78
|
uiChatArea->pushButton_expression->hide();
|
9f17d59e
陈明泉
no message
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
GotyeMsg::Instance()->setUpdataUserList(uiChatArea->listWidget);
centerChatArea->setStyleSheet("background-color:rgba(255,255,255);");
connect(uiChatArea->listWidget,SIGNAL(itemCliLeftChanged()),this,SLOT(showNowChat()));
//msgChatAreaInit();
nowUser.name = "0";
connect(uiChatArea->pushButton_picture, SIGNAL(clicked()), SLOT(on_pushButton_picture_clicked()));
connect(uiChatArea->pushButton, SIGNAL(clicked()), SLOT(on_pushButton_clicked()));
connect(ui->pushButtonMenuMessage, SIGNAL(clicked()), SLOT(showChatArea()));
connect(uiChatArea->listWidget, SIGNAL(deleteItem(QListWidgetItem *)), SLOT(delItemChat(QListWidgetItem *)));
stack = new QStackedWidget(this);
stack->insertWidget(ISTACK_HOME, centerHome);
stack->insertWidget(ISTACK_INCOMING, centerCalling);
stack->insertWidget(ISTACK_MESSAGE, centerChatArea);
stack->insertWidget(ISTACK_COURSE, ishowCourses);
stack->setCurrentIndex(ISTACK_HOME);
StackItemNum = ISTACK_HOME;
connect(uiIncoming->pushButtonAccept, SIGNAL(clicked()), this, SIGNAL(acceptCalling()));
connect(uiIncoming->pushButtonDecline, SIGNAL(clicked()), this, SIGNAL(repulseCalling()));
setting = new ISettingWidget();
connect(ui->pushButtonSetting, SIGNAL(clicked()), this, SLOT(showSetting()));
//上线
connect(uiHome->pushButtonOnline2, SIGNAL(clicked()), SLOT(on_pushButtonOnline_clicked()));
ui->verticalLayoutCenter->addWidget(stack);
IWebRequest *webrequest = IWebRequest::Instance();
connect(webrequest, SIGNAL(response(int,int,QString,QString)), this, SLOT(doResponse(int,int,QString,QString)));
onlineButton = new QPushButton(ui->widgetLeft);
onlineButton->setGeometry(58, 68, 12, 12);
onlineButton->setStyleSheet("border-image:url(:Images/Home/img_status_offline.png); background: transparent;");
hideTipTimer = new QTimer(this);
userInfoTip = new UserInfoTip();
connect(ui->label_header_img, SIGNAL(mouseIn()), this, SLOT(showUserTip()));
connect(ui->label_header_img, SIGNAL(mousePress()), this, SLOT(showUserTip()));
connect(ui->label_header_img, SIGNAL(mouseOut()), this, SLOT(hideUserTip()));
connect(hideTipTimer, SIGNAL(timeout()), userInfoTip, SLOT(hide()));
hideTipTimer->setInterval(500);
connect(userInfoTip, SIGNAL(mouseIn()), this, SLOT(showUserTip()));
connect(userInfoTip, SIGNAL(mouseOut()), this, SLOT(hideUserTip()));
//未读信息
newMsg = new QLabel(ui->widgetLeft);
newMsg->setGeometry(50,155,20,20);
newMsg->hide();
GotyeMsg::Instance()->setShowMsgNum(newMsg);
//loading
loadTimer = new QTimer(this);
loadTimer->setSingleShot(true);
loadTimer->setInterval(30*1000);
connect(loadTimer, SIGNAL(timeout()), this, SLOT(loginLoading()));
|
9f17d59e
陈明泉
no message
|
142
|
|
6e10e93e
陈明泉
no message
|
143
144
145
146
147
148
149
|
//login Status Timer
loginStatusTimer = new QTimer(this);
loginStatusTimer->setInterval(60*1000*5);
connect(loginStatusTimer, SIGNAL(timeout()), this, SLOT(initUserInfo()));
loginStatusTimer->start();
}
|
9f17d59e
陈明泉
no message
|
150
|
|
6e10e93e
陈明泉
no message
|
151
152
153
154
155
156
157
158
159
160
|
static void ChMessageOnlyOk_Error(QString info)
{
QMessageBox msg;
msg.setWindowTitle("Warning");
msg.setText(info);
msg.setStyleSheet("font: 10pt;background-color:rgb(255, 255, 255)");
msg.setIcon(QMessageBox::Critical);
msg.addButton("I SEE",QMessageBox::ActionRole);
msg.exec();
}
|
9f17d59e
陈明泉
no message
|
161
162
163
164
165
|
#include "GlobalSetting.h"
void IShowMain::initUserInfo()
{
QStringList params;
|
6e10e93e
陈明泉
no message
|
166
|
IWebRequest::Instance()->sendRequestToServer(REQ_USER_TEACHER_GET, params);
|
9f17d59e
陈明泉
no message
|
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
}
void IShowMain::showUserTip()
{
hideTipTimer->stop();
if(!userInfoTip)
{
userInfoTip = new UserInfoTip();
}
userInfoTip->setVisible(true);
// QString headerImg = QCoreApplication::applicationDirPath()+"/img/"+_GlobalSetting.userHeadImg.file_name +_GlobalSetting.userHeadImg.ext;
// userInfoTip->setHeaderImg(headerImg);
QPoint point = mapToGlobal(ui->label_header_img->pos()+QPoint(ui->label_header_img->size().width()/2, ui->label_header_img->size().height()/2));
userInfoTip->move(point);
// WId id = userInfoTip->winId();
// showWindowFront(id);
}
void IShowMain::hideUserTip()
{
hideTipTimer->start();
}
void IShowMain::loginLoading()
{
QMessageBox::warning( this , "Failed","Please check if the network is normal!" );
uiHome->label_LogBig->setStyleSheet("border-image:url(:Images/Home/home_img_offline.png);");
uiHome->pushButtonOnline2->setEnabled(true);
uiHome->pushButtonOnline2->setText("Go Online");
onlineButton->setStyleSheet("border-image:url(:Images/Home/img_status_offline.png); background: transparent;");
}
void IShowMain::doResponse(int cmd,int code,QString ,QString result)
{
switch(cmd)
{
case REQ_USER_ONLINE:
{
if(loadTimer->isActive())
loadTimer->stop();
uiHome->label_LogBig->setStyleSheet("border-image:url(:Images/Home/home_img_online.png);");
uiHome->pushButtonOnline2->setEnabled(true);
uiHome->pushButtonOnline2->setText("Go Offline");
onlineButton->setStyleSheet("border-image:url(:Images/Home/img_status_online.png); background: transparent;");
break;
}
case REQ_USER_OFFLINE:
{
if(loadTimer->isActive())
loadTimer->stop();
uiHome->label_LogBig->setStyleSheet("border-image:url(:Images/Home/home_img_offline.png);");
uiHome->pushButtonOnline2->setEnabled(true);
uiHome->pushButtonOnline2->setText("Go Online");
onlineButton->setStyleSheet("border-image:url(:Images/Home/img_status_offline.png); background: transparent;");
break;
}
case REQ_LOGOUT:
{
uiHome->label_LogBig->setStyleSheet("border-image:url(:Images/Home/home_img_offline.png);");
uiHome->pushButtonOnline2->setEnabled(true);
uiHome->pushButtonOnline2->setText("Go Online");
onlineButton->setStyleSheet("border-image:url(:Images/Home/img_status_offline.png); background: transparent;");
break;
}
case REQ_USER_GET:
{
qDebug() << "void IShowMain::doResponse(int cmd,int code,QString ,QString)";
if(!GotyeMsg::Instance()->isLogin)
GotyeMsg::Instance()->login(QString("%1").arg(_GlobalSetting.userInfo.uid));
|
9f17d59e
陈明泉
no message
|
241
242
|
headerImg = QCoreApplication::applicationDirPath()+"/img/"+_GlobalSetting.userHeadImg.file_name +_GlobalSetting.userHeadImg.ext;
|
9f17d59e
陈明泉
no message
|
243
244
|
GotyeMsg::Instance()->setMyUid(_GlobalSetting.userInfo.uid);
qDebug() << "CMQ:show headerImg = "<<headerImg;
|
d6ba1152
陈明泉
1.3.1PC老师端正式上线发布版;
|
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
if(_GlobalSetting.teacher.crown)
{
onlineButton->setGeometry(58, 93, 12, 12);
newMsg->setGeometry(50,180,20,20);
ui->label_crown->show();
}
else
{
onlineButton->setGeometry(58, 68, 12, 12);
newMsg->setGeometry(50,155,20,20);
ui->label_crown->hide();
}
|
9f17d59e
陈明泉
no message
|
259
|
QFile file(headerImg);
|
d6ba1152
陈明泉
1.3.1PC老师端正式上线发布版;
|
260
|
if(_GlobalSetting.userHeadImg.size > 1 && file.exists() && file.size() > 1024)
|
9f17d59e
陈明泉
no message
|
261
262
263
264
265
|
{
ui->label_header_img->setPixmap(QPixmap(headerImg).scaled(54,54));
if(userInfoTip)
userInfoTip->setHeaderImg(headerImg);
|
d6ba1152
陈明泉
1.3.1PC老师端正式上线发布版;
|
266
|
GotyeMsg::Instance()->setMyHeadImg(QString(imgTitle) + headerImg);
|
9f17d59e
陈明泉
no message
|
267
268
269
270
271
|
}
else
{
qDebug() << "CMQ:not found headerImg...";
|
d6ba1152
陈明泉
1.3.1PC老师端正式上线发布版;
|
272
273
|
if(file.exists())
file.remove();
|
6e10e93e
陈明泉
no message
|
274
|
GotyeMsg::Instance()->setMyHeadImg(QString(defaultHeadimg));
|
9f17d59e
陈明泉
no message
|
275
276
|
IDownloadFile *downfile = IDownloadFile::Instance();
downfile->downloadFile(_GlobalSetting.userHeadImg.s_url, headerImg, _GlobalSetting.userHeadImg.file_id);
|
9f17d59e
陈明泉
no message
|
277
|
}
|
6e10e93e
陈明泉
no message
|
278
|
QTimer::singleShot(3*1000,this,SLOT(setHeadImg()));
|
9f17d59e
陈明泉
no message
|
279
280
281
282
283
284
285
286
287
288
289
|
if(userInfoTip)
{
float evaluation_total = _GlobalSetting.teacher.evaluation_total/1.0;
QString balance;
balance.sprintf("%.2f", _GlobalSetting.credits.credits);
uiHome->labelBalanceValue->setText(balance);
userInfoTip->setName(_GlobalSetting.userInfo.user_name.section(' ', 0, 0));
if(evaluation_total > 0.001)
userInfoTip->setEvaluation(evaluation_total/_GlobalSetting.teacher.evaluation_times);
userInfoTip->setCallTime( _GlobalSetting.userInfo.call_time);
|
6e10e93e
陈明泉
no message
|
290
291
292
293
294
295
296
297
298
299
300
301
|
// qDebug("_GlobalSetting.userInfo.call_time %d...evaluation_total = %f\n",_GlobalSetting.userInfo.call_time,evaluation_total);
}
break;
}
case REQ_USER_TEACHER_GET:
{
if(userInfoTip)
{
float evaluation_total = _GlobalSetting.teacher.evaluation_total/1.0;
QString balance;
balance.sprintf("%.2f", _GlobalSetting.credits.credits);
uiHome->labelBalanceValue->setText(balance);
|
d6ba1152
陈明泉
1.3.1PC老师端正式上线发布版;
|
302
|
if(evaluation_total > 0.001 && _GlobalSetting.teacher.evaluation_times > 0)
|
6e10e93e
陈明泉
no message
|
303
304
|
userInfoTip->setEvaluation(evaluation_total/_GlobalSetting.teacher.evaluation_times);
userInfoTip->setCallTime( _GlobalSetting.userInfo.call_time);
|
9f17d59e
陈明泉
no message
|
305
|
qDebug("_GlobalSetting.userInfo.call_time %d...evaluation_total = %f\n",_GlobalSetting.userInfo.call_time,evaluation_total);
|
6e10e93e
陈明泉
no message
|
306
|
}
|
9f17d59e
陈明泉
no message
|
307
|
|
6e10e93e
陈明泉
no message
|
308
309
310
311
312
313
314
|
if(_GlobalSetting.teacher.online == 3)
{
if(!uiHome->pushButtonOnline2->text().contains("Online"))
{
on_pushButtonOnline_clicked();
ChMessageOnlyOk_Error("You have been moved offline for not answering. Please click 'go online' to get online.");
}
|
9f17d59e
陈明泉
no message
|
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
}
break;
}
//通话课程
case REQ_USER_COURSE_CALL_GET:
{
QJsonParseError jsonErr;
QJsonDocument myjsonDoc1 = QJsonDocument::fromJson(result.toLatin1(),&jsonErr);
QJsonArray pptarray = myjsonDoc1.object().find("result").value().toObject().find("ppt").value().toArray();
QJsonObject courseInfo = myjsonDoc1.object().find("result").value().toObject().find("courseInfo").value().toObject();
uiIncoming->course->show();
uiIncoming->course->setText(courseInfo.find("content").value().toString());
qDebug()<<"course: "<<courseInfo.find("course").value().toString()<<courseInfo.find("content").value().toString();
|
6e10e93e
陈明泉
no message
|
329
|
// ui->widgetLeft->hide();
|
9f17d59e
陈明泉
no message
|
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
stack->setCurrentIndex(ISTACK_INCOMING);
break;
}
case REQ_USER_REMARK_GET:
{
QJsonParseError jsonErr;
QJsonDocument myjsonDoc1 = QJsonDocument::fromJson(result.toLatin1(),&jsonErr);
QJsonObject remark = myjsonDoc1.object().find("result").value().toObject().find("remark").value().toObject();
QString name = QString("");
if(remark.size())
name = myjsonDoc1.object().find("result").value().toObject().find("remark").value().\
toObject().find("remark_name").value().toString();
else
name = myjsonDoc1.object().find("result").value().toObject().find("userInfo").value().\
toObject().find("user_name").value().toString();
|
6e10e93e
陈明泉
no message
|
345
|
// qDebug()<<"result: "<<result<<"\n";
|
9f17d59e
陈明泉
no message
|
346
347
348
|
uiIncoming->label_name->setText(name);
break;
}
|
6e10e93e
陈明泉
no message
|
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
|
case REQ_USER_MSG_REMARK_GET:
{
QJsonParseError jsonErr;
QJsonDocument myjsonDoc1 = QJsonDocument::fromJson(result.toLatin1(),&jsonErr);
QJsonObject remark = myjsonDoc1.object().find("result").value().toObject().find("remark").value().toObject();
QString name = QString("");
if(remark.size())
name = myjsonDoc1.object().find("result").value().toObject().find("remark").value().\
toObject().find("remark_name").value().toString();
else
name = myjsonDoc1.object().find("result").value().toObject().find("userInfo").value().\
toObject().find("user_name").value().toString();
qDebug()<<"result: "<<result<<"\n";
uiChatArea->label->setText(name);
break;
}
|
9f17d59e
陈明泉
no message
|
365
366
367
368
369
|
case REQ_USER_ORDER_GET:
{
QJsonParseError jsonErr;
QJsonDocument myjsonDoc1 = QJsonDocument::fromJson(result.toLatin1(),&jsonErr);
QJsonObject order = myjsonDoc1.object().find("result").value().toObject().find("orderInfo").value().toObject();
|
6e10e93e
陈明泉
no message
|
370
|
theOrderRank.setOrder(order.find("peso").value().toDouble());
|
9f17d59e
陈明泉
no message
|
371
|
theOrderRank.setHeaderImg(headerImg);
|
6e10e93e
陈明泉
no message
|
372
373
374
|
QStringList paramsRank;
IWebRequest::Instance()->sendRequestToServer(REQ_USER_ORDER_EARNING_RANK, paramsRank);
|
9f17d59e
陈明泉
no message
|
375
376
377
378
379
380
381
|
}
case REQ_USER_ORDER_EARNING_RANK:
{
QJsonParseError jsonErr;
QJsonDocument myjsonDoc1 = QJsonDocument::fromJson(result.toLatin1(),&jsonErr);
QJsonArray order = myjsonDoc1.object().find("result").value().toObject().find("lists").value().toArray();
theOrderRank.setEarningsRank(order);
|
6e10e93e
陈明泉
no message
|
382
383
384
385
|
initUserInfo();
// QStringList params;
// IWebRequest::Instance()->sendRequestToServer(REQ_USER_GET, params);
|
9f17d59e
陈明泉
no message
|
386
387
388
389
390
391
|
}
default:
break;
}
}
|
6e10e93e
陈明泉
no message
|
392
393
|
void IShowMain::setHeadImg()
{
|
d6ba1152
陈明泉
1.3.1PC老师端正式上线发布版;
|
394
395
396
397
|
QFile HeadImg(headerImg);
if(_GlobalSetting.userHeadImg.size > 1 && HeadImg.exists() && HeadImg.size() > 1024)
{
ui->label_header_img->setPixmap(QPixmap(headerImg).scaled(54,54));
|
6e10e93e
陈明泉
no message
|
398
|
|
d6ba1152
陈明泉
1.3.1PC老师端正式上线发布版;
|
399
400
401
402
|
if(userInfoTip)
userInfoTip->setHeaderImg(headerImg);
GotyeMsg::Instance()->setMyHeadImg(QString(imgTitle) + headerImg);
}
|
6e10e93e
陈明泉
no message
|
403
404
405
|
qDebug()<<"setHeadImg....";
}
|
9f17d59e
陈明泉
no message
|
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
|
void IShowMain::on_pushButtonOnline_clicked()
{
QStringList params;
if(uiHome->pushButtonOnline2->text().contains("Online"))
{
//1:在线 2:忙碌 3:离线
params << "1";
IWebRequest::Instance()->sendRequestToServer(REQ_USER_ONLINE, params);
}
else
{
//1:在线 2:忙碌 3:离线
params << "3";
IWebRequest::Instance()->sendRequestToServer(REQ_USER_OFFLINE, params);
}
loadTimer->start();
uiHome->pushButtonOnline2->setText("Loading...");
uiHome->pushButtonOnline2->setEnabled(false);
qDebug()<< "void IShowMain::on_pushButtonOnline_clicked()";
}
void IShowMain::buttonChecked()
{
changeCurrentButton((QPushButton*)sender());
}
void IShowMain::showSetting()
{
|
6e10e93e
陈明泉
no message
|
434
435
436
437
438
439
440
|
if(setting->isVisible())
{
setting->hide();
setting->show();
}
else
setting->show();
|
9f17d59e
陈明泉
no message
|
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
|
//WId id = setting->winId();
//showWindowFront(id);
}
void IShowMain::showWindowFront(WId id)
{
// bool ret = InitAPIVar() ;
// if(ret)
// {
// AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), NULL), GetCurrentThreadId(), true) ;
// SetForegroundWindow(id);
// SetFocus(id) ;
// AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), NULL), GetCurrentThreadId(), false) ;
// }
}
void IShowMain::changeCurrentButton(QPushButton* button)
{
if(currentButton != NULL && button != NULL)
{
if(button != currentButton)
{
currentButton->setChecked(false);
currentButton = button;
}
}
currentButton->setChecked(true);
}
|
6e10e93e
陈明泉
no message
|
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
|
void IShowMain::setPushButtonEnabled(bool flag)
{
if(flag)
{
ui->pushButtonMenuHome->setEnabled(true);
ui->pushButtonMenuMessage->setEnabled(true);
ui->pushButtonCourses->setEnabled(true);
}
else
{
ui->pushButtonMenuHome->setEnabled(false);
ui->pushButtonMenuMessage->setEnabled(false);
ui->pushButtonCourses->setEnabled(false);
}
}
|
d6ba1152
陈明泉
1.3.1PC老师端正式上线发布版;
|
486
487
488
489
490
491
492
|
/**
* 显示来电信息
* @brief IShowMain::showIncomingCall
* @param uid
* @param img
* @param course_id
*/
|
9f17d59e
陈明泉
no message
|
493
494
495
|
void IShowMain::showIncomingCall(const QString uid,const QString img,int course_id)
{
|
6e10e93e
陈明泉
no message
|
496
497
498
499
|
if(uiHome->pushButtonOnline2->text().contains("Online"))
return;
setPushButtonEnabled(false);
ui->widgetLeft->hide();
|
9f17d59e
陈明泉
no message
|
500
|
|
6e10e93e
陈明泉
no message
|
501
|
if(img.size() > 5)
|
9f17d59e
陈明泉
no message
|
502
|
{
|
6e10e93e
陈明泉
no message
|
503
504
505
|
uiIncoming->webView->load(QUrl(img));
uiIncoming->webView->show();
uiIncoming->label_header->hide();
|
9f17d59e
陈明泉
no message
|
506
|
}
|
6e10e93e
陈明泉
no message
|
507
508
509
510
511
512
513
|
else
{
uiIncoming->label_header->show();
uiIncoming->webView->hide();
}
m_callUid = uid;
|
9f17d59e
陈明泉
no message
|
514
515
516
517
518
519
520
521
522
523
|
// uiIncoming->label_name->setText(name);
QStringList getRemark;
getRemark.append(uid);
IWebRequest::Instance()->sendRequestToServer(REQ_USER_REMARK_GET, getRemark);
if(course_id > 0)
{
QStringList params;
params.append(QString("%1").arg(course_id));
IWebRequest::Instance()->sendRequestToServer(REQ_USER_COURSE_CALL_GET, params);
|
6e10e93e
陈明泉
no message
|
524
|
// qDebug()<<"CoursesId = "<<params.at(0);
|
9f17d59e
陈明泉
no message
|
525
526
527
|
}
else
{
|
6e10e93e
陈明泉
no message
|
528
|
// ui->widgetLeft->hide();
|
9f17d59e
陈明泉
no message
|
529
530
531
532
533
534
535
536
537
|
stack->setCurrentIndex(ISTACK_INCOMING);
uiIncoming->course->hide();
}
qDebug("CMQ fileName = %s filePath = %s course_id = %d",uid.toLatin1().data(),img.toLatin1().data(),course_id);
}
void IShowMain::overCallEnd(QString callId)
{
|
6e10e93e
陈明泉
no message
|
538
|
if(callId.size() > 0)
|
9f17d59e
陈明泉
no message
|
539
540
541
542
543
544
545
546
547
548
549
550
|
{
m_callId = callId;
QTimer::singleShot(3*1000,this,SLOT(getOrderEarningRank()));
}
qDebug()<<"overCallEnd callId = "<<callId;
}
void IShowMain::getOrderEarningRank()
{
QStringList params;
params.append(m_callId);
IWebRequest::Instance()->sendRequestToServer(REQ_USER_ORDER_GET, params);
|
6e10e93e
陈明泉
no message
|
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
|
if(m_callTimeSec >= 590)
{
QStringList params;
params.append(m_callUid);
params.append(m_callId);
IWebRequest::Instance()->sendRequestToServer(REQ_USER_REVIWE_CREATE, params);
theOrderRank.setMemeoPrompts(true);
}
else
{
theOrderRank.setMemeoPrompts(false);
}
qDebug()<<"m_callTimeSec = "<<m_callTimeSec;
}
//创建评语
void IShowMain::review_create(int callTimeSec)
{
m_callTimeSec = callTimeSec;
qDebug()<<"review_create = "<<m_callTimeSec;
|
9f17d59e
陈明泉
no message
|
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
|
}
void IShowMain::showHome()
{
stack->setCurrentIndex(ISTACK_HOME);
StackItemNum = ISTACK_HOME;
GotyeMsg::Instance()->setIsUpdata(false);
}
void IShowMain::showCourses()
{
stack->setCurrentIndex(ISTACK_COURSE);
StackItemNum = ISTACK_COURSE;
GotyeMsg::Instance()->setIsUpdata(false);
ishowCourses->go_now_courses();
}
void IShowMain::showStackItem()
{
ui->widgetLeft->show();
if(StackItemNum == ISTACK_HOME)
showHome();
else if(StackItemNum == ISTACK_MESSAGE)
showChatArea();
else if(StackItemNum == ISTACK_COURSE)
showCourses();
}
void IShowMain::delItemChat(QListWidgetItem *item)
{
GotyeMsg::Instance()->delItemChat(item);
}
void IShowMain::showChatArea()
{
stack->setCurrentIndex(ISTACK_MESSAGE);
StackItemNum = ISTACK_MESSAGE;
uiChatArea->textEdit->clear();
uiChatArea->textEdit->activateWindow();
uiChatArea->textEdit->setFocus();
GotyeMsg::Instance()->setShowMsgWebviwe(uiChatArea->webView);
GotyeMsg::Instance()->setUpdataUserList(uiChatArea->listWidget);
GotyeMsg::Instance()->setShowUserName(uiChatArea->label);
GotyeMsg::Instance()->setIsUpdata(true);
// if(atoi(nowUser.name.data()) > 0)
GotyeMsg::Instance()->showLastChatArea(nowUser);
GotyeMsg::Instance()->msgChatAreaInit();
qDebug("CMQ showChatArea...\n");
}
void IShowMain::on_pushButtonDecline_clicked()
{
showStackItem();
emit repulseCalling();//拒绝来电
qDebug("CMQ repulseCalling...\n");
}
void IShowMain::showNowChat()
{
nowUser = GotyeMsg::Instance()->setChooseUser(uiChatArea->listWidget->currentRow());
|
6e10e93e
陈明泉
no message
|
638
639
640
641
|
QStringList getRemark;
qDebug()<<"nowUser.name.data():"<<nowUser.name.data();
getRemark.append(nowUser.name.data());
IWebRequest::Instance()->sendRequestToServer(REQ_USER_MSG_REMARK_GET, getRemark);
|
9f17d59e
陈明泉
no message
|
642
643
644
645
646
647
648
649
650
651
|
}
void IShowMain::delgoty()
{
GotyeMsg::Instance()->apiist_exit();
}
void IShowMain::on_pushButton_clicked()
{
|
d6ba1152
陈明泉
1.3.1PC老师端正式上线发布版;
|
652
|
// QDesktopServices::openUrl(QUrl("http://www.baidu.com")); //打开默认浏览器 跳转到
|
9f17d59e
陈明泉
no message
|
653
|
|
9f17d59e
陈明泉
no message
|
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
|
if(GotyeMsg::Instance()->getNowUserName().toInt() == 0)
return;
if( uiChatArea->textEdit->toPlainText() == NULL )
{
QMessageBox::warning( this , "warning","Message to be sent cannot be empty!" );
return;
}
//自己发送的消息
GotyeMsg::Instance()->sendMessage(QString(nowUser.name.data()),uiChatArea->textEdit->toPlainText(),GotyeMessageTypeText);
// msgChatAreaInit();//刷新聊天列表
uiChatArea->textEdit->clear();
uiChatArea->textEdit->activateWindow();
uiChatArea->textEdit->setFocus();
}
void IShowMain::on_pushButton_picture_clicked()
{
if(GotyeMsg::Instance()->getNowUserName().toInt() == 0)
return;
QFileDialog::Options options;
//if (!native->isChecked())
options |= QFileDialog::DontUseNativeDialog;
QString selectedFilter,openFilesPath;
QStringList files = QFileDialog::getOpenFileNames(
this, tr("QFileDialog::getOpenFileNames()"),
openFilesPath,
tr("Images (*.png *.bmp *.jpg)"),
&selectedFilter,
options);
if (files.count())
{
for(int i = 0;i < files.count();i++)
{
GotyeMsg::Instance()->sendMessage(QString("%1").arg(nowUser.name.data()), files[i],GotyeMessageTypeImage);
qDebug("CMQ openFile = %s...\n",files[i].toLatin1().data());
// SendImageShow(files[i],Myhead);
}
}
}
bool IShowMain::eventFilter(QObject *obj, QEvent *e)
{
// Q_ASSERT(obj == inputTextEdit);
if (e->type() == QEvent::KeyPress)
{
QKeyEvent *event = static_cast<QKeyEvent*>(e);
if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) && (event->modifiers() & Qt::ControlModifier))
{
uiChatArea->textEdit->append("");
// on_pushButton_clicked(); //发送消息的槽
return true;
}
else if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
on_pushButton_clicked(); //发送消息的槽
return true;
}
}
return false;
}
|