root/branches/libffado-2.0/support/mixer-qt4/ffado_regdialog.py

Revision 1755, 4.0 kB (checked in by ppalmers, 2 years ago)

add donation link to the registration dialog

Line 
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2005-2008 by Pieter Palmers
4 #
5 # This file is part of FFADO
6 # FFADO = Free Firewire (pro-)audio drivers for linux
7 #
8 # FFADO is based upon FreeBoB.
9 #
10 # This program is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 2 of the License, or
13 # (at your option) version 3 of the License.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 #
23
24 from PyQt4.QtCore import SIGNAL, SLOT, QObject
25 from PyQt4.QtGui import QDialog
26 from ffado_regdialogui import Ui_ffadoRegDialogUI
27
28 import logging
29 log = logging.getLogger('registration')
30
31 REGISTRATION_MESSAGE = """
32 <html><head><meta name="qrichtext" content="1" />
33 <style type="text/css">\np, li { white-space: pre-wrap; }\n</style></head>
34 <body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">\n
35 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
36 You are running this version of FFADO for the first time with this device. </p>
37 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If FFADO is useful to you, please consider a donation through <a href="http://www.ffado.org/?q=donations ">http://www.ffado.org/?q=donations</a>.</p>
38 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
39 In order to collect usage statistics we would like to send some information about your system to ffado.org.
40 It is very important for us to have good usage statistics. This is to convince vendors that Linux users
41 do exist and is where you as a user can help the project. </p>
42 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
43 The information collected is intended only for usage monitoring. The email address is optional, and will
44 be used for FFADO related announcements only. If you provide one, please provide a valid one. </p>
45 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
46 Note: This registration can also be performed on-line at
47 <a href="http://www.ffado.org/?q=usage">http://www.ffado.org/?q=usage</a>.</p></body></html>
48 """
49
50 class ffadoRegDialog(QDialog, Ui_ffadoRegDialogUI):
51     def __init__(self, vendor_name, vendor_id, model_name, model_id,
52                  guid, version, email="(optional)",
53                  parent = None):
54         QDialog.__init__(self,parent)
55         self.setupUi(self)
56         self.txtVendorName.setText(vendor_name)
57         self.txtVendorId.setText(vendor_id)
58         self.txtModelName.setText(model_name)
59         self.txtModelId.setText(model_id)
60         self.txtGUID.setText(guid)
61         self.txtVersion.setText(version)
62         self.txtEmail.setText(email)
63         self.txtMessage.setHtml(REGISTRATION_MESSAGE)
64
65         self.choice = "nosend"
66         QObject.connect(self.btnSend,SIGNAL('clicked()'),self.buttonPressed)
67         QObject.connect(self.btnNoSend,SIGNAL('clicked()'),self.buttonPressed)
68         QObject.connect(self.btnNeverSend,SIGNAL('clicked()'),self.buttonPressed)
69
70     def buttonPressed(self):
71         sender = self.sender()
72         if sender == self.btnSend:
73             log.debug("user chose to send")
74             self.choice = "send"
75         elif sender ==  self.btnNoSend:
76             log.debug("user chose not to send")
77             self.choice = "nosend"
78         elif sender ==  self.btnNeverSend:
79             log.debug("user chose to never send")
80             self.choice = "neversend"
81         self.close()
82
83     def getEmail(self):
84         return self.txtEmail.text()
Note: See TracBrowser for help on using the browser.