Mercurial > hg > easaier-soundaccess
view 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 |
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* Sound Access EASAIER client application. Silogic 2007. Laure Bajard. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file COPYING included with this distribution for more information. */ #include "InfoWidget.h" #include <QScrollArea> #include <QLayoutItem> #include <iostream> #include "sv/main/MainWindow.h" InfoWidget::InfoWidget() : QWidget() { m_infoLayout = new QGridLayout; QWidget *infoWidget = new QWidget; infoWidget->setLayout(m_infoLayout); QScrollArea * scrollArea = new QScrollArea; scrollArea->setWidget(infoWidget); scrollArea->setWidgetResizable(true); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(scrollArea); setLayout(mainLayout); } InfoWidget::~InfoWidget() {} void InfoWidget::reset() { QLayoutItem *child; while ((child = m_infoLayout->takeAt(0)) != 0) { delete child->widget(); } } void InfoWidget::displayAudioSourceInfo(AudioSourceInfoModel* model) { std::map<QString, QString> info = model->getInfo(); std::map<QString, QString>::iterator iterInfo; QLabel* proper; QLabel* value; int row = 0; for (iterInfo = info.begin(); iterInfo != info.end(); iterInfo++) { proper = new QLabel(iterInfo->first); QString valueText(iterInfo->second); if ((valueText.left(4) == "http") && (valueText.right(4) == ".xml")) { value = new QLabel(); value->setText("<a href=\"" + iterInfo->second + "\">" + iterInfo->second + "</a>"); //connect the main window to the linkActivated signal connect(value, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierLayer(QString))); } else { value = new QLabel(iterInfo->second); } m_infoLayout->addWidget(proper, row, 0); m_infoLayout->addWidget(value, row, 1); row++; } m_infoLayout->setColumnStretch( 1, 1); }