Warning, file /sdk/ktechlab/src/gui/outputmethoddlg.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /***************************************************************************
0002  *   Copyright (C) 2003-2004 by David Saxton                               *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef OUTPUTMETHODDLG_H
0012 #define OUTPUTMETHODDLG_H
0013 
0014 #include <QDialog>
0015 #include <QUrl>
0016 
0017 class TextDocument;
0018 class KTechlab;
0019 class MicroSelectWidget;
0020 class OutputMethodDlg;
0021 class OutputMethodWidget;
0022 class FileFilters;
0023 
0024 class OutputMethodInfo
0025 {
0026 public:
0027     class Method
0028     {
0029     public:
0030         enum Type { Direct, SaveAndForget, SaveAndLoad };
0031     };
0032 
0033     OutputMethodInfo();
0034     void initialize(OutputMethodDlg *dlg);
0035 
0036     Method::Type method() const
0037     {
0038         return m_method;
0039     }
0040     void setMethod(Method::Type method)
0041     {
0042         m_method = method;
0043     }
0044 
0045     bool addToProject() const
0046     {
0047         return m_bAddToProject;
0048     }
0049     void setAddToProject(bool add)
0050     {
0051         m_bAddToProject = add;
0052     }
0053 
0054     QString picID() const
0055     {
0056         return m_picID;
0057     }
0058     void setPicID(const QString &id)
0059     {
0060         m_picID = id;
0061     }
0062 
0063     /// Only local filesystem urls supported
0064     QUrl outputFile() const
0065     {
0066         return m_outputFile;
0067     }
0068     void setOutputFile(const QUrl &outputFile)
0069     {
0070         m_outputFile = outputFile;
0071     }
0072 
0073 protected:
0074     Method::Type m_method;
0075     bool m_bAddToProject;
0076     QString m_picID;
0077     QUrl m_outputFile;
0078 };
0079 
0080 /**
0081 @author David Saxton
0082 */
0083 class OutputMethodDlg : public QDialog
0084 {
0085     Q_OBJECT
0086 public:
0087     /**
0088      * @param caption The caption of the dialog window
0089      * @param inputURL Used for saving/restoring previous options the user has selected for this file; set this to null if temporary file
0090      * @param showPICSelect Whether to show the combo boxes for selecting a PIC
0091      */
0092     OutputMethodDlg(const QString &caption, const QUrl &inputURL, bool showPICSelect = false, QWidget *parent = nullptr);
0093     ~OutputMethodDlg() override;
0094 
0095     void setOutputExtension(const QString &outputExtension);
0096     void setFileFilters(const FileFilters &filters);
0097     void setMethod(OutputMethodInfo::Method::Type m);
0098     void setOutputFile(const QUrl &out);
0099     void setPicID(const QString &id);
0100 
0101     void accept() override;
0102 
0103     OutputMethodInfo info() const
0104     {
0105         return m_outputMethodInfo;
0106     }
0107 
0108     MicroSelectWidget *microSelect() const;
0109 
0110 protected:
0111     OutputMethodWidget *m_widget;
0112     QString m_outputExtension;
0113     QUrl m_inputURL;
0114     OutputMethodInfo m_outputMethodInfo;
0115 
0116     friend class OutputMethodInfo;
0117 };
0118 
0119 #endif