Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
bitmask-vpn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Merlin
bitmask-vpn
Commits
3e8193f1
Unverified
Commit
3e8193f1
authored
4 years ago
by
Kali Kaneko
Browse files
Options
Downloads
Patches
Plain Diff
attempt workarounds for segfault at libQt5XcbQpa
parent
93e0d71c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gui/main.cpp
+3
-0
3 additions, 0 deletions
gui/main.cpp
gui/qml/main.qml
+64
-74
64 additions, 74 deletions
gui/qml/main.qml
with
67 additions
and
74 deletions
gui/main.cpp
+
3
−
0
View file @
3e8193f1
...
...
@@ -161,6 +161,8 @@ int main(int argc, char **argv) {
QJsonModel
*
model
=
new
QJsonModel
;
QString
desktop
=
QString
::
fromStdString
(
getEnv
(
"XDG_CURRENT_DESKTOP"
));
/* the backend handler has slots for calling back to Go when triggered by
signals in Qml. */
ctx
->
setContextProperty
(
"backend"
,
&
backend
);
...
...
@@ -168,6 +170,7 @@ int main(int argc, char **argv) {
/* set the json model, load providers.json */
ctx
->
setContextProperty
(
"jsonModel"
,
model
);
ctx
->
setContextProperty
(
"providers"
,
providers
);
ctx
->
setContextProperty
(
"desktop"
,
desktop
);
/* set some useful flags */
ctx
->
setContextProperty
(
"systrayVisible"
,
!
hideSystray
);
...
...
This diff is collapsed.
Click to expand it.
gui/qml/main.qml
+
64
−
74
View file @
3e8193f1
...
...
@@ -2,14 +2,15 @@ import QtQuick 2.9
import
QtQuick
.
Controls
1.4
import
QtQuick
.
Dialogs
1.2
import
QtQuick
.
Extras
1.2
import
Qt
.
labs
.
platform
1.1
import
Qt
.
labs
.
platform
1.1
as
LabsPlatform
ApplicationWindow
{
id
:
app
visible
:
false
flags
:
Qt
.
FramelessWindowWint
|
Qt
.
WindowsStaysOnTopHint
|
Qt
.
Popup
flags
:
Qt
.
WindowsStaysOnTopHint
|
Qt
.
Popup
property
var
ctx
property
var
loginDone
...
...
@@ -130,75 +131,32 @@ ApplicationWindow {
"
blocked
"
:
"
qrc:/assets/icon/png/black/vpn_blocked.png
"
}
SystemTrayIcon
{
LabsPlatform.SystemTrayIcon
{
id
:
systray
visible
:
systrayVisible
signal
activatedSignal
onActivated
:
{
// this looks like a widget bug. middle click (reasons 3 or 4)
// produce a segfault when trying to call menu.open()
// left and right click seem to be working fine, so let's ignore this for now.
switch
(
reason
)
{
case
SystemTrayIcon
.
Unknown
:
console
.
debug
(
"
activated: unknown event
"
)
menu
.
open
()
break
case
SystemTrayIcon
.
Context
:
console
.
debug
(
"
activated: context
"
)
/* segfaults in osx and linux */
if
(
Qt
.
platform
.
os
===
"
windows
"
)
{
menu
.
open
()
}
break
case
SystemTrayIcon
.
DoubleClick
:
console
.
debug
(
"
activated: double click
"
)
if
(
Qt
.
platform
.
os
===
"
windows
"
)
{
menu
.
open
()
}
break
case
SystemTrayIcon
.
Trigger
:
console
.
debug
(
"
activated: left click
"
)
if
(
Qt
.
platform
.
os
===
"
windows
"
)
{
menu
.
open
()
}
break
case
SystemTrayIcon
.
MiddleClick
:
break
}
}
Component.onCompleted
:
{
icon
.
source
=
icons
[
"
off
"
]
tooltip
=
qsTr
(
"
Checking status…
"
)
console
.
debug
(
"
systray init completed
"
)
hide
()
if
(
systrayVisible
)
{
show
()
if
(
Qt
.
platform
.
os
===
"
windows
"
)
{
let
appname
=
ctx
?
ctx
.
appName
:
"
VPN
"
showNotification
(
appname
+
"
is up and running. Please use system tray icon to control it.
"
)
}
}
}
// Helper to show notification messages
function
showNotification
(
msg
)
{
console
.
log
(
"
Going to show notification message:
"
,
msg
)
if
(
supportsMessages
)
{
let
appname
=
ctx
?
ctx
.
appName
:
"
VPN
"
showMessage
(
appname
,
msg
,
null
,
15000
)
}
else
{
console
.
log
(
"
System doesn't support systray notifications
"
)
}
systray
.
activatedSignal
()
}
menu
:
Menu
{
menu
:
LabsPlatform.
Menu
{
id
:
systrayMenu
Connections
{
target
:
systray
onActivatedSignal
:
{
if
(
Qt
.
platform
.
os
===
"
windows
"
||
desktop
===
"
LXQt
"
)
{
console
.
debug
(
"
open systray menu
"
);
systrayMenu
.
open
();
}
}
}
StateGroup
{
id
:
vpn
state
:
ctx
?
ctx
.
status
:
""
...
...
@@ -270,13 +228,13 @@ ApplicationWindow {
]
}
MenuItem
{
LabsPlatform.
MenuItem
{
id
:
statusItem
text
:
qsTr
(
"
Checking status…
"
)
enabled
:
false
}
MenuItem
{
LabsPlatform.
MenuItem
{
text
:
{
if
(
vpn
.
state
==
"
failed
"
)
qsTr
(
"
Reconnect
"
)
...
...
@@ -290,7 +248,7 @@ ApplicationWindow {
||
ctx
.
status
==
"
failed
"
)
:
false
}
MenuItem
{
LabsPlatform.
MenuItem
{
text
:
{
if
(
ctx
&&
ctx
.
status
==
"
starting
"
)
qsTr
(
"
Cancel
"
)
...
...
@@ -304,9 +262,9 @@ ApplicationWindow {
||
ctx
.
status
==
"
failed
"
)
:
false
}
MenuSeparator
{}
LabsPlatform.
MenuSeparator
{}
MenuItem
{
LabsPlatform.
MenuItem
{
text
:
qsTr
(
"
About…
"
)
onTriggered
:
{
about
.
visible
=
true
...
...
@@ -315,7 +273,7 @@ ApplicationWindow {
}
}
MenuItem
{
LabsPlatform.
MenuItem
{
id
:
donateItem
text
:
qsTr
(
"
Donate…
"
)
visible
:
ctx
?
ctx
.
donateURL
:
false
...
...
@@ -324,9 +282,9 @@ ApplicationWindow {
}
}
MenuSeparator
{}
LabsPlatform.
MenuSeparator
{}
MenuItem
{
LabsPlatform.
MenuItem
{
text
:
qsTr
(
"
Help…
"
)
onTriggered
:
{
...
...
@@ -335,7 +293,7 @@ ApplicationWindow {
}
}
MenuItem
{
LabsPlatform.
MenuItem
{
text
:
qsTr
(
"
Report a bug…
"
)
onTriggered
:
{
...
...
@@ -345,13 +303,44 @@ ApplicationWindow {
}
}
MenuSeparator
{}
LabsPlatform.
MenuSeparator
{}
MenuItem
{
LabsPlatform.
MenuItem
{
text
:
qsTr
(
"
Quit
"
)
onTriggered
:
backend
.
quit
()
}
}
Component.onCompleted
:
{
icon
.
source
=
icons
[
"
off
"
]
tooltip
=
qsTr
(
"
Checking status…
"
)
console
.
debug
(
"
systray init completed
"
)
hide
()
if
(
systrayVisible
)
{
console
.
log
(
"
show systray
"
)
show
()
if
(
Qt
.
platform
.
os
===
"
windows
"
)
{
let
appname
=
ctx
?
ctx
.
appName
:
"
VPN
"
showNotification
(
appname
+
"
is up and running. Please use system tray icon to control it.
"
)
}
}
}
// Helper to show notification messages
function
showNotification
(
msg
)
{
console
.
log
(
"
Going to show notification message:
"
,
msg
)
if
(
supportsMessages
)
{
let
appname
=
ctx
?
ctx
.
appName
:
"
VPN
"
showMessage
(
appname
,
msg
,
null
,
15000
)
}
else
{
console
.
log
(
"
System doesn't support systray notifications
"
)
}
}
}
DonateDialog
{
...
...
@@ -376,7 +365,7 @@ ApplicationWindow {
MessageDialog
{
id
:
errorStartingVPN
buttons
:
MessageDialog
.
Ok
//
buttons: MessageDialog.Ok
modality
:
Qt
.
NonModal
title
:
qsTr
(
"
Error starting VPN
"
)
text
:
""
...
...
@@ -386,7 +375,7 @@ ApplicationWindow {
MessageDialog
{
id
:
authAgent
buttons
:
MessageDialog
.
Ok
//
buttons: MessageDialog.Ok
modality
:
Qt
.
NonModal
title
:
qsTr
(
"
Missing authentication agent
"
)
text
:
qsTr
(
"
Could not find a polkit authentication agent. Please run one and try again.
"
)
...
...
@@ -397,4 +386,5 @@ ApplicationWindow {
id
:
initFailure
visible
:
false
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment