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
46f4294a
Commit
46f4294a
authored
Sep 04, 2019
by
Ming Rui Zhang
Committed by
Andreas Traczyk
Oct 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
video: refactor/separate preview from the distant renderer
Change-Id: I9af9e0a4bb07a83b68647015dc8a4e2a21cd2170
parent
35ccab3b
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
782 additions
and
744 deletions
+782
-744
callwidget.cpp
callwidget.cpp
+41
-5
callwidget.h
callwidget.h
+4
-4
jami-qt.pro
jami-qt.pro
+7
-3
lrcinstance.cpp
lrcinstance.cpp
+127
-0
lrcinstance.h
lrcinstance.h
+81
-0
mainwindow.cpp
mainwindow.cpp
+10
-78
mainwindow.h
mainwindow.h
+3
-2
newwizardwidget.cpp
newwizardwidget.cpp
+2
-0
photoboothwidget.cpp
photoboothwidget.cpp
+24
-42
photoboothwidget.h
photoboothwidget.h
+5
-17
photoboothwidget.ui
photoboothwidget.ui
+8
-13
previewrender.cpp
previewrender.cpp
+151
-0
previewrender.h
previewrender.h
+96
-0
previewrender.ui
previewrender.ui
+19
-0
ring-client-windows.vcxproj
ring-client-windows.vcxproj
+7
-0
ring-client-windows.vcxproj.filters
ring-client-windows.vcxproj.filters
+12
-7
settingswidget.cpp
settingswidget.cpp
+31
-125
settingswidget.h
settingswidget.h
+4
-17
settingswidget.ui
settingswidget.ui
+8
-14
stylesheet.css
stylesheet.css
+4
-0
utils.cpp
utils.cpp
+42
-0
utils.h
utils.h
+4
-15
videoview.cpp
videoview.cpp
+51
-68
videoview.h
videoview.h
+8
-6
videowidget.cpp
videowidget.cpp
+27
-275
videowidget.h
videowidget.h
+6
-53
No files found.
callwidget.cpp
View file @
46f4294a
...
...
@@ -50,6 +50,7 @@
#include <QScrollBar>
#include <QWebEngineScript>
#include <QMimeData>
#include <QtConcurrent/QtConcurrent>
#include <algorithm>
#include <memory>
...
...
@@ -222,6 +223,8 @@ CallWidget::CallWidget(QWidget* parent) :
setCallPanelVisibility
(
false
);
ui
->
containerWidget
->
setVisible
(
false
);
previewRenderer_
=
PreviewRenderWidget
::
attachPreview
();
}
CallWidget
::~
CallWidget
()
...
...
@@ -256,6 +259,16 @@ CallWidget::navigated(bool to)
}
else
{
backToWelcomePage
();
}
// reset preview renderer
if
(
LRCInstance
::
getActiveCalls
().
size
()
&&
!
LRCInstance
::
getCurrentCallModel
()
->
getCall
(
conversation
->
callId
).
isAudioOnly
)
{
previewRenderer_
->
setParent
(
ui
->
videoWidget
);
previewRenderer_
->
changeToRoundedBoarder
();
previewRenderer_
->
setCurrentConainerGeo
(
ui
->
videoWidget
->
width
(),
ui
->
videoWidget
->
height
());
previewRenderer_
->
setPhotoMode
(
false
);
previewRenderer_
->
setNeedToCentre
(
false
);
previewRenderer_
->
triggerResetPreviewAfterImageReloaded
();
previewRenderer_
->
show
();
}
}
else
{
QObject
::
disconnect
(
smartlistSelectionConnection_
);
smartListModel_
.
reset
(
nullptr
);
...
...
@@ -676,6 +689,16 @@ CallWidget::slotShowCallView(const std::string& accountId,
}
ui
->
callStackWidget
->
setCurrentWidget
(
ui
->
videoPage
);
hideMiniSpinner
();
// reset preview renderer when call is not audio only
if
(
!
LRCInstance
::
getCurrentCallModel
()
->
getCall
(
convInfo
.
callId
).
isAudioOnly
)
{
previewRenderer_
->
setParent
(
ui
->
videoWidget
);
previewRenderer_
->
changeToRoundedBoarder
();
previewRenderer_
->
setCurrentConainerGeo
(
ui
->
videoWidget
->
width
(),
ui
->
videoWidget
->
height
());
previewRenderer_
->
setPhotoMode
(
false
);
previewRenderer_
->
setNeedToCentre
(
false
);
previewRenderer_
->
triggerResetPreviewAfterImageReloaded
();
}
ui
->
videoWidget
->
pushRenderer
(
convInfo
.
callId
,
LRCInstance
::
accountModel
().
getAccountInfo
(
accountId
).
profileInfo
.
type
==
lrc
::
api
::
profile
::
Type
::
SIP
);
ui
->
videoWidget
->
setFocus
();
}
...
...
@@ -1412,13 +1435,26 @@ CallWidget::Copy()
}
void
CallWidget
::
disconnectRendering
()
CallWidget
::
reconnectRenderingVideoDeviceChanged
()
{
ui
->
videoWidget
->
disconnectRendering
();
// for distant renderer to reconnect rendering
ui
->
videoWidget
->
reconnectRenderingVideoDeviceChanged
();
}
void
CallWidget
::
connectRendering
(
bool
started
)
{
ui
->
videoWidget
->
connectRendering
(
started
);
CallWidget
::
restartPreviewWhenSwitchDevice
()
{
previewRenderer_
->
setCurrentConainerGeo
(
ui
->
videoWidget
->
width
(),
ui
->
videoWidget
->
height
());
// since there is the possiblity of image not reloaded properly
// after rendering reconnect, so trigger reset after image reloaded
previewRenderer_
->
triggerResetPreviewAfterImageReloaded
();
if
(
LRCInstance
::
getActiveCalls
().
size
()
&&
!
LRCInstance
::
getIfCurrentSelectedCallIsAudioOnly
())
{
// if no active calls, or device is changed -> reactive preview
previewRenderer_
->
connectRendering
();
QtConcurrent
::
run
(
[
this
]
{
LRCInstance
::
avModel
().
stopPreview
();
LRCInstance
::
avModel
().
startPreview
();
});
}
}
callwidget.h
View file @
46f4294a
...
...
@@ -32,6 +32,7 @@
#include "navwidget.h"
#include "smartlistmodel.h"
#include "previewrender.h"
// new LRC
#include "api/account.h"
...
...
@@ -57,11 +58,9 @@ public:
explicit
CallWidget
(
QWidget
*
parent
=
0
);
~
CallWidget
();
void
restartPreviewWhenSwitchDevice
();
int
getLeftPanelWidth
();
void
disconnectRendering
();
// if started is true, only update, stop signals are connected
void
connectRendering
(
bool
started
=
false
);
void
reconnectRenderingVideoDeviceChanged
();
// NavWidget
virtual
void
navigated
(
bool
to
);
...
...
@@ -143,6 +142,7 @@ private:
QMenu
*
menu_
;
QClipboard
*
clipboard_
;
PreviewRenderWidget
*
previewRenderer_
;
Ui
::
CallWidget
*
ui
;
QMovie
*
miniSpinner_
;
...
...
jami-qt.pro
View file @
46f4294a
...
...
@@ -74,7 +74,8 @@ HEADERS += ./aboutdialog.h \
.
/
sipinputpanel
.
h
\
.
/
callaudioonlyavataroverlay
.
h
\
.
/
overlaybutton
.
h
\
.
/
accountmigrationdialog
.
h
.
/
accountmigrationdialog
.
h
\
.
/
previewrender
.
h
SOURCES
+=
.
/
aboutdialog
.
cpp
\
.
/
banneditemwidget
.
cpp
\
.
/
conversationsfilterwidget
.
cpp
\
...
...
@@ -130,7 +131,9 @@ SOURCES += ./aboutdialog.cpp \
.
/
sipinputpanel
.
cpp
\
.
/
callaudioonlyavataroverlay
.
cpp
\
.
/
overlaybutton
.
cpp
\
.
/
accountmigrationdialog
.
cpp
.
/
accountmigrationdialog
.
cpp
\
.
/
previewrender
.
cpp
\
.
/
lrcinstance
.
cpp
FORMS
+=
.
/
aboutdialog
.
ui
\
.
/
advancedsipsettingwidget
.
ui
\
.
/
callwidget
.
ui
\
...
...
@@ -156,5 +159,6 @@ FORMS += ./aboutdialog.ui \
.
/
videoview
.
ui
\
.
/
sipkeypad
.
ui
\
.
/
callaudioonlyavataroverlay
.
ui
\
.
/
accountmigration
.
ui
.
/
accountmigration
.
ui
\
.
/
previewrender
.
ui
RESOURCES
+=
ressources
.
qrc
lrcinstance.cpp
0 → 100644
View file @
46f4294a
/**************************************************************************
| Copyright (C) 2019 by Savoir-faire Linux |
| Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> |
| |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation; either version 3 of the License, or |
| (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program. If not, see <https://www.gnu.org/licenses/>. |
**************************************************************************/
#include "lrcinstance.h"
FrameWrapper
::
FrameWrapper
(
bool
isPreview
)
:
isPreview_
(
isPreview
)
{
}
FrameWrapper
::~
FrameWrapper
()
{
}
void
FrameWrapper
::
connectPreviewRendering
()
{
QObject
::
disconnect
(
frameWrapperConnections_
.
started
);
if
(
isPreview_
)
{
frameWrapperConnections_
.
started
=
connect
(
&
LRCInstance
::
avModel
(),
&
lrc
::
api
::
AVModel
::
rendererStarted
,
this
,
&
FrameWrapper
::
slotPreviewStarted
);
}
}
void
FrameWrapper
::
slotPreviewStarted
(
const
std
::
string
&
id
)
{
if
(
id
!=
lrc
::
api
::
video
::
PREVIEW_RENDERER_ID
)
return
;
QObject
::
disconnect
(
frameWrapperConnections_
.
started
);
QObject
::
disconnect
(
frameWrapperConnections_
.
updated
);
frameWrapperConnections_
.
updated
=
connect
(
&
LRCInstance
::
avModel
(),
&
lrc
::
api
::
AVModel
::
frameUpdated
,
this
,
&
FrameWrapper
::
slotPreviewUpdated
);
QObject
::
disconnect
(
frameWrapperConnections_
.
stopped
);
frameWrapperConnections_
.
stopped
=
connect
(
&
LRCInstance
::
avModel
(),
&
lrc
::
api
::
AVModel
::
rendererStopped
,
this
,
&
FrameWrapper
::
slotPreviewStoped
);
}
void
FrameWrapper
::
slotPreviewUpdated
(
const
std
::
string
&
id
)
{
if
(
id
!=
lrc
::
api
::
video
::
PREVIEW_RENDERER_ID
)
return
;
auto
avModel
=
&
LRCInstance
::
avModel
();
auto
renderer
=
&
avModel
->
getRenderer
(
id
);
if
(
!
renderer
->
isRendering
())
{
return
;
}
previewRenderer_
=
const_cast
<
lrc
::
api
::
video
::
Renderer
*>
(
renderer
);
renderFrame
(
id
);
}
void
FrameWrapper
::
renderFrame
(
const
std
::
string
&
id
)
{
auto
avModel
=
&
LRCInstance
::
avModel
();
using
namespace
lrc
::
api
::
video
;
auto
renderer
=
&
avModel
->
getRenderer
(
id
);
if
(
renderer
&&
renderer
->
isRendering
())
{
{
QMutexLocker
lock
(
&
mutex_
);
auto
tmp
=
renderer
->
currentFrame
();
if
(
tmp
.
storage
.
size
())
{
previewFrame_
=
tmp
;
}
}
emit
previewRenderReady
();
}
}
void
FrameWrapper
::
slotPreviewStoped
(
const
std
::
string
&
id
)
{
if
(
id
!=
lrc
::
api
::
video
::
PREVIEW_RENDERER_ID
)
return
;
QObject
::
disconnect
(
frameWrapperConnections_
.
updated
);
QObject
::
disconnect
(
frameWrapperConnections_
.
stopped
);
previewRenderer_
=
nullptr
;
emit
previewRenderStopped
();
}
RenderDistributer
::
RenderDistributer
()
{
previewFrameWrapper_
=
std
::
make_unique
<
FrameWrapper
>
(
true
);
connect
(
previewFrameWrapper_
.
get
(),
&
FrameWrapper
::
previewRenderReady
,
[
this
]()
{
emit
previewRenderReady
();
});
connect
(
previewFrameWrapper_
.
get
(),
&
FrameWrapper
::
previewRenderStopped
,
[
this
]()
{
emit
previewRenderStopped
();
});
}
RenderDistributer
::~
RenderDistributer
()
{
previewFrameWrapper_
.
reset
();
}
lrcinstance.h
View file @
46f4294a
...
...
@@ -2,6 +2,7 @@
| Copyright (C) 2019 by Savoir-faire Linux |
| Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> |
| Author: Isa Nanic <isa.nanic@savoirfairelinux.com> |
| Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> |
| |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
...
...
@@ -23,6 +24,7 @@
#endif
#include <QObject>
#include <QMutex>
#include <QSettings>
#include <QRegularExpression>
#include <QPixmap>
...
...
@@ -30,6 +32,7 @@
#include "settingskey.h"
#include "accountlistmodel.h"
#include "utils.h"
#include "api/lrc.h"
#include "api/account.h"
...
...
@@ -46,6 +49,67 @@
#include "api/conversationmodel.h"
#include "api/peerdiscoverymodel.h"
#include <memory>
class
FrameWrapper
:
public
QObject
{
Q_OBJECT
public:
FrameWrapper
(
bool
isPreview
);
~
FrameWrapper
();
void
connectPreviewRendering
();
lrc
::
api
::
video
::
Renderer
*
getPreviewRenderer
()
{
return
previewRenderer_
;
}
lrc
::
api
::
video
::
Frame
getPreviewFrame
()
{
return
previewFrame_
;
}
signals:
void
previewRenderReady
();
void
previewRenderStopped
();
private
slots
:
void
slotPreviewStarted
(
const
std
::
string
&
id
=
{});
void
slotPreviewUpdated
(
const
std
::
string
&
id
=
{});
void
slotPreviewStoped
(
const
std
::
string
&
id
=
{});
private:
bool
isPreview_
;
lrc
::
api
::
video
::
Renderer
*
previewRenderer_
;
lrc
::
api
::
video
::
Frame
previewFrame_
;
QMutex
mutex_
;
struct
frameWrapperConnections
{
QMetaObject
::
Connection
started
,
stopped
,
updated
;
}
frameWrapperConnections_
;
void
renderFrame
(
const
std
::
string
&
id
);
};
class
RenderDistributer
:
public
QObject
{
Q_OBJECT
public:
RenderDistributer
();
~
RenderDistributer
();
lrc
::
api
::
video
::
Renderer
*
getPreviewRenderer
()
{
return
previewFrameWrapper_
->
getPreviewRenderer
();
}
lrc
::
api
::
video
::
Frame
getPreviewFrame
()
{
return
previewFrameWrapper_
->
getPreviewFrame
();
}
void
connectPreviewRendering
()
{
previewFrameWrapper_
->
connectPreviewRendering
();
}
signals:
void
previewRenderReady
();
void
previewRenderStopped
();
private:
// one preview to rule them all
std
::
unique_ptr
<
FrameWrapper
>
previewFrameWrapper_
;
// distant for each call/conf/conversation
//std::map<std::string, std::unique_ptr<FrameWrapper>> distantFrames_;
};
using
namespace
lrc
::
api
;
using
migrateCallback
=
std
::
function
<
void
()
>
;
...
...
@@ -67,6 +131,9 @@ public:
static
Lrc
&
getAPI
()
{
return
*
(
instance
().
lrc_
);
};
static
RenderDistributer
*
getRenderDistributer
()
{
return
instance
().
renderer_
.
get
();
}
static
void
connectivityChanged
()
{
instance
().
lrc_
->
connectivityChanged
();
};
...
...
@@ -132,11 +199,22 @@ public:
instance
().
selectedConvUid_
=
convUid
;
};
static
bool
getIfCurrentSelectedCallIsAudioOnly
()
{
auto
isAudioOnly
=
false
;
auto
convInfo
=
Utils
::
getSelectedConversation
();
if
(
!
convInfo
.
uid
.
empty
())
{
isAudioOnly
=
LRCInstance
::
getCurrentCallModel
()
->
getCall
(
convInfo
.
callId
).
isAudioOnly
;
}
return
isAudioOnly
;
};
static
void
reset
(
bool
newInstance
=
false
)
{
if
(
newInstance
)
{
instance
().
lrc_
.
reset
(
new
Lrc
());
instance
().
renderer_
.
reset
(
new
RenderDistributer
());
}
else
{
instance
().
lrc_
.
reset
();
instance
().
renderer_
.
reset
();
}
};
...
...
@@ -189,8 +267,11 @@ private:
LRCInstance
(
migrateCallback
willMigrateCb
=
{},
migrateCallback
didMigrateCb
=
{})
{
lrc_
=
std
::
make_unique
<
Lrc
>
(
willMigrateCb
,
didMigrateCb
);
renderer_
=
std
::
make_unique
<
RenderDistributer
>
();
};
std
::
string
selectedAccountId_
;
std
::
string
selectedConvUid_
;
std
::
unique_ptr
<
RenderDistributer
>
renderer_
;
};
mainwindow.cpp
View file @
46f4294a
...
...
@@ -21,7 +21,6 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtConcurrent/QtConcurrent>
#include <QDesktopWidget>
#include <QDir>
#include <QScreen>
...
...
@@ -43,9 +42,7 @@
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
)
,
ui
(
new
Ui
::
MainWindow
)
,
ui
(
new
Ui
::
MainWindow
)
{
ui
->
setupUi
(
this
);
...
...
@@ -187,17 +184,10 @@ MainWindow::MainWindow(QWidget* parent)
});
timer
->
start
(
1000
);
#endif
connect
(
ui
->
settingswidget
,
&
SettingsWidget
::
switchCallWidgetToSettingsWidgetPreview
,
this
,
&
MainWindow
::
slotSwitchVideoWidget
);
connect
(
ui
->
settingswidget
,
&
SettingsWidget
::
switchSettingsWidgetPreviewToCallWidget
,
this
,
&
MainWindow
::
slotSwitchVideoWidget
);
connect
(
ui
->
settingswidget
,
&
SettingsWidget
::
switchCallWidgetToSettingsWidgetPhotoBooth
,
this
,
&
MainWindow
::
slotSwitchVideoWidget
);
connect
(
ui
->
settingswidget
,
&
SettingsWidget
::
switchSettingsWidgetPhotoBoothToCallWidget
,
this
,
&
MainWindow
::
slotSwitchVideoWidget
);
connect
(
ui
->
settingswidget
,
&
SettingsWidget
::
videoInputDeviceConnectionLost
,
this
,
&
MainWindow
::
slotSwitchVideoWidget
);
// preview renderer is initialized firstly here
previewRenderer_
=
PreviewRenderWidget
::
attachPreview
(
this
);
connect
(
ui
->
settingswidget
,
&
SettingsWidget
::
videoDeviceChanged
,
this
,
&
MainWindow
::
slotVideoDeviceChanged
);
connect
(
&
LRCInstance
::
accountModel
(),
&
lrc
::
api
::
NewAccountModel
::
accountRemoved
,
[
this
](
const
std
::
string
&
accountId
)
{
Q_UNUSED
(
accountId
);
...
...
@@ -429,69 +419,11 @@ void MainWindow::slotAccountListChanged()
}
}
void
MainWindow
::
slot
SwitchVideoWidget
(
Utils
::
VideoWidgetSwapType
typ
e
)
void
MainWindow
::
slot
VideoDeviceChanged
(
const
std
::
string
&
device
,
bool
avSettingOrAccountSettingVisibl
e
)
{
auto
convInfo
=
Utils
::
getCurrentConvInfo
();
bool
isAudioOnly
=
LRCInstance
::
getCurrentCallModel
()
->
getCall
(
convInfo
.
callId
).
isAudioOnly
;
switch
(
type
)
{
case
Utils
::
VideoWidgetSwapType
::
CallWidgetToSettingsWidgetPreview
:
{
// switch local rendering from call to setting preview
ui
->
callwidget
->
disconnectRendering
();
ui
->
settingswidget
->
connectStartedRenderingToPreview
();
if
(
isAudioOnly
)
{
QtConcurrent
::
run
(
[
this
]
{
LRCInstance
::
avModel
().
stopPreview
();
LRCInstance
::
avModel
().
startPreview
();
});
break
;
}
break
;
}
case
Utils
::
VideoWidgetSwapType
::
CallWidgetToSettingsWidgetPhotoBooth
:
{
// switch local rendering from call to setting photo booth
ui
->
callwidget
->
disconnectRendering
();
ui
->
settingswidget
->
connectStartedRenderingToPhotoBooth
();
if
(
isAudioOnly
)
{
QtConcurrent
::
run
(
[
this
]
{
LRCInstance
::
avModel
().
stopPreview
();
LRCInstance
::
avModel
().
startPreview
();
});
break
;
}
break
;
}
case
Utils
::
VideoWidgetSwapType
::
SettingsWidgetPreviewToCallWidget
:
{
// switch local rendering from setting preview to call
ui
->
settingswidget
->
disconnectPreviewRendering
();
if
(
isAudioOnly
)
{
QtConcurrent
::
run
([
this
]
{
LRCInstance
::
avModel
().
stopPreview
();
});
break
;
}
ui
->
callwidget
->
connectRendering
(
true
);
break
;
}
case
Utils
::
VideoWidgetSwapType
::
SettingsWidgetPhotoBoothToCallWidget
:
{
// switch local rendering from setting photo booth to call
ui
->
settingswidget
->
disconnectPhotoBoothRendering
();
if
(
isAudioOnly
)
{
QtConcurrent
::
run
([
this
]
{
LRCInstance
::
avModel
().
stopPreview
();
});
break
;
}
ui
->
callwidget
->
connectRendering
(
true
);
break
;
}
case
Utils
::
VideoWidgetSwapType
::
VideoInputDeviceConnectionLost
:
{
if
(
isAudioOnly
)
{
break
;
}
ui
->
callwidget
->
connectRendering
(
false
);
break
;
}
default:
{
break
;
}
}
Q_UNUSED
(
device
)
ui
->
callwidget
->
reconnectRenderingVideoDeviceChanged
();
// if the device is not changed in avSettings, then restart preview manually
if
(
!
avSettingOrAccountSettingVisible
)
ui
->
callwidget
->
restartPreviewWhenSwitchDevice
();
}
mainwindow.h
View file @
46f4294a
...
...
@@ -22,6 +22,7 @@
#include "settingswidget.h"
#include "utils.h"
#include "connectivitymonitor.h"
#include "previewrender.h"
#include "globalsystemtray.h"
#include <QMainWindow>
...
...
@@ -55,8 +56,7 @@ public:
void
showWindow
();
public
slots
:
// A slot where covers all cases of video rendering switch between widgets
void
slotSwitchVideoWidget
(
Utils
::
VideoWidgetSwapType
Type
);
void
slotVideoDeviceChanged
(
const
std
::
string
&
,
bool
);
protected:
bool
nativeEvent
(
const
QByteArray
&
eventType
,
void
*
message
,
long
*
result
);
...
...
@@ -96,6 +96,7 @@ private:
std
::
unique_ptr
<
ConnectivityMonitor
>
connectivityMonitor_
;
QMetaObject
::
Connection
screenChangedConnection_
;
PreviewRenderWidget
*
previewRenderer_
;
QTimer
*
updateTimer_
;
};
newwizardwidget.cpp
View file @
46f4294a
...
...
@@ -238,6 +238,7 @@ void NewWizardWidget::changePage(QWidget* toPage)
&
LRCInstance
::
accountModel
(),
&
lrc
::
api
::
NewAccountModel
::
registeredNameFound
,
this
,
&
NewWizardWidget
::
slotRegisteredNameFound
);
validateWizardProgression
();
ui
->
setAvatarWidget
->
setUpPreviewRenderer
();
ui
->
setAvatarWidget
->
startBooth
();
}
else
if
(
toPage
==
ui
->
createSIPAccountPage
)
{
ui
->
SIPusernameEdit
->
clear
();
...
...
@@ -248,6 +249,7 @@ void NewWizardWidget::changePage(QWidget* toPage)
ui
->
SIPusernameEdit
->
setEnabled
(
true
);
setNavBarVisibility
(
true
);
ui
->
nextButton
->
setEnabled
(
true
);
ui
->
setSIPAvatarWidget
->
setUpPreviewRenderer
();
ui
->
setSIPAvatarWidget
->
startBooth
();
}
else
if
(
toPage
==
ui
->
importFromDevicePage
)
{
ui
->
pinFromDevice
->
clear
();
...
...
photoboothwidget.cpp
View file @
46f4294a
...
...
@@ -20,7 +20,6 @@
#include "photoboothwidget.h"
#include "ui_photoboothwidget.h"
#include "settingswidget.h"
#include <QFileDialog>
#include <QStandardPaths>
...
...
@@ -37,8 +36,8 @@ PhotoboothWidget::PhotoboothWidget(QWidget *parent) :
hasAvatar_
(
false
)
{
ui
->
setupUi
(
this
);
ui
->
videoFeed
->
setIsFullPreview
(
true
);
ui
->
videoFeed
->
setPhotoMode
(
true
);
previewRenderer_
=
PreviewRenderWidget
::
attachPreview
(
);
flashOverlay_
=
new
QLabel
(
this
);
flashOverlay_
->
setStyleSheet
(
"background-color:#fff"
);
...
...
@@ -53,6 +52,8 @@ PhotoboothWidget::PhotoboothWidget(QWidget *parent) :
flashAnimation_
->
setEndValue
(
0
);
flashAnimation_
->
setEasingCurve
(
QEasingCurve
::
OutCubic
);
Utils
::
drawBlackCircularImageOntoLabel
(
ui
->
previewContainer
);
ui
->
previewContainer
->
hide
();
ui
->
takePhotoButton
->
setIcon
(
QIcon
(
":/images/icons/baseline-camera_alt-24px.svg"
));
}
...
...
@@ -66,28 +67,18 @@ void
PhotoboothWidget
::
startBooth
(
bool
isDeviceChanged
)
{
hasAvatar_
=
false
;
ui
->
videoFeed
->
setResetPreview
(
true
);
if
(
!
LRCInstance
::
getActiveCalls
().
size
()
||
isDeviceChanged
)
{
if
(
!
LRCInstance
::
getActiveCalls
().
size
()
||
isDeviceChanged
||
LRCInstance
::
getIfCurrentSelectedCallIsAudioOnly
())
{
// if no active calls
ui
->
videoFeed
->
connectPreviewOnly
Rendering
();
previewRenderer_
->
connect
Rendering
();
QtConcurrent
::
run
(
[
this
]
{
LRCInstance
::
avModel
().
stopPreview
();
LRCInstance
::
avModel
().
startPreview
();
});
}
else
if
(
settingsPreviewed_
)
{
// if setting preview is viewed
emit
leaveSettingsWidgetPreviewToSettingsWidgetPhotoBooth
(
Utils
::
VideoWidgetSwapType
::
SettingsWidgetPreviewToSettingsWidgetPhotoBooth
);
hasConnection_
=
true
;
}
else
{
// call video rendering direct to photo booth
emit
enterSettingsWidgetPhotoBoothFromCallWidget
(
Utils
::
VideoWidgetSwapType
::
CallWidgetToSettingsWidgetPhotoBooth
);
hasConnection_
=
true
;
}
takePhotoState_
=
true
;
ui
->
videoFeed
->
show
();
ui
->
previewContainer
->
show
();
setUpPreviewRenderer
();
ui
->
avatarLabel
->
hide
();
ui
->
takePhotoButton
->
setIcon
(
QIcon
(
":/images/icons/baseline-camera_alt-24px.svg"
));
}
...
...
@@ -95,14 +86,9 @@ PhotoboothWidget::startBooth(bool isDeviceChanged)
void
PhotoboothWidget
::
stopBooth
()
{
if
(
!
LRCInstance
::
getActiveCalls
().
size
(
)
&&
takePhotoState_
)
{
if
(
(
!
LRCInstance
::
getActiveCalls
().
size
()
||
LRCInstance
::
getIfCurrentSelectedCallIsAudioOnly
()
)
&&
takePhotoState_
)
{
// if no active calls
QtConcurrent
::
run
([
this
]
{
LRCInstance
::
avModel
().
stopPreview
();
});
}
else
if
(
hasConnection_
){
// if video connection is still on photo booth (now stopBooth will onlt be called once leaving the setting widget)
emit
enterCallWidgetFromSettingsWidgetPhotoBooth
(
Utils
::
VideoWidgetSwapType
::
SettingsWidgetPhotoBoothToCallWidget
);
hasConnection_
=
false
;
}
resetToAvatarLabel
();
}
...
...
@@ -118,8 +104,6 @@ PhotoboothWidget::on_importButton_clicked()
picturesDir
,
tr
(
"Image Files"
)
+
" (*.jpg *.jpeg *.png)"
);
if
(
fileName_
.
isEmpty
())
{
ui
->
videoFeed
->
connectRendering
();
LRCInstance
::
avModel
().
startPreview
();
return
;
}
auto
image
=
Utils
::
cropImage
(
QImage
(
fileName_
));
...
...
@@ -143,8 +127,8 @@ PhotoboothWidget::on_takePhotoButton_clicked()
startBooth
();
return
;
}
else
{
auto
videoRect
=
ui
->
videoFeed
->
rect
();
QPoint
avatarLabelPos
=
ui
->
videoFeed
->
mapTo
(
this
,
videoRect
.
topLeft
());
auto
videoRect
=
previewRenderer_
->
rect
();