#include "quiswipecontrol.h"
#include "ui_quiswipecontrol.h"
#include <QMessageBox>
QUISwipeControl::QUISwipeControl(QWidget *parent) :
QWidget(parent),
ui(new Ui::QUISwipeControl)
{
ui->setupUi(this);
//////////////////////////////////////////////////////
this->m_pScreenCur = NULL;
this->m_pScreenPrev = NULL;
this->m_pScreenNext = NULL;
this->m_bSwipeLocked = false;
this->m_nCurScreen = -1;
this->m_curveType = QEasingCurve::OutCirc;
this->m_nScreenWidth = N_SCREEN_WIDTH;
this->m_nScreenHeight = N_SCREEN_HEIGHT;
// Page spots
int nLeftSpots = 10;
int nTopSpots = this->m_nScreenHeight - N_MAIN_ICON_SECTION_HEIGHT - N_SPOTS_HEIGHT;
int nWidthSpots = this->m_nScreenWidth - nLeftSpots;
int nHeightSpots = N_SPOTS_HEIGHT;
this->ui->wPageSpots->setGeometry(QRect(nLeftSpots, nTopSpots, nWidthSpots, nHeightSpots));
// Main Icon Area
int nLeftMainIcon = 0;
int nTopMainIcon = this->m_nScreenHeight - N_MAIN_ICON_SECTION_HEIGHT;
int nWidthMainIcon = this->m_nScreenWidth;
int nHeightMainIcon = N_MAIN_ICON_SECTION_HEIGHT;
this->ui->lblMainIconArea->setGeometry(QRect(nLeftMainIcon, nTopMainIcon, nWidthMainIcon, nHeightMainIcon));
// calc icoin size
this->m_nIconWidth = (this->m_nScreenWidth
- N_ICON_AREA_PADDING_LEFT
- N_ICON_AREA_PADDING_RIGHT
- N_ICON_SPACING_H * (N_ICON_COUNT_H - 1)) / N_ICON_COUNT_H;
this->m_nIconHeight = (this->m_nScreenHeight
- N_ICON_AREA_TOP
- N_ICON_AREA_PADDING_TOP
- N_MAIN_ICON_SECTION_HEIGHT
- N_SPOTS_HEIGHT
- N_ICON_AREA_PADDING_BOTTOM
- N_ICON_SPACING_V * (N_ICON_COUNT_V - 1)) / N_ICON_COUNT_V;
}
QUISwipeControl::~QUISwipeControl()
{
delete ui;
}
QUIScreen * QUISwipeControl::addScreen()
{
QUIScreen * pScreen = new QUIScreen(this);
int nScreenCount = this->m_lstScrrens.length();
pScreen->setScreenNumber(nScreenCount);
pScreen->updateSize(this->m_nScreenWidth, this->m_nScreenHeight, this->m_nIconWidth, this->m_nIconHeight);
this->connect(pScreen, SIGNAL(swipe_h_doing(int)), this, SLOT(slot_swipe_h_doing(int)));
this->connect(pScreen, SIGNAL(swipe_h_success()), this, SLOT(slot_swipe_h_success()));
this->connect(pScreen, SIGNAL(swipe_h_failed()), this, SLOT(slot_swipe_h_failed()));
// set force fail
if (nScreenCount == 0)
{
pScreen->setFirst(true);
pScreen->setLast(true);
}
else
{
pScreen->setFirst(false);
}
if (nScreenCount > 0)
{
QUIScreen * pScreenPrev = this->getScreen(nScreenCount - 1);
pScreenPrev->setLast(false);
}
pScreen->setLast(true);
// set geometry, hidden
pScreen->setGeometry(QRect(-this->m_nScreenWidth, 0, this->m_nScreenWidth, this->m_nScreenHeight));
this->m_lstScrrens.append(pScreen);
// spot
this->ui->wPageSpots->addSpot();
this->ui->wPageSpots->raise();
// main Icon area
this->ui->lblMainIconArea->raise();
return pScreen;
}
void QUISwipeControl::slot_swipe_h_doing(int nDistance)
{
if (this->m_bSwipeLocked)
{
return;
}
this->m_pScreenCur->setGeometry(QRect(nDistance, 0, this->m_nScreenWidth, this->m_nScreenHeight));
if (this->m_pScreenPrev) this->m_pScreenPrev->setGeometry(QRect(-this->m_nScreenWidth + nDistance, 0, this->m_nScreenWidth, this->m_nScreenHeight));
if (this->m_pScreenNext) this->m_pScreenNext->setGeometry(QRect(this->m_nScreenWidth + nDistance, 0, this->m_nScreenWidth, this->m_nScreenHeight));
}
void QUISwipeControl::slot_swipe_h_success()
{
if (this->m_bSwipeLocked)
{
return;
}
QRect rectCur = this->m_pScreenCur->geometry();
int nCurLeft = rectCur.left();
// current screen
this->m_pAnimationCur = new QPropertyAnimation(this->m_pScreenCur, "geometry");
connect(this->m_pAnimationCur, SIGNAL(finished()), this, SLOT(slot_animation_end()));
this->m_pAnimationCur->setDuration(N_ANIMATION_DURATION);
this->m_pAnimationCur->setStartValue(QRect(nCurLeft, 0, this->m_nScreenWidth, this->m_nScreenHeight));
this->m_pAnimationCur->setEasingCurve(this->m_curveType);
if (this->m_pScreenPrev)
{
this->m_pAnimationPrev = new QPropertyAnimation(this->m_pScreenPrev, "geometry");
this->m_pAnimationPrev->setDuration(N_ANIMATION_DURATION);
this->m_pAnimationPrev->setStartValue(QRect(-this->m_nScreenWidth + nCurLeft, 0, this->m_nScreenWidth, this->m_nScreenHeight));
this->m_pAnimationPrev->setEasingCurve(this->m_curveType);
}
if (this->m_pScreenNext)
{
this->m_pAnimationNext = new QPropertyAnimation(this->m_pScreenNext, "geometry");
this->m_pAnimationNext->setDuration(N_ANIMATION_DURATION);
this->m_pAnimationNext->setStartValue(QRect(this->m_nScreenWidth + nCurLeft, 0, this->m_nScreenWidth, this->m_nScreenHeight));
this->m_pAnimationNext->setEasingCurve(this->m_curveType);
}
if (nCurLeft > 0)
{
this->m_pAnimationCur->setEndValue(QRect(this->m_nScreenWidth, 0, this->m_nScreenWidth, this->m_nScreenHeight));
if (this->m_pScreenPrev) this->m_pAnimationPrev->setEndValue(QRect(0, 0, this->m_nScreenWidth, this->m_nScreenHeight));
if (this->m_pScreenNext) this->m_pAnimationNext->setEndValue(QRect(this->m_nScreenWidth * 2, 0, this->m_nScreenWidth, this->m_nScreenHeight));
this->m_nCurScreen --;
}
else
{
this->m_pAnimationCur->setEndValue(QRect(-this->m_nScreenWidth, 0, this->m_nScreenWidth, this->m_nScreenHeight));
if (this->m_pScreenPrev) this->m_pAnimationPrev->setEndValue(QRect(-this->m_nScreenWidth * 2, 0, this->m_nScreenWidth, this->m_nScreenHeight));
if (this->m_pScreenNext) this->m_pAnimationNext->setEndValue(QRect(0, 0, this->m_nScreenWidth, this->m_nScreenHeight));
this->m_nCurScreen ++;
}
this->m_pAnimationCur->start();
if (this->m_pScreenPrev) this->m_pAnimationPrev->start();
if (this->m_pScreenNext) this->m_pAnimationNext->start();
this->m_bSwipeLocked = true;
}
void QUISwipeControl::slot_swipe_h_failed()
{
if (this->m_bSwipeLocked)
{
return;
}
QRect rectCur = this->m_pScreenCur->geometry();
int nCurLeft = rectCur.left();
// current screen
this->m_pAnimationCur = new QPropertyAnimation(this->m_pScreenCur, "geometry");
connect(this->m_pAnimationCur, SIGNAL(finished()), this, SLOT(slot_animation_end()));
this->m_pAnimationCur->setDuration(N_ANIMATION_DURATION);
this->m_pAnimationCur->setStartValue(QRect(nCurLeft, 0, this->m_nScreenWidth, this->m_nScreenHeight));
this->m_pAnimationCur->setEasingCurve(this->m_curveType);
if (this->m_pScreenPrev)
{
this->m_pAnimationPrev = new QPropertyAnimation(this->m_pScreenPrev, "geometry");
this->m_pAnimationPrev->setDuration(N_ANIMATION_DURATION);
this->m_pAnimationPrev->setStartValue(QRect(-this->m_nScreenWidth + nCurLeft, 0, this->m_nScreenWidth, this->m_nScreenHeight));
this->m_pAnimationPrev->setEasingCurve(this->m_curveType);
}
if (this->m_pScreenNext)
{
this->m_pAnimationNext = new QPropertyAnimation(this->m_pScreenNext, "geometry");
this->m_pAnimationNext->setDuration(N_ANIMATION_DURATION);
this->m_pAnimationNext->setStartValue(QRect(this->m_nScreenWidth + nCurLeft, 0, this->m_nScreenWidth, this->m_nScreenHeight));
this->m_pAnimationNext->setEasingCurve(this->m_curveType);
}
this->m_pAnimationCur->setEndValue(QRect(0, 0, this->m_nScreenWidth, this->m_nScreenH
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
QLauncher_1_source.zip (47个子文件)
QLauncher
quiscreen.ui 469B
quiphone.h 1002B
img
back (1).png 3.19MB
back (2).png 3.46MB
main.png 4.77MB
back (6).png 3.28MB
back (0).png 4.32MB
spot_unselected.png 3KB
back (5).png 905KB
mask.png 5KB
position.png 10KB
back.png 2.66MB
phone.png 107KB
spot_selected.png 3KB
back (7).png 3.63MB
back (8).png 1.99MB
back (3).png 4.29MB
back (4).png 1.15MB
quiicon.h 2KB
QLauncher.pro.user 17KB
common.h 1KB
quiscreen.h 2KB
icons
earth.png 26KB
chrome.png 19KB
pdf.png 14KB
call.png 25KB
firefox.png 28KB
message.png 13KB
whatsapp.png 13KB
setting.png 23KB
camera.png 19KB
purple.png 26KB
apple.png 19KB
quiicon.cpp 8KB
quiswipecontrol.ui 1KB
quiphone.cpp 5KB
main.cpp 183B
quiphone.ui 326B
quiscreen.cpp 10KB
quiswipecontrol.cpp 16KB
quiicon.ui 1KB
qpagespots.cpp 1KB
QLauncher.pro 684B
qpagespots.ui 2KB
quiswipecontrol.h 9KB
QLauncher.qrc 252B
qpagespots.h 494B
共 47 条
- 1
资源评论
寒泊
- 粉丝: 75
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功