Blame view

LiveChat/FeiTalk/ishowview.cpp 5.08 KB
9f17d59e   陈明泉   no message
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  #include "ishowview.h"
  #include <QVBoxLayout>
  #include <QPushButton>
  #include "mainwindow.h"
  #include "login/widgetLogon.h"
  #include "ishowmain.h"
  #include "iwebRequest.h"
  #include "italkingwidget.h"
  #include <QAction>
  #include "justtalktest.h"
  #include <QMessageBox>
  
  #include <QJsonDocument>
  #include <QJsonArray>
  #include <QJsonValue>
  #include <QJsonParseError>
  #include <QJsonObject>
  
  
  IShowView::IShowView(QWidget *parent, MainWindow *_gui):
      QStackedWidget(parent),
      gui(_gui)
  {
      // Create tabs
      QVBoxLayout *vbox = new QVBoxLayout();
      QHBoxLayout *hbox_buttons = new QHBoxLayout();
      QPushButton *exportButton = new QPushButton(tr("&Export"), this);
      exportButton->setToolTip(tr("Export the data in the current tab to a file"));
      hbox_buttons->addStretch();
      hbox_buttons->addWidget(exportButton);
      vbox->addLayout(hbox_buttons);
  
      overviewPage = new IShowMain(this);//主页面
      this->hide();
  
      jstest = new JustTalkTest();
      connect(jstest, SIGNAL(justMessage(int)), _gui, SIGNAL(justMessage(int)));
      connect(jstest, SIGNAL(CallIncoming(const QString,const QString,int)), overviewPage, SLOT(showIncomingCall(const QString,const QString,int)));
6e10e93e   陈明泉   no message
39
      connect(jstest, SIGNAL(CallIncoming(const QString,const QString,int)), this, SLOT(showMaincalling()));
9f17d59e   陈明泉   no message
40
41
  
      talkingWidget = new ITalkingWidget(this);//通话界面
6e10e93e   陈明泉   no message
42
43
  //    connect(overviewPage, SIGNAL(acceptCalling()), talkingWidget, SLOT(slotClickedBtnAnswer()));
      connect(overviewPage, SIGNAL(acceptCalling()), SLOT(acceptCallAnswer()));
9f17d59e   陈明泉   no message
44
      connect(overviewPage, SIGNAL(repulseCalling()), talkingWidget, SLOT(repulseCurrentCall()));
6e10e93e   陈明泉   no message
45
46
      connect(talkingWidget, SIGNAL(send_callTimeSec(int)), overviewPage, SLOT(review_create(int)));
  //    connect(overviewPage, SIGNAL(repulseCalling()), talkingWidget, SLOT(slotClickedBtnEnd()));
9f17d59e   陈明泉   no message
47
48
49
50
      connect(jstest, SIGNAL(CallOutgoing(QString)), talkingWidget, SLOT(closeTheCurrentCall(QString)));
      connect(jstest, SIGNAL(CallOutgoing(QString)), overviewPage, SLOT(overCallEnd(QString)));
      connect(jstest, SIGNAL(videoReceive(bool)), talkingWidget, SLOT(otherVideoReceive(bool)));
      connect(jstest, SIGNAL(CallUiShow(int)), SLOT(showTalkingPage()));
6e10e93e   陈明泉   no message
51
      connect(jstest, SIGNAL(CallNetStrength(int)), talkingWidget, SLOT(CallNetChanged(int)));
9f17d59e   陈明泉   no message
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
  
      connect(overviewPage, SIGNAL(hideMain()), this, SLOT(hideMain()));
      connect(talkingWidget, SIGNAL(hideMain()), this, SLOT(hideMain()));
      connect(overviewPage, SIGNAL(showMainMax()), this, SLOT(showMainMaximized()));
  
      connect(talkingWidget, SIGNAL(stopCalling()), SLOT(hideTalkingPage()));
      //connect(talkingWidget, SIGNAL(stopCalling()), jstest, SIGNAL(closeClient()()));
  
      connect(jstest, SIGNAL(justLogouted(int)),this, SLOT(lodOut(int)));
      connect(IWebRequest::Instance(),SIGNAL(UseLogOut(int)),this, SLOT(lodOut(int)));
  
      addWidget(overviewPage);
      addWidget(talkingWidget);
      gotoOverviewPage();
  }
  
  IShowView::~IShowView()
  {
      delete jstest;
      overviewPage->delgoty();
  }
  void IShowView::doResponse(int cmd,int,QString,QString)
  {
  
  }
  
  void IShowView::lodOut(int flag)
  {
      if(flag == 2)
      {
          QMessageBox::warning( this , "warning","Your account has been logged in on your phone." );
  
          qApp->exit(773);
      }
  }
  
  void IShowView::hideMain()
  {
  //    this->gui->hide();
      this->gui->showMinimized();
  }
