-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFluentHiper.cpp
162 lines (152 loc) · 5.5 KB
/
FluentHiper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#include "FluentHiper.h"
#include "Headers/BaseInclude.h"
#include "Headers/T_Home.h"
#include <QStandardPaths>
#include <ElaApplication.h>
#include <QDesktopServices>
FluentHiper::FluentHiper(QWidget *parent)
: ElaWindow(parent)
{
this->setUserInfoCardPixmap(QPixmap(":/pic/Pic/favicon.png"));
this->setUserInfoCardTitle("CFG LinkWard");
this->setUserInfoCardSubTitle("by [email protected]");
this->setUserInfoCardVisible(true);
this->setWindowTitle("CFG - CSRM");
this->setWindowButtonFlag(ElaAppBarType::ThemeChangeButtonHint,false);
this->setWindowButtonFlag(ElaAppBarType::StayTopButtonHint,false);
this->setAcceptDrops(true);
this->setFixedSize(QSize(800,600));
//SaveFile To
gLocation=new QTemporaryDir();
GlobalLocation=gLocation->path();
// Use For Debug...
// QDesktopServices::openUrl(gLocation->path());
//
saveResourceFile("/Tools","Tools/7z.exe",GlobalLocation+"/7z.exe");
saveResourceFile("/Tools","Tools/7z.dll",GlobalLocation+"/7z.dll");
saveResourceFile("/Tools","Tools/getPerfectPath.bat",GlobalLocation+"/getPerfectPath.bat");
// normTips("located",GlobalLocation->path());
//SaveFile End
QScreen *screen = QGuiApplication::primaryScreen();
QString filePath = GlobalLocation+"/mica.png";
if (screen) {
// 截取全屏幕图像
QPixmap screenshot = screen->grabWindow(0);
// 设置截图保存的文件名
// 保存截图到文件
if (screenshot.save(filePath, "PNG")) {
qDebug() << "Screenshot saved as" << filePath;
} else {
qDebug() << "Failed to save screenshot";
}
}
eApp->setIsEnableMica(true);
eApp->setMicaImagePath(filePath);
// // this->setIsEnableMica(false);
// this->setMicaImagePath(filePath);
// this->setIsEnableMica(true);
ElaTheme::getInstance()->setThemeMode(ElaThemeType::Dark);
this->update();
this->setNavigationBarDisplayMode(ElaNavigationType::Compact);
//
// UI END
//
T_Home *homePage=new T_Home(parent);
T_Deploy *deployPage=new T_Deploy(parent,gLocation);
formatPage=new T_FormatHelp(parent);
connect(deployPage,&T_Deploy::targetToFormatHelp,this,[=](){
targetToFormatHelp();
});
connect(homePage->homeCard, &ElaPopularCard::popularCardButtonClicked, this, [=]() {
// this->navigation(formatPage->property("ElaPageKey").toString());
targetToFormatHelp();
});
this->addPageNode("主菜单",homePage,ElaIconType::House);
this->addPageNode("安装",deployPage,ElaIconType::ArrowDownToBracket);
this->addPageNode("接入",formatPage,ElaIconType::NetworkWired);
}
void FluentHiper::targetToFormatHelp(){
this->navigation(formatPage->property("ElaPageKey").toString());
}
void FluentHiper::originTips(QString title,QString context,ElaMessageBarType::MessageMode type){
originTips(this,title,context,type);
}
void FluentHiper::originTips(ElaWindow* parent,QString title,QString context,ElaMessageBarType::MessageMode type){
ElaMessageButton * bt=new ElaMessageButton(parent);
bt->setBarTitle(title);
bt->setBarText(context);
bt->setMessageMode(type);
bt->setPositionPolicy(ElaMessageBarType::TopRight);
bt->click();
bt->deleteLater();
}
void FluentHiper::warnTips(ElaWindow *parent,QString title,QString context){
originTips(parent,title,context,ElaMessageBarType::Warning);
}
void FluentHiper::warnTips(QString title,QString context){
originTips(title,context,ElaMessageBarType::Warning);
}
void FluentHiper::succTips(ElaWindow *parent,QString title,QString context){
originTips(parent,title,context,ElaMessageBarType::Success);
}
void FluentHiper::succTips(QString title,QString context){
originTips(title,context,ElaMessageBarType::Success);
}
void FluentHiper::normTips(ElaWindow *parent,QString title,QString context){
originTips(parent,title,context,ElaMessageBarType::Information);
}
void FluentHiper::normTips(QString title,QString context){
originTips(title,context,ElaMessageBarType::Information);
}
void FluentHiper::errTips(ElaWindow *parent,QString title,QString context){
originTips(parent,title,context,ElaMessageBarType::Error);
}
void FluentHiper::errTips(QString title,QString context){
originTips(title,context,ElaMessageBarType::Error);
}
void FluentHiper::saveResourceFile(QString resProfiex,QString resFileName,QString destFullPathFileName) {
//组装资源文件中的文件
QString resFile;
resFile=":/"+resProfiex+"/"+resFileName;
QFile file;
file.copy(resFile,destFullPathFileName);
}
void FluentHiper::dragEnterEvent(QDragEnterEvent* ev)
{
if (ev->mimeData()->hasUrls())
{
ev->acceptProposedAction();
}
else
{
ev->ignore();
}
}
void FluentHiper::dropEvent(QDropEvent* ev)
{
if (ev->mimeData()->hasUrls())
{
// QList<QUrl> url_list = ev->mimeData()->urls();
// for (int i = 0; i < url_list.size(); i++)
// {
// QString name = url_list.at(i).toLocalFile();
// QFileInfo info(name);
// if (info.suffix() != "ncm" || info.isDir())
// {
// continue;
// }
// this->addFile(name);
// }
// emit dropEnd();
QList<QUrl> urls = ev->mimeData()->urls();
if (!urls.isEmpty()) {
QString filename = urls.first().toLocalFile();
emit fileDropped(filename);
qDebug()<<filename;
update();
}
}
}
FluentHiper::~FluentHiper() {
delete gLocation;
}