diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-07-30 18:52:11 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-07-30 18:52:11 +0000 |
| commit | 70d66cdcd5f97ad6cb7e697423edf35883eaa65c (patch) | |
| tree | 25cc3f7cdb90c673d85f545e679fad826b3d541d /src/plugins | |
| parent | 13fddbc568dd417063dd360928f0ec8858274577 (diff) | |
| download | qmmp-70d66cdcd5f97ad6cb7e697423edf35883eaa65c.tar.gz qmmp-70d66cdcd5f97ad6cb7e697423edf35883eaa65c.tar.bz2 qmmp-70d66cdcd5f97ad6cb7e697423edf35883eaa65c.zip | |
added partial cover support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1088 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/Input/mad/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/plugins/Input/mad/coverwidget.cpp | 46 | ||||
| -rw-r--r-- | src/plugins/Input/mad/coverwidget.h | 50 | ||||
| -rw-r--r-- | src/plugins/Input/mad/detailsdialog.cpp | 15 | ||||
| -rw-r--r-- | src/plugins/Input/mad/detailsdialog.h | 1 | ||||
| -rw-r--r-- | src/plugins/Input/mad/detailsdialog.ui | 75 | ||||
| -rw-r--r-- | src/plugins/Input/mad/mad.pro | 8 |
7 files changed, 161 insertions, 36 deletions
diff --git a/src/plugins/Input/mad/CMakeLists.txt b/src/plugins/Input/mad/CMakeLists.txt index 1167005fd..bc08f3c74 100644 --- a/src/plugins/Input/mad/CMakeLists.txt +++ b/src/plugins/Input/mad/CMakeLists.txt @@ -38,6 +38,7 @@ SET(libmad_SRCS detailsdialog.cpp settingsdialog.cpp tagextractor.cpp + coverwidget.cpp ) SET(libmad_MOC_HDRS @@ -46,6 +47,7 @@ SET(libmad_MOC_HDRS decoder_mad.h detailsdialog.h tagextractor.h + coverwidget.h ) SET(libmad_RCCS translations/translations.qrc) diff --git a/src/plugins/Input/mad/coverwidget.cpp b/src/plugins/Input/mad/coverwidget.cpp new file mode 100644 index 000000000..88379ad50 --- /dev/null +++ b/src/plugins/Input/mad/coverwidget.cpp @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2009 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * 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. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include <QPixmap> +#include <QPainter> +#include <QPaintEvent> + +#include "coverwidget.h" + +CoverWidget::CoverWidget(QWidget *parent) + : QWidget(parent) +{} + + +CoverWidget::~CoverWidget() +{} + +void CoverWidget::setPixmap(const QPixmap &pixmap) +{ + m_pixmap = pixmap; + update(); +} + +void CoverWidget::paintEvent (QPaintEvent *p) +{ + QPainter paint(this); + if(!m_pixmap.isNull()) + paint.drawPixmap(0,0, m_pixmap.scaled(p->rect().size())); +} + diff --git a/src/plugins/Input/mad/coverwidget.h b/src/plugins/Input/mad/coverwidget.h new file mode 100644 index 000000000..b06e66f7e --- /dev/null +++ b/src/plugins/Input/mad/coverwidget.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2009 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * 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. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef PIXMAPWIDGET_H +#define PIXMAPWIDGET_H + +#include <QWidget> +#include <QPixmap> + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ + +class CoverWidget : public QWidget +{ +Q_OBJECT +public: + CoverWidget(QWidget *parent = 0); + + ~CoverWidget(); + + virtual void setPixmap(const QPixmap&); + +protected: + void paintEvent (QPaintEvent *event); + +private: + QPixmap m_pixmap; + + + +}; + +#endif diff --git a/src/plugins/Input/mad/detailsdialog.cpp b/src/plugins/Input/mad/detailsdialog.cpp index 0b4f3a051..64f6088e9 100644 --- a/src/plugins/Input/mad/detailsdialog.cpp +++ b/src/plugins/Input/mad/detailsdialog.cpp @@ -92,6 +92,7 @@ DetailsDialog::DetailsDialog(QWidget *parent, const QString &path) m_inputs << ui.yearLineEdit; m_inputs << ui.trackLineEdit; m_inputs << ui.genreLineEdit; + ui.coverWidget->setPixmap(findCover(path)); } @@ -341,3 +342,17 @@ void DetailsDialog::showAudioProperties(QMap <QString, QString> p) formattedText.append("</TABLE>"); ui.propertiesLabel->setText(formattedText); } + +QPixmap DetailsDialog::findCover(const QString &path) +{ + QString p = QFileInfo(path).absolutePath(); + QDir dir(p); + dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks); + dir.setSorting(QDir::Name); + QStringList filters; + filters << "*.jpg" << "*.png"; + QFileInfoList file_list = dir.entryInfoList(filters); + if(!file_list.isEmpty()) + return QPixmap (file_list.at(0).absoluteFilePath()); + return QPixmap(); +} diff --git a/src/plugins/Input/mad/detailsdialog.h b/src/plugins/Input/mad/detailsdialog.h index e98c4f469..98c8bedd9 100644 --- a/src/plugins/Input/mad/detailsdialog.h +++ b/src/plugins/Input/mad/detailsdialog.h @@ -50,6 +50,7 @@ private slots: void loadTag(); private: + QPixmap findCover(const QString &path); void loadMPEGInfo(); uint selectedTag(); void showAudioProperties(QMap <QString, QString> p); diff --git a/src/plugins/Input/mad/detailsdialog.ui b/src/plugins/Input/mad/detailsdialog.ui index d8893621f..c4cd5ab8a 100644 --- a/src/plugins/Input/mad/detailsdialog.ui +++ b/src/plugins/Input/mad/detailsdialog.ui @@ -26,38 +26,6 @@ <item row="0" column="0" colspan="4"> <widget class="QLineEdit" name="pathLineEdit"/> </item> - <item row="1" column="0"> - <widget class="QToolButton" name="toolButton"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="minimumSize"> - <size> - <width>110</width> - <height>110</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>110</width> - <height>110</height> - </size> - </property> - <property name="text"> - <string>...</string> - </property> - <property name="icon"> - <iconset> - <normaloff>:/crematory.jpg</normaloff>:/crematory.jpg</iconset> - </property> - <property name="iconSize"> - <size> - <width>100</width> - <height>100</height> - </size> - </property> - </widget> - </item> <item row="1" column="1"> <widget class="QGroupBox" name="groupBox"> <property name="title"> @@ -95,7 +63,18 @@ </property> <layout class="QGridLayout" name="gridLayout_3"> <item row="7" column="4" colspan="3"> - <widget class="QTextBrowser" name="commentBrowser"/> + <widget class="QTextBrowser" name="commentBrowser"> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="html"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html></string> + </property> + </widget> </item> <item row="5" column="6"> <widget class="QLineEdit" name="trackLineEdit"> @@ -364,8 +343,38 @@ </property> </widget> </item> + <item row="1" column="0"> + <widget class="CoverWidget" name="coverWidget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>110</width> + <height>110</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>110</width> + <height>110</height> + </size> + </property> + </widget> + </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>CoverWidget</class> + <extends>QWidget</extends> + <header>coverwidget.h</header> + <container>1</container> + </customwidget> + </customwidgets> <resources/> <connections> <connection> diff --git a/src/plugins/Input/mad/mad.pro b/src/plugins/Input/mad/mad.pro index b48885c3b..ac3f9fd01 100644 --- a/src/plugins/Input/mad/mad.pro +++ b/src/plugins/Input/mad/mad.pro @@ -2,17 +2,19 @@ include(../../plugins.pri) FORMS += detailsdialog.ui \ - settingsdialog.ui + settingsdialog.ui HEADERS += decodermadfactory.h \ decoder_mad.h \ detailsdialog.h \ settingsdialog.h \ - tagextractor.h + tagextractor.h \ + coverwidget.h SOURCES += decoder_mad.cpp \ decodermadfactory.cpp \ detailsdialog.cpp \ settingsdialog.cpp \ - tagextractor.cpp + tagextractor.cpp \ + coverwidget.cpp TARGET =$$PLUGINS_PREFIX/Input/mad unix:QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libmad.so |
