Commit ce733545 authored by Michael Pyne's avatar Michael Pyne

Fix invalid signal/slot connection warnings.

With some other minor cleanups to TagEditor.
parent b0d8e7b7
......@@ -224,9 +224,11 @@ void CollectionList::slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >
update();
}
void CollectionList::slotDeleteItem(const KFileItem &item)
void CollectionList::slotDeleteItems(const KFileItemList &items)
{
delete lookup(item.url().path());
for(const auto &item : items) {
delete lookup(item.url().path());
}
}
void CollectionList::saveItemsToCache() const
......@@ -421,7 +423,7 @@ QStringList CollectionList::uniqueSet(UniqueSetType t) const
CollectionListItem *CollectionList::lookup(const QString &file) const
{
return m_itemsDict.value(file, 0);
return m_itemsDict.value(file, nullptr);
}
void CollectionList::removeStringFromDict(const QString &value, int column)
......
......@@ -136,7 +136,7 @@ public slots:
void slotNewItems(const KFileItemList &items);
void slotRefreshItems(const QList<QPair<KFileItem, KFileItem> > &items);
void slotDeleteItem(const KFileItem &item);
void slotDeleteItems(const KFileItemList &items);
protected:
CollectionList(PlaylistCollection *collection);
......
......@@ -755,16 +755,18 @@ void PlaylistCollection::clearShowMore(bool raisePlaylist)
void PlaylistCollection::enableDirWatch(bool enable)
{
QObject *collection = CollectionList::instance();
auto collection = CollectionList::instance();
m_dirLister.disconnect(object());
if(enable) {
QObject::connect(&m_dirLister, SIGNAL(newItems(KFileItemList)),
object(), SLOT(slotNewItems(KFileItemList)));
QObject::connect(&m_dirLister, SIGNAL(refreshItems(QList<QPair<KFileItem,KFileItem> >)),
collection, SLOT(slotRefreshItems(QList<QPair<KFileItem,KFileItem> >)));
QObject::connect(&m_dirLister, SIGNAL(deleteItem(KFileItem)),
collection, SLOT(slotDeleteItem(KFileItem)));
QObject::connect(&m_dirLister, &KDirLister::newItems,
object(), [this](const KFileItemList &items) {
this->newItems(items);
});
QObject::connect(&m_dirLister, &KDirLister::refreshItems,
collection, &CollectionList::slotRefreshItems);
QObject::connect(&m_dirLister, &KDirLister::itemsDeleted,
collection, &CollectionList::slotDeleteItems);
}
}
......
......@@ -501,10 +501,12 @@ void TagEditor::setupLayout()
setupUi(this);
foreach(QWidget *input, findChildren<QWidget *>()) {
if(input->inherits("QLineEdit") || input->inherits("QComboBox"))
if(input->inherits("QLineEdit"))
connect(input, SIGNAL(textChanged(QString)), this, SLOT(slotDataChanged()));
if(input->inherits("QComboxBox"))
if(input->inherits("QComboxBox")) {
connect(input, SIGNAL(activated(int)), this, SLOT(slotDataChanged()));
connect(input, SIGNAL(currentTextChanged(QString)), this, SLOT(slotDataChanged()));
}
if(input->inherits("QSpinBox"))
connect(input, SIGNAL(valueChanged(int)), this, SLOT(slotDataChanged()));
if(input->inherits("QTextEdit"))
......@@ -638,15 +640,6 @@ void TagEditor::showEvent(QShowEvent *e)
QWidget::showEvent(e);
}
bool TagEditor::eventFilter(QObject *watched, QEvent *e)
{
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
if(watched->inherits("QSpinBox") && e->type() == QEvent::KeyRelease && ke->modifiers() == 0)
slotDataChanged();
return false;
}
////////////////////////////////////////////////////////////////////////////////
// private slots
////////////////////////////////////////////////////////////////////////////////
......
......@@ -14,8 +14,8 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TAGEDITOR_H
#define TAGEDITOR_H
#ifndef JUK_TAGEDITOR_H
#define JUK_TAGEDITOR_H
#include <QWidget>
#include <QList>
......@@ -70,7 +70,6 @@ private:
void save(const PlaylistItemList &list);
void saveChangesPrompt();
virtual void showEvent(QShowEvent *e);
virtual bool eventFilter(QObject *watched, QEvent *e);
private slots:
void slotDataChanged(bool c = true);
......
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