File indexing completed on 2025-02-23 04:34:15
0001 /** 0002 * \file batchimportdialog.h 0003 * Batch import dialog. 0004 * 0005 * \b Project: Kid3 0006 * \author Urs Fleisch 0007 * \date 2 Jan 2013 0008 * 0009 * Copyright (C) 2013-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 "batchimportprofile.h" 0031 #include "trackdata.h" 0032 0033 class QPushButton; 0034 class QTextEdit; 0035 class QComboBox; 0036 class ServerImporter; 0037 class BatchImportSourcesModel; 0038 0039 /** 0040 * Batch import dialog. 0041 */ 0042 class BatchImportDialog : public QDialog { 0043 Q_OBJECT 0044 public: 0045 /** 0046 * Constructor. 0047 * 0048 * @param importers server importers 0049 * @param parent parent widget 0050 */ 0051 explicit BatchImportDialog(const QList<ServerImporter*>& importers, 0052 QWidget* parent = nullptr); 0053 0054 /** 0055 * Destructor. 0056 */ 0057 ~BatchImportDialog() override = default; 0058 0059 /** 0060 * Read the local settings from the configuration. 0061 */ 0062 void readConfig(); 0063 0064 signals: 0065 /** 0066 * Start batch import with given @a profile. 0067 * @param profile batch import profile 0068 * @param tagVersion import destination tag versions 0069 */ 0070 void start(const BatchImportProfile& profile, 0071 Frame::TagVersion tagVersion); 0072 0073 /** 0074 * Abort batch import. 0075 */ 0076 void abort(); 0077 0078 public slots: 0079 /** 0080 * Show information about import event. 0081 * @param type import event type, enum BatchImporter::ImportEventType 0082 * @param text text to display 0083 */ 0084 void showImportEvent(int type, const QString& text); 0085 0086 private slots: 0087 /** 0088 * Save the local settings to the configuration. 0089 */ 0090 void saveConfig(); 0091 0092 /** 0093 * Show help. 0094 */ 0095 void showHelp(); 0096 0097 /** 0098 * Start or abort batch import. 0099 */ 0100 void startOrAbortImport(); 0101 0102 /** 0103 * Add a new profile. 0104 */ 0105 void addProfile(); 0106 0107 /** 0108 * Remove the selected profile. 0109 */ 0110 void removeProfile(); 0111 0112 /** 0113 * Switch to different profile. 0114 * @param index combo box index to set 0115 */ 0116 void changeProfile(int index); 0117 0118 /** 0119 * Change name of current profile. 0120 * @param name profile name 0121 */ 0122 void changeProfileName(const QString& name); 0123 0124 private: 0125 /** 0126 * Set the profile from the configuration. 0127 */ 0128 void setProfileFromConfig(); 0129 0130 /** 0131 * Update profile from GUI controls. 0132 */ 0133 void setProfileFromGuiControls(); 0134 0135 /** 0136 * Update GUI controls from profiles. 0137 */ 0138 void setGuiControlsFromProfile(); 0139 0140 /** 0141 * Add a new profile to the list of profiles. 0142 */ 0143 void addNewProfile(); 0144 0145 /** 0146 * Set button to Start or Abort. 0147 * @param enableAbort true to set Abort button 0148 */ 0149 void setAbortButton(bool enableAbort); 0150 0151 /** Text editor */ 0152 QTextEdit* m_edit; 0153 /** Combo box with import destinations */ 0154 QComboBox* m_destComboBox; 0155 /** Combo box with profile name */ 0156 QComboBox* m_profileComboBox; 0157 /** Start/Abort button */ 0158 QPushButton* m_startAbortButton; 0159 /** Model containing currently selected import sources */ 0160 BatchImportSourcesModel* m_profileModel; 0161 /** Importers for different servers */ 0162 QList<ServerImporter*> m_importers; 0163 /** Batch import profiles */ 0164 QList<BatchImportProfile> m_profiles; 0165 /** Index of currently selected profile */ 0166 int m_profileIdx; 0167 /** Currently used batch import profile */ 0168 BatchImportProfile m_currentProfile; 0169 /** true if m_startAbortButton is an Abort button */ 0170 bool m_isAbortButton; 0171 };