You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
4.4 KiB

6 months ago
#include "desktop.h"
#include <QDebug>
#include <QThread>
desktop::desktop()
{
this->setGeometry(0, 0, 800, 480);
this->setMinimumSize(800, 480);
/*背景初始化*/
bgWidget=new QWidget(this);
bgWidget->setStyleSheet("border-image: url(:/icon/abc.png);");
/*app初始化*/
musicplay= new music();
climateapp=new climate();
classtable= new class_table();
alarmnotice = new Alarm();
cameraapp = new CAM();
setapp = new set();
albumapp = new album();
/*桌面初始化*/
mySlidePage = new SlidePage(this);
mySlidePage->resize(this->size());
desktop1= new assistant();
mySlidePage->addPage(desktop1);
desk2= new desktop2();
mySlidePage->addPage(desk2);
// music
connect(desk2, SIGNAL(music_ready(bool)),this, SLOT(music_handle(bool)));
connect(musicplay, SIGNAL(music_close(bool)),this, SLOT(music_handle(bool)));
// camera
connect(desk2, SIGNAL(cam_ready(bool)),this, SLOT(cam_handle(bool)));
connect(cameraapp, SIGNAL(cam_close(bool)),this, SLOT(cam_handle(bool)));
// set
connect(desk2, SIGNAL(set_ready(bool)),this, SLOT(set_handle(bool)));
connect(setapp, SIGNAL(set_close(bool)),this, SLOT(set_handle(bool)));
// ablum
connect(desk2, SIGNAL(album_ready(bool)),this, SLOT(album_handle(bool)));
connect(albumapp, SIGNAL(album_close(bool)),this, SLOT(album_handle(bool)));
// climate
connect(desktop1, SIGNAL(climate_ready(bool)),this, SLOT(climate_handle(bool)));
connect(climateapp, SIGNAL(climate_close(bool)),this, SLOT(climate_handle(bool)));
// classtable
connect(desktop1, SIGNAL(class_ready(bool)),this, SLOT(class_handle(bool)));
connect(classtable, SIGNAL(class_close(bool)),this, SLOT(class_handle(bool)));
// alarm
connect(desktop1, SIGNAL(alarm_ready(bool)),this, SLOT(alarm_handle(bool)));
connect(alarmnotice, SIGNAL(alarm_close(bool)),this, SLOT(alarm_handle(bool)));
}
desktop::~desktop()
{
delete bgWidget;
delete mySlidePage;
delete desktop1;
delete desk2;
delete musicplay;
delete classtable;
delete alarmnotice;
delete climateapp;
delete cameraapp;
delete setapp;
}
void desktop::onButtonPressed()
{
qDebug() << "悬浮球被按下了!";
}
void desktop::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event)
mySlidePage->resize(this->size());
bgWidget->resize(this->size());
}
/*music handle*/
void desktop::music_handle(bool t)
{
if(t)
{
mySlidePage->close();
musicplay->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
musicplay->close();
qDebug() << "close success";
}
}
/*climate handle*/
void desktop::climate_handle(bool t)
{
if(t)
{
mySlidePage->close();
climateapp->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
climateapp->close();
qDebug() << "close success";
}
}
/*class handle*/
void desktop::class_handle(bool t)
{
if(t)
{
mySlidePage->close();
classtable->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
classtable->close();
qDebug() << "close success";
}
}
/*alarm handle*/
void desktop::alarm_handle(bool t)
{
qDebug()<<t;
if(t)
{
mySlidePage->close();
alarmnotice->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
alarmnotice->close();
qDebug() << "close success";
}
}
/*cam handle*/
void desktop::cam_handle(bool t)
{
qDebug()<<t;
if(t)
{
mySlidePage->close();
cameraapp->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
cameraapp->close();
qDebug() << "close success";
}
}
/*set handle*/
void desktop::set_handle(bool t)
{
qDebug()<<t;
if(t)
{
mySlidePage->close();
setapp->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
setapp->close();
qDebug() << "close success";
}
}
/*set handle*/
void desktop::album_handle(bool t)
{
if(t)
{
mySlidePage->close();
albumapp->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
albumapp->close();
qDebug() << "close success";
}
}