File indexing completed on 2024-05-05 04:48:25

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Sergey Ivanov <123kash@gmail.com>                                 *
0003  * Copyright (c) 2013 Alberto Villa <avilla@FreeBSD.org>                                *
0004  *                                                                                      *
0005  * This program is free software; you can redistribute it and/or modify it under        *
0006  * the terms of the GNU General Public License as published by the Free Software        *
0007  * Foundation; either version 2 of the License, or (at your option) any later           *
0008  * version.                                                                             *
0009  *                                                                                      *
0010  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0012  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0013  *                                                                                      *
0014  * You should have received a copy of the GNU General Public License along with         *
0015  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0016  ****************************************************************************************/
0017 
0018 #ifndef MUSICBRAINZTAGGER_H
0019 #define MUSICBRAINZTAGGER_H
0020 
0021 #include <config.h>
0022 #include "core/meta/forward_declarations.h"
0023 
0024 #include <QDialog>
0025 
0026 namespace Ui
0027 {
0028     class MusicBrainzTagger;
0029 }
0030 
0031 class MusicBrainzFinder;
0032 class MusicBrainzTagsModel;
0033 class MusicBrainzTagsModelDelegate;
0034 #ifdef HAVE_LIBOFA
0035 class MusicDNSFinder;
0036 #endif
0037 
0038 class QSortFilterProxyModel;
0039 
0040 class MusicBrainzTagger : public QDialog
0041 {
0042     Q_OBJECT
0043 
0044     public:
0045         /**
0046          * @arg tracks Track list for search
0047          */
0048         explicit MusicBrainzTagger( const Meta::TrackList &tracks,
0049                                     QWidget *parent = nullptr );
0050         ~MusicBrainzTagger() override;
0051 
0052     Q_SIGNALS:
0053         void sendResult( const QMap<Meta::TrackPtr, QVariantMap> &result );
0054 
0055     private Q_SLOTS:
0056         void search();
0057         void progressStep();
0058         void searchDone();
0059 #ifdef HAVE_LIBOFA
0060         void mdnsSearchDone();
0061 #endif
0062         void saveAndExit();
0063 
0064     private:
0065         void init();
0066 
0067         Ui::MusicBrainzTagger *ui;
0068 
0069         Meta::TrackList m_tracks;
0070 
0071         MusicBrainzFinder *mb_finder;
0072 #ifdef HAVE_LIBOFA
0073         MusicDNSFinder *mdns_finder;
0074         bool mdns_searchDone;
0075 #endif
0076         MusicBrainzTagsModel *m_resultsModel;
0077         MusicBrainzTagsModelDelegate *m_resultsModelDelegate;
0078         QSortFilterProxyModel *m_resultsProxyModel;
0079 };
0080 
0081 #endif // MUSICBRAINZTAGGER_H