Mercurial > hg > easaier-soundaccess
comparison widgets/InfoWidget.cpp @ 257:057856cf81a2
reformat the InfoWidget and integrate the related media query
author | lbajardsilogic |
---|---|
date | Wed, 18 Jun 2008 10:38:39 +0000 |
parents | 2ea04b3f9141 |
children |
comparison
equal
deleted
inserted
replaced
256:6eeb195adbb4 | 257:057856cf81a2 |
---|---|
67 | 67 |
68 m_infoLayout->setColumnMinimumWidth(1,20); | 68 m_infoLayout->setColumnMinimumWidth(1,20); |
69 m_infoLayout->setColumnMinimumWidth(3,20); | 69 m_infoLayout->setColumnMinimumWidth(3,20); |
70 | 70 |
71 //display author and title at first | 71 //display author and title at first |
72 /* iterInfo = info.find("performance_title"); | 72 iterInfo = info.find("title"); |
73 if (iterInfo!= info.end()) | 73 if (iterInfo!= info.end()) |
74 { | 74 { |
75 proper = new QLabel(iterInfo->first.toUpper()); | 75 proper = new QLabel(iterInfo->first.toUpper()); |
76 value = new QLabel(iterInfo->second); | 76 value = new QLabel(iterInfo->second->join(" - ")); |
77 m_infoLayout->addWidget(proper, row, 0,1,3); | 77 m_infoLayout->addWidget(proper, row, 2,1,1); |
78 m_infoLayout->addWidget(value, row, 4,1,1); | 78 m_infoLayout->addWidget(value, row, 4,1,1); |
79 row++; | 79 row++; |
80 } | 80 } |
81 iterInfo = info.find("author"); | 81 iterInfo = info.find("author"); |
82 if (iterInfo!= info.end()) | 82 if (iterInfo!= info.end()) |
83 { | 83 { |
84 proper = new QLabel(iterInfo->first.toUpper()); | 84 proper = new QLabel(iterInfo->first.toUpper()); |
85 value = new QLabel(iterInfo->second); | 85 value = new QLabel(iterInfo->second->join(" - ")); |
86 m_infoLayout->addWidget(proper, row, 0,1,3); | 86 m_infoLayout->addWidget(proper, row, 2,1,1); |
87 m_infoLayout->addWidget(value, row, 4,1,1); | 87 m_infoLayout->addWidget(value, row, 4,1,1); |
88 row++; | 88 row++; |
89 } | 89 } |
90 m_infoLayout->setRowMinimumHeight(row,25); | 90 iterInfo = info.find("performer_name"); |
91 if (iterInfo!= info.end()) | |
92 { | |
93 proper = new QLabel("PERFORMER"); | |
94 value = new QLabel(iterInfo->second->join(" - ")); | |
95 m_infoLayout->addWidget(proper, row, 2,1,1); | |
96 m_infoLayout->addWidget(value, row, 4,1,1); | |
97 row++; | |
98 } | |
91 row++; | 99 row++; |
92 */ | 100 |
93 | 101 |
94 //display other info | 102 //display other info |
95 for (iterInfo = info.begin(); iterInfo != info.end(); iterInfo++) | 103 for (iterInfo = info.begin(); iterInfo != info.end(); iterInfo++) |
96 { | 104 { |
97 /*if ((iterInfo->first != "title") && (iterInfo->first != "author") && (iterInfo->first.contains("http://purl.org/ontology/mo"))) | 105 if ( (iterInfo->first != "title") && (iterInfo->first != "author") && (iterInfo->first != "performer_name") && (iterInfo->first != "event_label") && (iterInfo->first != "signal")) |
98 { | 106 { |
99 QString properName; | 107 proper = new QLabel(iterInfo->first.toUpper()); |
100 properName = iterInfo->first.split("#").last(); | 108 QStringList *values = iterInfo->second; |
101 proper = new QLabel(properName); | 109 QString label = ""; |
102 icon = new QLabel(); | 110 for (int i = 0; i < values->size(); ++i) |
103 if(properName == "beats"){ | 111 { |
104 icon->setPixmap(QPixmap(":icons/instants.png")); | 112 QString curVal = values->at(i); |
105 }else if(properName == "chromagram"){ | 113 if (curVal.contains("http:")) |
106 icon->setPixmap(QPixmap(":icons/colour3d.png")); | 114 { |
107 }else if(properName == "instruments"){ | 115 curVal = curVal.right(curVal.length() - curVal.lastIndexOf('/') - 1); |
108 icon->setPixmap(QPixmap(":icons/notes.png")); | 116 curVal = curVal.right(curVal.length() - curVal.lastIndexOf('#') - 1); |
109 }else if(properName == "key"){ | 117 } |
110 icon->setPixmap(QPixmap(":icons/values.png")); | 118 label += curVal; |
111 }else if(properName == "tempo"){ | 119 if (i+1 < values->size()) |
112 icon->setPixmap(QPixmap(":icons/values.png")); | 120 label += " - "; |
113 }else{ | |
114 //nothing | |
115 } | 121 } |
122 value = new QLabel(label); | |
123 | |
124 m_infoLayout->addWidget(proper, row, 2,1,1); | |
125 m_infoLayout->addWidget(value, row, 4,1,1); | |
126 row++; | |
127 } | |
128 } | |
116 | 129 |
117 QString valueText(iterInfo->second); | 130 iterInfo = info.find("event_label"); |
118 | 131 if (iterInfo!= info.end()) |
119 if (valueText.right(4) == ".xml") | 132 { |
120 { | 133 proper = new QLabel("TIMELINE INFORMATION"); |
121 value = new QLabel(); | 134 value = new QLabel(""); |
122 //value->setIcon(QIcon(":icons/redo.png")); | 135 QString label; |
123 value->setText("<html><header><style type=\"text/css\">a {text-decoration: none;}</style></header><body><a href=\"" + iterInfo->second + "\"><img src=\":icons/addToLayer.png\"> </a></body></html>"); | 136 QStringList::const_iterator constIterator; |
124 value->setToolTip(tr("Add this layer to the layer list")); | 137 for (constIterator = iterInfo->second->constBegin(); constIterator != iterInfo->second->constEnd(); ++constIterator) |
125 //connect the main window to the linkActivated signal | |
126 connect(value, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierLayer(QString))); | |
127 | |
128 m_infoLayout->addWidget(icon,row,0,1,1); | |
129 m_infoLayout->addWidget(proper, row, 2,1,1); | |
130 m_infoLayout->addWidget(value, row, 4,1,1); | |
131 row++; | |
132 } | |
133 }*/ | |
134 if (iterInfo->first == "event_label") | |
135 { | 138 { |
136 proper = new QLabel(iterInfo->first); | 139 label += "<a href=\""; |
137 value = new QLabel(iterInfo->second->join(" - ")); | 140 label += *constIterator; |
138 QString label; | 141 label += "\">"; |
139 QStringList::const_iterator constIterator; | 142 label += *constIterator; |
140 for (constIterator = iterInfo->second->constBegin(); constIterator != iterInfo->second->constEnd(); ++constIterator) | 143 label += "</a> - "; |
141 { | |
142 label += "<a href=\""; | |
143 label += *constIterator; | |
144 label += "\">"; | |
145 label += *constIterator; | |
146 label += "</a> - "; | |
147 } | |
148 value->setText(label); | |
149 //connect the main window to the linkActivated signal | |
150 connect(value, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierLayer(QString))); | |
151 } | 144 } |
152 else { | 145 value->setText(label); |
153 proper = new QLabel(iterInfo->first); | 146 //connect the main window to the linkActivated signal |
154 value = new QLabel(iterInfo->second->join(" - ")); | 147 connect(value, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierLayer(QString))); |
155 } | |
156 m_infoLayout->addWidget(proper, row, 2,1,1); | 148 m_infoLayout->addWidget(proper, row, 2,1,1); |
157 m_infoLayout->addWidget(value, row, 4,1,1); | 149 m_infoLayout->addWidget(value, row, 4,1,1); |
158 row++; | 150 row++; |
159 } | 151 } |
160 | 152 |