1 /** 2 * \file tagimportdialog.h 3 * Dialog to import from other tags. 4 * 5 * \b Project: Kid3 6 * \author Urs Fleisch 7 * \date 20 Jun 2011 8 * 9 * Copyright (C) 2011-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 "frame.h" 31 32 class QComboBox; 33 class FormatListEdit; 34 class TrackDataModel; 35 36 /** 37 * Dialog to import from a text (file or clipboard). 38 */ 39 class TagImportDialog : public QDialog { 40 Q_OBJECT 41 42 public: 43 /** 44 * Constructor. 45 * 46 * @param parent parent widget 47 * @param trackDataModel track data to be filled with imported values, 48 * nullptr if dialog is used independent from import dialog 49 */ 50 explicit TagImportDialog(QWidget* parent, 51 TrackDataModel* trackDataModel); 52 53 /** 54 * Destructor. 55 */ 56 virtual ~TagImportDialog() override = default; 57 58 /** 59 * Clear dialog data. 60 */ 61 void clear(); 62 63 /** 64 * Get import destination. 65 * Is only available if dialog is not opened from import dialog. 66 * @return TagV1, TagV2 or TagV2V1 for ID3v1, ID3v2 or both. 67 */ 68 Frame::TagVersion getDestination() const; 69 70 /** 71 * Get selected source format. 72 * @return source format. 73 */ 74 QString getSourceFormat() const; 75 76 /** 77 * Get selected extraction format. 78 * @return extraction format. 79 */ 80 QString getExtractionFormat() const; 81 82 private slots: 83 /** 84 * Apply import to track data. 85 */ 86 void apply(); 87 88 /** 89 * Save the local settings to the configuration. 90 */ 91 void saveConfig(); 92 93 /** 94 * Show help. 95 */ 96 void showHelp(); 97 98 signals: 99 /** 100 * Emitted when the m_trackDataVector was updated with new imported data. 101 */ 102 void trackDataUpdated(); 103 104 private: 105 /** 106 * Set the format combo box and line edits from the configuration. 107 */ 108 void setFormatFromConfig(); 109 110 /** 111 * Get help text for format codes supported in extraction field. 112 * @return help text. 113 */ 114 static QString getExtractionToolTip(); 115 116 FormatListEdit* m_formatListEdit; 117 TrackDataModel* m_trackDataModel; 118 QComboBox* m_destComboBox; 119 }; 120