Commit acbca1d0 authored by Dan Pascu's avatar Dan Pascu

Added sessions panel

parent ea1d69b3
......@@ -39,10 +39,17 @@ class MainWindow(base_class, ui_class):
self.search_list.setItemDelegate(ContactDelegate(self.search_list))
self.search_box.textChanged.connect(self.contact_search_model.setFilterFixedString)
self.contacts_panel.sibling_panel = self.sessions_panel
self.contacts_panel.sibling_name = u'Sessions'
self.sessions_panel.sibling_panel = self.contacts_panel
self.sessions_panel.sibling_name = u'Contacts'
self.main_view.setCurrentWidget(self.contacts_panel)
self.contacts_view.setCurrentWidget(self.contact_list_panel)
self.search_view.setCurrentWidget(self.search_list_panel)
self.switch_view.clicked.connect(self.switch_main_view)
self.search_box.textChanged.connect(self.search_box_text_changed)
self.back_to_contacts.clicked.connect(self.search_box.clear) # this can be set in designer -Dan
......@@ -80,11 +87,22 @@ class MainWindow(base_class, ui_class):
print "identity changed", string
def search_box_text_changed(self, text):
if text:
self.main_view.setCurrentWidget(self.contacts_panel)
self.switch_view.setText(u"Sessions")
else:
# switch to the sessions panel if there are active sessions, else to the contacts panel -Dan
pass
active_widget = self.contact_list_panel if text.isEmpty() else self.search_panel
self.contacts_view.setCurrentWidget(active_widget)
active_widget = self.search_list_panel if self.contact_search_model.rowCount() else self.not_found_panel
self.search_view.setCurrentWidget(active_widget)
def switch_main_view(self):
widget = self.main_view.currentWidget().sibling_panel
self.main_view.setCurrentWidget(widget)
self.switch_view.setText(widget.sibling_name)
def test_add_contact(self):
from blink.contacts import Contact, ContactGroup
import random
......
......@@ -265,7 +265,7 @@
<item>
<widget class="QStackedWidget" name="main_view">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="contacts_panel">
<layout class="QVBoxLayout" name="verticalLayout_8">
......@@ -278,7 +278,7 @@
<item>
<widget class="QStackedWidget" name="contacts_view">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="contact_list_panel">
<layout class="QVBoxLayout" name="verticalLayout_7">
......@@ -644,7 +644,122 @@ buttons below.</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="sessions_panel"/>
<widget class="QWidget" name="sessions_panel">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListView" name="session_list"/>
</item>
<item>
<layout class="QHBoxLayout" name="session_buttons_layout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QPushButton" name="hangup_all">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="text">
<string>Hangup all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="conference">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="text">
<string>Conference</string>
</property>
</widget>
</item>
<item>
<spacer name="session_buttons_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="QToolButton" name="mute">
<property name="minimumSize">
<size>
<width>29</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>29</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>icons/mic-on.png</normaloff>
<normalon>icons/mic-off.png</normalon>icons/mic-on.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
......
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