aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-08-07 17:57:44 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-08-07 17:57:44 +0000
commitffed2da98a14465350bd5e82046722fa1aa7a199 (patch)
tree86400075b7eeb8917bcab67481c040bf4ce7d554
parent00178e429588dc76b467377eed3d20f48a389476 (diff)
downloadqmmp-ffed2da98a14465350bd5e82046722fa1aa7a199.tar.gz
qmmp-ffed2da98a14465350bd5e82046722fa1aa7a199.tar.bz2
qmmp-ffed2da98a14465350bd5e82046722fa1aa7a199.zip
added unified dialog api
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1110 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--src/plugins/Input/flac/CMakeLists.txt10
-rw-r--r--src/plugins/Input/flac/detailsdialog.cpp96
-rw-r--r--src/plugins/Input/flac/detailsdialog.h19
-rw-r--r--src/plugins/Input/flac/detailsdialog.ui347
-rw-r--r--src/plugins/Input/flac/flac.pro58
-rw-r--r--src/qmmp/CMakeLists.txt13
-rw-r--r--src/qmmp/abstractdetailsdialog.cpp145
-rw-r--r--src/qmmp/abstractdetailsdialog.h66
-rw-r--r--src/qmmp/coverwidget.cpp (renamed from src/qmmp/forms/coverwidget.cpp)0
-rw-r--r--src/qmmp/coverwidget.h (renamed from src/qmmp/forms/coverwidget.h)0
-rw-r--r--src/qmmp/forms/abstractdetailsdialog.ui (renamed from src/qmmp/forms/detailsdialog.ui)4
-rw-r--r--src/qmmp/qmmp.pro9
12 files changed, 300 insertions, 467 deletions
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 <QString, QString> 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 <QDialog>
-
-#include "ui_detailsdialog.h"
+#include <qmmp/abstractdetailsdialog.h>
/**
@author Ilya Kotov <forkotov02@hotmail.ru>
*/
-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 @@
-<ui version="4.0" >
- <class>DetailsDialog</class>
- <widget class="QDialog" name="DetailsDialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>545</width>
- <height>374</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Details</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_28" >
- <property name="text" >
- <string>File path:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="3" >
- <widget class="QLineEdit" name="pathLineEdit" >
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item rowspan="2" row="1" column="0" colspan="2" >
- <widget class="QGroupBox" name="groupBox" >
- <property name="minimumSize" >
- <size>
- <width>0</width>
- <height>16</height>
- </size>
- </property>
- <property name="title" >
- <string>FLAC Info</string>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>8</number>
- </property>
- <property name="topMargin" >
- <number>8</number>
- </property>
- <property name="rightMargin" >
- <number>8</number>
- </property>
- <property name="bottomMargin" >
- <number>8</number>
- </property>
- <property name="horizontalSpacing" >
- <number>6</number>
- </property>
- <property name="verticalSpacing" >
- <number>6</number>
- </property>
- <item row="6" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>74</width>
- <height>151</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="1" colspan="2" >
- <widget class="QLabel" name="fileSizeLabel" >
- <property name="text" >
- <string>-</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Length:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2" >
- <widget class="QLabel" name="lengthLabel" >
- <property name="text" >
- <string>-</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
- <string>Sample rate:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1" colspan="2" >
- <widget class="QLabel" name="sampleRateLabel" >
- <property name="text" >
- <string>-</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_10" >
- <property name="layoutDirection" >
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text" >
- <string>Channels:</string>
- </property>
- <property name="textFormat" >
- <enum>Qt::PlainText</enum>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_5" >
- <property name="text" >
- <string>File size:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>Bitrate:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="2" >
- <widget class="QLabel" name="channelsLabel" >
- <property name="layoutDirection" >
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text" >
- <string>-</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1" colspan="2" >
- <widget class="QLabel" name="bitrateLabel" >
- <property name="text" >
- <string>-</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0" >
- <widget class="QLabel" name="label_4" >
- <property name="text" >
- <string>Sample width:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="1" colspan="2" >
- <widget class="QLabel" name="sampleWidthLabel" >
- <property name="text" >
- <string>-</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="2" colspan="2" >
- <widget class="QGroupBox" name="groupBox_2" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title" >
- <string>FLAC Tag</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_21" >
- <property name="text" >
- <string>Title:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="3" >
- <widget class="QLineEdit" name="titleLineEdit" />
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_22" >
- <property name="text" >
- <string>Artist:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1" colspan="3" >
- <widget class="QLineEdit" name="artistLineEdit" />
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_23" >
- <property name="text" >
- <string>Album:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="3" >
- <widget class="QLineEdit" name="albumLineEdit" />
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_24" >
- <property name="text" >
- <string>Comment:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="3" >
- <widget class="QLineEdit" name="commentLineEdit" />
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_25" >
- <property name="text" >
- <string>Year:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="1" >
- <widget class="QLineEdit" name="yearLineEdit" />
- </item>
- <item row="4" column="2" >
- <widget class="QLabel" name="label_26" >
- <property name="text" >
- <string>Track number:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="3" >
- <widget class="QLineEdit" name="trackLineEdit" />
- </item>
- <item row="5" column="0" >
- <widget class="QLabel" name="label_27" >
- <property name="text" >
- <string>Genre:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="1" colspan="2" >
- <widget class="QLineEdit" name="genreLineEdit" />
- </item>
- <item row="6" column="1" >
- <widget class="QPushButton" name="saveButton" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="text" >
- <string>Save</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="2" column="2" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>111</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="3" >
- <widget class="QPushButton" name="pushButton_3" >
- <property name="text" >
- <string>Close</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>pushButton_3</sender>
- <signal>clicked()</signal>
- <receiver>DetailsDialog</receiver>
- <slot>close()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>623</x>
- <y>353</y>
- </hint>
- <hint type="destinationlabel" >
- <x>539</x>
- <y>352</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
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 <QPushButton>
+
+#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 <QString, QString> p)
+{
+ QString formattedText;
+ formattedText.append("<TABLE>");
+ foreach(QString key, p.keys())
+ {
+ formattedText.append("<tr>");
+ formattedText.append("<td>" + key + ":</td> <td style=\"padding-left: 5px; \"><b>"
+ + p.value(key) + "</b></td>");
+ formattedText.append("</tr>");
+ }
+ formattedText.append("</TABLE>");
+ 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 <QDialog>
+#include <QMap>
+
+#include "qmmp.h"
+
+/**
+ @author Ilya Kotov <forkotov02@hotmail.ru>
+*/
+
+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 <QString, QString> 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/forms/coverwidget.cpp b/src/qmmp/coverwidget.cpp
index 88379ad50..88379ad50 100644
--- a/src/qmmp/forms/coverwidget.cpp
+++ b/src/qmmp/coverwidget.cpp
diff --git a/src/qmmp/forms/coverwidget.h b/src/qmmp/coverwidget.h
index b06e66f7e..b06e66f7e 100644
--- a/src/qmmp/forms/coverwidget.h
+++ b/src/qmmp/coverwidget.h
diff --git a/src/qmmp/forms/detailsdialog.ui b/src/qmmp/forms/abstractdetailsdialog.ui
index 6e04cb615..6ee0bbe17 100644
--- a/src/qmmp/forms/detailsdialog.ui
+++ b/src/qmmp/forms/abstractdetailsdialog.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>DetailsDialog</class>
- <widget class="QDialog" name="DetailsDialog">
+ <class>AbstractDetailsDialog</class>
+ <widget class="QDialog" name="AbstractDetailsDialog">
<property name="geometry">
<rect>
<x>0</x>
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 \