-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDefine.qml
executable file
·193 lines (167 loc) · 6.88 KB
/
Define.qml
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
import QtQuick 2.0
import MyFunction.module 1.0
import QtQuick.Window 2.2
Item {
id: def
property int win_width: Screen.desktopAvailableWidth
property int win_height: Screen.desktopAvailableHeight
MyFunction {id: myFunction}
property int iconSize: 25
//FontAwesome字体图标代码
property string iconCode_play: "\uf04c" //播放
property string iconCode_pause: "\uf04b" //暂停
property string iconCode_stop: "\uf04d" //停止
property string iconCode_step_backward: "\uf04a" //快退
property string iconCode_step_forward: "\uf04e" //快进
property string iconCode_forward: "\uf051" //下一曲
property string iconCode_backward: "\uf048" //上一曲
property string iconCode_folder: "\uf07c" //打开文件图标
property string iconCode_back: "\uf053" //返回图标
property string iconCode_volume_mute: "\uf026" //静音图标
property string iconCode_volume_up: "\uf028" //音量增大
property string iconCode_volume_down: "\uf027" //音量减小
property string iconCode_album: "\uf03e" //所有图片
property string iconCode_camera: "\uf030" //相机
property string iconCode_left: "\uf104" //上一张
property string iconCode_right: "\uf105" //下一张
property string iconCode_trash: "\uf014" //删除标志
property string iconCode_file_folder: "\uf07b"
property string iconCode_file_audio: "\uf1c7"
property string iconCode_file_image: "\uf1c5"
property string iconCode_file_file: "\uf15b"
property string iconCode_file_video: "\uf1c8"
property string iconCode_file_archive: "\uf1c6"
property string iconCode_file_code: "\uf1c9"
property string iconCode_file_excel: "\uf1c3"
property string iconCode_file_pdf: "\uf1c1"
property string iconCode_file_powerpoint: "\uf1c4"
property string iconCode_file_sound: "\uf1c7"
property string iconCode_file_text: "\uf15c"
property int fontSize: 16
property url url_music_audio_wave: "qrc:/images/wvga/multimedia/img_audio_wave.png"
property url url_music_background: "qrc:/images/wvga/multimedia/img_music_background.png"
property url url_music_record: "qrc:/images/wvga/multimedia/img_record.png"
property url url_music_fixdot: "qrc:/images/wvga/multimedia/img_fixdot.png"
property url url_music_stylus: "qrc:/images/wvga/multimedia/img_stylus.png"
property url url_video_background: "qrc:/images/wvga/multimedia/img_music_background.png"
property url url_icon_camera: "qrc:/icon/icon_camera.png"
property url url_icon_music: "qrc:/icon/icon_music.png"
property url url_icon_video: "qrc:/icon/icon_video.png"
property url url_icon_album: "qrc:/icon/icon_album.png"
//相机图片保存路径
property string captureSaveHead: "myir_"
//相对路径
//默认构建目录:./%{CurrentBuild:Name}
property string captureSavePath: myFunction.getPath() + "/Capture/"
property string audioDefaultLocation: "file://" + myFunction.getPath() + "/Music/"
property string videoDefaultLocation: "file://" + myFunction.getPath() + "/Video/"
property string imageDefaultLocation: "file://" + captureSavePath
/*
//绝对路径
property string captureSavePath: "F:/MYIR/MultimediaPlayer/Capture/"
property string audioDefaultLocation: "file:///F:/MYIR/MultimediaPlayer/Music/"
property string videoDefaultLocation: "file:///F:/MYIR/MultimediaPlayer/Video/"
property string imageDefaultLocation: "file:///" + captureSavePath;
*/
//媒体文件类型过滤
property var audioNameFilters: ["*.mp3", "*.ape", "*.acc", "*.ogg", "*.flac"]
property var videoNameFilters: ["*.mp4", "*.mkv", "*.avi", "*.wmv", "*.rmvb", "*.mov"]
property var imageNameFilters: ["*.jpg", "*.png", "*.bmp", "*.jpeg"]
property url url_img_preview: "qrc:/img/img_preview.jpg"
property url url_img_black_transparent: "qrc:/images/wvga/multimedia/img_black_transparent.png"
property string source_url: "qrc:/images/wvga/multimedia/img_preview.jpg"
//图库和预览界面参数
property int slidLength: 150 //图库预览左右滑动有效长度
property int albumNumber: 9 //图库一行显示的照片个数
property int albumMargins: 20 //图库图片左右间距大小
//毫秒->分钟秒
function msToMMSS(ms)
{
var utilDate = new Date();
utilDate.setTime(ms);
return Qt.formatTime(utilDate, "mm:ss");
}
//毫秒转换->小时分钟秒钟
function msToHHMMSS(ms)
{
var hour = Math.floor((ms / 1000) / 3600);
if(hour <= 9)
hour = "0" + hour;
var min = Math.floor((ms / 1000) % 3600 / 60);
if(min <= 9)
min = "0" + min;
var sec = Math.floor((ms / 1000) % 3600 % 60);
if(sec <= 9)
sec = "0" + sec;
return hour + ":" + min + ":" + sec;
}
//获取影音名称
function getFileName()
{
var url = source_url;
var arr = [];
arr = url.split("/");
var name = arr[arr.length-1];
return name;
}
//时间字符串20200323_21_56_29_926
function getCurrentTime(){
var time = Qt.formatDateTime(new Date(), "yyyyMMdd_hh_mm_ss_zzz");
// console.log(time)
return time;
}
//根据文件名获取文件后缀
function getFileSuffix(fileName)
{
var suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
return suffix;
}
//根据文件后缀显示对应的图标
function getFileIconCode(fileName)
{
var iconCode;
//获取文件后缀
var suffix = getFileSuffix(fileName)
switch(suffix)
{
//image file
case "jpg":
case "jpeg":
case "bmp":
case "png":
iconCode = iconCode_file_image;
break;
//audio file
case "mp3":
case "ape":
case "aac":
case "ogg":
case "flac":
iconCode = iconCode_file_audio;
break;
//video file
case "mp4":
case "mkv":
case "avi":
case "wmv":
case "rmvb":
iconCode = iconCode_file_video;
break;
//other file
case "pdf": iconCode = iconCode_file_pdf;
break;
case "rar":
case "zip":
iconCode = iconCode_file_archive;
break;
case "txt":
case "md":
iconCode = iconCode_file_text;
break;
default:
iconCode = iconCode_file_file;
break;
}
return iconCode;
}
}