Mercurial > hg > easaier-soundaccess
comparison widgets/InfoWidget.cpp @ 7:a5175615d153
add easaier tab widgets, style and pass the layer characteristics in the main window (remove from panestack)
author | lbajardsilogic |
---|---|
date | Fri, 11 May 2007 14:11:19 +0000 |
parents | |
children | 87495ac7710a |
comparison
equal
deleted
inserted
replaced
6:028faa201f0e | 7:a5175615d153 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* Sound Access | |
4 EASAIER client application. | |
5 Silogic 2007. Laure Bajard. | |
6 | |
7 This program is free software; you can redistribute it and/or | |
8 modify it under the terms of the GNU General Public License as | |
9 published by the Free Software Foundation; either version 2 of the | |
10 License, or (at your option) any later version. See the file | |
11 COPYING included with this distribution for more information. | |
12 */ | |
13 | |
14 #include "InfoWidget.h" | |
15 | |
16 #include <QScrollArea> | |
17 #include <QLayoutItem> | |
18 | |
19 #include <iostream> | |
20 | |
21 #include "sv/main/MainWindow.h" | |
22 | |
23 InfoWidget::InfoWidget() : QWidget() | |
24 { | |
25 m_infoLayout = new QGridLayout; | |
26 | |
27 QWidget *infoWidget = new QWidget; | |
28 infoWidget->setLayout(m_infoLayout); | |
29 | |
30 QScrollArea * scrollArea = new QScrollArea; | |
31 scrollArea->setWidget(infoWidget); | |
32 scrollArea->setWidgetResizable(true); | |
33 | |
34 QVBoxLayout *mainLayout = new QVBoxLayout; | |
35 mainLayout->addWidget(scrollArea); | |
36 | |
37 setLayout(mainLayout); | |
38 } | |
39 | |
40 InfoWidget::~InfoWidget() | |
41 {} | |
42 | |
43 void InfoWidget::reset() | |
44 { | |
45 QLayoutItem *child; | |
46 while ((child = m_infoLayout->takeAt(0)) != 0) { | |
47 delete child->widget(); | |
48 } | |
49 } | |
50 void InfoWidget::displayAudioSourceInfo(AudioSourceInfoModel* model) | |
51 { | |
52 std::map<QString, QString> info = model->getInfo(); | |
53 std::map<QString, QString>::iterator iterInfo; | |
54 QLabel* proper; | |
55 QLabel* value; | |
56 | |
57 int row = 0; | |
58 for (iterInfo = info.begin(); iterInfo != info.end(); iterInfo++) | |
59 { | |
60 proper = new QLabel(iterInfo->first); | |
61 | |
62 QString valueText(iterInfo->second); | |
63 | |
64 if ((valueText.left(4) == "http") && (valueText.right(4) == ".xml")) | |
65 { | |
66 value = new QLabel(); | |
67 value->setText("<a href=\"" + iterInfo->second + "\">" + iterInfo->second + "</a>"); | |
68 //connect the main window to the linkActivated signal | |
69 connect(value, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierLayer(QString))); | |
70 | |
71 } else { | |
72 value = new QLabel(iterInfo->second); | |
73 } | |
74 | |
75 m_infoLayout->addWidget(proper, row, 0); | |
76 m_infoLayout->addWidget(value, row, 1); | |
77 row++; | |
78 } | |
79 | |
80 m_infoLayout->setColumnStretch( 1, 1); | |
81 } |