6e10e93e   陈明泉   no message
93
94
95
96
97
98
99
100
101
102
103
104
105
106
  
  void IShowView::showMaincalling()
  {
      if(this->gui->isMinimized())
      {
          this->gui->showMaximized();
          this->gui->showNormal();
      }
      else if(!this->gui->isVisible())
      {
          this->gui->show();
      }
  }
  
9f17d59e   陈明泉   no message
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
  void IShowView::showMainMaximized()
  {
      if(this->gui->isMaximized())
      {
          this->gui->showNormal();
      }
      else
      {
          this->gui->showMaximized();
      }
  }
  
  void IShowView::setMainGUI(MainWindow *gui)
  {
      this->gui = gui;
  }
  
  void IShowView::gotoOverviewPage()
  {
      if(!overviewPage)
          return;
      gui->getOverviewAction()->setChecked(true);
      setCurrentWidget(overviewPage);
  }
  
6e10e93e   陈明泉   no message
132
  void IShowView::acceptCallAnswer()
9f17d59e   陈明泉   no message
133
134
135
  {
      if(!talkingWidget)
          return;
6e10e93e   陈明泉   no message
136
137
  
      talkingWidget->slotClickedBtnAnswer();
9f17d59e   陈明泉   no message
138
139
140
      talkingWidget->stopLocalVideo();
      talkingWidget->startLocalVideo();
      talkingWidget->startRemoteVideo();
6e10e93e   陈明泉   no message
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
      if(talkingWidget->pptNmu == 0)
      {
          this->gui->showNormal();
          this->resize(QSize(1200,700));
          talkingWidget->initShowUI();
          setCurrentWidget(talkingWidget);
      }
  
  }
  
  void IShowView::showTalkingPage()
  {
      if(!talkingWidget)
          return;
  //    talkingWidget->slotClickedBtnAnswer();
      if(talkingWidget->pptNmu > 0)
      {
          this->gui->showNormal();
          this->resize(QSize(1200,700));
          talkingWidget->initShowUI();
          setCurrentWidget(talkingWidget);
      }
9f17d59e   陈明泉   no message
163
164
165
166
  }
  
  void IShowView::hideTalkingPage()
  {
9f17d59e   陈明泉   no message
167
168
169
170
      talkingWidget->showSessTermed();
      RCallManager::Instance()->rmvSession(RCallManager::Instance()->m_pRSession);
      gotoOverviewPage();
      overviewPage->showStackItem();
6e10e93e   陈明泉   no message
171
      overviewPage->setPushButtonEnabled(true);
9f17d59e   陈明泉   no message
172
173
174
175
176
177
178
179
180
181
182
      qDebug("CMQ hideTalkingPage...\n");
  }
  
  void IShowView::on_pushButtonClose_clicked()
  {
  //    overviewPage->delgoty();
  //    this->gui->close();
  //    this->close();
  //    qApp->exit();
      this->gui->hide();
  }