File indexing completed on 2025-02-23 04:34:17

0001 /**
0002  * \file exportdialog.h
0003  * Export dialog.
0004  *
0005  * \b Project: Kid3
0006  * \author Urs Fleisch
0007  * \date 10 May 2006
0008  *
0009  * Copyright (C) 2006-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 <QStringList>
0031 
0032 class IPlatformTools;
0033 class QTextEdit;
0034 class QTableView;
0035 class QPushButton;
0036 class QComboBox;
0037 class TextExporter;
0038 class TextTableModel;
0039 class FormatListEdit;
0040 
0041 /**
0042  * Export dialog.
0043  */
0044 class ExportDialog : public QDialog {
0045   Q_OBJECT
0046 public:
0047   /**
0048    * Constructor.
0049    *
0050    * @param platformTools platform tools
0051    * @param parent       parent widget
0052    * @param textExporter text exporter to use
0053    */
0054   ExportDialog(IPlatformTools* platformTools,
0055                QWidget* parent, TextExporter* textExporter);
0056 
0057   /**
0058    * Destructor.
0059    */
0060   ~ExportDialog() override = default;
0061 
0062   /**
0063    * Read the local settings from the configuration.
0064    */
0065   void readConfig();
0066 
0067 public slots:
0068   /**
0069    * Show exported text as preview in editor.
0070    */
0071   void showPreview();
0072 
0073 private slots:
0074   /**
0075    * Export to a file.
0076    */
0077   void slotToFile();
0078 
0079   /**
0080    * Export to clipboard.
0081    */
0082   void slotToClipboard();
0083 
0084   /**
0085    * Save the local settings to the configuration.
0086    */
0087   void saveConfig();
0088 
0089   /**
0090    * Show help.
0091    */
0092   void showHelp();
0093 
0094   /**
0095    * Called when the source combo box selection is changed.
0096    * @param index combo box index
0097    */
0098   void onSrcComboBoxActivated(int index);
0099 
0100 private:
0101   /**
0102    * Set the format combo box and line edits from the configuration.
0103    */
0104   void setFormatFromConfig();
0105 
0106   IPlatformTools* m_platformTools;
0107   /** Text editor */
0108   QTextEdit* m_edit;
0109   /** Table view */
0110   QTableView* m_table;
0111   /** Format editor */
0112   FormatListEdit* m_formatListEdit;
0113   /** To File button */
0114   QPushButton* m_fileButton;
0115   /** To Clipboard button */
0116   QPushButton* m_clipButton;
0117   /** combobox with export sources */
0118   QComboBox* m_srcComboBox;
0119 
0120   /** text exporter */
0121   TextExporter* m_textExporter;
0122   /** text table model */
0123   TextTableModel* m_textTableModel;
0124 };