File indexing completed on 2024-05-05 04:51:47

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef K3BPROJECTBURNDIALOG_H
0007 #define K3BPROJECTBURNDIALOG_H
0008 
0009 #include "k3binteractiondialog.h"
0010 #include "k3bglobals.h"
0011 
0012 #include <QVBoxLayout>
0013 
0014 
0015 class QGroupBox;
0016 class QCheckBox;
0017 class QTabWidget;
0018 class QSpinBox;
0019 class QVBoxLayout;
0020 
0021 namespace K3b {
0022     class Doc;
0023     class BurnJob;
0024     class WriterSelectionWidget;
0025     class TempDirSelectionWidget;
0026     class WritingModeWidget;
0027 
0028     /**
0029      *@author Sebastian Trueg
0030      */
0031     class ProjectBurnDialog : public InteractionDialog
0032     {
0033         Q_OBJECT
0034 
0035     public:
0036         explicit ProjectBurnDialog( Doc* doc, QWidget *parent=0 );
0037         ~ProjectBurnDialog() override;
0038 
0039         enum resultCode { Canceled = 0, Saved = 1, Burn = 2 };
0040 
0041         /**
0042          * shows the dialog with exec().
0043          * Use this instead of InteractionDialog::exec
0044          * \param burn If true the dialog shows the Burn-button
0045          */
0046         int execBurnDialog( bool burn );
0047 
0048         Doc* doc() const { return m_doc; }
0049 
0050     protected Q_SLOTS:
0051         /** burn */
0052         void slotStartClicked() override;
0053         /** save */
0054         void slotSaveClicked() override;
0055         void slotCancelClicked() override;
0056 
0057         /**
0058          * gets called if the user changed the writer
0059          * default implementation just calls
0060          * toggleAllOptions()
0061          */
0062         virtual void slotWriterChanged();
0063 
0064         /**
0065          * gets called if the user changed the writing app
0066          * default implementation just calls
0067          * toggleAllOptions()
0068          */
0069         virtual void slotWritingAppChanged( K3b::WritingApp );
0070 
0071     Q_SIGNALS:
0072         void writerChanged();
0073 
0074     protected:
0075         /**
0076          * The default implementation loads the following settings from the KConfig.
0077          * May be used in subclasses.
0078          * <ul>
0079          *   <li>Writing mode</li>
0080          *   <li>Simulate</li>
0081          *   <li>on the fly</li>
0082          *   <li>remove images</li>
0083          *   <li>only create images</li>
0084          *   <li>writer</li>
0085          *   <li>writing speed</li>
0086          * </ul>
0087          */
0088         void loadSettings( const KConfigGroup& ) override;
0089 
0090         /**
0091          * The default implementation saves the following settings to the KConfig.
0092          * May be used in subclasses.
0093          * <ul>
0094          *   <li>Writing mode</li>
0095          *   <li>Simulate</li>
0096          *   <li>on the fly</li>
0097          *   <li>remove images</li>
0098          *   <li>only create images</li>
0099          *   <li>writer</li>
0100          *   <li>writing speed</li>
0101          * </ul>
0102          */
0103         void saveSettings( KConfigGroup ) override;
0104 
0105         /**
0106          * The default implementation saves the following settings to the doc and may be called
0107          * in subclasses:
0108          * <ul>
0109          *   <li>Writing mode</li>
0110          *   <li>Simulate</li>
0111          *   <li>on the fly</li>
0112          *   <li>remove images</li>
0113          *   <li>only create images</li>
0114          *   <li>writer</li>
0115          *   <li>writing speed</li>
0116          * </ul>
0117          */
0118         virtual void saveSettingsToProject();
0119 
0120         /**
0121          * The default implementation reads the following settings from the doc and may be called
0122          * in subclasses:
0123          * <ul>
0124          *   <li>Writing mode</li>
0125          *   <li>Simulate</li>
0126          *   <li>on the fly</li>
0127          *   <li>remove images</li>
0128          *   <li>only create images</li>
0129          *   <li>writer</li>
0130          *   <li>writing speed</li>
0131          * </ul>
0132          */
0133         virtual void readSettingsFromProject();
0134 
0135         void toggleAll() override;
0136 
0137         /**
0138          * use this to set additional stuff in the job
0139          */
0140         virtual void prepareJob( BurnJob* ) {};
0141 
0142         void prepareGui();
0143 
0144         void addPage( QWidget*, const QString& title );
0145 
0146         /**
0147          * Call this if you must reimplement it.
0148          * \reimplemented from InteractionDialog
0149          */
0150         void init() override;
0151 
0152         WriterSelectionWidget* m_writerSelectionWidget;
0153         TempDirSelectionWidget* m_tempDirSelectionWidget;
0154         WritingModeWidget* m_writingModeWidget;
0155         QGroupBox* m_optionGroup;
0156         QVBoxLayout* m_optionGroupLayout;
0157         QCheckBox* m_checkCacheImage;
0158         QCheckBox* m_checkSimulate;
0159         QCheckBox* m_checkRemoveBufferFiles;
0160         QCheckBox* m_checkOnlyCreateImage;
0161         QSpinBox* m_spinCopies;
0162         QTabWidget *m_tabWidget;
0163         QString m_imageTipText;
0164 
0165     private Q_SLOTS:
0166         void slotShowImageTip( bool buttonActivated );
0167 
0168     private:
0169         Doc* m_doc;
0170         BurnJob* m_job;
0171     };
0172 }
0173 
0174 #endif