diff --git a/main.cpp b/main.cpp index 3eb2336..ec7e6d2 100644 --- a/main.cpp +++ b/main.cpp @@ -38,8 +38,8 @@ int main(int argc, char *argv[]) { qInstallMessageHandler(service::customMessageHandler); //拦截部分错误,真的修不好了喵眼不见心不烦 - //view::SplashScreen::SplashScreen splash; - //splash.show(); + view::SplashScreen::nativeSplash splash; + splash.show(); service::logger::instance().setLogFile( @@ -64,10 +64,11 @@ int main(int argc, char *argv[]) { view::login::loginPage b; b.show(); - //splash.close(); setup_tasks(); service::taskManager::getTimer().startAll(); + splash.closeSplash(); + return QApplication::exec(); } diff --git a/view/SplashScreen/nativesplash.cpp b/view/SplashScreen/nativesplash.cpp index 4bbd9da..90804e0 100644 --- a/view/SplashScreen/nativesplash.cpp +++ b/view/SplashScreen/nativesplash.cpp @@ -5,16 +5,52 @@ // You may need to build the project (run Qt uic code generator) to get "ui_nativeSplash.h" resolved #include "nativesplash.h" +#include +#include + #include "ui_nativeSplash.h" namespace view::SplashScreen { -nativeSplash::nativeSplash(QWidget *parent) : - QWidget(parent), ui(new Ui::nativeSplash) { - ui->setupUi(this); - service::style::setMica(this); -} - -nativeSplash::~nativeSplash() { - delete ui; -} + nativeSplash::nativeSplash(QWidget *parent) : QWidget(parent), ui(new Ui::nativeSplash) { + ui->setupUi(this); + service::style::setMica(this); + setWindowFlags(Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnTopHint); + + QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this); + this->setGraphicsEffect(effect); + + QPropertyAnimation *anim = new QPropertyAnimation(effect, "opacity"); + anim->setDuration(800); + anim->setStartValue(0); + anim->setEndValue(1); + anim->setEasingCurve(QEasingCurve::OutQuad); + anim->start(QPropertyAnimation::DeleteWhenStopped); + + ui->progressBar->setMaximum(0); + ui->progressBar->setMinimum(0); + + play_animation(); + } + + nativeSplash::~nativeSplash() { + delete ui; + } + + void nativeSplash::closeSplash() { + QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this); + this->setGraphicsEffect(effect); + + + QPropertyAnimation *anim = new QPropertyAnimation(effect, "opacity"); + anim->setDuration(400); + anim->setStartValue(1); + anim->setEndValue(0); + anim->setEasingCurve(QEasingCurve::InQuad); + anim->start(QPropertyAnimation::DeleteWhenStopped); + connect(anim, &QPropertyAnimation::finished, this, &nativeSplash::close); + } + + void nativeSplash::play_animation() { + + } } // view::SplashScreen diff --git a/view/SplashScreen/nativesplash.h b/view/SplashScreen/nativesplash.h index 37e98eb..e99aa79 100644 --- a/view/SplashScreen/nativesplash.h +++ b/view/SplashScreen/nativesplash.h @@ -18,9 +18,11 @@ Q_OBJECT public: explicit nativeSplash(QWidget *parent = nullptr); ~nativeSplash() override; + void closeSplash(); private: Ui::nativeSplash *ui; + void play_animation(); }; } // view::SplashScreen diff --git a/view/SplashScreen/nativesplash.ui b/view/SplashScreen/nativesplash.ui index ca5bd81..b531c10 100644 --- a/view/SplashScreen/nativesplash.ui +++ b/view/SplashScreen/nativesplash.ui @@ -6,92 +6,96 @@ 0 0 - 662 - 449 + 611 + 419 nativeSplash - - - - - - 600 - 400 - - - - - 600 - 400 - - - - QFrame { - background-color: transparent; - border: none; - } - - - - QFrame::Shape::StyledPanel - - - QFrame::Shadow::Raised - - - - - 10 - -50 - 221 - 221 - - - - - 1 - 1 - - - - - - - :/Logo1.png - - - true - - - - - - 230 - 0 - 501 - 401 - - - - QLabel { + + + + + + + 0 + -60 + 221 + 221 + + + + + 1 + 1 + + + + + + + :/Logo1.png + + + true + + + + + + 200 + 0 + 551 + 431 + + + + QLabel { border-radius: 20px; background-clip: content-box; } - - - - - - :/landscape/BB1msMpB.jpg - - - - - + + + + + + :/landscape/BB1msMpB.jpg + + + + + + 10 + 370 + 171 + 41 + + + + + + + 24 + + + false + + + + + + 10 + 360 + 151 + 21 + + + + Loading resources... + +