From ffed2da98a14465350bd5e82046722fa1aa7a199 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Fri, 7 Aug 2009 17:57:44 +0000 Subject: added unified dialog api git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1110 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/flac/CMakeLists.txt | 10 +- src/plugins/Input/flac/detailsdialog.cpp | 96 +++------ src/plugins/Input/flac/detailsdialog.h | 19 +- src/plugins/Input/flac/detailsdialog.ui | 347 ------------------------------ src/plugins/Input/flac/flac.pro | 58 +++-- src/qmmp/CMakeLists.txt | 13 +- src/qmmp/abstractdetailsdialog.cpp | 145 +++++++++++++ src/qmmp/abstractdetailsdialog.h | 66 ++++++ src/qmmp/coverwidget.cpp | 46 ++++ src/qmmp/coverwidget.h | 50 +++++ src/qmmp/forms/abstractdetailsdialog.ui | 356 +++++++++++++++++++++++++++++++ src/qmmp/forms/coverwidget.cpp | 46 ---- src/qmmp/forms/coverwidget.h | 50 ----- src/qmmp/forms/detailsdialog.ui | 356 ------------------------------- src/qmmp/qmmp.pro | 9 +- 15 files changed, 750 insertions(+), 917 deletions(-) delete mode 100644 src/plugins/Input/flac/detailsdialog.ui create mode 100644 src/qmmp/abstractdetailsdialog.cpp create mode 100644 src/qmmp/abstractdetailsdialog.h create mode 100644 src/qmmp/coverwidget.cpp create mode 100644 src/qmmp/coverwidget.h create mode 100644 src/qmmp/forms/abstractdetailsdialog.ui delete mode 100644 src/qmmp/forms/coverwidget.cpp delete mode 100644 src/qmmp/forms/coverwidget.h delete mode 100644 src/qmmp/forms/detailsdialog.ui (limited to 'src') diff --git a/src/plugins/Input/flac/CMakeLists.txt b/src/plugins/Input/flac/CMakeLists.txt index a5a1d81e0..5a4694d97 100644 --- a/src/plugins/Input/flac/CMakeLists.txt +++ b/src/plugins/Input/flac/CMakeLists.txt @@ -56,20 +56,12 @@ QT4_ADD_RESOURCES(libflac_RCC_SRCS ${libflac_RCCS}) QT4_WRAP_CPP(libflac_MOC_SRCS ${libflac_MOC_HDRS}) -# user interface - - -SET(libflac_UIS - detailsdialog.ui -) - -QT4_WRAP_UI(libflac_UIS_H ${libflac_UIS}) # Don't forget to include output directory, otherwise # the UI file won't be wrapped! include_directories(${CMAKE_CURRENT_BINARY_DIR}) IF(FLAC_FOUND) -ADD_LIBRARY(flac MODULE ${libflac_SRCS} ${libflac_MOC_SRCS} ${libflac_UIS_H} ${libflac_RCC_SRCS}) +ADD_LIBRARY(flac MODULE ${libflac_SRCS} ${libflac_MOC_SRCS} ${libflac_RCC_SRCS}) add_dependencies(flac qmmp) target_link_libraries(flac ${QT_LIBRARIES} -lqmmp ${FLAC_LDFLAGS} ${FLAC_CFLAGS} ${TAGLIB_LDFLAGS} ${TAGLIB_CFLAGS}) install(TARGETS flac DESTINATION ${LIB_DIR}/qmmp/Input) diff --git a/src/plugins/Input/flac/detailsdialog.cpp b/src/plugins/Input/flac/detailsdialog.cpp index 2826b6cdb..a06b0778e 100644 --- a/src/plugins/Input/flac/detailsdialog.cpp +++ b/src/plugins/Input/flac/detailsdialog.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006 by Ilya Kotov * + * Copyright (C) 2006-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -27,92 +27,62 @@ #include "detailsdialog.h" #define QStringToTString_qt4(s) TagLib::String(s.toUtf8().constData(), TagLib::String::UTF8) +#define TStringToQString_qt4(s) QString::fromUtf8(s.toCString(TRUE)).trimmed() DetailsDialog::DetailsDialog(QWidget *parent, const QString &path) - : QDialog(parent) + : AbstractDetailsDialog(parent) { - ui.setupUi(this); - setAttribute(Qt::WA_DeleteOnClose); m_path = path; - setWindowTitle (path.section('/',-1)); - path.section('/',-1); - ui.pathLineEdit->setText(m_path); if (QFile::exists(m_path)) { loadFLACInfo(); - loadTag(); + loadTags(); + blockSaveButton(!QFileInfo(m_path).isWritable()); } + else + blockSaveButton(); } - DetailsDialog::~DetailsDialog() {} void DetailsDialog::loadFLACInfo() { TagLib::FLAC::File f (m_path.toLocal8Bit()); - //l.label - //ui. f.audioProperties()->level(); - QString text; - text = QString("%1").arg(f.audioProperties()->length()/60); + QMap ap; + QString text = QString("%1").arg(f.audioProperties()->length()/60); text +=":"+QString("%1").arg(f.audioProperties()->length()%60,2,10,QChar('0')); - ui.lengthLabel->setText(text); - text = QString("%1").arg(f.audioProperties()->sampleRate()); - ui.sampleRateLabel->setText(text+" "+tr("Hz")); - text = QString("%1").arg(f.audioProperties()->channels()); - ui.channelsLabel->setText(text); - text = QString("%1").arg(f.audioProperties()->bitrate()); - ui.bitrateLabel->setText(text+" "+tr("kbps")); - text = QString("%1").arg(f.audioProperties()->sampleWidth()); - ui.sampleWidthLabel->setText(text+" "+tr("bits")); - text = QString("%1 "+tr("KB")).arg(f.length()/1024); - ui.fileSizeLabel->setText(text); - + ap.insert(tr("Length"), text); + ap.insert(tr("Sample rate"), QString("%1 " + tr("Hz")).arg(f.audioProperties()->sampleRate())); + ap.insert(tr("Channels"), QString("%1").arg(f.audioProperties()->channels())); + ap.insert(tr("Bitrate"), QString("%1 " + tr("kbps")).arg(f.audioProperties()->bitrate())); + ap.insert(tr("Sample width"), QString("%1 "+tr("bits")).arg(f.audioProperties()->sampleWidth())); + ap.insert(tr("File size"), QString("%1 "+tr("KB")).arg(f.length()/1024)); + setAudioProperties(ap); } -void DetailsDialog::loadTag() +void DetailsDialog::loadTags() { TagLib::FileRef f (m_path.toLocal8Bit()); - - if (f.tag()) - { //TODO: load codec name from config - - TagLib::String title = f.tag()->title(); - TagLib::String artist = f.tag()->artist(); - TagLib::String album = f.tag()->album(); - TagLib::String comment = f.tag()->comment(); - TagLib::String genre = f.tag()->genre(); - QString string = QString::fromUtf8(title.toCString(TRUE)).trimmed(); - ui.titleLineEdit->setText(string); - string = QString::fromUtf8(artist.toCString(TRUE)).trimmed(); - ui.artistLineEdit->setText(string); - string = QString::fromUtf8(album.toCString(TRUE)).trimmed(); - ui.albumLineEdit->setText(string); - string = QString::fromUtf8(comment.toCString(TRUE)).trimmed(); - ui.commentLineEdit->setText(string); - string = QString("%1").arg(f.tag()->year()); - ui.yearLineEdit->setText(string); - string = QString("%1").arg(f.tag()->track()); - ui.trackLineEdit->setText(string); - string = QString::fromUtf8(genre.toCString(TRUE)).trimmed(); - ui.genreLineEdit->setText(string); - } - QFileInfo info(m_path); - ui.saveButton->setEnabled(info.isWritable()); - connect(ui.saveButton, SIGNAL(clicked()), SLOT(saveTag())); + setMetaData(Qmmp::TITLE, TStringToQString_qt4(f.tag()->title())); + setMetaData(Qmmp::ARTIST, TStringToQString_qt4(f.tag()->artist())); + setMetaData(Qmmp::ALBUM, TStringToQString_qt4(f.tag()->album())); + setMetaData(Qmmp::COMMENT, TStringToQString_qt4(f.tag()->comment())); + setMetaData(Qmmp::GENRE, TStringToQString_qt4(f.tag()->genre())); + setMetaData(Qmmp::YEAR, f.tag()->year()); + setMetaData(Qmmp::TRACK, f.tag()->track()); + setMetaData(Qmmp::URL, m_path); } -void DetailsDialog::saveTag() +void DetailsDialog::writeTags() { TagLib::FileRef f (m_path.toLocal8Bit()); - - f.tag()->setTitle(QStringToTString_qt4(ui.titleLineEdit->text())); - f.tag()->setArtist(QStringToTString_qt4(ui.artistLineEdit->text())); - f.tag()->setAlbum(QStringToTString_qt4(ui.albumLineEdit->text())); - f.tag()->setComment(QStringToTString_qt4(ui.commentLineEdit->text())); - f.tag()->setGenre(QStringToTString_qt4(ui.genreLineEdit->text())); - f.tag()->setYear(ui.yearLineEdit->text().toUInt()); - f.tag()->setTrack(ui.trackLineEdit->text().toUInt()); - + f.tag()->setTitle(QStringToTString_qt4(strMetaData(Qmmp::TITLE))); + f.tag()->setArtist(QStringToTString_qt4(strMetaData(Qmmp::ARTIST))); + f.tag()->setAlbum(QStringToTString_qt4(strMetaData(Qmmp::ALBUM))); + f.tag()->setComment(QStringToTString_qt4(strMetaData(Qmmp::COMMENT))); + f.tag()->setGenre(QStringToTString_qt4(strMetaData(Qmmp::GENRE))); + f.tag()->setYear(intMetaData(Qmmp::YEAR)); + f.tag()->setTrack(intMetaData(Qmmp::TRACK)); f.save(); } diff --git a/src/plugins/Input/flac/detailsdialog.h b/src/plugins/Input/flac/detailsdialog.h index 80c17544c..97069306a 100644 --- a/src/plugins/Input/flac/detailsdialog.h +++ b/src/plugins/Input/flac/detailsdialog.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Ilya Kotov * - * forkotov02@hotmail.ru * + * Copyright (C) 2006-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 * @@ -20,14 +20,12 @@ #ifndef DETAILSDIALOG_H #define DETAILSDIALOG_H -#include - -#include "ui_detailsdialog.h" +#include /** @author Ilya Kotov */ -class DetailsDialog : public QDialog +class DetailsDialog : public AbstractDetailsDialog { Q_OBJECT public: @@ -35,13 +33,10 @@ public: ~DetailsDialog(); -private slots: - void saveTag(); - -private: +private: void loadFLACInfo(); - void loadTag(); - Ui::DetailsDialog ui; + void loadTags(); + void writeTags(); QString m_path; }; diff --git a/src/plugins/Input/flac/detailsdialog.ui b/src/plugins/Input/flac/detailsdialog.ui deleted file mode 100644 index c796248ca..000000000 --- a/src/plugins/Input/flac/detailsdialog.ui +++ /dev/null @@ -1,347 +0,0 @@ - - DetailsDialog - - - - 0 - 0 - 545 - 374 - - - - Details - - - - - - File path: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - - - - - 0 - 16 - - - - FLAC Info - - - - 8 - - - 8 - - - 8 - - - 8 - - - 6 - - - 6 - - - - - Qt::Vertical - - - - 74 - 151 - - - - - - - - - - - - - - - - Length: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - Sample rate: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - Qt::LeftToRight - - - Channels: - - - Qt::PlainText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - File size: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Bitrate: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::LeftToRight - - - - - - - - - - - - - - - - - - - Sample width: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - FLAC Tag - - - - - - Title: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - Artist: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - Album: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - Comment: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - Year: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - Track number: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - Genre: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - false - - - Save - - - - - - - - - - Qt::Horizontal - - - - 111 - 20 - - - - - - - - Close - - - - - - - - - pushButton_3 - clicked() - DetailsDialog - close() - - - 623 - 353 - - - 539 - 352 - - - - - diff --git a/src/plugins/Input/flac/flac.pro b/src/plugins/Input/flac/flac.pro index 15bd4b537..3f13de9c0 100644 --- a/src/plugins/Input/flac/flac.pro +++ b/src/plugins/Input/flac/flac.pro @@ -1,42 +1,38 @@ include(../../plugins.pri) - -FORMS += detailsdialog.ui +FORMS += HEADERS += decoderflacfactory.h \ - decoder_flac.h \ - detailsdialog.h \ - cueparser.h + decoder_flac.h \ + detailsdialog.h \ + cueparser.h SOURCES += decoder_flac.cpp \ - decoderflacfactory.cpp \ - detailsdialog.cpp \ - cueparser.cpp - -TARGET =$$PLUGINS_PREFIX/Input/flac -QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libflac.so - + decoderflacfactory.cpp \ + detailsdialog.cpp \ + cueparser.cpp +TARGET = $$PLUGINS_PREFIX/Input/flac +QMAKE_CLEAN = $$PLUGINS_PREFIX/Input/libflac.so INCLUDEPATH += ../../../ CONFIG += release \ -warn_on \ -plugin \ -link_pkgconfig + warn_on \ + plugin \ + link_pkgconfig TEMPLATE = lib QMAKE_LIBDIR += ../../../../lib -LIBS += -lqmmp -L/usr/lib -I/usr/include -PKGCONFIG += taglib flac +LIBS += -lqmmp \ + -L/usr/lib \ + -I/usr/include +PKGCONFIG += taglib \ + flac TRANSLATIONS = translations/flac_plugin_ru.ts \ - translations/flac_plugin_uk_UA.ts \ - translations/flac_plugin_zh_CN.ts \ - translations/flac_plugin_zh_TW.ts \ - translations/flac_plugin_cs.ts \ - translations/flac_plugin_pl.ts \ - translations/flac_plugin_de.ts \ - translations/flac_plugin_it.ts \ - translations/flac_plugin_tr.ts \ - translations/flac_plugin_lt.ts + translations/flac_plugin_uk_UA.ts \ + translations/flac_plugin_zh_CN.ts \ + translations/flac_plugin_zh_TW.ts \ + translations/flac_plugin_cs.ts \ + translations/flac_plugin_pl.ts \ + translations/flac_plugin_de.ts \ + translations/flac_plugin_it.ts \ + translations/flac_plugin_tr.ts \ + translations/flac_plugin_lt.ts RESOURCES = translations/translations.qrc - -isEmpty(LIB_DIR){ - LIB_DIR = /lib -} +isEmpty(LIB_DIR):LIB_DIR = /lib target.path = $$LIB_DIR/qmmp/Input INSTALLS += target - diff --git a/src/qmmp/CMakeLists.txt b/src/qmmp/CMakeLists.txt index fe71f1b17..ffd8e973c 100644 --- a/src/qmmp/CMakeLists.txt +++ b/src/qmmp/CMakeLists.txt @@ -52,6 +52,8 @@ SET(libqmmp_SRCS qmmp.cpp statehandler.cpp volumecontrol.cpp + abstractdetailsdialog.cpp + coverwidget.cpp ) SET(libqmmp_MOC_HDRS @@ -74,6 +76,8 @@ SET(libqmmp_MOC_HDRS qmmp.h statehandler.h volumecontrol.h + abstractdetailsdialog.h + coverwidget.h ) SET(libqmmp_DEVEL_HDRS @@ -92,14 +96,21 @@ SET(libqmmp_DEVEL_HDRS visualfactory.h visual.h volumecontrol.h + abstractdetailsdialog.h ) +SET(qmmp_UIS + forms/abstractdetailsdialog.ui +) QT4_WRAP_CPP(libqmmp_MOC_SRCS ${libqmmp_MOC_HDRS}) +QT4_WRAP_UI(qmmp_UIS_H ${qmmp_UIS}) +# Don't forget to include output directory, otherwise +# the UI file won't be wrapped! include_directories(${CMAKE_CURRENT_BINARY_DIR}) -ADD_LIBRARY(libqmmp SHARED ${libqmmp_SRCS} ${libqmmp_MOC_SRCS}) +ADD_LIBRARY(libqmmp SHARED ${libqmmp_SRCS} ${libqmmp_MOC_SRCS} ${qmmp_UIS_H}) target_link_libraries(libqmmp ${QT_LIBRARIES} ${CURL_LDFLAGS} ${CURL_CFLAGS}) SET_TARGET_PROPERTIES(libqmmp PROPERTIES VERSION ${QMMP_VERSION} SOVERSION ${QMMP_SOVERSION} OUTPUT_NAME qmmp) install(TARGETS libqmmp LIBRARY DESTINATION ${LIB_DIR} diff --git a/src/qmmp/abstractdetailsdialog.cpp b/src/qmmp/abstractdetailsdialog.cpp new file mode 100644 index 000000000..4840e200f --- /dev/null +++ b/src/qmmp/abstractdetailsdialog.cpp @@ -0,0 +1,145 @@ +/*************************************************************************** + * 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 + +#include "ui_abstractdetailsdialog.h" +#include "abstractdetailsdialog.h" + +AbstractDetailsDialog::AbstractDetailsDialog(QWidget *parent) + : QDialog(parent) +{ + ui = new Ui::AbstractDetailsDialog(); + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + connect(ui->buttonBox, SIGNAL(clicked (QAbstractButton *)),SLOT(processButton(QAbstractButton *))); +} + +AbstractDetailsDialog::~AbstractDetailsDialog() +{ + delete ui; +} + +void AbstractDetailsDialog::hideSaveButton(bool hide) +{ + ui->buttonBox->button(QDialogButtonBox::Save)->setHidden(hide); +} + +void AbstractDetailsDialog::blockSaveButton(bool block) +{ + ui->buttonBox->button(QDialogButtonBox::Save)->setDisabled(block); +} + +void AbstractDetailsDialog::setMetaData(Qmmp::MetaData key, const QString &value) +{ + switch((int) key) + { + case Qmmp::TITLE: + ui->titleLineEdit->setText(value); + break; + case Qmmp::ARTIST: + ui->artistLineEdit->setText(value); + break; + case Qmmp::ALBUM: + ui->albumLineEdit->setText(value); + break; + case Qmmp::COMMENT: + ui->commentBrowser->setPlainText(value); + break; + case Qmmp::GENRE: + ui->genreLineEdit->setText(value); + break; + case Qmmp::YEAR: + ui->yearSpinBox->setValue(value.toInt()); + break; + case Qmmp::TRACK: + ui->trackSpinBox->setValue(value.toInt()); + break; + case Qmmp::URL: + ui->pathLineEdit->setText(value); + setWindowTitle (value.section('/',-1)); + } +} + +void AbstractDetailsDialog::writeTags() +{ + +} + +void AbstractDetailsDialog::setMetaData(Qmmp::MetaData key, int value) +{ + setMetaData(key, QString("%1").arg(value)); +} + +void AbstractDetailsDialog::setAudioProperties(QMap p) +{ + QString formattedText; + formattedText.append(""); + foreach(QString key, p.keys()) + { + formattedText.append(""); + formattedText.append(""); + formattedText.append(""); + } + formattedText.append("
" + key + ": " + + p.value(key) + "
"); + ui->propertiesLabel->setText(formattedText); +} + +void AbstractDetailsDialog::processButton(QAbstractButton *button) +{ + switch((int) ui->buttonBox->standardButton(button)) + { + case QDialogButtonBox::Close: + close(); + break; + case QDialogButtonBox::Save: + writeTags(); + break; + } +} + +const QString AbstractDetailsDialog::strMetaData(Qmmp::MetaData key) +{ + switch((int) key) + { + case Qmmp::TITLE: + return ui->titleLineEdit->text(); + case Qmmp::ARTIST: + return ui->artistLineEdit->text(); + case Qmmp::ALBUM: + return ui->albumLineEdit->text(); + case Qmmp::COMMENT: + return ui->commentBrowser->toPlainText(); + case Qmmp::GENRE: + return ui->genreLineEdit->text(); + case Qmmp::YEAR: + return QString("%1").arg(ui->yearSpinBox->value()); + case Qmmp::TRACK: + return QString("%1").arg(ui->trackSpinBox->value()); + case Qmmp::URL: + return ui->pathLineEdit->text(); + } +} + +int AbstractDetailsDialog::intMetaData(Qmmp::MetaData key) +{ + return strMetaData(key).toInt(); +} diff --git a/src/qmmp/abstractdetailsdialog.h b/src/qmmp/abstractdetailsdialog.h new file mode 100644 index 000000000..372b49fd7 --- /dev/null +++ b/src/qmmp/abstractdetailsdialog.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * 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 ABSTRACTDETAILSDIALOG_H +#define ABSTRACTDETAILSDIALOG_H + +#include +#include + +#include "qmmp.h" + +/** + @author Ilya Kotov +*/ + +namespace Ui +{ + class AbstractDetailsDialog; +} +class QAbstractButton; + +class AbstractDetailsDialog : public QDialog +{ + Q_OBJECT +public: + AbstractDetailsDialog(QWidget *parent = 0); + + ~AbstractDetailsDialog(); + + void hideSaveButton(bool hide = TRUE); + void blockSaveButton(bool block = TRUE); + +protected: + virtual void writeTags(); + + void setMetaData(Qmmp::MetaData key, const QString &value); + void setMetaData(Qmmp::MetaData key, int value); + void setAudioProperties(QMap p); + const QString strMetaData(Qmmp::MetaData key); + int intMetaData(Qmmp::MetaData key); + +private slots: + void processButton(QAbstractButton *); + +private: + Ui::AbstractDetailsDialog *ui; + +}; + +#endif diff --git a/src/qmmp/coverwidget.cpp b/src/qmmp/coverwidget.cpp new file mode 100644 index 000000000..88379ad50 --- /dev/null +++ b/src/qmmp/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 +#include +#include + +#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/qmmp/coverwidget.h b/src/qmmp/coverwidget.h new file mode 100644 index 000000000..b06e66f7e --- /dev/null +++ b/src/qmmp/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 +#include + +/** + @author Ilya Kotov +*/ + +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/qmmp/forms/abstractdetailsdialog.ui b/src/qmmp/forms/abstractdetailsdialog.ui new file mode 100644 index 000000000..6ee0bbe17 --- /dev/null +++ b/src/qmmp/forms/abstractdetailsdialog.ui @@ -0,0 +1,356 @@ + + + AbstractDetailsDialog + + + + 0 + 0 + 608 + 362 + + + + Dialog + + + + + + + + + + 0 + 0 + + + + + 110 + 110 + + + + + 110 + 110 + + + + + + + + Metadata + + + + + + + 0 + 0 + + + + Title: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + Artist: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + Album: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + QLayout::SetDefaultConstraint + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + Disc number: + + + + + + + ? + + + + + + + + + Composer: + + + + + + + + + + + 0 + 0 + + + + Genre: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + Track: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + 0 + 0 + + + + ? + + + + + + + + 0 + 0 + + + + Year: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + ? + + + + + + 2012 + + + + + + + + + + 0 + 0 + + + + Comment: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + false + + + <!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> + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Audio Properties + + + + + + - + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + + + Qt::Horizontal + + + + 192 + 23 + + + + + + + + QDialogButtonBox::Close|QDialogButtonBox::Save + + + + + + + + CoverWidget + QWidget +
coverwidget.h
+ 1 +
+
+ + +
diff --git a/src/qmmp/forms/coverwidget.cpp b/src/qmmp/forms/coverwidget.cpp deleted file mode 100644 index 88379ad50..000000000 --- a/src/qmmp/forms/coverwidget.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - * 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 -#include -#include - -#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/qmmp/forms/coverwidget.h b/src/qmmp/forms/coverwidget.h deleted file mode 100644 index b06e66f7e..000000000 --- a/src/qmmp/forms/coverwidget.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * 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 -#include - -/** - @author Ilya Kotov -*/ - -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/qmmp/forms/detailsdialog.ui b/src/qmmp/forms/detailsdialog.ui deleted file mode 100644 index 6e04cb615..000000000 --- a/src/qmmp/forms/detailsdialog.ui +++ /dev/null @@ -1,356 +0,0 @@ - - - DetailsDialog - - - - 0 - 0 - 608 - 362 - - - - Dialog - - - - - - - - - - 0 - 0 - - - - - 110 - 110 - - - - - 110 - 110 - - - - - - - - Metadata - - - - - - - 0 - 0 - - - - Title: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - Artist: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - Album: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - QLayout::SetDefaultConstraint - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - Disc number: - - - - - - - ? - - - - - - - - - Composer: - - - - - - - - - - - 0 - 0 - - - - Genre: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - Track: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - 0 - 0 - - - - ? - - - - - - - - 0 - 0 - - - - Year: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - ? - - - - - - 2012 - - - - - - - - - - 0 - 0 - - - - Comment: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - false - - - <!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> - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Audio Properties - - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - - - Qt::Horizontal - - - - 192 - 23 - - - - - - - - QDialogButtonBox::Close|QDialogButtonBox::Save - - - - - - - - CoverWidget - QWidget -
coverwidget.h
- 1 -
-
- - -
diff --git a/src/qmmp/qmmp.pro b/src/qmmp/qmmp.pro index 787c77d2f..05a84806a 100644 --- a/src/qmmp/qmmp.pro +++ b/src/qmmp/qmmp.pro @@ -19,7 +19,9 @@ HEADERS += recycler.h \ statehandler.h \ qmmp.h \ fileinfo.h \ - volumecontrol.h + volumecontrol.h \ + coverwidget.h \ + abstractdetailsdialog.h SOURCES += recycler.cpp \ decoder.cpp \ output.cpp \ @@ -34,7 +36,10 @@ SOURCES += recycler.cpp \ statehandler.cpp \ qmmp.cpp \ fileinfo.cpp \ - volumecontrol.cpp + volumecontrol.cpp \ + coverwidget.cpp \ + abstractdetailsdialog.cpp +FORMS += forms/abstractdetailsdialog.ui unix:TARGET = ../../lib/qmmp win32:TARGET = ../../../bin/qmmp CONFIG += release \ -- cgit v1.2.3-13-gbd6f