Mercurial > hg > easaier-soundaccess
changeset 154:1b8f08375391
add the RelatedMediaWidget in the InfoWidget
author | lbajardsilogic |
---|---|
date | Thu, 15 Nov 2007 10:46:57 +0000 |
parents | 98df77b4f041 |
children | 708c00883180 |
files | sv/main/MainWindow.cpp widgets/InfoWidget.cpp widgets/InfoWidget.h widgets/RelatedMediaWidget.cpp widgets/RelatedMediaWidget.h |
diffstat | 5 files changed, 33 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/sv/main/MainWindow.cpp Thu Nov 15 09:44:32 2007 +0000 +++ b/sv/main/MainWindow.cpp Thu Nov 15 10:46:57 2007 +0000 @@ -267,16 +267,16 @@ m_playMono->setChecked(settings.value("playmono", false).toBool()); settings.endGroup();*/ - m_infoWidget = new InfoWidget(); + m_relMediaWidget = new RelatedMediaWidget(); + m_infoWidget = new InfoWidget(m_relMediaWidget); m_searchWidget = new SearchWidget(); m_resultsWidget = new QueryResultsWidget(); - m_relMediaWidget = new RelatedMediaWidget(); - + m_qtabwidget = new QTabWidget(); m_qtabwidget->addTab(m_searchWidget, tr("Search")); m_qtabwidget->addTab(m_resultsWidget, tr("Result")); m_qtabwidget->addTab(m_infoWidget, tr("Info")); - m_qtabwidget->addTab(m_relMediaWidget, tr("Related media")); + //m_qtabwidget->addTab(m_relMediaWidget, tr("Related media")); QGridLayout *auxlayout = new QGridLayout; auxlayout->addWidget(m_paneStack, 0, 0, 1, 2);
--- a/widgets/InfoWidget.cpp Thu Nov 15 09:44:32 2007 +0000 +++ b/widgets/InfoWidget.cpp Thu Nov 15 10:46:57 2007 +0000 @@ -19,8 +19,9 @@ #include <iostream> #include "sv/main/MainWindow.h" +#include "RelatedMediaWidget.h" -InfoWidget::InfoWidget() : QWidget() +InfoWidget::InfoWidget(RelatedMediaWidget * relMediaWidget) : QWidget() { m_infoLayout = new QGridLayout; @@ -32,7 +33,8 @@ scrollArea->setWidgetResizable(true); QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addWidget(scrollArea); + mainLayout->addWidget(scrollArea, Qt::AlignTop); + mainLayout->addWidget(relMediaWidget, Qt::AlignTop); setLayout(mainLayout); }
--- a/widgets/InfoWidget.h Thu Nov 15 09:44:32 2007 +0000 +++ b/widgets/InfoWidget.h Thu Nov 15 10:46:57 2007 +0000 @@ -20,11 +20,13 @@ #include "data/model/AudioSourceInfoModel.h" +class RelatedMediaWidget; + class InfoWidget : public QWidget { Q_OBJECT public: - InfoWidget(); + InfoWidget(RelatedMediaWidget * relMediaWidget); virtual ~InfoWidget(); void reset();
--- a/widgets/RelatedMediaWidget.cpp Thu Nov 15 09:44:32 2007 +0000 +++ b/widgets/RelatedMediaWidget.cpp Thu Nov 15 10:46:57 2007 +0000 @@ -13,29 +13,36 @@ #include "RelatedMediaWidget.h" -#include <QScrollArea> #include <QLayoutItem> #include <QLinearGradient> #include <iostream> #include "sv/main/MainWindow.h" +#include "AdvancedToolBox.h" RelatedMediaWidget::RelatedMediaWidget() : QWidget() , m_nbRelMedia(0), - m_painter(0) + m_painter(0), + m_relMediaMaxHeight(150) { m_relMediaLayout = new QGridLayout; QWidget *mediaWidget = new QWidget; mediaWidget->setLayout(m_relMediaLayout); - QScrollArea * scrollArea = new QScrollArea; - scrollArea->setWidget(mediaWidget); - scrollArea->setWidgetResizable(true); + m_scrollArea = new QScrollArea; + m_scrollArea->setWidget(mediaWidget); + m_scrollArea->setWidgetResizable(true); + m_scrollArea->setMinimumHeight(m_relMediaMaxHeight + 50); + + AdvancedToolBox * toolBox= new AdvancedToolBox; + toolBox->addItem("Related Media", m_scrollArea); QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addWidget(scrollArea); + mainLayout->addWidget(toolBox); + mainLayout->setSpacing(0); + mainLayout->setMargin(0); setLayout(mainLayout); } @@ -60,8 +67,7 @@ int width; int height; - int maxHeight = 150; - + if (extension == "pdf") { imageSource = ":icons/icon_pdf.png"; @@ -71,10 +77,10 @@ } QPixmap image(imageSource); - if (image.height() > maxHeight) + if (image.height() > m_relMediaMaxHeight) { - height = maxHeight; - width = image.width() * maxHeight / image.height(); + height = m_relMediaMaxHeight; + width = image.width() * m_relMediaMaxHeight / image.height(); } else { height = image.height();
--- a/widgets/RelatedMediaWidget.h Thu Nov 15 09:44:32 2007 +0000 +++ b/widgets/RelatedMediaWidget.h Thu Nov 15 10:46:57 2007 +0000 @@ -17,6 +17,7 @@ #include <QWidget> #include <QPainter> #include <QGridLayout> +#include <QScrollArea> //#include "data/model/AudioSourceInfoModel.h" @@ -39,8 +40,12 @@ QPainter * m_painter; + QScrollArea * m_scrollArea; + int m_nbRelMedia; + int m_relMediaMaxHeight; + };