2010-10-25 01:46:05 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-10-25 01:46:05 +02:00
|
|
|
|
|
|
|
Clementine 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 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SMARTPLAYLISTSEARCHTERMWIDGET_H
|
|
|
|
#define SMARTPLAYLISTSEARCHTERMWIDGET_H
|
|
|
|
|
2010-11-18 21:19:33 +01:00
|
|
|
#include "searchterm.h"
|
2010-10-26 21:59:55 +02:00
|
|
|
|
2010-10-25 01:46:05 +02:00
|
|
|
#include <QPushButton>
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
class LibraryBackend;
|
|
|
|
class Ui_SmartPlaylistSearchTermWidget;
|
|
|
|
|
|
|
|
class QPropertyAnimation;
|
|
|
|
|
2010-11-18 21:19:33 +01:00
|
|
|
namespace smart_playlists {
|
|
|
|
|
|
|
|
class SearchTermWidget : public QWidget {
|
2010-10-25 01:46:05 +02:00
|
|
|
Q_OBJECT
|
2014-02-07 16:34:20 +01:00
|
|
|
Q_PROPERTY(float overlay_opacity READ overlay_opacity WRITE
|
|
|
|
set_overlay_opacity);
|
2010-10-25 01:46:05 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2010-11-18 21:19:33 +01:00
|
|
|
SearchTermWidget(LibraryBackend* library, QWidget* parent);
|
|
|
|
~SearchTermWidget();
|
2010-10-25 01:46:05 +02:00
|
|
|
|
|
|
|
void SetActive(bool active);
|
|
|
|
|
|
|
|
float overlay_opacity() const;
|
|
|
|
void set_overlay_opacity(float opacity);
|
|
|
|
|
2010-11-19 00:08:37 +01:00
|
|
|
void SetTerm(const SearchTerm& term);
|
2010-11-18 21:19:33 +01:00
|
|
|
SearchTerm Term() const;
|
2010-10-26 21:59:55 +02:00
|
|
|
|
2010-10-25 01:46:05 +02:00
|
|
|
signals:
|
|
|
|
void Clicked();
|
2010-10-26 21:03:23 +02:00
|
|
|
void RemoveClicked();
|
2010-10-25 01:46:05 +02:00
|
|
|
|
2010-10-29 20:41:49 +02:00
|
|
|
void Changed();
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
protected:
|
2010-10-25 01:46:05 +02:00
|
|
|
void showEvent(QShowEvent*);
|
|
|
|
void enterEvent(QEvent*);
|
|
|
|
void leaveEvent(QEvent*);
|
|
|
|
void resizeEvent(QResizeEvent*);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private slots:
|
2010-10-25 01:46:05 +02:00
|
|
|
void FieldChanged(int index);
|
2011-04-24 19:52:16 +02:00
|
|
|
void OpChanged(int index);
|
|
|
|
void RelativeValueChanged();
|
2010-10-25 01:46:05 +02:00
|
|
|
void Grab();
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2010-10-25 01:46:05 +02:00
|
|
|
class Overlay;
|
|
|
|
friend class Overlay;
|
|
|
|
|
|
|
|
Ui_SmartPlaylistSearchTermWidget* ui_;
|
|
|
|
LibraryBackend* library_;
|
|
|
|
|
|
|
|
Overlay* overlay_;
|
|
|
|
QPropertyAnimation* animation_;
|
|
|
|
bool active_;
|
2011-04-24 19:52:16 +02:00
|
|
|
bool initialized_;
|
2012-12-10 09:37:38 +01:00
|
|
|
|
|
|
|
SearchTerm::Type current_field_type_;
|
2010-10-25 01:46:05 +02:00
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
} // namespace
|
2010-11-18 21:19:33 +01:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
#endif // SMARTPLAYLISTSEARCHTERMWIDGET_H
|