tageditor/gui/dbquerywidget.h

90 lines
2.3 KiB
C
Raw Normal View History

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;
struct SongDescription;
2016-03-03 22:21:15 +01:00
2018-03-07 01:18:01 +01:00
class DbQueryWidget : public QWidget {
2016-03-03 22:21:15 +01:00
Q_OBJECT
public:
explicit DbQueryWidget(TagEditorWidget *tagEditorWidget, QWidget *parent = nullptr);
2019-06-01 12:45:12 +02:00
~DbQueryWidget() override;
2016-03-03 22:21:15 +01:00
void insertSearchTermsFromTagEdit(TagEdit *tagEdit, bool songSpecific = false);
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:
void searchMusicBrainz();
void searchLyricsWikia();
void searchMakeItPersonal();
2016-03-03 22:21:15 +01:00
void abortSearch();
2016-10-24 20:15:10 +02:00
void applySelectedResults();
2019-08-12 20:27:51 +02:00
void applySpecifiedResults(const QModelIndex &modelIndex);
2016-10-24 20:15:10 +02:00
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);
void showResultsContextMenu(const QPoint &pos);
2019-02-13 18:15:49 +01:00
#ifndef QT_NO_CLIPBOARD
void copySelectedResult();
#endif
void fetchAndShowCoverForSelection();
void fetchAndShowLyricsForSelection();
void openSelectionInBrowser();
void showCover(const QByteArray &data);
void showCoverFromIndex(const QModelIndex &index);
void showLyrics(const QString &data);
void showLyricsFromIndex(const QModelIndex &index);
2016-03-03 22:21:15 +01:00
protected:
2019-06-01 12:45:12 +02:00
bool eventFilter(QObject *obj, QEvent *event) override;
2016-03-03 22:21:15 +01:00
private:
2017-08-08 19:16:11 +02:00
void useQueryResults(QueryResultsModel *queryResults);
QModelIndex selectedIndex() const;
2017-08-08 19:16:11 +02:00
2016-03-03 22:21:15 +01:00
std::unique_ptr<Ui::DbQueryWidget> m_ui;
TagEditorWidget *m_tagEditorWidget;
QueryResultsModel *m_model;
int m_coverIndex, m_lyricsIndex;
2016-06-02 22:41:01 +02:00
QMenu *m_menu;
QAction *m_insertPresentDataAction;
QAction *m_searchMusicBrainzAction;
QAction *m_searchLyricsWikiaAction;
QAction *m_searchMakeItPersonalAction;
QAction *m_lastSearchAction;
2019-02-13 18:15:49 +01:00
QPoint m_contextMenuPos;
2016-03-03 22:21:15 +01:00
};
2018-03-07 01:18:01 +01:00
} // namespace QtGui
2016-03-03 22:21:15 +01:00
#endif // DBQUERYWIDGET_H