Commit b5c11d29 authored by Scott Wheeler's avatar Scott Wheeler
Browse files

Oops, forgot to add the files. Also fixed random play when search is enabled.

Ok, while there's still work to do / features to add, I think this fulfills
it can now be said that "quicksearch" is working, so I'm closing that bug report.

CCMAIL:56614-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=218777
parent 98608c48
......@@ -327,13 +327,14 @@ PlaylistItem *Playlist::nextItem(PlaylistItem *current, bool random)
PlaylistItem *i;
if(random) {
if(count() > 1) {
PlaylistItemList l = visibleItems();
if(l.count() > 1) {
m_history.push(current);
srand(time(0));
i = current;
while(i == current)
i = items()[rand() % count()];
i = l[rand() % l.count()];
}
else
i = 0;
......
/***************************************************************************
searchwidget.cpp
-------------------
begin : Sun Mar 6 2003
copyright : (C) 2003 by Scott Wheeler
(C) 2003 by Richard Lärkäng <nouseforaname@home.se>
***************************************************************************/
/***************************************************************************
* *
* 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 <klocale.h>
#include <klineedit.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
#include "searchwidget.h"
////////////////////////////////////////////////////////////////////////////////
// public methods
////////////////////////////////////////////////////////////////////////////////
SearchWidget::SearchWidget(QWidget *parent, const char *name) : QWidget(parent, name)
{
QHBoxLayout *layout = new QHBoxLayout(this, 5);
layout->setAutoAdd(true);
new QLabel(i18n("Search:"), this);
m_lineEdit = new KLineEdit(this, "searchLineEdit");
m_caseSensitive = new QCheckBox(i18n("Case sensitive"), this);
QPushButton *button = new QPushButton(i18n("Clear"), this);
connect(button, SIGNAL(clicked()), this, SLOT(clear()));
connect(m_lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotQueryChanged()));
connect(m_caseSensitive, SIGNAL(toggled(bool)), this, SLOT(slotQueryChanged()));
setFixedHeight(minimumSizeHint().height());
}
SearchWidget::~SearchWidget()
{
}
////////////////////////////////////////////////////////////////////////////////
// public slots
////////////////////////////////////////////////////////////////////////////////
void SearchWidget::clear()
{
m_lineEdit->clear();
}
////////////////////////////////////////////////////////////////////////////////
// private slots
////////////////////////////////////////////////////////////////////////////////
void SearchWidget::slotQueryChanged()
{
emit signalQueryChanged(m_lineEdit->text(), m_caseSensitive->isChecked());
}
#include "searchwidget.moc"
/***************************************************************************
searchwidget.h
-------------------
begin : Sun Mar 6 2003
copyright : (C) 2003 by Scott Wheeler <wheeler@kde.org>
(C) 2003 by Richard Lrkng <nouseforaname@home.se>
***************************************************************************/
/***************************************************************************
* *
* 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 SEARCHWIDGET_H
#define SEARCHWIDGET_H
#include <qwidget.h>
class KLineEdit;
class QCheckBox;
class SearchWidget : public QWidget
{
Q_OBJECT
public:
SearchWidget(QWidget *parent, const char *name);
virtual ~SearchWidget();
public slots:
void clear();
signals:
void signalQueryChanged(const QString &query, bool caseSensitive);
private slots:
void slotQueryChanged();
private:
KLineEdit *m_lineEdit;
QCheckBox *m_caseSensitive;
} ;
#endif
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