File indexing completed on 2024-06-02 04:59:23
0001 /** 0002 * \file filterdialog.h 0003 * Filter dialog. 0004 * 0005 * \b Project: Kid3 0006 * \author Urs Fleisch 0007 * \date 16 Jan 2008 0008 * 0009 * Copyright (C) 2008-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 <QTextEdit> 0031 #include "filefilter.h" 0032 0033 class QGroupBox; 0034 class QPushButton; 0035 class FormatListEdit; 0036 0037 /** 0038 * Filter dialog. 0039 */ 0040 class FilterDialog : public QDialog { 0041 Q_OBJECT 0042 public: 0043 /** 0044 * Constructor. 0045 * 0046 * @param parent parent widget 0047 */ 0048 explicit FilterDialog(QWidget* parent); 0049 0050 /** 0051 * Destructor. 0052 */ 0053 ~FilterDialog() override = default; 0054 0055 /** 0056 * Read the local settings from the configuration. 0057 */ 0058 void readConfig(); 0059 0060 /** 0061 * Display information in text view. 0062 * 0063 * @param text text to display 0064 */ 0065 void showInformation(const QString& text) { m_edit->append(text); } 0066 0067 /** 0068 * Abort filter operation. 0069 */ 0070 void abort() { m_fileFilter.abort(); } 0071 0072 signals: 0073 /** 0074 * Is triggered when the selected @a filter has to be applied. 0075 */ 0076 void apply(FileFilter&); 0077 0078 public slots: 0079 /** 0080 * Show information about filter event. 0081 * 0082 * @param type filter event type, enum FileFilter::FilterEventType 0083 * @param fileName name of filtered file 0084 */ 0085 void showFilterEvent(int type, const QString& fileName); 0086 0087 private slots: 0088 /** 0089 * Save the local settings to the configuration. 0090 */ 0091 void saveConfig(); 0092 0093 /** 0094 * Show help. 0095 */ 0096 void showHelp(); 0097 0098 /** 0099 * Apply or abort filter. 0100 */ 0101 void applyOrAbortFilter(); 0102 0103 private: 0104 /** 0105 * Set the filter combo box and line edit from the configuration. 0106 */ 0107 void setFiltersFromConfig(); 0108 0109 /** 0110 * Set button to Apply or Abort. 0111 * @param enableAbort true to set Abort button 0112 */ 0113 void setAbortButton(bool enableAbort); 0114 0115 /** Preview group box */ 0116 QGroupBox* m_previewBox; 0117 /** Text editor */ 0118 QTextEdit* m_edit; 0119 /** format editor */ 0120 FormatListEdit* m_formatListEdit; 0121 /** Apply button */ 0122 QPushButton* m_applyButton; 0123 /** file filter used */ 0124 FileFilter m_fileFilter; 0125 /** true if m_applyButton is an Abort button */ 0126 bool m_isAbortButton; 0127 };