#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::const_iterator i; for (i = mapIShowViews.constBegin(); i != mapIShowViews.constEnd(); ++i) removeWidget(i.value()); mapIShowViews.clear(); } void IShowStack::gotoOverviewPage() { QMap::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); }