Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qtTsOverlay
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
C-Fu
qtTsOverlay
Commits
28be81ec
Commit
28be81ec
authored
Feb 25, 2017
by
Carsten Fuhrmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cosmetic
parent
84cb4ff6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
26 deletions
+45
-26
Release/x64/qtTsOverlay_x64.dll
Release/x64/qtTsOverlay_x64.dll
+0
-0
Release/x64/qtTsOverlay_x64.exp
Release/x64/qtTsOverlay_x64.exp
+0
-0
Release/x64/qtTsOverlay_x64.lib
Release/x64/qtTsOverlay_x64.lib
+0
-0
overlaycontroller.cpp
overlaycontroller.cpp
+38
-20
overlaycontroller.h
overlaycontroller.h
+7
-6
No files found.
Release/x64/qtTsOverlay_x64.dll
View file @
28be81ec
No preview for this file type
Release/x64/qtTsOverlay_x64.exp
View file @
28be81ec
No preview for this file type
Release/x64/qtTsOverlay_x64.lib
View file @
28be81ec
No preview for this file type
overlaycontroller.cpp
View file @
28be81ec
...
...
@@ -24,6 +24,7 @@ OverlayController::OverlayController() : QObject()
m_timer
->
setInterval
(
5000
);
m_timer
->
setSingleShot
(
true
);
connect
(
m_timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
hideChat
()));
}
OverlayController
::~
OverlayController
()
...
...
@@ -41,7 +42,7 @@ OverlayController::~OverlayController()
delete
m_timer
;
}
void
OverlayController
::
deleteChatLine
(
Q
Label
*
line
)
void
OverlayController
::
deleteChatLine
(
Q
Widget
*
line
)
{
//TODO: delete the given line instead of the last
delete
m_msgLines
.
last
();
...
...
@@ -65,24 +66,33 @@ void OverlayController::addChatLine(QString message)
showChat
();
// generate new chatline
QLabel
*
newChatLine
=
new
QLabel
;
QWidget
*
w
=
new
QWidget
;
QLabel
*
newChatLine
=
new
QLabel
(
w
);
w
->
setAttribute
(
Qt
::
WA_TranslucentBackground
);
w
->
setAttribute
(
Qt
::
WA_ShowWithoutActivating
);
w
->
setWindowFlags
(
Qt
::
WindowStaysOnTopHint
|
Qt
::
FramelessWindowHint
|
Qt
::
WindowTransparentForInput
);
newChatLine
->
setText
(
message
);
newChatLine
->
setStyleSheet
(
"padding:2px;border-radius:5px;border-style:solid;border-width:1px;border-color:rgb(100,100,100);font:bold; font-size:20px;background-color:rgba(50,50,50,150); color:rgb(255,255,255);"
);
newChatLine
->
adjustSize
();
newChatLine
->
setWindowFlags
(
Qt
::
WindowStaysOnTopHint
|
Qt
::
SplashScreen
);
newChatLine
->
setAttribute
(
Qt
::
WA_TranslucentBackground
);
newChatLine
->
setAttribute
(
Qt
::
WA_ShowWithoutActivating
);
newChatLine
->
setGeometry
(
BOARDEROFFSET
,
BOARDEROFFSET
,
newChatLine
->
geometry
().
width
(),
LINEHEIGHT
);
newChatLine
->
setAlignment
(
Qt
::
AlignTop
|
Qt
::
AlignLeft
);
newChatLine
->
setWindowFlags
(
Qt
::
WindowStaysOnTopHint
|
Qt
::
WindowTransparentForInput
);
newChatLine
->
setAlignment
(
Qt
::
AlignCenter
|
Qt
::
AlignHCenter
);
w
->
adjustSize
();
w
->
setGeometry
(
BORDEROFFSET
,
BORDEROFFSET
,
w
->
size
().
width
(),
w
->
size
().
height
()
+
SPACING
);
newChatLine
->
show
();
w
->
show
();
// move old messages down
for
(
auto
&
it
:
m_msgLines
)
it
->
setGeometry
(
it
->
geometry
().
x
(),
it
->
geometry
().
y
()
+
LINEHEIGHT
,
it
->
geometry
().
width
(),
it
->
geometry
().
height
());
it
->
setGeometry
(
it
->
geometry
().
x
(),
it
->
geometry
().
y
()
+
w
->
size
().
height
()
,
it
->
geometry
().
width
(),
it
->
geometry
().
height
());
// inseart new chat line
m_msgLines
.
push_front
(
newChatLine
);
m_msgLines
.
push_front
(
w
);
// limit the number of lines
if
(
m_msgLines
.
size
()
>
MAXLINES
)
...
...
@@ -95,24 +105,32 @@ void OverlayController::addChatLine(QString message)
void
OverlayController
::
addSpeaker
(
QString
name
)
{
int
labelWidth
=
0
;
QLabel
*
newSpeaker
=
new
QLabel
;
QWidget
*
w
=
new
QWidget
;
QLabel
*
newSpeaker
=
new
QLabel
(
w
);
w
->
setAttribute
(
Qt
::
WA_TranslucentBackground
);
w
->
setAttribute
(
Qt
::
WA_ShowWithoutActivating
);
w
->
setWindowFlags
(
Qt
::
WindowStaysOnTopHint
|
Qt
::
FramelessWindowHint
|
Qt
::
WindowTransparentForInput
);
w
->
setObjectName
(
name
);
newSpeaker
->
setText
(
name
);
newSpeaker
->
setStyleSheet
(
"padding:2px;border-radius:5px;border-style:solid;border-width:1px;border-color:rgb(100,100,100);font:bold; font-size:20px;background-color:rgba(50,50,50,150); color:rgb(255,255,255);"
);
newSpeaker
->
adjustSize
();
newSpeaker
->
resize
(
newSpeaker
->
size
().
width
()
+
SPACING
,
LINEHEIGHT
);
labelWidth
=
newSpeaker
->
geometry
().
width
();
newSpeaker
->
setWindowFlags
(
Qt
::
WindowStaysOnTopHint
|
Qt
::
SplashScreen
);
newSpeaker
->
setAttribute
(
Qt
::
WA_TranslucentBackground
);
newSpeaker
->
setAttribute
(
Qt
::
WA_ShowWithoutActivating
);
newSpeaker
->
setGeometry
(
BOARDEROFFSET
+
m_speakerOffset
,
m_screenHeight
-
BOARDEROFFSET
-
LINEHEIGHT
,
labelWidth
,
LINEHEIGHT
);
newSpeaker
->
setAlignment
(
Qt
::
AlignTop
|
Qt
::
AlignCenter
);
//newSpeaker->setStyleSheet("border-style: none; padding: 2px; background-color: rgba(255, 255, 255, 10);");
newSpeaker
->
setWindowFlags
(
Qt
::
WindowStaysOnTopHint
|
Qt
::
WindowTransparentForInput
);
newSpeaker
->
setAlignment
(
Qt
::
AlignCenter
|
Qt
::
AlignHCenter
);
w
->
adjustSize
();
w
->
setGeometry
(
BORDEROFFSET
+
m_speakerOffset
,
m_screenHeight
-
BORDEROFFSET
-
w
->
size
().
height
(),
w
->
size
().
width
()
+
SPACING
,
w
->
size
().
height
());
labelWidth
=
w
->
geometry
().
width
();
newSpeaker
->
show
();
w
->
show
();
m_speakerOffset
+=
labelWidth
;
m_speakers
.
push_back
(
newSpeaker
);
m_speakers
.
push_back
(
w
);
}
void
OverlayController
::
removeSpeaker
(
QString
name
)
...
...
@@ -123,11 +141,11 @@ void OverlayController::removeSpeaker(QString name)
// move all speaker to the left side and find the one to delete
for
(
int
i
=
0
;
i
<
m_speakers
.
size
();
i
++
)
{
Q
Label
*
it
=
m_speakers
.
at
(
i
);
Q
Widget
*
it
=
m_speakers
.
at
(
i
);
it
->
setGeometry
(
it
->
geometry
().
x
()
-
labelWidth
,
it
->
geometry
().
y
(),
it
->
geometry
().
width
(),
it
->
geometry
().
height
());
if
(
it
->
text
()
==
name
)
if
(
it
->
objectName
()
==
name
)
{
labelWidth
=
it
->
geometry
().
width
();
m_speakerOffset
-=
labelWidth
;
...
...
overlaycontroller.h
View file @
28be81ec
...
...
@@ -3,13 +3,14 @@
#include "qttsoverlay_global.h"
#include <QObject>
#include <QString>
#include <Q
Label
>
#include <Q
Widget
>
#include <QVector>
#include <QTimer>
#include <QLabel>
#define MAXLINES 5
#define BOARDEROFFSET 5
#define LINEHEIGHT 15
#define BORDEROFFSET 5
#define SPACING 10
...
...
@@ -27,13 +28,13 @@ private:
int
m_speakerOffset
;
QLabel
*
m_debugWindow
;
QVector
<
Q
Label
*>
m_speakers
;
QVector
<
Q
Label
*>
m_msgLines
;
QVector
<
Q
Widget
*>
m_speakers
;
QVector
<
Q
Widget
*>
m_msgLines
;
QTimer
*
m_timer
;
private:
void
deleteChatLine
(
Q
Label
*
line
);
void
deleteChatLine
(
Q
Widget
*
line
);
void
showChat
();
private
slots
:
...
...
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