1 /** 2 * \file textimportdialog.h 3 * Dialog to import from a text (file or clipboard). 4 * 5 * \b Project: Kid3 6 * \author Urs Fleisch 7 * \date 19 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 <QScopedPointer> 31 32 class TextImporter; 33 class TrackDataModel; 34 class FormatListEdit; 35 class IPlatformTools; 36 37 /** 38 * Dialog to import from a text (file or clipboard). 39 */ 40 class TextImportDialog : public QDialog { 41 Q_OBJECT 42 43 public: 44 /** 45 * Constructor. 46 * 47 * @param platformTools platform tools 48 * @param parent parent widget 49 * @param trackDataModel track data to be filled with imported values 50 */ 51 TextImportDialog(IPlatformTools* platformTools, QWidget* parent, 52 TrackDataModel* trackDataModel); 53 54 /** 55 * Destructor. 56 */ 57 virtual ~TextImportDialog() override; 58 59 /** 60 * Clear dialog data. 61 */ 62 void clear(); 63 64 private slots: 65 /** 66 * Let user select file, assign file contents to text and preview in 67 * table. 68 */ 69 void fromFile(); 70 71 /** 72 * Assign clipboard contents to text and preview in table. 73 */ 74 void fromClipboard(); 75 76 /** 77 * Save the local settings to the configuration. 78 */ 79 void saveConfig(); 80 81 /** 82 * Show help. 83 */ 84 void showHelp(); 85 86 signals: 87 /** 88 * Emitted when the m_trackDataVector was updated with new imported data. 89 */ 90 void trackDataUpdated(); 91 92 private: 93 /** 94 * Import from a file. 95 * 96 * @param fn file name 97 * 98 * @return true if ok. 99 */ 100 bool importFromFile(const QString& fn); 101 102 /** 103 * Set the format combo box and line edits from the configuration. 104 */ 105 void setFormatFromConfig(); 106 107 IPlatformTools* m_platformTools; 108 /** format editor */ 109 FormatListEdit* m_formatListEdit; 110 /** text importer */ 111 QScopedPointer<TextImporter> m_textImporter; 112 }; 113