1 /**
2  * \file browsecoverartdialog.h
3  * Browse cover art dialog.
4  *
5  * \b Project: Kid3
6  * \author Urs Fleisch
7  * \date 11-Jan-2009
8  *
9  * Copyright (C) 2009-2018  Urs Fleisch
10  *
11  * This file is part of Kid3.
12  *
13  * Kid3 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * Kid3 is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 #pragma once
28 
29 #include <QDialog>
30 #include <QScopedPointer>
31 #include "frame.h"
32 
33 class QTextEdit;
34 class QLineEdit;
35 class ExternalProcess;
36 class ConfigTable;
37 class ConfigTableModel;
38 class FormatListEdit;
39 class Kid3Application;
40 
41 /**
42  * Browse cover art dialog.
43  */
44 class BrowseCoverArtDialog : public QDialog {
45   Q_OBJECT
46 public:
47   /**
48    * Constructor.
49    *
50    * @param app application context
51    * @param parent parent widget
52    */
53   explicit BrowseCoverArtDialog(Kid3Application* app, QWidget* parent);
54 
55   /**
56    * Destructor.
57    */
58   virtual ~BrowseCoverArtDialog() override;
59 
60   /**
61    * Read the local settings from the configuration.
62    */
63   void readConfig();
64 
65   /**
66    * Set frames for which picture has to be found.
67    *
68    * @param frames track data
69    */
70   void setFrames(const FrameCollection& frames);
71 
72 public slots:
73   /**
74    * Hide modal dialog, start browse command.
75    */
76   virtual void accept() override;
77 
78 private slots:
79   /**
80    * Show browse command as preview.
81    */
82   void showPreview();
83 
84   /**
85    * Save the local settings to the configuration.
86    */
87   void saveConfig();
88 
89   /**
90    * Show help.
91    */
92   void showHelp();
93 
94 private:
95   /**
96    * Set the source combo box and line edits from the configuration.
97    */
98   void setSourceFromConfig();
99 
100   /** Text editor with command preview */
101   QTextEdit* m_edit;
102   /** Combobox with artist */
103   QLineEdit* m_artistLineEdit;
104   /** Combobox with album */
105   QLineEdit* m_albumLineEdit;
106   /** format editor */
107   FormatListEdit* m_formatListEdit;
108   /** Table to extract picture URL */
109   ConfigTable* m_matchUrlTable;
110   /** Table model to extract picture URL */
111   ConfigTableModel* m_matchUrlTableModel;
112   /** Formatted URL */
113   QString m_url;
114 
115   /** Track data */
116   FrameCollection m_frames;
117   /** Application context */
118   Kid3Application* m_app;
119   /** Process for browser command */
120   QScopedPointer<ExternalProcess> m_process;
121 };
122