added a small fileinfo dialog to the playlistwidget
This commit is contained in:
parent
0369b3aa37
commit
8dc34b1759
9 changed files with 406 additions and 6 deletions
|
|
@ -1,10 +1,13 @@
|
|||
HEADERS += playlistchooser.h \
|
||||
HEADERS += entryinfo.h \
|
||||
playlistchooser.h \
|
||||
urlopen.h
|
||||
|
||||
SOURCES += playlistchooser.cpp \
|
||||
SOURCES += entryinfo.cpp \
|
||||
playlistchooser.cpp \
|
||||
urlopen.cpp
|
||||
|
||||
FORMS += playlistchooser.ui \
|
||||
FORMS += entryinfo.ui \
|
||||
playlistchooser.ui \
|
||||
urlopen.ui
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
|
|
|
|||
84
src/dialogs/entryinfo.cpp
Normal file
84
src/dialogs/entryinfo.cpp
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* This file is a part of promoe, an XMMS2 client
|
||||
*
|
||||
* Copyright (C) 2008 Thomas Frauendorfer
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "xclientcache.h"
|
||||
|
||||
#include "entryinfo.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
EntryInfo::EntryInfo (QWidget *paren, XClientCache *cache, uint32_t id)
|
||||
{
|
||||
setupUi (this);
|
||||
setAttribute (Qt::WA_DeleteOnClose);
|
||||
|
||||
m_cache = cache;
|
||||
m_id = id;
|
||||
|
||||
connect (cache, SIGNAL (entryChanged (uint32_t)),
|
||||
this, SLOT (mlib_entry_changed (uint32_t)));
|
||||
|
||||
connect (cache, SIGNAL (entryRemoved (uint32_t)),
|
||||
this, SLOT (mlib_entry_removed (uint32_t)));
|
||||
|
||||
getInfo ();
|
||||
}
|
||||
|
||||
void
|
||||
EntryInfo::getInfo ()
|
||||
{
|
||||
QHash<QString, QVariant> tmp = m_cache->get_info (m_id);
|
||||
|
||||
//FIXME "url" value ist wrong. tight be an error in clientcache
|
||||
filenameEdit->setText (tmp.value ("url").toString ());
|
||||
titleEdit->setText (tmp.value ("title").toString ());
|
||||
artistEdit->setText (tmp.value ("artist").toString ());
|
||||
albumEdit->setText (tmp.value ("album").toString ());
|
||||
// commentEdit->setText ();
|
||||
yearEdit->setText (tmp.value ("date").toString ());
|
||||
trackEdit->setText (tmp.value ("tracknr").toString ());
|
||||
genreEdit->setText (tmp.value ("genre").toString ());
|
||||
}
|
||||
|
||||
void
|
||||
EntryInfo::setId (uint32_t id)
|
||||
{
|
||||
m_id = id;
|
||||
getInfo ();
|
||||
}
|
||||
|
||||
void
|
||||
EntryInfo::mlib_entry_changed (uint32_t id)
|
||||
{
|
||||
if (id == m_id) {
|
||||
// the metadata for the current entry changed,
|
||||
// so we update the dialog to display the current values
|
||||
// TODO: think of a good way to handle changed values as soon as
|
||||
// we allow editing of metadata
|
||||
getInfo ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EntryInfo::mlib_entry_removed (uint32_t id)
|
||||
{
|
||||
// if the mlib no longer contains our item, we have to remove it
|
||||
if (id == m_id) {
|
||||
close ();
|
||||
}
|
||||
}
|
||||
46
src/dialogs/entryinfo.h
Normal file
46
src/dialogs/entryinfo.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* This file is a part of Promoe, an XMMS2 client
|
||||
*
|
||||
* Copyright (C) 2008 Thomas Frauendorfer
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __ENTRYINFO_H__
|
||||
#define __ENTRYINFO_H__
|
||||
|
||||
#include "ui_entryinfo.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class XClientCache;
|
||||
|
||||
class EntryInfo : public QDialog, private Ui::EntryInfo {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EntryInfo (QWidget *parent, XClientCache *cache, uint32_t id = 0);
|
||||
|
||||
public slots:
|
||||
void setId (uint32_t id);
|
||||
|
||||
private slots:
|
||||
void mlib_entry_changed (uint32_t id);
|
||||
void mlib_entry_removed (uint32_t id);
|
||||
|
||||
private:
|
||||
void getInfo ();
|
||||
|
||||
uint32_t m_id;
|
||||
XClientCache *m_cache;
|
||||
};
|
||||
|
||||
#endif
|
||||
224
src/dialogs/entryinfo.ui
Normal file
224
src/dialogs/entryinfo.ui
Normal file
|
|
@ -0,0 +1,224 @@
|
|||
<ui version="4.0" >
|
||||
<class>EntryInfo</class>
|
||||
<widget class="QDialog" name="EntryInfo" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>426</width>
|
||||
<height>357</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="filenameLabel" >
|
||||
<property name="text" >
|
||||
<string>Filename:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="filenameEdit" >
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="idBox" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>ID Tag:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="titleLabel" >
|
||||
<property name="text" >
|
||||
<string>Title:</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="titleEdit" >
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="artistLabel" >
|
||||
<property name="text" >
|
||||
<string>Artist:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3" >
|
||||
<widget class="QLineEdit" name="artistEdit" >
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="albumLabel" >
|
||||
<property name="text" >
|
||||
<string>Album:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="3" >
|
||||
<widget class="QLineEdit" name="albumEdit" >
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="commentLabel" >
|
||||
<property name="text" >
|
||||
<string>Comment:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3" >
|
||||
<widget class="QLineEdit" name="commentEdit" >
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="yearLabel" >
|
||||
<property name="text" >
|
||||
<string>Year:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QLineEdit" name="yearEdit" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" >
|
||||
<widget class="QLabel" name="trackLabel" >
|
||||
<property name="text" >
|
||||
<string>Track Number:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3" >
|
||||
<widget class="QLineEdit" name="trackEdit" >
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<widget class="QLabel" name="genreLabel" >
|
||||
<property name="text" >
|
||||
<string>Genre:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="3" >
|
||||
<widget class="QLineEdit" name="genreEdit" >
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>EntryInfo</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>EntryInfo</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Loading…
Add table
Add a link
Reference in a new issue