Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
skylivex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
astronomy
skylivex
Commits
31e360d1
Commit
31e360d1
authored
Feb 20, 2013
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export to JS some window settings
parent
02eafc95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
2 deletions
+81
-2
mainwin.cpp
src/mainwin.cpp
+74
-2
mainwin.h
src/mainwin.h
+7
-0
No files found.
src/mainwin.cpp
View file @
31e360d1
...
...
@@ -50,7 +50,6 @@ MainWin::MainWin(QString &htmlfile)
{
baseUrl
=
QUrl
::
fromLocalFile
(
QDir
::
current
().
absoluteFilePath
(
"gui/dummy.html"
));
QPalette
pal
=
palette
();
pal
.
setBrush
(
QPalette
::
Base
,
Qt
::
transparent
);
...
...
@@ -58,7 +57,6 @@ MainWin::MainWin(QString &htmlfile)
page
()
->
setPalette
(
pal
);
setAttribute
(
Qt
::
WA_TranslucentBackground
,
true
);
setAttribute
(
Qt
::
WA_OpaquePaintEvent
,
false
);
setHtmlFile
(
htmlfile
);
resize
(
250
,
200
);
...
...
@@ -85,6 +83,22 @@ void MainWin::setHtmlFile(QString &fname)
}
void
MainWin
::
setHtmlFile
(
QString
&
fname
,
bool
borders
,
bool
transparentbg
)
{
toggleBorders
(
borders
);
toggleTransparentBackground
(
transparentbg
);
setHtmlFile
(
fname
);
}
void
MainWin
::
setHtmlCont
(
QString
cont
,
QUrl
baseUrl
,
bool
borders
,
bool
transparentbg
)
{
toggleBorders
(
borders
);
toggleTransparentBackground
(
transparentbg
);
setHtml
(
cont
,
baseUrl
);
}
void
MainWin
::
msgFromCore
(
SKMessage
::
SKMessage
&
msg
)
{
std
::
cout
<<
"MainWindow msg reveived: "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
...
...
@@ -96,6 +110,48 @@ void MainWin::msgFromCore(SKMessage::SKMessage &msg)
}
void
MainWin
::
toggleBorders
(
bool
borders
)
{
Qt
::
WindowFlags
flags
=
windowFlags
();
if
(
borders
)
{
if
(
flags
&
Qt
::
FramelessWindowHint
)
{
flags
&=
~
Qt
::
FramelessWindowHint
;
setWindowFlags
(
flags
);
show
();
}
}
else
{
if
(
!
(
flags
&
Qt
::
FramelessWindowHint
))
{
flags
&=
Qt
::
FramelessWindowHint
;
setWindowFlags
(
flags
);
show
();
}
}
}
void
MainWin
::
toggleTransparentBackground
(
bool
transparentbg
)
{
QPalette
pal
=
palette
();
if
(
transparentbg
)
{
pal
.
setBrush
(
QPalette
::
Base
,
Qt
::
transparent
);
setAttribute
(
Qt
::
WA_TranslucentBackground
,
true
);
setAttribute
(
Qt
::
WA_OpaquePaintEvent
,
false
);
}
else
{
pal
.
setBrush
(
QPalette
::
Base
,
Qt
::
white
);
setAttribute
(
Qt
::
WA_TranslucentBackground
,
false
);
setAttribute
(
Qt
::
WA_OpaquePaintEvent
,
true
);
}
page
()
->
setPalette
(
pal
);
}
void
MainWin
::
sendMessage
(
SKMessage
::
SKMessage
&
msg
)
{
...
...
@@ -147,3 +203,19 @@ void JSBridge::pushLogin(QString username, QString password)
loginmsg
.
parameters
.
insert
(
"password"
,
password
);
mwin
->
sendMessage
(
loginmsg
);
}
void
JSBridge
::
resizeWin
(
int
width
,
int
height
)
{
mwin
->
resize
(
width
,
height
);
}
void
JSBridge
::
toggleBorders
(
bool
borders
)
{
mwin
->
toggleBorders
(
borders
);
}
void
JSBridge
::
toggleTransparentBackground
(
bool
transparentbg
)
{
mwin
->
toggleTransparentBackground
(
transparentbg
);
}
src/mainwin.h
View file @
31e360d1
...
...
@@ -67,6 +67,9 @@ class JSBridge : public QObject
void
notify
(
QString
content
);
public
slots
:
void
pushLogin
(
QString
username
,
QString
password
);
void
resizeWin
(
int
width
,
int
height
);
void
toggleBorders
(
bool
borders
);
void
toggleTransparentBackground
(
bool
transparentbg
);
};
...
...
@@ -89,6 +92,8 @@ class MainWin : public QWebView
private
:
QHash
<
QString
,
SKHandlerFunction
>
_handlers
;
void
setHtmlFile
(
QString
&
fname
);
void
setHtmlFile
(
QString
&
fname
,
bool
borders
,
bool
transparentbg
);
void
setHtmlCont
(
QString
cont
,
QUrl
baseUrl
,
bool
borders
,
bool
transparentbg
);
public
:
MainWin
(
QString
&
htmlfile
);
...
...
@@ -98,6 +103,8 @@ class MainWin : public QWebView
void
handle_corestarted
(
SKMessage
::
SKMessage
&
msg
);
void
handle_connected
(
SKMessage
::
SKMessage
&
msg
);
void
handle_asklogin
(
SKMessage
::
SKMessage
&
msg
);
void
toggleBorders
(
bool
borders
);
void
toggleTransparentBackground
(
bool
transparentbg
);
public
slots
:
void
msgFromCore
(
SKMessage
::
SKMessage
&
msg
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment