Newer
Older
Import / applications / Photoframe / src / manager.cpp
#include <QSound>
#include "intro.h"
#include "manager.h"


Manager *g_Manager = 0;


Manager::Manager(QWidget *parent) : QWidget(parent)
{
	g_Manager = this;
	resize(800,480);

	Intro *intro = new Intro(this);
	intro->raise();
	connect(intro, SIGNAL(setStage(int)), this, SLOT(setStage(int)));

	mainmenu = new MainMenu(this);
	connect(mainmenu, SIGNAL(setStage(int)), this, SLOT(setStage(int)));
	mainmenu->hide();

	slideshow = 0;
	photos = 0;
	videos = 0;
	music = 0;
	info = 0;
	settings = 0;
}


Manager::~Manager()
{

}


void Manager::setStage(int stage)
{
	switch (stage) {
		case -1:
			QSound::play("sounds/Delete.wav");
		case -2:
			if (slideshow)
				slideshow->hide();
			if (photos)
				photos->hide();
			if (music)
				music->hide();
			if (videos)
				videos->hide();
			if (info)
				info->hide();
			if (settings)
				settings->hide();
			mainmenu->show();
			mainmenu->setFocus();
			break;
		case 0:
			if (!slideshow) {
				slideshow = new SlideShow(this);
				connect(slideshow, SIGNAL(setStage(int)), this, SLOT(setStage(int)));
			}
			slideshow->show();
			slideshow->setFocus();
			break;
		case 1:
			if (!photos) {
				photos = new PhotoList(this);
				connect(photos, SIGNAL(setStage(int)), this, SLOT(setStage(int)));
			}
			photos->show();
			photos->setFocus();
			break;
		case 2:
			if (!music) {
				music = new MusicList(this);
				connect(music, SIGNAL(setStage(int)), this, SLOT(setStage(int)));
			}
			music->show();
			music->setFocus();
			break;
		case 3:
			if (!videos) {
				videos = new VideoList(this);
				connect(videos, SIGNAL(setStage(int)), this, SLOT(setStage(int)));
			}
			videos->show();
			videos->setFocus();
			break;
		case 4:
			if (!info) {
				info = new Information(this);
				connect(info, SIGNAL(setStage(int)), this, SLOT(setStage(int)));
			}
			info->show();
			info->setFocus();
			break;
		case 5:
			if (!settings) {
				settings = new Settings(this);
				connect(settings, SIGNAL(setStage(int)), this, SLOT(setStage(int)));
			}
			settings->show();
			settings->setFocus();
			break;
		case 6:
			// Turn Off
			exit(0);
			break;
		default:
			return;
	}
}