Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
泡沫o0
Qt定时关机器
提交
374f5ccc
Qt定时关机器
项目概览
泡沫o0
/
Qt定时关机器
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Qt定时关机器
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
374f5ccc
编写于
10月 27, 2022
作者:
泡沫o0
🤖
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
删除 mainwindow.cpp
上级
04a98e43
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
102 deletion
+0
-102
src/mainwindow.cpp
src/mainwindow.cpp
+0
-102
未找到文件。
src/mainwindow.cpp
已删除
100644 → 0
浏览文件 @
04a98e43
#include "mainwindow.h"
#include "ui_mainwindow.h"
//static QString widgetbackgroundSheet ="background-color: qconicalgradient(cx:0.5, cy:0, angle:0, stop:0 rgba(55, 55, 202, 100), stop:1 rgba(207, 179, 179, 255))";
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
)
,
ui
(
new
Ui
::
MainWindow
)
{
ui
->
setupUi
(
this
);
qRegisterMetaType
<
atime_t
>
(
"atime_t"
);
//注册PortConfig类型
qRegisterMetaType
<
c_type
>
(
"c_type"
);
//注册PortConfig类型
memset
(
&
mshut
,
0
,
sizeof
(
mshut
));
ui
->
widget_note
->
hide
();
time_worker
=
new
timethread
;
mythread
=
new
QThread
(
this
);
//Create child thread
time_worker
->
moveToThread
(
mythread
);
//Add custom threads to child threads
connect
(
mythread
,
&
QThread
::
finished
,
time_worker
,
&
QObject
::
deleteLater
);
//Thread suicide through deleteLater
connect
(
time_worker
,
SIGNAL
(
time_Signal
(
atime_t
)),
this
,
SLOT
(
Show_time
(
atime_t
)));
//Processing real-time clock signals sent by sub-threads
connect
(
this
,
SIGNAL
(
kill_Signal
(
c_type
)),
time_worker
,
SLOT
(
shotdown
(
c_type
)));
connect
(
this
,
&
MainWindow
::
time_Start
,
time_worker
,
&
timethread
::
beginToWork
);
//Connect signal to thread start function
mythread
->
start
();
//Start the thread, but have not started the thread processing function
emit
time_Start
();
}
MainWindow
::~
MainWindow
()
{
delete
ui
;
}
//用于接收子线程发来的时间数据
void
MainWindow
::
Show_time
(
atime_t
mtime
)
{
ui
->
label_systemtime
->
setText
(
mtime
.
systime
.
toString
(
"MM/dd hh:mm:ss"
));
if
(
work
==
true
)
ui
->
label_Countdown
->
setText
(
mtime
.
Countdowntime
.
toString
(
"hh:mm:ss"
));
}
void
MainWindow
::
on_radioButton_1_clicked
()
{
if
(
ui
->
radioButton_1
->
isChecked
())
{
ui
->
radioButton_2
->
setChecked
(
false
);
}
else
ui
->
radioButton_2
->
setChecked
(
true
);
}
void
MainWindow
::
on_radioButton_2_clicked
()
{
if
(
ui
->
radioButton_2
->
isChecked
())
{
ui
->
radioButton_1
->
setChecked
(
false
);
}
else
ui
->
radioButton_1
->
setChecked
(
true
);
}
void
MainWindow
::
on_pushButton_clicked
()
{
work
=
true
;
if
(
ui
->
radioButton_1
->
isChecked
())
{
qDebug
()
<<
QString
(
"将在%1关机"
).
arg
(
ui
->
timeEditpowertime_1
->
time
().
toString
(
"hh:mm"
))
<<
endl
;
mshut
.
endtime
=
ui
->
timeEditpowertime_1
->
time
();
mshut
.
type
=
1
;
emit
kill_Signal
(
mshut
);
}
else
if
(
ui
->
radioButton_2
->
isChecked
())
{
qDebug
()
<<
QString
(
"将在%1后关机"
).
arg
(
ui
->
timeEditpowertime_2
->
time
().
toString
(
"hh:mm"
))
<<
endl
;
mshut
.
endtime
=
ui
->
timeEditpowertime_2
->
time
();
mshut
.
type
=
2
;
emit
kill_Signal
(
mshut
);
}
if
(
ui
->
checkBox
->
isChecked
())
{
mshut
.
endtime
=
ui
->
timeEdit_screen
->
time
();
mshut
.
type
=
3
;
emit
kill_Signal
(
mshut
);
}
ui
->
radioButton_1
->
setEnabled
(
false
);
ui
->
radioButton_2
->
setEnabled
(
false
);
ui
->
timeEditpowertime_1
->
setEnabled
(
false
);
ui
->
timeEditpowertime_2
->
setEnabled
(
false
);
ui
->
widget_set
->
setStyleSheet
(
"background-color: rgb(204, 204, 204);"
);
ui
->
widget_note
->
show
();
}
void
MainWindow
::
on_pushButton_2_clicked
()
{
work
=
false
;
ui
->
radioButton_1
->
setEnabled
(
true
);
ui
->
radioButton_2
->
setEnabled
(
true
);
ui
->
timeEditpowertime_1
->
setEnabled
(
true
);
ui
->
timeEditpowertime_2
->
setEnabled
(
true
);
ui
->
timeEditpowertime_1
->
setTime
(
QTime
(
0
,
0
,
0
));
ui
->
timeEditpowertime_2
->
setTime
(
QTime
(
0
,
0
,
0
));
ui
->
widget_set
->
setStyleSheet
(
"background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 178, 102, 255), stop:0.55 rgba(235, 148, 61, 255), stop:0.98 rgba(0, 0, 0, 255), stop:1 rgba(0, 0, 0, 0));"
);
ui
->
widget_note
->
hide
();
memset
(
&
mshut
,
0
,
sizeof
(
mshut
));
emit
kill_Signal
(
mshut
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录