Commit 01395f31 authored by Dan Pascu's avatar Dan Pascu

Added about panel

parent b411033e
# Copyright (C) 2010 AG Projects. See LICENSE for details.
#
from __future__ import with_statement
__all__ = ['AboutPanel']
from PyQt4 import uic
from PyQt4.QtCore import QSize
from PyQt4.QtGui import QFontMetrics
from blink.resources import Resources
from blink.util import QSingleton
credits_text = """
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<meta name="qrichtext" content="1" />
<style type="text/css">
td.name { text-align: right; padding-right: 6px; }
a:link { text-decoration: none; color: #1f487f; }
</style>
</head>
<body>
<table width="100%" cellspacing="2" cellpadding="0" border="0">
<tr><td class="name" align="right">AG Projects</td><td align="left"><a href="http://ag-projects.com/">http://ag-projects.com/</a></td></tr>
<tr><td class="name" align="right">NLNET Foundation</td><td align="left"><a href="http://nlnet.nl/">http://nlnet.nl/</a></td></tr>
<tr><td class="name" align="right">IETF Community</td><td align="left"><a href="http://ietf.org/">http://ietf.org/</a></td></tr>
<tr><td class="name" align="right">SIP Simple Client</td><td align="left"><a href="http://sipsimpleclient.com/">http://sipsimpleclient.com/</a></td></tr>
</table>
</body>
</html>
"""
ui_class, base_class = uic.loadUiType(Resources.get('about_panel.ui'))
class AboutPanel(base_class, ui_class):
__metaclass__ = QSingleton
def __init__(self, parent=None):
super(AboutPanel, self).__init__(parent)
with Resources.directory:
self.setupUi(self)
credits_width = QFontMetrics(self.credits_text.currentFont()).width("NLNET Foundation" + "http://sipsimpleclient.com") + 40
self.credits_text.setMinimumWidth(credits_width)
self.credits_text.document().documentLayout().documentSizeChanged.connect(self._credits_size_changed)
self.credits_text.setHtml(credits_text)
def _credits_size_changed(self, size):
size.setHeight(max(size.height(), 168))
self.credits_text.document().documentLayout().documentSizeChanged.disconnect(self._credits_size_changed)
self.credits_text.setFixedSize(size.toSize() + QSize(6, 6))
del ui_class, base_class
......@@ -17,6 +17,7 @@ from sipsimple.account import AccountManager, BonjourAccount
from sipsimple.application import SIPApplication
from sipsimple.configuration.settings import SIPSimpleSettings
from blink.aboutpanel import AboutPanel
from blink.accounts import AccountModel, ActiveAccountModel
from blink.contacts import BonjourNeighbour, Contact, ContactGroup, ContactEditorDialog, ContactModel, ContactSearchModel
from blink.sessions import SessionManager, SessionModel
......@@ -57,6 +58,7 @@ class MainWindow(base_class, ui_class):
self.contact_model.load()
self.about_panel = AboutPanel(self)
self.contact_editor = ContactEditorDialog(self.contact_model, self)
self.session_model = SessionModel(self)
......@@ -106,6 +108,7 @@ class MainWindow(base_class, ui_class):
self.search_box.shortcut.setKey('CTRL+F')
self.search_box.shortcut.activated.connect(self.search_box.setFocus)
self.about_action.triggered.connect(self.about_panel.show)
self.quit_action.triggered.connect(self.close)
self.idle_status_index = 0
......@@ -139,6 +142,7 @@ class MainWindow(base_class, ui_class):
def closeEvent(self, event):
super(MainWindow, self).closeEvent(event)
self.about_panel.close()
self.contact_editor.close()
def set_user_icon(self, image_file_name):
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>about_panel</class>
<widget class="QDialog" name="about_panel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>451</height>
</rect>
</property>
<property name="windowTitle">
<string>About Blink</string>
</property>
<layout class="QVBoxLayout" name="panel_layout">
<property name="spacing">
<number>5</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>20</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QLabel" name="logo">
<property name="pixmap">
<pixmap>icons/blink-logo.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="description">
<property name="text">
<string>A state of the art, easy to use SIP client</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="version">
<property name="text">
<string>Version 0.1.0
July 5, 2010</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="spacer2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="credits">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Credits</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="credits_text">
<property name="minimumSize">
<size>
<width>294</width>
<height>194</height>
</size>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Trebuchet MS'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="spacer3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="copyright">
<property name="text">
<string>Copyright © 2010 AG Projects
All rights reserved.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<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