File indexing completed on 2024-06-02 04:59:25
0001 /** 0002 * \file tagimportdialog.h 0003 * Dialog to import from other tags. 0004 * 0005 * \b Project: Kid3 0006 * \author Urs Fleisch 0007 * \date 20 Jun 2011 0008 * 0009 * Copyright (C) 2011-2024 Urs Fleisch 0010 * 0011 * This file is part of Kid3. 0012 * 0013 * Kid3 is free software; you can redistribute it and/or modify 0014 * it under the terms of the GNU General Public License as published by 0015 * the Free Software Foundation; either version 2 of the License, or 0016 * (at your option) any later version. 0017 * 0018 * Kid3 is distributed in the hope that it will be useful, 0019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0021 * GNU General Public License for more details. 0022 * 0023 * You should have received a copy of the GNU General Public License 0024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0025 */ 0026 0027 #pragma once 0028 0029 #include <QDialog> 0030 #include "frame.h" 0031 0032 class QComboBox; 0033 class FormatListEdit; 0034 class TrackDataModel; 0035 0036 /** 0037 * Dialog to import from a text (file or clipboard). 0038 */ 0039 class TagImportDialog : public QDialog { 0040 Q_OBJECT 0041 0042 public: 0043 /** 0044 * Constructor. 0045 * 0046 * @param parent parent widget 0047 * @param trackDataModel track data to be filled with imported values, 0048 * nullptr if dialog is used independent from import dialog 0049 */ 0050 explicit TagImportDialog(QWidget* parent, 0051 TrackDataModel* trackDataModel); 0052 0053 /** 0054 * Destructor. 0055 */ 0056 ~TagImportDialog() override = default; 0057 0058 /** 0059 * Clear dialog data. 0060 */ 0061 void clear(); 0062 0063 /** 0064 * Get import destination. 0065 * Is only available if dialog is not opened from import dialog. 0066 * @return TagV1, TagV2 or TagV2V1 for ID3v1, ID3v2 or both. 0067 */ 0068 Frame::TagVersion getDestination() const; 0069 0070 /** 0071 * Get selected source format. 0072 * @return source format. 0073 */ 0074 QString getSourceFormat() const; 0075 0076 /** 0077 * Get selected extraction format. 0078 * @return extraction format. 0079 */ 0080 QString getExtractionFormat() const; 0081 0082 private slots: 0083 /** 0084 * Apply import to track data. 0085 */ 0086 void apply(); 0087 0088 /** 0089 * Save the local settings to the configuration. 0090 */ 0091 void saveConfig(); 0092 0093 /** 0094 * Show help. 0095 */ 0096 void showHelp(); 0097 0098 signals: 0099 /** 0100 * Emitted when the m_trackDataVector was updated with new imported data. 0101 */ 0102 void trackDataUpdated(); 0103 0104 private: 0105 /** 0106 * Set the format combo box and line edits from the configuration. 0107 */ 0108 void setFormatFromConfig(); 0109 0110 /** 0111 * Get help text for format codes supported in extraction field. 0112 * @return help text. 0113 */ 0114 static QString getExtractionToolTip(); 0115 0116 FormatListEdit* m_formatListEdit; 0117 TrackDataModel* m_trackDataModel; 0118 QComboBox* m_destComboBox; 0119 };