Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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();
}
54 changes: 45 additions & 9 deletions view/SplashScreen/nativesplash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <QGraphicsOpacityEffect>
#include <QPropertyAnimation>

#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
2 changes: 2 additions & 0 deletions view/SplashScreen/nativesplash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
158 changes: 81 additions & 77 deletions view/SplashScreen/nativesplash.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,92 +6,96 @@
<rect>
<x>0</x>
<y>0</y>
<width>662</width>
<height>449</height>
<width>611</width>
<height>419</height>
</rect>
</property>
<property name="windowTitle">
<string>nativeSplash</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>600</width>
<height>400</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>400</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QFrame {
background-color: transparent;
border: none;
}
</string>
</property>
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>-50</y>
<width>221</width>
<height>221</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../assets/Logo/LogoResource.qrc">:/Logo1.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>230</x>
<y>0</y>
<width>501</width>
<height>401</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QLabel {
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>0</x>
<y>-60</y>
<width>221</width>
<height>221</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../assets/Logo/LogoResource.qrc">:/Logo1.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>200</x>
<y>0</y>
<width>551</width>
<height>431</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QLabel {
border-radius: 20px;
background-clip: content-box;
}
</string>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../assets/LandScapes/LandScape.qrc">:/landscape/BB1msMpB.jpg</pixmap>
</property>
</widget>
</widget>
</item>
</layout>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../assets/LandScapes/LandScape.qrc">:/landscape/BB1msMpB.jpg</pixmap>
</property>
</widget>
<widget class="QProgressBar" name="progressBar">
<property name="geometry">
<rect>
<x>10</x>
<y>370</y>
<width>171</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="value">
<number>24</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>360</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Loading resources...</string>
</property>
</widget>
</widget>
<resources>
<include location="../../assets/Logo/LogoResource.qrc"/>
Expand Down