Commit 1d6fae7c authored by Dan Pascu's avatar Dan Pascu

Added incoming session dialog panel

parent 64e47cc3
......@@ -786,3 +786,75 @@ class SessionListView(QListView):
session.widget.drop_indicator = True
ui_class, base_class = uic.loadUiType(Resources.get('incoming_dialog.ui'))
class IncomingDialog(base_class, ui_class):
def __init__(self, parent=None):
super(IncomingDialog, self).__init__(parent)
with Resources.directory:
self.setupUi(self)
font = self.username_label.font()
font.setPointSizeF(self.uri_label.fontInfo().pointSizeF() + 3)
font.setFamily("Sans Serif")
self.username_label.setFont(font)
font = self.note_label.font()
font.setPointSizeF(self.uri_label.fontInfo().pointSizeF() - 1)
self.note_label.setFont(font)
self.reject_mode = 'ignore'
self.busy_button.released.connect(self._set_busy_mode)
self.reject_button.released.connect(self._set_reject_mode)
for stream in self.streams:
stream.toggled.connect(self._update_accept_button)
stream.hidden.connect(self._update_streams_layout)
stream.shown.connect(self._update_streams_layout)
self.desktopsharing_stream.hidden.connect(self.desktopsharing_label.hide)
self.desktopsharing_stream.shown.connect(self.desktopsharing_label.show)
for stream in self.streams:
stream.hide()
@property
def streams(self):
return (self.audio_stream, self.chat_stream, self.desktopsharing_stream, self.video_stream)
@property
def accepted_streams(self):
return [stream for stream in self.streams if stream.in_use and stream.accepted]
def _set_busy_mode(self):
self.reject_mode = 'busy'
def _set_reject_mode(self):
self.reject_mode = 'reject'
def _update_accept_button(self):
was_enabled = self.accept_button.isEnabled()
self.accept_button.setEnabled(len(self.accepted_streams) > 0)
if self.accept_button.isEnabled() != was_enabled:
self.accept_button.setFocus()
def _update_streams_layout(self):
if len([stream for stream in self.streams if stream.in_use]) > 1:
self.audio_stream.active = True
self.chat_stream.active = True
self.desktopsharing_stream.active = True
self.video_stream.active = True
self.note_label.setText(u'To refuse a stream click its icon')
else:
self.audio_stream.active = False
self.chat_stream.active = False
self.desktopsharing_stream.active = False
self.video_stream.active = False
if self.audio_stream.in_use:
self.note_label.setText(u'Audio call')
elif self.chat_stream.in_use:
self.note_label.setText(u'Chat session')
elif self.video_stream.in_use:
self.note_label.setText(u'Video call')
elif self.desktopsharing_stream.in_use:
self.note_label.setText(u'Desktop sharing request')
else:
self.note_label.setText(u'')
self._update_accept_button()
del ui_class, base_class
# Copyright (c) 2010 AG Projects. See LICENSE for details.
#
__all__ = ['ToolButton', 'ConferenceButton', 'SegmentButton', 'SingleSegment', 'LeftSegment', 'MiddleSegment', 'RightSegment', 'SwitchViewButton']
__all__ = ['ToolButton', 'ConferenceButton', 'StreamButton', 'SegmentButton', 'SingleSegment', 'LeftSegment', 'MiddleSegment', 'RightSegment', 'SwitchViewButton']
from PyQt4.QtCore import QTimer, pyqtSignal
from PyQt4.QtGui import QAction, QPushButton, QStyle, QStyleOptionToolButton, QStylePainter, QToolButton
from PyQt4.QtGui import QAction, QIcon, QPushButton, QStyle, QStyleOptionToolButton, QStylePainter, QToolButton
class ToolButton(QToolButton):
......@@ -37,6 +37,61 @@ class ConferenceButton(ToolButton):
self.addAction(self.make_conference_action)
class StreamButton(QToolButton):
hidden = pyqtSignal()
shown = pyqtSignal()
def __init__(self, parent=None):
super(StreamButton, self).__init__(parent)
self.default_icon = QIcon()
self.alternate_icon = QIcon()
self.clicked.connect(self._clicked)
def _clicked(self):
super(StreamButton, self).setIcon(self.default_icon)
def _get_accepted(self):
return not self.isChecked()
def _set_accepted(self, accepted):
super(StreamButton, self).setIcon(self.alternate_icon)
self.setChecked(not accepted)
accepted = property(_get_accepted, _set_accepted)
del _get_accepted, _set_accepted
def _get_active(self):
return self.isEnabled()
def _set_active(self, active):
self.setEnabled(bool(active))
active = property(_get_active, _set_active)
del _get_active, _set_active
@property
def in_use(self):
return self.isVisibleTo(self.parent())
def setVisible(self, visible):
super(StreamButton, self).setVisible(visible)
if visible:
self.shown.emit()
else:
self.hidden.emit()
def setIcon(self, icon):
self.default_icon = icon
self.alternate_icon = QIcon(icon)
normal_sizes = icon.availableSizes(QIcon.Normal, QIcon.On)
selected_sizes = icon.availableSizes(QIcon.Selected, QIcon.On)
selected_additional_sizes = [size for size in selected_sizes if size not in normal_sizes]
for size in normal_sizes + selected_additional_sizes:
pixmap = icon.pixmap(size, QIcon.Selected, QIcon.On)
self.alternate_icon.addPixmap(pixmap, QIcon.Normal, QIcon.On)
super(StreamButton, self).setIcon(icon)
class SegmentTypeMeta(type):
def __repr__(cls):
return cls.__name__
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>170</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>480</width>
<height>170</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>170</height>
</size>
</property>
<property name="windowTitle">
<string>Incoming session request</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="dialog_layout">
<property name="spacing">
<number>10</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string>QFrame#frame {
background-color: #f8f8f8;
border-color: #545454;
border-radius: 4px;
border-width: 2px;
border-style: solid;
}
</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" name="frame_layout">
<property name="topMargin">
<number>7</number>
</property>
<property name="bottomMargin">
<number>7</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0" rowspan="2">
<layout class="QVBoxLayout" name="user_icon_layout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="user_icon">
<property name="minimumSize">
<size>
<width>36</width>
<height>36</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>36</width>
<height>36</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>icons/default-avatar.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="user_icon_spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QLabel" name="username_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>26</height>
</size>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Caller name</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="stream_icon_layout">
<property name="spacing">
<number>2</number>
</property>
<item>
<spacer name="stream_icon_spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="StreamButton" name="chat_stream">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="styleSheet">
<string>border-style: none;
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>icons/chat.png</normaloff>
<normalon>icons/chat-rejected.png</normalon>
<disabledoff>icons/chat.png</disabledoff>
<disabledon>icons/chat-rejected.png</disabledon>
<selectedon>icons/chat-auto-rejected.png</selectedon>icons/chat.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="StreamButton" name="audio_stream">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="styleSheet">
<string>border-style: none;
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>icons/audio.png</normaloff>
<normalon>icons/audio-rejected.png</normalon>
<disabledoff>icons/audio.png</disabledoff>
<disabledon>icons/audio-rejected.png</disabledon>
<selectedon>icons/audio-auto-rejected.png</selectedon>icons/audio.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="StreamButton" name="video_stream">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="styleSheet">
<string>border-style: none;
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>icons/video.png</normaloff>
<normalon>icons/video-rejected.png</normalon>
<disabledoff>icons/video.png</disabledoff>
<disabledon>icons/video-rejected.png</disabledon>
<selectedon>icons/video-auto-rejected.png</selectedon>icons/video.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="StreamButton" name="desktopsharing_stream">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="styleSheet">
<string>border-style: none;
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>icons/desktopsharing.png</normaloff>
<normalon>icons/desktopsharing-rejected.png</normalon>
<disabledoff>icons/desktopsharing.png</disabledoff>
<disabledon>icons/desktopsharing-rejected.png</disabledon>
<selectedon>icons/desktopsharing-auto-rejected.png</selectedon>icons/desktopsharing.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QLabel" name="uri_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>118</red>
<green>118</green>
<blue>117</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>118</red>
<green>118</green>
<blue>117</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Caller URI</string>
</property>
<property name="indent">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="note_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>118</red>
<green>118</green>
<blue>117</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>To refuse a stream click its icon</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<spacer name="frame_spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>407</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="3">
<widget class="QLabel" name="desktopsharing_label">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>118</red>
<green>118</green>
<blue>117</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>118</red>
<green>118</green>
<blue>117</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string extracomment="is offering to share his desktop">is asking to share your desktop</string>
</property>
<property name="indent">
<number>3</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="audio_device_label">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>118</red>
<green>118</green>
<blue>117</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>118</red>
<green>118</green>
<blue>117</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Selected audio device is system default</string>
</property>
<property name="indent">
<number>3</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="button_layout">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QPushButton" name="reject_button">
<property name="minimumSize">
<size>
<width>85</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="text">
<string>Reject</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="busy_button">
<property name="minimumSize">
<size>
<width>85</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="text">
<string>Busy</string>
</property>
</widget>
</item>
<item>
<spacer name="button_spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="accept_button">
<property name="minimumSize">
<size>
<width>85</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="text">
<string>Accept</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>StreamButton</class>
<extends>QToolButton</extends>
<header>blink.widgets.buttons</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>accept_button</tabstop>
<tabstop>reject_button</tabstop>
<tabstop>busy_button</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>accept_button</sender>
<signal>clicked()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>345</x>
<y>117</y>
</hint>
<hint type="destinationlabel">
<x>196</x>
<y>67</y>
</hint>
</hints>
</connection>
<connection>
<sender>reject_button</sender>
<signal>clicked()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>48</x>
<y>117</y>
</hint>
<hint type="destinationlabel">
<x>196</x>
<y>67</y>
</hint>
</hints>
</connection>
<connection>
<sender>busy_button</sender>
<signal>clicked()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>138</x>
<y>117</y>
</hint>
<hint type="destinationlabel">
<x>196</x>
<y>67</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment