Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit ca396699 authored by Frerich Raabe's avatar Frerich Raabe

- The filename schemes used by the tag guesser are configurable now

svn path=/trunk/kdemultimedia/juk/; revision=214246
parent a1c4210b
......@@ -7,7 +7,8 @@ juk_SOURCES = directorylistbase.ui genrelisteditorbase.ui \
playlistitem.cpp playlist.cpp playlistsplitter.cpp listboxpixmap.cpp \
playlistbox.cpp tageditor.cpp cache.cpp genrelistreader.cpp \
genrelistlist.cpp genrelist.cpp genre.cpp player.cpp tag.cpp customaction.cpp \
slideraction.cpp keydialog.cpp juk.cpp main.cpp tagguesser.cpp
slideraction.cpp keydialog.cpp juk.cpp main.cpp tagguesser.cpp \
tagguesserconfigdlgwidget.ui tagguesserconfigdlg.cpp
tagguessertest_SOURCES = tagguessertest.cpp tagguesser.cpp
......
......@@ -39,6 +39,7 @@
#include "genrelisteditor.h"
#include "systemtray.h"
#include "keydialog.h"
#include "tagguesserconfigdlg.h"
////////////////////////////////////////////////////////////////////////////////
// public members
......@@ -161,6 +162,8 @@ void JuK::setupActions()
connect(m_outputSelectAction, SIGNAL(activated(int)), this, SLOT(slotSetOutput(int)));
}
new KAction(i18n("Tag Guesser..."), "tagGuesserConfig", 0, this, SLOT(slotConfigureTagGuesser()), actionCollection(), "tagGuesserConfig");
KStdAction::keyBindings(this, SLOT(slotEditKeys()), actionCollection());
// just in the toolbar
......@@ -713,4 +716,10 @@ void JuK::slotSetVolume(int volume)
}
}
void JuK::slotConfigureTagGuesser()
{
TagGuesserConfigDlg dlg(this);
dlg.exec();
}
#include "juk.moc"
......@@ -110,6 +110,7 @@ private slots:
void slotToggleSystemTray(bool enabled);
void slotSetOutput(int output);
void slotEditKeys();
void slotConfigureTagGuesser();
// additional player slots
void slotTrackPositionSliderClicked();
......
......@@ -54,6 +54,7 @@
<Action name="dockOnClose"/>
<Action name="togglePopups"/>
<Action name="outputSelect"/>
<Action name="tagGuesserConfig"/>
<Separator/>
<Action name="options_configure_keybinding"/>
</Menu>
......
/*
* tagguesserconfigdlg.cpp - (c) 2003 Frerich Raabe <raabe@kde.org>
*
* 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.
*/
#include "tagguesser.h"
#include "tagguesserconfigdlg.h"
#include "tagguesserconfigdlgwidget.h"
#include <kiconloader.h>
#include <klistview.h>
#include <klocale.h>
#include <kpushbutton.h>
#include <qtoolbutton.h>
TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name)
: KDialogBase(parent, name, true, i18n("Tag guesser configuration"),
Ok | Cancel, Ok, true)
{
m_child = new TagGuesserConfigDlgWidget(this, "child");
setMainWidget(m_child);
m_child->lvSchemes->setItemsRenameable(true);
m_child->bMoveUp->setIconSet(QIconSet(DesktopIcon("1uparrow")));
m_child->bMoveDown->setIconSet(QIconSet(DesktopIcon("1downarrow")));
const QStringList schemes = TagGuesser::schemeStrings();
QStringList::ConstIterator it = schemes.begin();
QStringList::ConstIterator end = schemes.end();
for (; it != end; ++it)
new KListViewItem(m_child->lvSchemes, *it);
connect(m_child->lvSchemes, SIGNAL(currentChanged(QListViewItem *)),
this, SLOT(slotCurrentChanged(QListViewItem *)));
connect(m_child->lvSchemes, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)),
this, SLOT(slotRenameItem(QListViewItem *, const QPoint &, int)));
connect(m_child->bAdd, SIGNAL(clicked()), this, SLOT(slotAddClicked()));
connect(m_child->bModify, SIGNAL(clicked()), this, SLOT(slotModifyClicked()));
connect(m_child->bRemove, SIGNAL(clicked()), this, SLOT(slotRemoveClicked()));
}
void TagGuesserConfigDlg::accept()
{
QStringList schemes;
for (QListViewItem *it = m_child->lvSchemes->firstChild(); it; it = it->nextSibling())
schemes += it->text(0);
TagGuesser::setSchemeStrings(schemes);
accept();
}
void TagGuesserConfigDlg::slotCurrentChanged(QListViewItem *item)
{
m_child->bMoveUp->setEnabled(item != 0 && item->itemAbove() != 0);
m_child->bMoveDown->setEnabled(item != 0 && item->itemBelow() != 0);
m_child->bModify->setEnabled(item != 0);
m_child->bRemove->setEnabled(item != 0);
}
void TagGuesserConfigDlg::slotRenameItem(QListViewItem *item, const QPoint &, int c)
{
m_child->lvSchemes->rename(item, c);
}
void TagGuesserConfigDlg::slotAddClicked()
{
KListViewItem *item = new KListViewItem(m_child->lvSchemes);
m_child->lvSchemes->rename(item, 0);
}
void TagGuesserConfigDlg::slotModifyClicked()
{
m_child->lvSchemes->rename(m_child->lvSchemes->currentItem(), 0);
}
void TagGuesserConfigDlg::slotRemoveClicked()
{
delete m_child->lvSchemes->currentItem();
}
#include "tagguesserconfigdlg.moc"
/*
* tagguesserconfigdlg.h - (c) 2003 Frerich Raabe <raabe@kde.org>
*
* 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.
*/
#ifndef TAGGUESSERCONFIGDLG_H
#define TAGGUESSERCONFIGDLG_H
#include <kdialogbase.h>
class QListViewItem;
class TagGuesserConfigDlgWidget;
class TagGuesserConfigDlg : public KDialogBase
{
Q_OBJECT
public:
TagGuesserConfigDlg(QWidget *parent, const char *name = 0);
protected slots:
virtual void accept();
private slots:
void slotCurrentChanged(QListViewItem *item);
void slotRenameItem(QListViewItem *item, const QPoint &p, int c);
void slotAddClicked();
void slotModifyClicked();
void slotRemoveClicked();
private:
TagGuesserConfigDlgWidget *m_child;
};
#endif // TAGGUESSERCONFIGDLG_H
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>TagGuesserConfigDlgWidget</class>
<author>Frerich Raabe &lt;raabe@kde.org&gt;</author>
<widget class="QWidget">
<property name="name">
<cstring>Form1</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>480</height>
</rect>
</property>
<property name="caption">
<string>Form1</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KListView" row="0" column="0" rowspan="5" colspan="1">
<column>
<property name="text">
<string>Filename scheme</string>
</property>
<property name="clickable">
<bool>false</bool>
</property>
<property name="resizable">
<bool>false</bool>
</property>
</column>
<property name="name">
<cstring>lvSchemes</cstring>
</property>
<property name="frameShape">
<enum>StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="fullWidth">
<bool>true</bool>
</property>
</widget>
<widget class="KPushButton" row="1" column="1" rowspan="1" colspan="3">
<property name="name">
<cstring>bAdd</cstring>
</property>
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
<widget class="QToolButton" row="0" column="1">
<property name="name">
<cstring>bMoveUp</cstring>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QToolButton" row="0" column="3">
<property name="name">
<cstring>bMoveDown</cstring>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="KPushButton" row="2" column="1" rowspan="1" colspan="3">
<property name="name">
<cstring>bModify</cstring>
</property>
<property name="text">
<string>&amp;Modify</string>
</property>
</widget>
<widget class="KPushButton" row="3" column="1" rowspan="1" colspan="3">
<property name="name">
<cstring>bRemove</cstring>
</property>
<property name="text">
<string>&amp;Remove</string>
</property>
</widget>
<spacer row="4" column="2">
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>130</height>
</size>
</property>
</spacer>
</grid>
</widget>
<includes>
<include location="local" impldecl="in implementation">kdialog.h</include>
<include location="local" impldecl="in implementation">kiconloader.h</include>
</includes>
<layoutdefaults spacing="6" margin="11"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
<includehints>
<includehint>klistview.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
</includehints>
</UI>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment