Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Alderaan
pan-light
提交
0cbc8172
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 搜索 >>
提交
0cbc8172
编写于
7月 02, 2019
作者:
P
peterq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix pc: crash in mac
上级
2bd95865
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
50 addition
and
383 deletion
+50
-383
pc/dep/dep.go
pc/dep/dep.go
+12
-3
pc/functions/base.go
pc/functions/base.go
+1
-2
pc/gui/gui.go
pc/gui/gui.go
+6
-0
pc/gui/qml/explore/explore.qml
pc/gui/qml/explore/explore.qml
+0
-137
pc/gui/qml/layout/Layout.qml
pc/gui/qml/layout/Layout.qml
+22
-36
pc/gui/qml/main.qml
pc/gui/qml/main.qml
+1
-2
pc/gui/qml/pan/pan.qml
pc/gui/qml/pan/pan.qml
+0
-84
pc/gui/qml/qml.qrc
pc/gui/qml/qml.qrc
+3
-3
pc/gui/qml/transfer/transfer.qml
pc/gui/qml/transfer/transfer.qml
+0
-113
pc/pan-light-pc.go
pc/pan-light-pc.go
+5
-3
未找到文件。
pc/dep/dep.go
浏览文件 @
0cbc8172
...
...
@@ -6,6 +6,7 @@ import (
"os"
"runtime"
"runtime/debug"
"syscall"
)
var
Fatal
=
func
(
str
string
)
{
...
...
@@ -14,6 +15,7 @@ var Fatal = func(str string) {
}
var
initCb
[]
func
()
var
ExitCode
=
0
func
OnInit
(
cb
func
())
{
initCb
=
append
(
initCb
,
cb
)
...
...
@@ -32,18 +34,25 @@ func OnClose(cb func()) {
}
func
DoClose
()
{
if
closeCb
==
nil
{
return
}
for
_
,
cb
:=
range
closeCb
{
cb
()
}
closeCb
=
nil
if
runtime
.
GOOS
==
"darwin"
{
syscall
.
Kill
(
os
.
Getpid
(),
syscall
.
SIGKILL
)
}
os
.
Exit
(
ExitCode
)
}
func
Reboot
()
{
if
runtime
.
GOOS
==
"windows"
{
ExitCode
=
2
if
runtime
.
GOOS
==
"windows"
||
runtime
.
GOOS
==
"darwin"
{
ioutil
.
WriteFile
(
DataPath
(
"reboot"
),
[]
byte
(
"true"
),
0664
)
}
DoClose
()
os
.
Exit
(
2
)
//
os.Exit(2)
}
var
NotifyQml
=
func
(
event
string
,
data
map
[
string
]
interface
{})
{
...
...
pc/functions/base.go
浏览文件 @
0cbc8172
...
...
@@ -7,7 +7,6 @@ import (
"github.com/peterq/pan-light/pc/server-api"
"github.com/peterq/pan-light/pc/storage"
"log"
"os"
)
func
init
()
{
...
...
@@ -41,7 +40,7 @@ var baseSyncRoutes = map[string]syncHandler{
// 退出
"exit"
:
func
(
p
map
[
string
]
interface
{})
(
result
interface
{})
{
dep
.
DoClose
()
os
.
Exit
(
0
)
//
os.Exit(0)
return
},
// config
...
...
pc/gui/gui.go
浏览文件 @
0cbc8172
...
...
@@ -3,6 +3,7 @@
package
gui
import
(
"github.com/peterq/pan-light/pc/dep"
_
"github.com/peterq/pan-light/pc/functions"
_
"github.com/peterq/pan-light/pc/gui/bridge"
_
"github.com/peterq/pan-light/pc/gui/comp"
...
...
@@ -11,6 +12,7 @@ import (
"github.com/peterq/pan-light/qt/bindings/gui"
"github.com/peterq/pan-light/qt/bindings/qml"
"github.com/peterq/pan-light/qt/bindings/quick"
"log"
"os"
)
...
...
@@ -41,5 +43,9 @@ func StartGui() {
engine
:=
qml
.
NewQQmlApplicationEngine
(
nil
)
engine
.
Load
(
core
.
NewQUrl3
(
"qrc:/main.qml"
,
0
))
dep
.
OnClose
(
func
()
{
log
.
Println
(
"will exit ui"
)
app
.
Exit
(
dep
.
ExitCode
)
})
app
.
Exec
()
}
pc/gui/qml/explore/explore.qml
已删除
100644 → 0
浏览文件 @
2bd95865
import
QtQuick
2.0
import
"
../comps
"
Item
{
id
:
root
property
var
tabWapper
property
var
tasbs
:
Object
.
keys
(
tasbsMap
)
property
var
tasbsMap
:
{
"
newest
"
:
'
最新
'
,
"
hottest
"
:
'
最热
'
,
"
official
"
:
'
官方
'
}
property
string
currentTab
:
'
newest
'
onCurrentTabChanged
:
{
listRepeater
.
itemAt
(
tasbs
.
indexOf
(
currentTab
)).
active
()
}
Connections
{
target
:
tabWapper
onActive
:
{
listRepeater
.
itemAt
(
tasbs
.
indexOf
(
currentTab
)).
active
()
}
}
DataSaver
{
$key
:
'
page-explorer
'
property
alias
showTip
:
tip
.
showTip
}
Column
{
anchors.fill
:
parent
Rectangle
{
id
:
tip
property
string
showTip
:
'
show
'
visible
:
showTip
===
'
show
'
color
:
'
#409EFF
'
width
:
parent
.
width
height
:
visible
?
textTip
.
implicitHeight
+
20
:
0
Text
{
id
:
textTip
color
:
'
white
'
width
:
parent
.
width
-
40
anchors.centerIn
:
parent
wrapMode
:
Text
.
WrapAnywhere
text
:
'
开放型的资源广场, 突破版权文件分享限制(被和谐的违规文件除外).实验性功能, 暂只支持分享大于256k的文件.
'
}
IconButton
{
iconType
:
'
close
'
color
:
'
red
'
anchors.right
:
parent
.
right
anchors.rightMargin
:
10
anchors.verticalCenter
:
parent
.
verticalCenter
onClicked
:
{
tip
.
showTip
=
''
}
}
}
Rectangle
{
id
:
tabsBar
width
:
parent
.
width
height
:
60
Rectangle
{
width
:
parent
.
width
height
:
1
color
:
'
#ddd
'
anchors.bottom
:
parent
.
bottom
}
Item
{
id
:
typeTab
property
int
padding
:
4
property
int
tabWidth
:
80
width
:
tabWidth
*
tabs
.
length
+
2
*
padding
height
:
parent
.
height
*
0.7
anchors.verticalCenter
:
parent
.
verticalCenter
x
:
10
Rectangle
{
anchors.fill
:
parent
radius
:
3
color
:
'
#eee
'
}
Rectangle
{
radius
:
3
width
:
typeTab
.
tabWidth
height
:
typeTab
.
height
-
2
*
typeTab
.
padding
color
:
'
#fff
'
anchors.verticalCenter
:
parent
.
verticalCenter
x
:
typeTab
.
padding
+
root
.
tasbs
.
indexOf
(
root
.
currentTab
)
*
typeTab
.
tabWidth
Behavior
on
x
{
PropertyAnimation
{
duration
:
400
easing.type
:
Easing
.
OutCubic
}
}
}
Repeater
{
model
:
root
.
tasbs
delegate
:
Item
{
width
:
typeTab
.
tabWidth
height
:
typeTab
.
height
-
2
*
typeTab
.
padding
anchors.verticalCenter
:
parent
.
verticalCenter
x
:
typeTab
.
padding
+
index
*
typeTab
.
tabWidth
Text
{
text
:
root
.
tasbsMap
[
modelData
]
anchors.centerIn
:
parent
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
root
.
currentTab
=
modelData
}
}
}
}
}
}
Repeater
{
id
:
listRepeater
model
:
root
.
tasbs
ShareList
{
id
:
shareList
type
:
modelData
height
:
parent
.
height
-
tip
.
height
-
tabsBar
.
height
width
:
parent
.
width
visible
:
root
.
currentTab
==
type
}
}
}
}
pc/gui/qml/layout/Layout.qml
浏览文件 @
0cbc8172
import
QtQuick
2.4
import
"
../pan
"
import
"
../transfer
"
import
"
../explore
"
import
"
../js/util.js
"
as
Util
Item
{
id
:
mainLayout
property
var
tabs
Url
:
{
'
我的网盘
'
:
'
pan
'
,
'
传输列表
'
:
'
transfer
'
,
'
探索
'
:
'
explore
'
}
property
var
tabs
Map
:
{
'
我的网盘
'
:
pan
,
'
传输列表
'
:
transfer
,
'
探索
'
:
explore
}
property
var
tabs
:
[
'
我的网盘
'
,
'
传输列表
'
,
'
探索
'
]
property
var
colors
:
[
'
blue
'
,
'
red
'
,
'
green
'
]
property
string
activeTab
:
'
我的网盘
'
...
...
@@ -17,10 +20,7 @@ Item {
}
}
function
notiActive
()
{
var
idx
=
mainLayout
.
tabs
.
findIndex
(
function
(
tab
)
{
return
tab
===
mainLayout
.
activeTab
})
tabRepeater
.
itemAt
(
idx
).
active
()
tabsMap
[
mainLayout
.
activeTab
].
active
()
}
onActiveTabChanged
:
{
notiActive
()
...
...
@@ -112,48 +112,34 @@ Item {
}
}
transform
:
Scale
{
id
:
tabsConScale
property
real
scale
:
1
xScale
:
scale
yScale
:
scale
origin.x
:
-
tabsCon
.
x
+
tabsViewport
.
width
/
2
// origin.x: tabsCon.width / 2
origin.y
:
parent
.
height
/
2
}
Repeater
{
id
:
tabRepeater
model
:
tabs
Rectangle
{
id
:
tabWapper
width
:
tabsViewport
.
width
height
:
tabsViewport
.
height
signal
active
Pan
{
id
:
pan
width
:
tabsViewport
.
width
height
:
tabsViewport
.
height
}
// color: mainLayout.colors[index]
Rectangle
{
visible
:
false
property
real
borderWidth
:
10
width
:
parent
.
width
+
2
*
borderWidth
height
:
parent
.
height
+
2
*
borderWidth
x
:
-
borderWidth
y
:
-
borderWidth
border.color
:
'
red
'
border.width
:
borderWidth
}
Loader
{
id
:
tabLoader
focus
:
true
width
:
tabWapper
.
width
height
:
tabWapper
.
height
Component.onCompleted
:
{
tabLoader
.
setSource
(
'
../
'
+
tabsUrl
[
modelData
]
+
'
/
'
+
tabsUrl
[
modelData
]
+
'
.qml
'
,
{
tabWapper
:
tabWapper
})
}
}
}
Transfer
{
id
:
transfer
width
:
tabsViewport
.
width
height
:
tabsViewport
.
height
}
Explore
{
id
:
explore
width
:
tabsViewport
.
width
height
:
tabsViewport
.
height
}
}
}
...
...
pc/gui/qml/main.qml
浏览文件 @
0cbc8172
...
...
@@ -18,8 +18,7 @@ Window {
minimumWidth
:
900
title
:
"
pan-light
"
signal
customerEvent
(
string
event
,
var
data
)
flags
:
Qt
.
WA_TranslucentBackground
|
Qt
.
WA_TransparentForMouseEvents
|
Qt
.
FramelessWindowHint
|
Qt
.
MSWindowsFixedSizeDialogHint
flags
:
Qt
.
FramelessWindowHint
color
:
'
transparent
'
visibility
:
Window
.
Windowed
...
...
pc/gui/qml/pan/pan.qml
已删除
100644 → 0
浏览文件 @
2bd95865
import
QtQuick
2.0
import
'
../videoPlayer
'
import
'
../js/app.js
'
as
App
import
'
../js/util.js
'
as
Util
import
'
../comps
'
import
'
./left-panel
'
Rectangle
{
id
:
root
// 左侧信息栏
LeftPanel
{
id
:
leftPanel
height
:
parent
.
height
width
:
250
// 右侧border
Rectangle
{
color
:
'
gray
'
width
:
2
height
:
parent
.
height
anchors.right
:
parent
.
right
}
}
// 头部加列表
Rectangle
{
anchors.left
:
leftPanel
.
right
width
:
root
.
width
-
leftPanel
.
width
height
:
parent
.
height
PathNav
{
id
:
pathNav
width
:
parent
.
width
height
:
40
// 下侧border
Rectangle
{
color
:
'
gray
'
width
:
parent
.
width
height
:
2
anchors.bottom
:
parent
.
bottom
}
}
FileList
{
width
:
parent
.
width
height
:
parent
.
height
-
pathNav
.
height
anchors.top
:
pathNav
.
bottom
color
:
"
#fff
"
Rectangle
{
id
:
loading
anchors.fill
:
parent
visible
:
false
color
:
Qt
.
rgba
(
1
,
1
,
1
,.
6
)
Component
{
id
:
iconComp
IconFont
{
type
:
'
loading
'
width
:
Math
.
min
(
loading
.
width
,
loading
.
height
)
*
0.3
}
}
Loader
{
id
:
iconLoader
focus
:
true
anchors.centerIn
:
parent
}
Component.onCompleted
:
{
// 监听进入path, 延时500ms显示加载动画
App
.
appState
.
enterPathPromiseChanged
.
connect
(
function
()
{
if
(
!
App
.
appState
.
enterPathPromise
)
{
loading
.
visible
=
false
iconLoader
.
sourceComponent
=
null
return
}
var
p
=
App
.
appState
.
enterPathPromise
Util
.
sleep
(
500
)
.
then
(
function
(){
if
(
App
.
appState
.
enterPathPromise
===
p
)
{
iconLoader
.
sourceComponent
=
iconComp
loading
.
visible
=
true
}
})
})
}
}
LoadDirError
{}
}
}
}
pc/gui/qml/qml.qrc
浏览文件 @
0cbc8172
...
...
@@ -12,9 +12,9 @@
<file>comps/desktop-widget_copy.qml</file>
<file>comps/bridge.qml</file>
<file>assets/images/pan-light-1.png</file>
<file>pan/
p
an.qml</file>
<file>explore/
e
xplore.qml</file>
<file>transfer/
t
ransfer.qml</file>
<file>pan/
P
an.qml</file>
<file>explore/
E
xplore.qml</file>
<file>transfer/
T
ransfer.qml</file>
<file>login/Login.qml</file>
<file>comps/IconFont.qml</file>
<file>assets/images/icons/wx.svg</file>
...
...
pc/gui/qml/transfer/transfer.qml
已删除
100644 → 0
浏览文件 @
2bd95865
import
QtQuick
2.0
import
"
../js/app.js
"
as
App
import
"
../js/util.js
"
as
Util
Item
{
id
:
root
signal
sumSpeed
(
var
data
)
HeaderBar
{
id
:
headerBar
}
Rectangle
{
width
:
parent
.
width
height
:
2
color
:
'
gray
'
anchors.bottom
:
headerBar
.
bottom
}
DownloadList
{
id
:
downloadingList
visible
:
headerBar
.
currentTab
==
'
下载中
'
isFinish
:
false
anchors.top
:
headerBar
.
bottom
width
:
parent
.
width
height
:
parent
.
height
-
headerBar
.
height
}
DownloadList
{
id
:
downloadedList
visible
:
headerBar
.
currentTab
==
'
已完成
'
isFinish
:
true
anchors.top
:
headerBar
.
bottom
width
:
parent
.
width
height
:
parent
.
height
-
headerBar
.
height
}
Component.onCompleted
:
{
App
.
appState
.
transferComp
=
root
}
function
addDownload
(
meta
,
useVip
)
{
return
Util
.
Promise
.
resolve
().
then
(
function
()
{
var
evt
=
{
"
fid
"
:
meta
.
fs_id
+
''
,
"
exist
"
:
false
}
downloadingList
.
checkFid
(
evt
)
if
(
evt
.
exist
)
return
Util
.
confirm
()
return
true
}).
then
(
function
()
{
if
(
App
.
appState
.
settings
.
defaultDownloadPath
)
return
App
.
appState
.
settings
.
defaultDownloadPath
return
Util
.
pickSavePath
({
"
fileName
"
:
meta
.
server_filename
,
"
defaultFolder
"
:
App
.
appState
.
settings
.
lastDownloadPath
})
}).
then
(
function
(
savePath
)
{
savePath
=
savePath
.
toString
()
var
newFid
=
(
useVip
?
'
vip
'
:
'
direct
'
)
+
'
.
'
+
meta
.
fs_id
var
id
=
Util
.
callGoSync
(
'
download.new
'
,
{
"
fid
"
:
newFid
,
"
savePath
"
:
savePath
})
var
obj
=
JSON
.
parse
(
JSON
.
stringify
(
meta
))
obj
.
downloadId
=
id
var
sep
=
Qt
.
platform
.
os
==
"
windows
"
?
'
\\
'
:
'
/
'
var
t
=
String
.
prototype
.
split
.
call
(
savePath
,
sep
)
obj
.
newFid
=
newFid
obj
.
saveName
=
t
.
pop
()
obj
.
savePath
=
savePath
obj
.
useVip
=
!!
useVip
downloadingList
.
add
(
obj
)
})
}
function
addDownloadShare
(
md5
,
sliceMd5
,
fileSize
,
fileName
)
{
var
fid
=
[
'
share
'
,
md5
,
sliceMd5
,
fileSize
].
join
(
'
.
'
)
return
Util
.
Promise
.
resolve
().
then
(
function
()
{
return
Util
.
pickSavePath
({
"
fileName
"
:
fileName
,
"
defaultFolder
"
:
App
.
appState
.
settings
.
lastDownloadPath
})
}).
then
(
function
(
savePath
)
{
var
id
=
Util
.
callGoSync
(
'
download.new
'
,
{
"
fid
"
:
fid
,
"
savePath
"
:
savePath
})
var
obj
=
{
"
size
"
:
fileSize
,
"
downloadId
"
:
id
,
"
newFid
"
:
fid
,
"
savePath
"
:
savePath
,
"
useVip
"
:
true
,
"
fileName
"
:
fileName
,
"
isShare
"
:
true
}
var
sep
=
Qt
.
platform
.
os
==
"
windows
"
?
'
\\
'
:
'
/
'
var
t
=
String
.
prototype
.
split
.
call
(
savePath
,
sep
)
obj
.
saveName
=
t
.
pop
()
downloadingList
.
add
(
obj
)
})
}
function
deleteItem
(
idx
,
isFinish
)
{
var
c
=
isFinish
?
downloadedList
:
downloadingList
c
.
remove
(
idx
)
}
function
itemCompleted
(
idx
)
{
var
data
=
JSON
.
parse
(
JSON
.
stringify
(
downloadingList
.
get
(
idx
)))
downloadingList
.
remove
(
idx
)
downloadedList
.
add
(
data
)
}
}
pc/pan-light-pc.go
浏览文件 @
0cbc8172
...
...
@@ -32,7 +32,7 @@ const startCmd = "pan_light_start"
func
master
()
{
if
runtime
.
GOOS
==
"windows
"
{
if
runtime
.
GOOS
!=
"linux
"
{
windosMaster
()
return
}
...
...
@@ -55,7 +55,8 @@ START_PAN:
}
}
}
log
.
Fatal
(
err
)
log
.
Println
(
err
)
os
.
Exit
(
0
)
}
func
windosMaster
()
{
...
...
@@ -85,5 +86,6 @@ START_PAN:
if
string
(
bin
)
==
"true"
{
goto
START_PAN
}
log
.
Fatal
(
err
)
log
.
Println
(
err
)
os
.
Exit
(
0
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录