Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
jami-client-windows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
savoirfairelinux
jami-client-windows
Commits
c24fe538
Commit
c24fe538
authored
Nov 08, 2019
by
Yang Wang
Committed by
Andreas Traczyk
Nov 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
record widget: add volume meter display
Change-Id: I4cced5abd46424df4b8388fed3985131de1351db
parent
426c7be8
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
561 additions
and
459 deletions
+561
-459
images/icons/av_icons/mic-24px.svg
images/icons/av_icons/mic-24px.svg
+1
-0
recordoverlay.cpp
recordoverlay.cpp
+57
-44
recordoverlay.h
recordoverlay.h
+4
-10
recordoverlay.ui
recordoverlay.ui
+457
-396
recordwidget.cpp
recordwidget.cpp
+6
-0
recordwidget.h
recordwidget.h
+2
-0
ressources.qrc
ressources.qrc
+1
-0
stylesheet.css
stylesheet.css
+11
-0
utils.cpp
utils.cpp
+21
-9
utils.h
utils.h
+1
-0
No files found.
images/icons/av_icons/mic-24px.svg
0 → 100644
View file @
c24fe538
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"24"
height=
"24"
viewBox=
"0 0 24 24"
><path
d=
"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"
fill=
"white"
/><path
d=
"M0 0h24v24H0z"
fill=
"none"
/></svg>
\ No newline at end of file
recordoverlay.cpp
View file @
c24fe538
...
...
@@ -20,6 +20,7 @@
#include "ui_recordoverlay.h"
#include "recordwidget.h"
#include "lrcinstance.h"
#include "utils.h"
RecordOverlay
::
RecordOverlay
(
RecordWidget
*
recordWidget
)
:
...
...
@@ -40,7 +41,19 @@ RecordOverlay::RecordOverlay(RecordWidget* recordWidget) :
ui
->
recordOverlayPlayBtn
->
setVisible
(
false
);
ui
->
recordOverlayStopPlayingBtn
->
setVisible
(
false
);
setUpRecorderStatus
(
RecorderStatus
::
aboutToRecord
);
connect
(
&
LRCInstance
::
avModel
(),
&
lrc
::
api
::
AVModel
::
audioMeter
,
ui
->
levelMeter
,
[
this
](
const
std
::
string
&
/*id*/
,
float
level
)
{
ui
->
levelMeter
->
setLevel
(
level
);
});
ui
->
inputIcon
->
setVisible
(
false
);
ui
->
inputIcon
->
setPixmap
(
Utils
::
pixmapFromSvg
(
QString
(
":/images/icons/av_icons/mic-24px.svg"
),
ui
->
inputIcon
->
size
()));
setRecorderState
(
RecorderState
::
aboutToRecord
);
}
RecordOverlay
::~
RecordOverlay
()
...
...
@@ -49,30 +62,24 @@ RecordOverlay::~RecordOverlay()
}
void
RecordOverlay
::
set
UpRecorderStatus
(
RecorderStatus
status
,
bool
isTimerToBeInvolved
,
bool
isAimationToBeInvolved
)
RecordOverlay
::
set
RecorderState
(
RecorderState
state
)
{
status_
=
status
;
switch
(
status
)
{
case
RecorderStatus
::
aboutToRecord
:
reinitializeTimer
();
recorderState_
=
state
;
switch
(
recorderState_
)
{
case
RecorderState
::
aboutToRecord
:
switchToAboutToRecordPage
();
if
(
isTimerToBeInvolved
)
{
reinitializeTimer
();}
if
(
isAimationToBeInvolved
)
{
stopRedDotBlink
();}
ui
->
redDotBlinkable
->
stop
();
break
;
case
RecorderStat
us
::
recording
:
case
RecorderStat
e
::
recording
:
switchToRecordingPage
();
if
(
isTimerToBeInvolved
)
{
reinitializeTimer
();
recordTimer_
.
start
(
1000
);
}
if
(
isAimationToBeInvolved
)
{
stopRedDotBlink
();
startRedDotBlink
();
}
recordTimer_
.
start
(
1000
);
ui
->
redDotBlinkable
->
stop
();
ui
->
redDotBlinkable
->
start
();
break
;
case
RecorderStat
us
::
recorded
:
case
RecorderStat
e
::
recorded
:
switchToRecordedPage
();
if
(
isTimerToBeInvolved
)
{
reinitializeTimer
();}
if
(
isAimationToBeInvolved
)
{
stopRedDotBlink
();}
ui
->
redDotBlinkable
->
stop
();
break
;
}
}
...
...
@@ -133,66 +140,72 @@ RecordOverlay::reinitializeTimer()
currentTime_
=
0
;
}
void
RecordOverlay
::
startRedDotBlink
()
{
ui
->
redDotBlinkable
->
start
();
}
void
RecordOverlay
::
stopRedDotBlink
()
{
ui
->
redDotBlinkable
->
stop
();
}
void
RecordOverlay
::
showEvent
(
QShowEvent
*
event
)
{
QWidget
::
showEvent
(
event
);
setUpRecorderStatus
(
RecorderStatus
::
aboutToRecord
);
if
(
recordWidget_
->
isAudio
())
{
ui
->
inputIcon
->
setVisible
(
true
);
ui
->
levelMeter
->
setVisible
(
true
);
ui
->
levelMeter
->
start
();
LRCInstance
::
startAudioMeter
(
true
);
}
else
{
ui
->
inputIcon
->
setVisible
(
false
);
ui
->
levelMeter
->
setVisible
(
false
);
ui
->
levelMeter
->
stop
();
LRCInstance
::
stopAudioMeter
(
true
);
}
setRecorderState
(
RecorderState
::
aboutToRecord
);
}
void
RecordOverlay
::
hideEvent
(
QHideEvent
*
event
)
{
QWidget
::
hideEvent
(
event
);
if
(
recordWidget_
->
isAudio
())
{
ui
->
levelMeter
->
stop
();
ui
->
levelMeter
->
setVisible
(
false
);
ui
->
inputIcon
->
setVisible
(
false
);
LRCInstance
::
stopAudioMeter
(
true
);
}
// set the page to about record page
set
UpRecorderStatus
(
RecorderStatus
::
aboutToRecord
);
set
RecorderState
(
RecorderState
::
aboutToRecord
);
}
void
RecordOverlay
::
on_recordOverlayStartOrFinishRecordingBtn_toggled
(
bool
checked
)
{
if
(
status_
==
RecorderStatus
::
aboutToRecord
)
{
if
(
recorderState_
==
RecorderState
::
aboutToRecord
)
{
// start record function call, if call succeed, switch the page to recording page and start the timer
if
(
recordWidget_
->
startRecording
())
{
set
UpRecorderStatus
(
RecorderStatus
::
recording
);
set
RecorderState
(
RecorderState
::
recording
);
}
else
{
ui
->
recordOverlayStartOrFinishRecordingBtn
->
setOverlayButtonChecked
(
!
checked
);
qDebug
()
<<
"The recording does not start properly"
;
}
}
else
if
(
status_
==
RecorderStatus
::
recording
)
{
}
else
if
(
recorderState_
==
RecorderState
::
recording
)
{
// finish the record, if it succeed, switch the page and re-initialize the timer
if
(
recordWidget_
->
finishRecording
())
{
set
UpRecorderStatus
(
RecorderStatus
::
recorded
);
set
RecorderState
(
RecorderState
::
recorded
);
}
else
{
ui
->
recordOverlayStartOrFinishRecordingBtn
->
setOverlayButtonChecked
(
!
checked
);
qDebug
()
<<
"The recording does not finish properly"
;
}
}
else
{
ui
->
recordOverlayStartOrFinishRecordingBtn
->
setOverlayButtonChecked
(
!
checked
);
qDebug
()
<<
"This button should not appear on current page"
;
}
}
void
RecordOverlay
::
on_recordOverlaySendBtn_pressed
()
{
if
(
status_
!=
RecorderStatus
::
recorded
)
{
if
(
recorderState_
!=
RecorderState
::
recorded
)
{
qDebug
()
<<
"The contented is not recorded and cannot be sent out"
;
return
;
}
if
(
recordWidget_
->
sendRecording
())
{
set
UpRecorderStatus
(
RecorderStatus
::
aboutToRecord
);
set
RecorderState
(
RecorderState
::
aboutToRecord
);
// define what to do when the record is sent out
recordWidget_
->
getContainer
()
->
accept
();
}
...
...
@@ -201,24 +214,24 @@ RecordOverlay::on_recordOverlaySendBtn_pressed()
void
RecordOverlay
::
on_recordOverlayDeleteBtn_pressed
()
{
if
(
status_
!=
RecorderStatus
::
recorded
)
{
if
(
recorderState_
!=
RecorderState
::
recorded
)
{
qDebug
()
<<
"The content is not recorded and cannot be deleted"
;
return
;
}
recordWidget_
->
deleteRecording
();
set
UpRecorderStatus
(
RecorderStatus
::
aboutToRecord
);
set
RecorderState
(
RecorderState
::
aboutToRecord
);
}
void
RecordOverlay
::
on_recordOverlayRerecordBtn_pressed
()
{
if
(
status_
!=
RecorderStatus
::
recording
)
{
if
(
recorderState_
!=
RecorderState
::
recording
)
{
qDebug
()
<<
"it's not on the recording page and thus there's cannot re-record"
;
return
;
}
recordWidget_
->
recordAgain
();
// re-initialize the timer at the same time
set
UpRecorderStatus
(
RecorderStatus
::
recording
);
set
RecorderState
(
RecorderState
::
recording
);
}
void
...
...
recordoverlay.h
View file @
c24fe538
...
...
@@ -29,10 +29,10 @@ class RecordWidget;
class
RecordOverlay
:
public
VignetteWidget
{
Q_OBJECT
Q_PROPERTY
(
QPixmap
pixRedDot
READ
getOriginPix
WRITE
setOriginPix
DESIGNABLE
true
NOTIFY
originPixChanged
);
Q_PROPERTY
(
QPixmap
pixRedDot
READ
getOriginPix
WRITE
setOriginPix
DESIGNABLE
true
);
public:
enum
class
RecorderStat
us
enum
class
RecorderStat
e
{
aboutToRecord
,
recording
,
...
...
@@ -42,17 +42,11 @@ public:
QPixmap
getOriginPix
();
void
setOriginPix
(
QPixmap
);
signals:
void
originPixChanged
(
QPixmap
);
public:
explicit
RecordOverlay
(
RecordWidget
*
recordWidget
);
~
RecordOverlay
();
void
setUpRecorderStatus
(
RecorderStatus
status
,
bool
isTimerToBeInvolved
=
true
,
bool
isAimationToBeInvolved
=
true
);
void
startRedDotBlink
();
void
stopRedDotBlink
();
void
setRecorderState
(
RecorderState
status
);
private:
void
switchToAboutToRecordPage
();
...
...
@@ -77,7 +71,7 @@ private:
Ui
::
RecordOverlay
*
ui
;
RecordWidget
*
recordWidget_
;
RecorderStat
us
status
_
;
RecorderStat
e
recorderState
_
;
int
currentTime_
=
0
;
QTimer
recordTimer_
;
QPixmap
redDotPix_
;
...
...
recordoverlay.ui
View file @
c24fe538
This diff is collapsed.
Click to expand it.
recordwidget.cpp
View file @
c24fe538
...
...
@@ -121,6 +121,12 @@ RecordWidget::openRecorder(bool isAudio)
widgetContainer_
->
show
();
}
bool
RecordWidget
::
isAudio
()
{
return
isAudio_
;
}
void
RecordWidget
::
resizeEvent
(
QResizeEvent
*
event
)
{
Q_UNUSED
(
event
);
...
...
recordwidget.h
View file @
c24fe538
...
...
@@ -44,6 +44,8 @@ public:
void
openRecorder
(
bool
isAudio
);
bool
isAudio
();
protected:
void
resizeEvent
(
QResizeEvent
*
event
)
override
;
void
hideEvent
(
QHideEvent
*
event
)
override
;
...
...
ressources.qrc
View file @
c24fe538
...
...
@@ -97,5 +97,6 @@
<file>images/icons/av_icons/pause-24px.svg</file>
<file>images/icons/av_icons/send-24px.svg</file>
<file>images/icons/av_icons/stop-24px.svg</file>
<file>images/icons/av_icons/mic-24px.svg</file>
</qresource>
</RCC>
stylesheet.css
View file @
c24fe538
...
...
@@ -886,3 +886,14 @@ QLabel#timerLabel {
background-color
:
transparent
;
color
:
white
;
}
QProgressBar
#levelMeter
{
border
:
2px
solid
white
;
text-align
:
center
;
background
:
transparent
;
}
QProgressBar
#levelMeter
::chunk
{
background-color
:
white
;
margin
:
2px
;
}
\ No newline at end of file
utils.cpp
View file @
c24fe538
...
...
@@ -29,6 +29,15 @@
#include <shlwapi.h>
#endif
#include "pixbufmanipulator.h"
#include "globalsystemtray.h"
#include "lrcinstance.h"
#include "networkmanager.h"
#include "updateconfirmdialog.h"
#include "version.h"
#include <globalinstances.h>
//Qt
#include <QBitmap>
#include <QObject>
...
...
@@ -41,15 +50,7 @@
#include <QMessageBox>
#include <QScreen>
#include <QtConcurrent/QtConcurrent>
#include <globalinstances.h>
#include "pixbufmanipulator.h"
#include "globalsystemtray.h"
#include "lrcinstance.h"
#include "networkmanager.h"
#include "updateconfirmdialog.h"
#include "version.h"
#include <QSvgRenderer>
bool
Utils
::
CreateStartupLink
(
const
std
::
wstring
&
wstrAppName
)
...
...
@@ -680,6 +681,17 @@ Utils::cropImage(const QImage& img)
return
img
.
copy
({
0
,
(
h
-
w
)
/
2
,
w
,
w
});
}
QPixmap
Utils
::
pixmapFromSvg
(
const
QString
&
svg_resource
,
const
QSize
&
size
)
{
QSvgRenderer
svgRenderer
(
svg_resource
);
QPixmap
pixmap
(
size
);
pixmap
.
fill
(
Qt
::
transparent
);
QPainter
pixPainter
(
&
pixmap
);
svgRenderer
.
render
(
&
pixPainter
);
return
pixmap
;
}
QString
Utils
::
formattedTime
(
int
duration
)
{
...
...
utils.h
View file @
c24fe538
...
...
@@ -107,6 +107,7 @@ QPixmap generateTintedPixmap(const QPixmap& pix, QColor color);
QImage
scaleAndFrame
(
const
QImage
photo
,
const
QSize
&
size
=
IMAGE_SIZE
);
QImage
accountPhoto
(
const
lrc
::
api
::
account
::
Info
&
accountInfo
,
const
QSize
&
size
=
IMAGE_SIZE
);
QImage
cropImage
(
const
QImage
&
img
);
QPixmap
pixmapFromSvg
(
const
QString
&
svg_resource
,
const
QSize
&
size
);
// rounded corner
template
<
typename
T
>
...
...
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