Mercurial > hg > easaier-soundaccess
comparison widgets/ListResultGeneralItemWidget.cpp @ 108:c107866fd387
first draft to the list result
author | benoitrigolleau |
---|---|
date | Fri, 14 Sep 2007 16:44:36 +0000 |
parents | |
children | 1c638a8e9897 |
comparison
equal
deleted
inserted
replaced
107:c3ac34b2e45b | 108:c107866fd387 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sound Access | |
5 EASAIER client application. | |
6 Silogic 2007. Benoit Rigolleau. | |
7 | |
8 This program is free software; you can redistribute it and/or | |
9 modify it under the terms of the GNU General Public License as | |
10 published by the Free Software Foundation; either version 2 of the | |
11 License, or (at your option) any later version. See the file | |
12 COPYING included with this distribution for more information. | |
13 */ | |
14 | |
15 #include "ListResultGeneralItemWidget.h" | |
16 | |
17 #include "CriteriaDialog.h" | |
18 #include <QPixmap> | |
19 | |
20 ListResultGeneralItemWidget::ListResultGeneralItemWidget(QWidget *parent):QWidget(parent){ | |
21 vLayout1 = new QVBoxLayout(); | |
22 vLayout2 = new QVBoxLayout(); | |
23 hLayout1 = new QHBoxLayout(); | |
24 hLayout2 = new QHBoxLayout(); | |
25 hLayout3 = new QHBoxLayout(); | |
26 m_waitingWidget = new WaitingWidget(); | |
27 | |
28 m_labelRank = new QLabel(); | |
29 m_labelIcon = new QLabel(); | |
30 m_labelTitleArtist = new QLabel(); | |
31 label4 = new QLabel("4"); | |
32 label5 = new QLabel("le super mega truc des options que même que c'est trop bien"); | |
33 | |
34 m_buttonPrev = new QPushButton("prev"); | |
35 m_buttonSimilar = new QPushButton("similar"); | |
36 | |
37 m_confidenceListWidget= new ConfidenceListWidget(); | |
38 m_confidenceListWidget->setMaximumWidth(180); | |
39 | |
40 | |
41 // set parameters for each component | |
42 | |
43 m_labelRank->setMaximumWidth(40); | |
44 m_labelRank->setMinimumWidth(40); | |
45 m_labelIcon->setMaximumWidth(40); | |
46 m_labelIcon->setMinimumWidth(40); | |
47 label4->setMaximumWidth(40); | |
48 label4->setMinimumWidth(40); | |
49 | |
50 m_labelRank->setAlignment(Qt::AlignCenter); | |
51 m_labelIcon->setAlignment(Qt::AlignCenter); | |
52 | |
53 m_buttonPrev->setMaximumWidth(60); | |
54 //m_buttonPrev->setMaximumHeight(40); | |
55 m_buttonSimilar->setMaximumWidth(60); | |
56 //m_buttonSimilar->setMaximumHeight(40); | |
57 | |
58 ////////////// | |
59 /*QFrame *vLine = new QFrame(); | |
60 vLine->setFrameStyle(QFrame::VLine | QFrame::Raised); | |
61 vLine->setMaximumWidth(1); | |
62 vLine->setMinimumWidth(1); | |
63 QFrame *vLine2 = new QFrame(); | |
64 vLine2->setFrameStyle(QFrame::VLine | QFrame::Raised); | |
65 vLine2->setMaximumWidth(1); | |
66 vLine2->setMinimumWidth(1);*/ | |
67 | |
68 QWidget *mainWidget = new QWidget(); | |
69 | |
70 hLayout1->setMargin(0); | |
71 hLayout1->setSpacing(0); | |
72 //hLayout1->addWidget(vLine); | |
73 hLayout1->addWidget(mainWidget); | |
74 //hLayout1->addWidget(vLine2); | |
75 | |
76 ////////// | |
77 | |
78 QFrame *hLine = new QFrame(); | |
79 hLine->setFrameStyle(QFrame::HLine | QFrame::Raised); | |
80 hLine->setMaximumHeight(1); | |
81 hLine->setMinimumHeight(1); | |
82 | |
83 vLayout1->setMargin(0); | |
84 vLayout1->setSpacing(0); | |
85 vLayout1->addLayout(hLayout1); | |
86 vLayout1->addWidget(hLine); | |
87 | |
88 this->setLayout(vLayout1); | |
89 | |
90 //////// | |
91 | |
92 /*QFrame *vLine3 = new QFrame(); | |
93 vLine3->setFrameStyle(QFrame::VLine | QFrame::Raised); | |
94 vLine3->setMaximumWidth(1); | |
95 vLine3->setMinimumWidth(1); | |
96 QFrame *vLine4 = new QFrame(); | |
97 vLine4->setFrameStyle(QFrame::VLine | QFrame::Raised); | |
98 vLine4->setMaximumWidth(1); | |
99 vLine4->setMinimumWidth(1);*/ | |
100 | |
101 mainWidget->setLayout(hLayout2); | |
102 hLayout2->setMargin(0); | |
103 hLayout2->setSpacing(0); | |
104 | |
105 hLayout2->addWidget(m_labelRank); | |
106 //hLayout2->addWidget(vLine3); | |
107 hLayout2->addWidget(m_labelIcon); | |
108 //hLayout2->addWidget(vLine4); | |
109 hLayout2->addWidget(m_waitingWidget); | |
110 | |
111 ////// | |
112 | |
113 m_waitingWidget->setLayout(vLayout2); | |
114 vLayout2->addLayout(hLayout3); | |
115 vLayout2->addWidget(label5); | |
116 vLayout2->setMargin(0); | |
117 vLayout2->setSpacing(0); | |
118 | |
119 ///// | |
120 /*QFrame *vLine5 = new QFrame(); | |
121 vLine5->setFrameStyle(QFrame::VLine | QFrame::Raised); | |
122 vLine5->setMaximumWidth(1); | |
123 vLine5->setMinimumWidth(1); | |
124 QFrame *vLine6 = new QFrame(); | |
125 vLine6->setFrameStyle(QFrame::VLine | QFrame::Raised); | |
126 vLine6->setMaximumWidth(1); | |
127 vLine6->setMinimumWidth(1); | |
128 QFrame *vLine7 = new QFrame(); | |
129 vLine7->setFrameStyle(QFrame::VLine | QFrame::Raised); | |
130 vLine7->setMaximumWidth(1); | |
131 vLine7->setMinimumWidth(1);*/ | |
132 | |
133 hLayout3->setMargin(0); | |
134 hLayout3->setSpacing(0); | |
135 hLayout3->addWidget(m_labelTitleArtist); | |
136 //hLayout3->addWidget(vLine5); | |
137 hLayout3->addWidget(m_confidenceListWidget); | |
138 //hLayout3->addWidget(vLine6); | |
139 hLayout3->addWidget(label4); | |
140 //hLayout3->addWidget(vLine7); | |
141 hLayout3->addWidget(m_buttonPrev); | |
142 hLayout3->addWidget(m_buttonSimilar); | |
143 | |
144 connect(m_buttonSimilar, SIGNAL(clicked()), this, SLOT(displayCriteria())); | |
145 | |
146 } | |
147 | |
148 void ListResultGeneralItemWidget::setTitleAndAuthorName(QString author,QString title){ | |
149 m_labelTitleArtist->setText(author+" - \""+title+"\""); | |
150 } | |
151 | |
152 void ListResultGeneralItemWidget::setRank(int rank){ | |
153 m_labelRank->setText(QString().setNum(rank)); | |
154 } | |
155 | |
156 void ListResultGeneralItemWidget::setType(int type){ | |
157 QString pixmapName; | |
158 switch(type){ | |
159 case 0: | |
160 pixmapName.append(":icons/musicIcon.png"); | |
161 break; | |
162 case 1: | |
163 pixmapName.append(":icons/speechIcon.png"); | |
164 break; | |
165 | |
166 default: | |
167 break; | |
168 } | |
169 m_labelIcon->setPixmap(QPixmap(pixmapName)); | |
170 } | |
171 | |
172 void ListResultGeneralItemWidget::addConfidence(int confidence, QString confidenceName){ | |
173 m_confidenceListWidget->addConfidence(confidence,confidenceName); | |
174 } | |
175 | |
176 void ListResultGeneralItemWidget::displayCriteria(){ | |
177 m_criteriaDialog = new CriteriaDialog(); | |
178 m_criteriaDialog->addCriteria("criteria 1"); | |
179 m_criteriaDialog->addCriteria("criteria 2"); | |
180 m_criteriaDialog->addCriteria("criteria 3"); | |
181 m_criteriaDialog->setLocation(1000,200); | |
182 m_criteriaDialog->setOpacity(0.9); | |
183 if(m_criteriaDialog->exec()){ | |
184 m_waitingWidget->setAnimation(true); | |
185 } | |
186 delete m_criteriaDialog; | |
187 } | |
188 | |
189 | |
190 |