Git commit 9b8dafaa095cb0f321b90d1efce9066072867748 by Emmanuel Lepage Vall= ee. Committed on 30/06/2014 at 22:20. Pushed by lepagevalleeemmanuel into branch 'master'. [ #50496 ] Improve the screen sharing implementation M +6 -2 src/lib/video/videodevicemodel.cpp M +105 -58 src/widgets/ui/screensharingwidget.ui M +39 -0 src/widgets/videodock.cpp M +4 -0 src/widgets/videodock.h http://commits.kde.org/sflphone-kde/9b8dafaa095cb0f321b90d1efce9066072867748 diff --git a/src/lib/video/videodevicemodel.cpp b/src/lib/video/videodevice= model.cpp index cbb8725..ae4a814 100644 --- a/src/lib/video/videodevicemodel.cpp +++ b/src/lib/video/videodevicemodel.cpp @@ -182,7 +182,7 @@ ExtendedVideoDeviceModel* ExtendedVideoDeviceModel::m_s= pInstance =3D nullptr; = ExtendedVideoDeviceModel::ExtendedVideoDeviceModel() : QAbstractListModel(= QCoreApplication::instance()) { - = + m_Display.rect =3D QRect(0,0,0,0); } = ExtendedVideoDeviceModel* ExtendedVideoDeviceModel::instance() @@ -259,7 +259,10 @@ void ExtendedVideoDeviceModel::switchTo(const int idx) DBus::VideoManager::instance().switchInput(ProtocolPrefix::NONE); break; case ExtendedDeviceList::SCREEN: - DBus::VideoManager::instance().switchInput( QString(ProtocolPrefi= x::DISPLAY)+"0:100x100"); + DBus::VideoManager::instance().switchInput( QString(ProtocolPrefi= x::DISPLAY)+QString(":%1 %2x%3") + .arg(m_Display.index) + .arg(m_Display.rect.width()) + .arg(m_Display.rect.height())); break; case ExtendedDeviceList::FILE: DBus::VideoManager::instance().switchInput( @@ -296,6 +299,7 @@ void ExtendedVideoDeviceModel::setDisplay(int index, QR= ect rect) { m_Display.index =3D index ; m_Display.rect =3D rect ; + switchTo(ExtendedDeviceList::SCREEN); } = VideoDevice* VideoDeviceModel::getDevice(const QString& devId) const diff --git a/src/widgets/ui/screensharingwidget.ui b/src/widgets/ui/screens= haringwidget.ui index 3839455..44dd86e 100644 --- a/src/widgets/ui/screensharingwidget.ui +++ b/src/widgets/ui/screensharingwidget.ui @@ -6,46 +6,97 @@ 0 0 - 260 - 89 + 320 + 136 - - - - - - - - Offset (x,y): + + + + + QFrame::StyledPanel - - - - - - Size (width,height): + + QFrame::Raised + + + + + + + + + + + + + + Display id: + + + + + + + x + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + , + + + + + + + Offset (x,y): + + + + + + + + + + Size (width,height): + + + + + + + - - - - - - - x - - + + - + - Display id: + Screen: - + Qt::Vertical @@ -61,37 +112,33 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - , - - - + m_pScreens + m_pFrame + label + label_6 + verticalSpacer - + + + m_pScreens + currentIndexChanged(int) + ScreenSharing + slotScreenIndexChanged(int) + + + 133 + 11 + + + 295 + 20 + + + + + + slotScreenIndexChanged(int) + diff --git a/src/widgets/videodock.cpp b/src/widgets/videodock.cpp index 4524215..a6e8b17 100644 --- a/src/widgets/videodock.cpp +++ b/src/widgets/videodock.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include = #include @@ -67,9 +68,36 @@ public: ScreenSharingWidget(QWidget* parent) : QWidget(parent) { setupUi(this); + setupScreenCombo(); + m_pFrame->setVisible(false); + slotScreenIndexChanged(0); } +private: + //Helper + void setupScreenCombo(); +private Q_SLOTS: + void slotScreenIndexChanged(int idx); }; = +void ScreenSharingWidget::setupScreenCombo() +{ + for (int i =3D0; i < QApplication::desktop()->screenCount();i++) { + m_pScreens->addItem(QString::number(i)); + } + m_pScreens->addItem(i18n("Custom")); +} + + +void ScreenSharingWidget::slotScreenIndexChanged(int idx) +{ + if (idx =3D=3D m_pScreens->count()-1) { + m_pFrame->setVisible(true); + } + else { + ExtendedVideoDeviceModel::instance()->setDisplay(0,QApplication::des= ktop()->screenGeometry(idx)); + m_pFrame->setVisible(false); + } +} = = ///Constructor @@ -128,6 +156,9 @@ void VideoDock::addRenderer(VideoRenderer* r) m_pVideoWidet->addRenderer(r); } = + + + void VideoDock::slotDeviceChanged(int index) { switch (index) { @@ -158,6 +189,8 @@ void VideoDock::slotDeviceChanged(int index) if ( !m_pMediaPicker ) { m_pMediaPicker =3D new MediaPicker(this); m_pMoreOpts->addWidget(m_pMediaPicker,11,0,1,4); + connect(m_pMediaPicker->m_pPicker,SIGNAL(urlSelected(KUrl)), + this,SLOT(slotFileSelected(KUrl))); } m_pMediaPicker->setVisible(true); break; @@ -178,5 +211,11 @@ void VideoDock::slotDeviceChanged(int index) }; } = + +void VideoDock::slotFileSelected(const KUrl& url) +{ + ExtendedVideoDeviceModel::instance()->setFile(url); +} + #include "moc_videodock.cpp" #include "videodock.moc" diff --git a/src/widgets/videodock.h b/src/widgets/videodock.h index 227c6a1..a624a26 100644 --- a/src/widgets/videodock.h +++ b/src/widgets/videodock.h @@ -23,6 +23,9 @@ //Qt class QGridLayout; = +//KDE +class KUrl; + //SFLPhone class VideoWidget3; class VideoRenderer; @@ -46,6 +49,7 @@ private: = private Q_SLOTS: void slotDeviceChanged(int index); + void slotFileSelected(const KUrl& url); }; = #endif