comparison widgets/InfoWidget.cpp @ 90:87495ac7710a

support audio source info from boca
author lbajardsilogic
date Thu, 28 Jun 2007 16:57:29 +0000
parents a5175615d153
children 1ae07a8c28a0
comparison
equal deleted inserted replaced
89:4fd3274908a5 90:87495ac7710a
47 delete child->widget(); 47 delete child->widget();
48 } 48 }
49 } 49 }
50 void InfoWidget::displayAudioSourceInfo(AudioSourceInfoModel* model) 50 void InfoWidget::displayAudioSourceInfo(AudioSourceInfoModel* model)
51 { 51 {
52 reset();
53
52 std::map<QString, QString> info = model->getInfo(); 54 std::map<QString, QString> info = model->getInfo();
53 std::map<QString, QString>::iterator iterInfo; 55 std::map<QString, QString>::iterator iterInfo;
54 QLabel* proper; 56 QLabel* proper;
55 QLabel* value; 57 QLabel* value;
56 58
57 int row = 0; 59 int row = 0;
58 for (iterInfo = info.begin(); iterInfo != info.end(); iterInfo++) 60
61 //display author and title at first
62 iterInfo = info.find("title");
63 if (iterInfo!= info.end())
59 { 64 {
60 proper = new QLabel(iterInfo->first); 65 proper = new QLabel(iterInfo->first);
61 66 value = new QLabel(iterInfo->second);
62 QString valueText(iterInfo->second); 67 m_infoLayout->addWidget(proper, row, 0);
63 68 m_infoLayout->addWidget(value, row, 1);
64 if ((valueText.left(4) == "http") && (valueText.right(4) == ".xml")) 69 row++;
65 { 70 }
66 value = new QLabel(); 71 iterInfo = info.find("author");
67 value->setText("<a href=\"" + iterInfo->second + "\">" + iterInfo->second + "</a>"); 72 if (iterInfo!= info.end())
68 //connect the main window to the linkActivated signal 73 {
69 connect(value, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierLayer(QString))); 74 proper = new QLabel(iterInfo->first);
70 75 value = new QLabel(iterInfo->second);
71 } else {
72 value = new QLabel(iterInfo->second);
73 }
74
75 m_infoLayout->addWidget(proper, row, 0); 76 m_infoLayout->addWidget(proper, row, 0);
76 m_infoLayout->addWidget(value, row, 1); 77 m_infoLayout->addWidget(value, row, 1);
77 row++; 78 row++;
78 } 79 }
79 80
81 //display other info
82 for (iterInfo = info.begin(); iterInfo != info.end(); iterInfo++)
83 {
84 if ((iterInfo->first != "title") && (iterInfo->first != "author"))
85 {
86 proper = new QLabel(iterInfo->first);
87
88 QString valueText(iterInfo->second);
89
90 if (valueText.right(4) == ".xml")
91 {
92 value = new QLabel();
93 value->setText("<a href=\"" + iterInfo->second + "\">" + iterInfo->second + "</a>");
94 //connect the main window to the linkActivated signal
95 connect(value, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierLayer(QString)));
96
97 } else {
98 value = new QLabel(iterInfo->second);
99 }
100
101 m_infoLayout->addWidget(proper, row, 0);
102 m_infoLayout->addWidget(value, row, 1);
103 row++;
104 }
105 }
106
80 m_infoLayout->setColumnStretch( 1, 1); 107 m_infoLayout->setColumnStretch( 1, 1);
81 } 108 }