comparison widgets/ItemAudioFilterList.cpp @ 73:a5d941805d45

widgets for the audio filter list
author benoitrigolleau
date Wed, 13 Jun 2007 14:07:29 +0000
parents
children afcf540ae3a2
comparison
equal deleted inserted replaced
72:9e1a46a72cde 73:a5d941805d45
1
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
3
4 /*
5 Sound Access
6 EASAIER client application.
7 Silogic 2007. Benoit Rigolleau.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #include "ItemAudioFilterList.h"
17
18 #include "data/model/LayerItemModel.h"
19 #include "layer/Layer.h"
20 #include "base/PlayParameters.h"
21
22 #include <QWidget>
23
24 #include <QApplication>
25 #include <QLabel>
26
27
28 ItemAudioFilterList::ItemAudioFilterList(QWidget *parent) : GenericItemList(parent){
29 setAcceptDrops(true);
30
31 /* Init all variables*/
32 m_labelIcon = new QLabel;
33 m_labelName = new QLabel;
34 m_checkBoxPlay = new QCheckBox;
35 m_layoutMain = new QHBoxLayout;
36
37 /* set the correct widget parameters*/
38 m_labelIcon->setMaximumSize(25,25);
39 //labelIcon->setPixmap(QIcon(":icons/layerViewer_btn_config.png").pixmap(20));
40
41 m_labelName->setMaximumHeight(25);
42 //labelName->setText("ljdh lksdf hl");
43
44 m_checkBoxPlay->setMaximumSize(30,30);
45
46 m_layoutMain->setSpacing(5);
47 m_layoutMain->setMargin(0);
48
49 this->setMaximumHeight(30);
50 this->setMinimumHeight(30);
51 this->setFrameStyle(QFrame::Panel | QFrame::Raised);
52 this->setLineWidth(1);
53
54 /* build the interface*/
55 m_layoutMain->addWidget(m_checkBoxPlay);
56 m_layoutMain->addWidget(m_labelIcon);
57 m_layoutMain->addWidget(m_labelName);
58
59 /*add the main layout in this widget*/
60 this->setLayout(m_layoutMain);
61
62 connect(this, SIGNAL(doubleClicked()), this, SLOT(openPropertyBox()));
63 }
64
65 void ItemAudioFilterList::setIcon(QString &icon){
66 m_labelIcon->setPixmap(QIcon(icon).pixmap(25));
67 }
68
69 void ItemAudioFilterList::setName(QString &name){
70 m_labelName->setText(name);
71 }
72
73
74 void ItemAudioFilterList::changeCheckBoxPlayState(bool state){
75 m_checkBoxPlay->setChecked(state);
76 }
77
78 void ItemAudioFilterList::setPropertyBox(PropertyBox *box){
79 m_propertyBox = box;
80 if(m_propertyBox!=0){
81
82 m_container = m_propertyBox->container();
83
84
85 updateCheckboxs();
86 connect(m_propertyBox, SIGNAL(showLayer(bool)), this, SLOT(showLayer(bool)));
87 }
88
89 //connect();
90 }
91
92 void ItemAudioFilterList::configAction(){
93 if(m_propertyBox!=0){
94 m_propertyBox->close();
95 m_propertyBox->show();
96 }
97 }
98
99
100 /*********SLOTS ************/
101 void ItemAudioFilterList::openPropertyBox(){
102 ItemAudioFilterList::configAction();
103 }
104
105 void ItemAudioFilterList::updateCheckboxs(){
106
107 PlayParameters *params = m_container->getPlayParameters();
108
109 if(params){
110 m_checkBoxPlay->setEnabled(true);
111 m_checkBoxPlay->setChecked(!params->isPlayMuted());
112
113 connect(params, SIGNAL(playAudibleChanged(bool)),m_checkBoxPlay, SLOT(setState(bool)));
114 connect(m_checkBoxPlay, SIGNAL(stateChanged(int)),params, SLOT(setPlayAudible(int)));
115 }else{
116 m_checkBoxPlay->setEnabled(false);
117 }
118 }
119
120
121
122
123
124
125