X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmainwindowstack.cpp;fp=src%2Fmainwindowstack.cpp;h=ca9b5014c72c10d2ba401f0fe8d2a0ebac50d49f;hb=64f0d552c4c5235f19988138edeb3048ac7ec151;hp=0000000000000000000000000000000000000000;hpb=b92d758bf682d9ec98d1a92e07eb616829be3917;p=jspeed diff --git a/src/mainwindowstack.cpp b/src/mainwindowstack.cpp new file mode 100644 index 0000000..ca9b501 --- /dev/null +++ b/src/mainwindowstack.cpp @@ -0,0 +1,75 @@ +/* + * This file is part of jSpeed. + * + * jSpeed is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jSpeed is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jSpeed. If not, see . + * + */ + +#include "widgetscreen.h" +#include "mainwindowstack.h" + +MainWindowStack::MainWindowStack(QWidget* parent): WidgetScreen(parent), +currentScreen_(-1) +{ +} + +void MainWindowStack::addScreen(WidgetScreen* screen) +{ + screens_.push_back(screen); + connect(screen, SIGNAL(minimizePressed()), this, SIGNAL(minimizePressed())); + connect(screen, SIGNAL(settingsPressed()), this, SIGNAL(settingsPressed())); + connect(screen, SIGNAL(closePressed()), this, SIGNAL(closePressed())); + connect(screen, SIGNAL(clicked()), this, SLOT(toggleScreen())); + addWidget(screen); + + if(currentScreen_ == -1) + { + toggleScreen(); + } +} + +void MainWindowStack::reArrange() +{ + for(int i = 0; i < screens_.size(); i++) + { + screens_.at(i)->reArrange(); + } +} + +void MainWindowStack::flip() +{ + for(int i = 0; i < screens_.size(); i++) + { + screens_.at(i)->flip(); + } +} + +void MainWindowStack::toggleScreen() +{ + if(currentScreen_ < 0) + { + currentScreen_ = 0; + } + else + { + currentScreen_++; + + if(currentScreen_ >= screens_.size()) + { + currentScreen_ = 0; + } + } + + setCurrentIndex(currentScreen_); +}