Blame view

LiveChat/FeiTalk/ishowstack.cpp 1.31 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  #include "ishowstack.h"
  #include "ishowview.h"
  #include "mainwindow.h"
  
  
  IShowStack::IShowStack(QWidget *parent) :
      QStackedWidget(parent)
  {
      setContentsMargins(0,0,0,0);
  }
  
  IShowStack::~IShowStack()
  {
  }
  
  bool IShowStack::addIShow(const QString& name)
  {
      if (!gui || mapIShowViews.count(name) > 0)
          return false;
  
      IShowView *iShowView = new IShowView(this, gui);
      iShowView->setMainGUI(gui);
      addWidget(iShowView);
      mapIShowViews[name] = iShowView;
      return true;
  }
  
  bool IShowStack::removeIShow(const QString& name)
  {
      if (mapIShowViews.count(name) == 0) return false;
      IShowView *ishowView = mapIShowViews.take(name);
      removeWidget(ishowView);
      return true;
  }
  
  void IShowStack::removeAllIShows()
  {
      QMap<QString, IShowView*>::const_iterator i;
      for (i = mapIShowViews.constBegin(); i != mapIShowViews.constEnd(); ++i)
          removeWidget(i.value());
      mapIShowViews.clear();
  }
  
  
  
  void IShowStack::gotoOverviewPage()
  {
      QMap<QString, IShowView*>::const_iterator i;
      for (i = mapIShowViews.constBegin(); i != mapIShowViews.constEnd(); ++i)
          i.value()->gotoOverviewPage();
  }
  
  
  
  void IShowStack::setCurrentIShow(const QString& name)
  {
      if (mapIShowViews.count(name) == 0) return;
      IShowView *ishowView = mapIShowViews.value(name);
      setCurrentWidget(ishowView);
  }