File: portdlg.ui.h

package info (click to toggle)
djplay 0.5.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,432 kB
  • ctags: 1,388
  • sloc: cpp: 13,382; sh: 7,454; makefile: 810; sed: 16
file content (99 lines) | stat: -rw-r--r-- 2,520 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/


void PortDlg::init()
{
    Client *c=frame->client();
    cfg.setName(config->name());
    cfg.setSave(false);
    
    QValueList<Portinfo>::Iterator it1;
    QValueList<Port *>::Iterator it2;
    
    for(it2=c->ports.begin();it2 != c->ports.end();++it2)
	if((*it2)->type() == Port::Output)
	    OutputFrom->insertItem((*it2)->name());
    
    for(it1=c->out_ports.begin();it1 != c->out_ports.end();++it1)
	OutputFrom->insertItem((*it1).name);
}


void PortDlg::OutputFrom_selectionChanged( QListBoxItem * li)
{
    QString text;
    if(li)
	text=li->text();
    outputStoreSetup();
    OutputTo->clear();
    outputSelected=text;
    if(text == QString::null)
	return;
    insertEligible(OutputTo, text);
    QString val=cfg.getValue(text, "");
    QStringList sl=QStringList::split("=", val, false);
    QStringList::Iterator it;
    for(it=sl.begin();it!=sl.end();++it)
    {
	QListBoxItem *i=OutputTo->findItem((*it));
	if(i)
	    OutputTo->setSelected(i, true);
    }
}


bool PortDlg::isMine( QString port )
{
    Client *c=frame->client();
    
    QValueList<Port *>::Iterator it2;
    
    for(it2=c->ports.begin();it2 != c->ports.end();++it2)
	if((*it2)->name() == port)
	    return true;
    return false;
}



void PortDlg::insertEligible( QListBox *lb, QString port )
{
    Client *c=frame->client();
    QValueList<Portinfo>::Iterator it1;
    QValueList<Port *>::Iterator it2;
    
    for(it2=c->ports.begin();it2 != c->ports.end();++it2)
	if((*it2)->type() == Port::Input)
	    OutputTo->insertItem((*it2)->name());
    if(isMine(port))
    {
	for(it1=c->in_ports.begin();it1 != c->in_ports.end();++it1)
	    OutputTo->insertItem((*it1).name);
    }
}


void PortDlg::outputStoreSetup()
{
    if(outputSelected == QString::null)
	return;
    QStringList sl;
    int i;
    for(i=0;i<OutputTo->count();++i)
    {
	QListBoxItem *it=OutputTo->item(i);
	if(OutputTo->isSelected(it))
	    sl.append(it->text());
    }
    QString val=sl.join("=");
    if(val == QString::null)
	val="";
    cfg.setValue(outputSelected, val);
}