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

0001 /*
0002     SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 
0007 #ifndef K3BVIEW_H
0008 #define K3BVIEW_H
0009 
0010 #include "k3bdoc.h"
0011 
0012 #ifdef HAVE_CONFIG_H
0013 #include <config-k3b.h>
0014 #endif
0015 
0016 #include <KXMLGUIClient>
0017 
0018 #include <QHash>
0019 #include <QList>
0020 #include <QUrl>
0021 #include <QWidget>
0022 
0023 class QVBoxLayout;
0024 class KToolBar;
0025 
0026 namespace K3b {
0027     class FillStatusDisplay;
0028     class ProjectBurnDialog;
0029     class ProjectPlugin;
0030 
0031     class View : public QWidget, public KXMLGUIClient
0032     {
0033         Q_OBJECT
0034 
0035     public:
0036         /**
0037          *
0038          */
0039         View( Doc* pDoc, QWidget* parent );
0040         ~View() override;
0041 
0042         /**
0043          * returns a pointer to the document connected to the view
0044          * @deprecated use doc()
0045          */
0046         Doc* getDocument() const { return m_doc; }
0047         Doc* doc() const { return m_doc; }
0048 
0049         void setMainWidget( QWidget* );
0050 
0051     public Q_SLOTS:
0052         /**
0053          * Default impl. brings up the burnDialog via newBurnDialog() with writing
0054          */
0055         virtual void slotBurn();
0056 
0057         /**
0058          * Default impl. brings up the burnDialog via newBurnDialog() without writing
0059          */
0060         virtual void slotProperties();
0061 
0062         /**
0063          * Add an url to the doc. The default implementation simply calls
0064          * addUrls.
0065          */
0066         virtual void addUrl( const QUrl& );
0067 
0068         /**
0069          * Add urls to the doc. The default implementation calls doc()->addUrls.
0070          */
0071         virtual void addUrls( const QList<QUrl>& );
0072 
0073     protected:
0074         /**
0075          * Protected since the BurnDialog is not part of the API.
0076          */
0077         virtual ProjectBurnDialog* newBurnDialog( QWidget* = 0) = 0;
0078 
0079         /**
0080          * Call this to get the projectplugin actions.
0081          * It is usually used to place plugins buttons on the toolbar.
0082          */
0083         QList<QAction*> createPluginsActions( Doc::Type docType );
0084 
0085         FillStatusDisplay* fillStatusDisplay() const { return m_fillStatusDisplay; }
0086         KToolBar* toolBox() const { return m_toolBox; }
0087 
0088     private Q_SLOTS:
0089         void slotPluginButtonClicked();
0090 
0091     private:
0092         Doc* m_doc;
0093         FillStatusDisplay* m_fillStatusDisplay;
0094         KToolBar* m_toolBox;
0095         QVBoxLayout* m_layout;
0096 
0097         QHash<const QObject*, K3b::ProjectPlugin*> m_plugins;
0098     };
0099 }
0100 
0101 #endif // K3BVIEW_H