Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Alderaan
pan-light
提交
1a4b035c
P
pan-light
项目概览
Alderaan
/
pan-light
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pan-light
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1a4b035c
编写于
6月 28, 2019
作者:
P
peterq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
兼容windows
上级
167df9f3
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
113 addition
and
72 deletion
+113
-72
pc/functions/base.go
pc/functions/base.go
+6
-0
pc/gui/gui.go
pc/gui/gui.go
+16
-17
pc/gui/qml/comps/Alert.qml
pc/gui/qml/comps/Alert.qml
+2
-1
pc/gui/qml/comps/PromiseDialog.qml
pc/gui/qml/comps/PromiseDialog.qml
+2
-1
pc/gui/qml/comps/confirm-window.qml
pc/gui/qml/comps/confirm-window.qml
+2
-1
pc/gui/qml/comps/desktop-widget.qml
pc/gui/qml/comps/desktop-widget.qml
+2
-2
pc/gui/qml/comps/prompt-window.qml
pc/gui/qml/comps/prompt-window.qml
+3
-1
pc/gui/qml/comps/select-save-path.qml
pc/gui/qml/comps/select-save-path.qml
+8
-1
pc/gui/qml/js/util.js
pc/gui/qml/js/util.js
+4
-0
pc/gui/qml/login/FixedWindow.qml
pc/gui/qml/login/FixedWindow.qml
+2
-1
pc/gui/qml/main.qml
pc/gui/qml/main.qml
+2
-1
pc/gui/qml/pages/about-window.qml
pc/gui/qml/pages/about-window.qml
+2
-1
pc/gui/qml/pages/feedback-window.qml
pc/gui/qml/pages/feedback-window.qml
+2
-1
pc/gui/qml/pages/setting-window.qml
pc/gui/qml/pages/setting-window.qml
+2
-1
pc/gui/qml/pages/share-window.qml
pc/gui/qml/pages/share-window.qml
+2
-1
pc/gui/qml/transfer/transfer.qml
pc/gui/qml/transfer/transfer.qml
+0
-3
pc/gui/qml/widget/Resize.qml
pc/gui/qml/widget/Resize.qml
+40
-30
pc/gui/qml/widget/VirtualFrame.qml
pc/gui/qml/widget/VirtualFrame.qml
+10
-7
pc/pan-download/pan-download.go
pc/pan-download/pan-download.go
+1
-2
pc/pan-light-pc.go
pc/pan-light-pc.go
+5
-0
未找到文件。
pc/functions/base.go
浏览文件 @
1a4b035c
...
...
@@ -39,6 +39,12 @@ var baseSyncRoutes = map[string]syncHandler{
os
.
Exit
(
2
)
return
},
// 退出
"exit"
:
func
(
p
map
[
string
]
interface
{})
(
result
interface
{})
{
dep
.
DoClose
()
os
.
Exit
(
0
)
return
},
// config
"config"
:
func
(
p
map
[
string
]
interface
{})
(
result
interface
{})
{
maxParallelCorutineNumber
:=
int
(
p
[
"maxParallelCorutineNumber"
]
.
(
float64
))
...
...
pc/gui/gui.go
浏览文件 @
1a4b035c
...
...
@@ -3,14 +3,10 @@
package
gui
import
(
"bytes"
_
"github.com/peterq/pan-light/pc/functions"
_
"github.com/peterq/pan-light/pc/gui/bridge"
_
"github.com/peterq/pan-light/pc/gui/comp"
"io/ioutil"
"time"
//_ "github.com/peterq/pan-light/pc/gui/qml"
_
"github.com/peterq/pan-light/pc/gui/qml"
"github.com/peterq/pan-light/qt/bindings/core"
"github.com/peterq/pan-light/qt/bindings/gui"
"github.com/peterq/pan-light/qt/bindings/qml"
...
...
@@ -25,19 +21,22 @@ func StartGui() {
// 下面2句话居然能解决windows 异常退出的bug
core
.
QCoreApplication_SetOrganizationName
(
"PeterQ"
)
//needed to fix an QML Settings issue on windows
quick
.
QQuickWindow_SetSceneGraphBackend
(
quick
.
QSGRendererInterface__Software
)
if
os
.
Getenv
(
"pan_light_render_exception_fix"
)
==
"true"
{
quick
.
QQuickWindow_SetSceneGraphBackend
(
quick
.
QSGRendererInterface__Software
)
}
//rccFile := "E:\\pan-light\\qml.rcc"
//bin, _ := ioutil.ReadFile(rccFile)
//go func() {
// for range time.Tick(2 * time.Second) {
// n, _ := ioutil.ReadFile(rccFile)
// if !bytes.Equal(bin, n) {
// os.Exit(2)
// }
// }
//}()
//core.QResource_RegisterResource(rccFile, "/")
rccFile
:=
"E:
\\
pan-light
\\
qml.rcc"
bin
,
_
:=
ioutil
.
ReadFile
(
rccFile
)
go
func
()
{
for
range
time
.
Tick
(
2
*
time
.
Second
)
{
n
,
_
:=
ioutil
.
ReadFile
(
rccFile
)
if
!
bytes
.
Equal
(
bin
,
n
)
{
os
.
Exit
(
2
)
}
}
}()
core
.
QResource_RegisterResource
(
rccFile
,
"/"
)
app
:=
gui
.
NewQGuiApplication
(
len
(
os
.
Args
),
os
.
Args
)
engine
:=
qml
.
NewQQmlApplicationEngine
(
nil
)
...
...
pc/gui/qml/comps/Alert.qml
浏览文件 @
1a4b035c
...
...
@@ -23,7 +23,8 @@ Window {
}
height
:
msg
.
implicitHeight
+
24
+
100
flags
:
Qt
.
Dialog
|
Qt
.
WindowModal
|
Qt
.
WindowCloseButtonHint
flags
:
Qt
.
MSWindowsFixedSizeDialogHint
|
Qt
.
WindowTitleHint
|
Qt
.
WindowCloseButtonHint
|
Qt
.
WindowModal
|
Qt
.
Dialog
modality
:
Qt
.
WindowModal
Dialog
{
...
...
pc/gui/qml/comps/PromiseDialog.qml
浏览文件 @
1a4b035c
...
...
@@ -34,7 +34,8 @@ Item {
parent
:
G
.
root
Window
{
id
:
window
flags
:
Qt
.
Dialog
|
Qt
.
WindowModal
|
Qt
.
WindowCloseButtonHint
flags
:
Qt
.
MSWindowsFixedSizeDialogHint
|
Qt
.
WindowTitleHint
|
Qt
.
WindowCloseButtonHint
|
Qt
.
WindowModal
|
Qt
.
Dialog
modality
:
Qt
.
ApplicationModal
title
:
root
.
title
minimumHeight
:
100
...
...
pc/gui/qml/comps/confirm-window.qml
浏览文件 @
1a4b035c
...
...
@@ -22,7 +22,8 @@ Window {
}
height
:
msg
.
implicitHeight
+
24
+
150
flags
:
Qt
.
Dialog
|
Qt
.
WindowModal
|
Qt
.
WindowCloseButtonHint
flags
:
Qt
.
MSWindowsFixedSizeDialogHint
|
Qt
.
WindowTitleHint
|
Qt
.
WindowCloseButtonHint
|
Qt
.
WindowModal
|
Qt
.
Dialog
modality
:
Qt
.
WindowModal
Dialog
{
...
...
pc/gui/qml/comps/desktop-widget.qml
浏览文件 @
1a4b035c
...
...
@@ -160,7 +160,7 @@ Window {
}
Controls.MenuItem
{
text
:
'
退出程序
'
onTriggered
:
Qt
.
qu
it
()
onTriggered
:
Util
.
ex
it
()
}
}
...
...
@@ -189,7 +189,7 @@ Window {
}
MenuItem
{
text
:
'
退出程序
'
onTriggered
:
Qt
.
qu
it
()
onTriggered
:
Util
.
ex
it
()
}
}
// 系统托盘
...
...
pc/gui/qml/comps/prompt-window.qml
浏览文件 @
1a4b035c
...
...
@@ -27,7 +27,9 @@ Window {
}
height
:
msg
.
implicitHeight
+
24
+
150
flags
:
Qt
.
Dialog
|
Qt
.
WindowModal
|
Qt
.
WindowCloseButtonHint
// flags: Qt.Dialog | Qt.WindowModal | Qt.WindowCloseButtonHint
flags
:
Qt
.
MSWindowsFixedSizeDialogHint
|
Qt
.
WindowTitleHint
|
Qt
.
WindowCloseButtonHint
|
Qt
.
WindowModal
|
Qt
.
Dialog
modality
:
Qt
.
WindowModal
function
checkInput
()
{
...
...
pc/gui/qml/comps/select-save-path.qml
浏览文件 @
1a4b035c
...
...
@@ -18,7 +18,14 @@ FileDialog {
console
.
log
(
v
)
}
onAccepted
:
{
resolve
(
file
)
console
.
log
(
file
.
toString
())
var
savePath
=
file
.
toString
().
replace
(
'
file://
'
+
(
Qt
.
platform
.
os
==
"
windows
"
?
'
/
'
:
''
)
,
''
)
if
(
Qt
.
platform
.
os
==
"
windows
"
)
{
savePath
=
savePath
.
split
(
'
/
'
).
join
(
'
\\
'
)
}
resolve
(
savePath
)
}
onRejected
:
{
reject
(
'
用户取消选择保存路径
'
)
...
...
pc/gui/qml/js/util.js
浏览文件 @
1a4b035c
...
...
@@ -470,3 +470,7 @@ function unixTime(t) {
return
date
+
'
'
+
time
}
function
exit
()
{
callGoSync
(
'
exit
'
)
}
pc/gui/qml/login/FixedWindow.qml
浏览文件 @
1a4b035c
...
...
@@ -7,7 +7,8 @@ Window {
maximumHeight
:
height
minimumWidth
:
width
maximumWidth
:
width
flags
:
Qt
.
Dialog
|
Qt
.
WindowModal
|
Qt
.
WindowCloseButtonHint
flags
:
Qt
.
MSWindowsFixedSizeDialogHint
|
Qt
.
WindowTitleHint
|
Qt
.
WindowCloseButtonHint
|
Qt
.
WindowModal
|
Qt
.
Dialog
visible
:
false
modality
:
Qt
.
WindowModal
}
pc/gui/qml/main.qml
浏览文件 @
1a4b035c
...
...
@@ -18,7 +18,8 @@ Window {
minimumWidth
:
900
title
:
"
pan-light
"
signal
customerEvent
(
string
event
,
var
data
)
flags
:
Qt
.
WA_TranslucentBackground
|
Qt
.
WA_TransparentForMouseEvents
|
Qt
.
FramelessWindowHint
flags
:
Qt
.
WA_TranslucentBackground
|
Qt
.
WA_TransparentForMouseEvents
|
Qt
.
FramelessWindowHint
|
Qt
.
MSWindowsFixedSizeDialogHint
color
:
'
transparent
'
visibility
:
Window
.
Windowed
...
...
pc/gui/qml/pages/about-window.qml
浏览文件 @
1a4b035c
...
...
@@ -7,7 +7,8 @@ import "../js/util.js" as Util
Window
{
id
:
window
flags
:
Qt
.
Dialog
|
Qt
.
WindowModal
|
Qt
.
WindowCloseButtonHint
flags
:
Qt
.
MSWindowsFixedSizeDialogHint
|
Qt
.
WindowTitleHint
|
Qt
.
WindowCloseButtonHint
|
Qt
.
WindowModal
|
Qt
.
Dialog
modality
:
Qt
.
ApplicationModal
title
:
'
关于
'
minimumHeight
:
height
...
...
pc/gui/qml/pages/feedback-window.qml
浏览文件 @
1a4b035c
...
...
@@ -7,7 +7,8 @@ import "../js/util.js" as Util
import
"
../widget
"
Window
{
id
:
window
flags
:
Qt
.
Dialog
|
Qt
.
WindowModal
|
Qt
.
WindowCloseButtonHint
flags
:
Qt
.
MSWindowsFixedSizeDialogHint
|
Qt
.
WindowTitleHint
|
Qt
.
WindowCloseButtonHint
|
Qt
.
WindowModal
|
Qt
.
Dialog
modality
:
Qt
.
ApplicationModal
title
:
'
反馈
'
minimumHeight
:
height
...
...
pc/gui/qml/pages/setting-window.qml
浏览文件 @
1a4b035c
...
...
@@ -6,7 +6,8 @@ import "../js/app.js" as App
import
"
../js/util.js
"
as
Util
Window
{
id
:
window
flags
:
Qt
.
Dialog
|
Qt
.
WindowModal
|
Qt
.
WindowCloseButtonHint
flags
:
Qt
.
MSWindowsFixedSizeDialogHint
|
Qt
.
WindowTitleHint
|
Qt
.
WindowCloseButtonHint
|
Qt
.
WindowModal
|
Qt
.
Dialog
modality
:
Qt
.
ApplicationModal
title
:
'
设置
'
minimumHeight
:
height
...
...
pc/gui/qml/pages/share-window.qml
浏览文件 @
1a4b035c
...
...
@@ -8,7 +8,8 @@ import "../widget"
Window
{
id
:
window
flags
:
Qt
.
Dialog
|
Qt
.
WindowModal
|
Qt
.
WindowCloseButtonHint
flags
:
Qt
.
MSWindowsFixedSizeDialogHint
|
Qt
.
WindowTitleHint
|
Qt
.
WindowCloseButtonHint
|
Qt
.
WindowModal
|
Qt
.
Dialog
modality
:
Qt
.
ApplicationModal
title
:
'
分享到资源广场
'
minimumHeight
:
height
...
...
pc/gui/qml/transfer/transfer.qml
浏览文件 @
1a4b035c
...
...
@@ -55,7 +55,6 @@ Item {
})
}).
then
(
function
(
savePath
)
{
savePath
=
savePath
.
toString
()
savePath
=
savePath
.
replace
(
'
file://
'
,
''
)
var
newFid
=
(
useVip
?
'
vip
'
:
'
direct
'
)
+
'
.
'
+
meta
.
fs_id
var
id
=
Util
.
callGoSync
(
'
download.new
'
,
{
"
fid
"
:
newFid
,
...
...
@@ -81,8 +80,6 @@ Item {
"
defaultFolder
"
:
App
.
appState
.
settings
.
lastDownloadPath
})
}).
then
(
function
(
savePath
)
{
savePath
=
savePath
.
toString
()
savePath
=
savePath
.
replace
(
'
file://
'
,
''
)
var
id
=
Util
.
callGoSync
(
'
download.new
'
,
{
"
fid
"
:
fid
,
"
savePath
"
:
savePath
...
...
pc/gui/qml/widget/Resize.qml
浏览文件 @
1a4b035c
...
...
@@ -18,6 +18,8 @@ Item {
}
onPositionChanged
:
{
var
delta
=
Qt
.
point
(
mouse
.
x
-
clickPos
.
x
,
mouse
.
y
-
clickPos
.
y
)
delta
.
x
=
Math
.
max
(
delta
.
x
,
-
mainWindow
.
width
+
mainWindow
.
minimumWidth
)
mainWindow
.
width
+=
delta
.
x
}
}
...
...
@@ -38,11 +40,10 @@ Item {
return
t
=
now
var
delta
=
Qt
.
point
(
mouse
.
x
-
clickPos
.
x
,
mouse
.
y
-
clickPos
.
y
)
if
(
!
(
mainWindow
.
minimumWidth
===
mainWindow
.
width
&&
delta
.
x
>
0
))
{
mainWindow
.
width
-=
delta
.
x
mainWindow
.
x
+=
delta
.
x
}
delta
.
x
=
Math
.
min
(
delta
.
x
,
mainWindow
.
width
-
mainWindow
.
minimumWidth
)
mainWindow
.
width
-=
delta
.
x
mainWindow
.
x
+=
delta
.
x
}
}
// 上
...
...
@@ -62,11 +63,10 @@ Item {
return
t
=
now
var
delta
=
Qt
.
point
(
mouse
.
x
-
clickPos
.
x
,
mouse
.
y
-
clickPos
.
y
)
if
(
!
(
mainWindow
.
minimumHeight
===
mainWindow
.
height
&&
delta
.
y
>
0
))
{
mainWindow
.
height
-=
delta
.
y
mainWindow
.
y
+=
delta
.
y
}
delta
.
y
=
Math
.
min
(
mainWindow
.
height
-
mainWindow
.
minimumHeight
,
delta
.
y
)
mainWindow
.
height
-=
delta
.
y
mainWindow
.
y
+=
delta
.
y
}
}
// 下
...
...
@@ -87,6 +87,8 @@ Item {
return
t
=
now
var
delta
=
Qt
.
point
(
mouse
.
x
-
clickPos
.
x
,
mouse
.
y
-
clickPos
.
y
)
delta
.
y
=
Math
.
max
(
-
mainWindow
.
height
+
mainWindow
.
minimumHeight
,
delta
.
y
)
mainWindow
.
height
+=
delta
.
y
}
}
...
...
@@ -107,12 +109,14 @@ Item {
return
t
=
now
var
delta
=
Qt
.
point
(
mouse
.
x
-
clickPos
.
x
,
mouse
.
y
-
clickPos
.
y
)
delta
.
x
=
Math
.
max
(
delta
.
x
,
-
mainWindow
.
width
+
mainWindow
.
minimumWidth
)
delta
.
y
=
Math
.
min
(
mainWindow
.
height
-
mainWindow
.
minimumHeight
,
delta
.
y
)
mainWindow
.
width
+=
delta
.
x
if
(
!
(
mainWindow
.
minimumHeight
===
mainWindow
.
height
&&
delta
.
y
>
0
))
{
mainWindow
.
height
-=
delta
.
y
mainWindow
.
y
+=
delta
.
y
}
mainWindow
.
height
-=
delta
.
y
mainWindow
.
y
+=
delta
.
y
}
}
// 左下
...
...
@@ -132,12 +136,14 @@ Item {
return
t
=
now
var
delta
=
Qt
.
point
(
mouse
.
x
-
clickPos
.
x
,
mouse
.
y
-
clickPos
.
y
)
delta
.
x
=
Math
.
min
(
delta
.
x
,
mainWindow
.
width
-
mainWindow
.
minimumWidth
)
delta
.
y
=
Math
.
max
(
-
mainWindow
.
height
+
mainWindow
.
minimumHeight
,
delta
.
y
)
mainWindow
.
height
+=
delta
.
y
if
(
!
(
mainWindow
.
minimumWidth
===
mainWindow
.
width
&&
delta
.
x
>
0
))
{
mainWindow
.
width
-=
delta
.
x
mainWindow
.
x
+=
delta
.
x
}
mainWindow
.
width
-=
delta
.
x
mainWindow
.
x
+=
delta
.
x
}
}
// 左上
...
...
@@ -156,16 +162,16 @@ Item {
return
t
=
now
var
delta
=
Qt
.
point
(
mouse
.
x
-
clickPos
.
x
,
mouse
.
y
-
clickPos
.
y
)
if
(
!
(
mainWindow
.
minimumWidth
===
mainWindow
.
width
&&
delta
.
x
>
0
))
{
mainWindow
.
width
-=
delta
.
x
mainWindow
.
x
+=
delta
.
x
}
if
(
!
(
mainWindow
.
minimumHeight
===
mainWindow
.
height
&&
delta
.
y
>
0
))
{
mainWindow
.
height
-=
delta
.
y
mainWindow
.
y
+
=
delta
.
y
}
delta
.
x
=
Math
.
min
(
delta
.
x
,
mainWindow
.
width
-
mainWindow
.
minimumWidth
)
delta
.
y
=
Math
.
min
(
mainWindow
.
height
-
mainWindow
.
minimumHeight
,
delta
.
y
)
mainWindow
.
width
-=
delta
.
x
mainWindow
.
x
+=
delta
.
x
mainWindow
.
height
-
=
delta
.
y
mainWindow
.
y
+=
delta
.
y
}
}
// 右下
...
...
@@ -186,6 +192,10 @@ Item {
return
t
=
now
var
delta
=
Qt
.
point
(
mouse
.
x
-
clickPos
.
x
,
mouse
.
y
-
clickPos
.
y
)
delta
.
x
=
Math
.
max
(
delta
.
x
,
-
mainWindow
.
width
+
mainWindow
.
minimumWidth
)
delta
.
y
=
Math
.
max
(
-
mainWindow
.
height
+
mainWindow
.
minimumHeight
,
delta
.
y
)
mainWindow
.
width
+=
delta
.
x
mainWindow
.
height
+=
delta
.
y
}
...
...
pc/gui/qml/widget/VirtualFrame.qml
浏览文件 @
1a4b035c
...
...
@@ -16,14 +16,11 @@ Item {
height
:
parent
.
height
RightMenu
{}
Resize
{
width
:
contentContainer
.
width
+
2
*
maWidth
height
:
contentContainer
.
height
+
2
*
maWidth
anchors.centerIn
:
parent
}
Rectangle
{
id
:
contentContainer
border.color
:
'
gray
'
clip
:
true
property
int
subInt
:
2
*
shadeWidth
*
1.1
width
:
parent
.
width
-
subInt
height
:
parent
.
height
-
subInt
...
...
@@ -126,7 +123,7 @@ Item {
}
MenuItem
{
text
:
'
退出程序
'
onTriggered
:
Qt
.
qu
it
()
onTriggered
:
Util
.
ex
it
()
}
}
}
...
...
@@ -163,7 +160,7 @@ Item {
width
:
20
onClicked
:
{
if
(
!
App
.
appState
.
transferComp
)
{
Qt
.
qu
it
()
Util
.
ex
it
()
}
else
{
G
.
root
.
visible
=
false
}
...
...
@@ -172,6 +169,12 @@ Item {
}
}
Resize
{
width
:
contentContainer
.
width
+
maWidth
height
:
contentContainer
.
height
+
maWidth
anchors.centerIn
:
parent
}
DropShadow
{
anchors.fill
:
contentContainer
horizontalOffset
:
-
5
...
...
pc/pan-download/pan-download.go
浏览文件 @
1a4b035c
...
...
@@ -13,7 +13,6 @@ import (
"log"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"time"
...
...
@@ -123,7 +122,7 @@ func test() {
}
func
DownloadFile
(
fid
,
savePath
string
)
(
taskId
downloader
.
TaskId
,
err
error
)
{
savePath
,
err
=
filepath
.
Abs
(
savePath
)
//
savePath, err = filepath.Abs(savePath)
if
err
!=
nil
{
return
}
...
...
pc/pan-light-pc.go
浏览文件 @
1a4b035c
...
...
@@ -43,6 +43,11 @@ START_PAN:
code
:=
status
.
ExitStatus
()
if
code
==
2
{
goto
START_PAN
}
else
if
code
==
3221225477
{
if
os
.
Getenv
(
"pan_light_render_exception_fix"
)
!=
"true"
{
os
.
Setenv
(
"pan_light_render_exception_fix"
,
"true"
)
goto
START_PAN
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录