2016-03-03 22:21:15 +01:00
|
|
|
#ifndef DBQUERYWIDGET_H
|
|
|
|
#define DBQUERYWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QItemSelection)
|
2016-06-02 22:41:01 +02:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QMenu)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QAction)
|
2016-03-03 22:21:15 +01:00
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
class KnownFieldModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace QtGui {
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class DbQueryWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
class QueryResultsModel;
|
|
|
|
class TagEditorWidget;
|
|
|
|
class TagEdit;
|
2016-10-09 22:41:34 +02:00
|
|
|
struct SongDescription;
|
2016-03-03 22:21:15 +01:00
|
|
|
|
|
|
|
class DbQueryWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit DbQueryWidget(TagEditorWidget *tagEditorWidget, QWidget *parent = nullptr);
|
|
|
|
~DbQueryWidget();
|
|
|
|
|
|
|
|
void insertSearchTermsFromTagEdit(TagEdit *tagEdit);
|
2016-10-09 22:41:34 +02:00
|
|
|
SongDescription currentSongDescription() const;
|
2016-10-24 20:15:10 +02:00
|
|
|
void applyResults(TagEdit *tagEdit, const QModelIndex &resultIndex);
|
2016-03-03 22:21:15 +01:00
|
|
|
|
|
|
|
public slots:
|
2016-10-09 19:44:06 +02:00
|
|
|
void searchMusicBrainz();
|
|
|
|
void searchLyricsWikia();
|
2016-03-03 22:21:15 +01:00
|
|
|
void abortSearch();
|
2016-10-24 20:15:10 +02:00
|
|
|
void applySelectedResults();
|
|
|
|
void applyMatchingResults();
|
|
|
|
void applyMatchingResults(TagEdit *tagEdit);
|
2016-12-01 22:23:01 +01:00
|
|
|
void autoInsertMatchingResults();
|
2016-06-02 22:41:01 +02:00
|
|
|
void insertSearchTermsFromActiveTagEdit();
|
|
|
|
void clearSearchCriteria();
|
2016-03-03 22:21:15 +01:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void showResults();
|
|
|
|
void setStatus(bool aborted);
|
|
|
|
void fileStatusChanged(bool opened, bool hasTags);
|
2016-03-06 17:52:33 +01:00
|
|
|
void showResultsContextMenu();
|
|
|
|
void fetchAndShowCoverForSelection();
|
2016-10-09 22:41:34 +02:00
|
|
|
void fetchAndShowLyricsForSelection();
|
2016-03-06 17:52:33 +01:00
|
|
|
void showCover(const QByteArray &data);
|
|
|
|
void showCoverFromIndex(const QModelIndex &index);
|
2016-10-09 22:41:34 +02:00
|
|
|
void showLyrics(const QString &data);
|
|
|
|
void showLyricsFromIndex(const QModelIndex &index);
|
2016-03-03 22:21:15 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<Ui::DbQueryWidget> m_ui;
|
|
|
|
TagEditorWidget *m_tagEditorWidget;
|
|
|
|
QueryResultsModel *m_model;
|
2016-10-09 22:41:34 +02:00
|
|
|
int m_coverIndex, m_lyricsIndex;
|
2016-06-02 22:41:01 +02:00
|
|
|
QMenu *m_menu;
|
|
|
|
QAction *m_insertPresentDataAction;
|
2016-03-03 22:21:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // DBQUERYWIDGET_H
|