File indexing completed on 2024-04-28 04:48:37
0001 /* 0002 SPDX-FileCopyrightText: 2012 Harald Sitter <sitter@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #include "audioView2.h" 0008 #include "theStream.h" 0009 #include "ui_audioView2.h" 0010 #include "videoWindow.h" 0011 0012 namespace Dragon 0013 { 0014 0015 AudioView2::AudioView2(QWidget *parent) 0016 : QWidget(parent) 0017 , ui(new Ui::AudioView2) 0018 { 0019 ui->setupUi(this); 0020 0021 ui->m_analyzerFrame->setMaximumSize(ui->m_analyzer->maximumSize()); 0022 ui->m_analyzerFrame->setMinimumSize(ui->m_analyzer->minimumSize()); 0023 0024 setupAnalyzer(); 0025 connect(engine(), &VideoWindow::metaDataChanged, this, &AudioView2::update); 0026 } 0027 0028 AudioView2::~AudioView2() 0029 { 0030 delete ui; 0031 } 0032 0033 void AudioView2::setupAnalyzer() 0034 { 0035 engine()->setupAnalyzer(ui->m_analyzer); 0036 } 0037 0038 void AudioView2::enableDemo(bool enable) 0039 { 0040 ui->m_analyzer->enableDemo(enable); 0041 } 0042 0043 void AudioView2::update() 0044 { 0045 ui->m_artist->setText(TheStream::metaData(Phonon::ArtistMetaData)); 0046 ui->m_album->setText(TheStream::metaData(Phonon::AlbumMetaData)); 0047 ui->m_track->setText(TheStream::metaData(Phonon::TitleMetaData)); 0048 // { //somewhat of a longshot: try to find Amarok cover for the music 0049 // QString imagePath = checkForAmarokImage( artist, album ); 0050 // if(imagePath.isNull()) 0051 // { 0052 // delete m_image; 0053 // m_image = 0; 0054 // m_layout->setColumnFixedWidth(0, 0.0); 0055 // } 0056 // else 0057 // { 0058 // m_layout->setColumnFixedWidth(0, COVER_COLUMN_WIDTH); 0059 // if(!m_image) 0060 // { 0061 // m_image = new QGraphicsPixmapItem(); 0062 // scene()->addItem( m_image ); 0063 // m_image->setPos( 3.0, 3.0 ); 0064 // } 0065 // QPixmap cover( imagePath ); 0066 // m_image->setPixmap( cover ); 0067 // qreal width = static_cast<qreal>( cover.width() ); 0068 // qreal scale = COVER_WIDTH / width; 0069 // m_image->setScale( scale ); 0070 // } 0071 // } 0072 } 0073 0074 void AudioView2::changeEvent(QEvent *e) 0075 { 0076 QWidget::changeEvent(e); 0077 switch (e->type()) { 0078 case QEvent::LanguageChange: 0079 ui->retranslateUi(this); 0080 break; 0081 default: 0082 break; 0083 } 0084 } 0085 0086 } // namespace Dragon 0087 0088 #include "moc_audioView2.cpp"