File indexing completed on 2024-04-14 15:00:55

0001 /***************************************************************************
0002                           kmplayer.h  -  description
0003                              -------------------
0004     begin                : Sat Dec  7 16:14:51 CET 2002
0005     copyright            : (C) 2002 by Koos Vriezen
0006     email                :
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef KMPLAYER_H
0019 #define KMPLAYER_H
0020 
0021 
0022 #include "config-kmplayer.h"
0023 
0024 #include <QModelIndex>
0025 #include <qframe.h>
0026 
0027 #include <kxmlguiwindow.h>
0028 #include <ksharedconfig.h>
0029 
0030 #include "kmplayerconfig.h"
0031 #include "kmplayerpartbase.h"
0032 
0033 
0034 class KUrlRequester;
0035 class QAction;
0036 class QCheckBox;
0037 class QLabel;
0038 class QMenu;
0039 class QMenuItem;
0040 class QTreeWidgetItem;
0041 class KMPlayerBroadcastConfig;
0042 class KMPlayerFFServerConfig;
0043 class KSystemTrayIcon;
0044 class KRecentFilesAction;
0045 class KSharedConfig;
0046 template<class T> class KSharedPtr;
0047 
0048 namespace KMPlayer {
0049     class View;
0050     class PartBase;
0051     class Source;
0052     class PlayItem;
0053 } // namespace
0054 
0055 
0056 class KMPlayerApp : public KXmlGuiWindow {
0057     Q_OBJECT
0058 public:
0059     KMPlayerApp (QWidget* parent=NULL);
0060     ~KMPlayerApp ();
0061     void openDocumentFile (const KUrl& url=KUrl());
0062     void addUrl (const KUrl& url);
0063     KMPlayer::PartBase * player () const { return m_player; }
0064     void resizePlayer (int percentage);
0065     KDE_NO_EXPORT KRecentFilesAction * recentFiles () const { return fileOpenRecent; }
0066     KDE_NO_EXPORT KMPlayer::View *view () const { return m_view; }
0067     bool broadcasting () const;
0068     void showBroadcastConfig ();
0069     void hideBroadcastConfig ();
0070     KDE_NO_EXPORT KMPlayerBroadcastConfig * broadcastConfig () const { return m_broadcastconfig; }
0071     /* After createGUI() some menu's have to readded again */
0072     void initMenu ();
0073     void restoreFromConfig ();
0074 protected:
0075     void saveOptions ();
0076     void readOptions ();
0077     void saveProperties (KConfigGroup&);
0078     void readProperties (const KConfigGroup&);
0079     void initActions ();
0080     void initStatusBar ();
0081     void initView ();
0082     virtual bool queryClose ();
0083 
0084 public slots:
0085     void slotFileNewWindow ();
0086     void slotFileOpen ();
0087     void slotFileOpenRecent(const QUrl& url);
0088     void slotSaveAs ();
0089     void slotFileClose ();
0090     void slotFileQuit ();
0091     void slotPreferences ();
0092     void slotViewToolBar ();
0093     void slotViewStatusBar ();
0094     void slotViewMenuBar ();
0095     void slotStatusMsg (const QString &text);
0096     void slotSourceChanged (KMPlayer::Source *, KMPlayer::Source *);
0097 private slots:
0098     void openDVD ();
0099     void openVCD ();
0100     void openAudioCD ();
0101     void openPipe ();
0102     void openVDR ();
0103     void fullScreen ();
0104     void configChanged ();
0105     void keepSizeRatio ();
0106     void loadingProgress (int percentage);
0107     void positioned (int pos, int length);
0108     void zoom50 ();
0109     void zoom100 ();
0110     void zoom150 ();
0111     void editMode ();
0112     void syncEditMode ();
0113     void broadcastClicked ();
0114     void broadcastStarted ();
0115     void broadcastStopped ();
0116     void playerStarted ();
0117     void slotMinimalMode ();
0118     void slotConfigureKeys();
0119     void slotConfigureToolbars ();
0120     void slotClearHistory ();
0121     void windowVideoConsoleToggled (bool show);
0122     void playListItemActivated (const QModelIndex&);
0123     void playListItemDropped (QDropEvent *e, KMPlayer::PlayItem *after);
0124     void playListItemMoved ();
0125     void menuDropInList ();
0126     void menuDropInGroup ();
0127     void menuCopyDrop ();
0128     void menuDeleteNode ();
0129     void menuMoveUpNode ();
0130     void menuMoveDownNode ();
0131     void preparePlaylistMenu (KMPlayer::PlayItem *, QMenu *);
0132     void slotGeneratorMenu ();
0133     void slotGenerator ();
0134 
0135 private:
0136     void aboutToCloseWindow ();
0137     void minimalMode (bool deco=true);
0138     KSystemTrayIcon *m_systray;
0139     KMPlayer::PartBase * m_player;
0140     KMPlayer::View * m_view;
0141     KMPlayer::NodePtr recents;
0142     KMPlayer::NodePtr playlist;
0143     KMPlayer::NodePtrW manip_node;
0144     KMPlayer::NodePtrW current_generator;
0145     KMPlayer::NodeStoreList generators;
0146 
0147     QLabel* playtime_info;
0148     QAction * dropAdd;
0149     QAction * dropAddGroup;
0150     QAction * dropCopy;
0151     QAction * dropDelete;
0152     QAction * fileNewWindow;
0153     QAction * fileOpen;
0154     KRecentFilesAction * fileOpenRecent;
0155     QAction * fileClose;
0156     QAction * fileQuit;
0157     QAction * editVolumeInc;
0158     QAction * editVolumeDec;
0159     QAction * toggleView;
0160     QAction * viewSyncEditMode;
0161     QAction * viewEditMode;
0162     QAction * viewFullscreen;
0163     QAction * viewToolBar;
0164     QAction * viewStatusBar;
0165     QAction * viewMenuBar;
0166     QAction * viewKeepRatio;
0167     QMenuItem * m_sourcemenu;
0168     QMenu * m_dropmenu;
0169     QMenu * m_generatormenu;
0170     KMPlayerFFServerConfig * m_ffserverconfig;
0171     KMPlayerBroadcastConfig * m_broadcastconfig;
0172     QList<QUrl> m_drop_list;
0173     KMPlayer::PlayItem *m_drop_after;
0174     int edit_tree_id;
0175     int manip_tree_id;
0176     int last_time_left;
0177     int recents_id;
0178     int playlist_id;
0179     bool m_showToolbar;
0180     bool m_showStatusbar;
0181     bool m_showMenubar;
0182     bool m_played_intro;
0183     bool m_played_exit;
0184     bool m_minimal_mode;
0185     bool m_auto_resize;
0186 };
0187 
0188 
0189 /*
0190  * Preference page for DVD
0191  */
0192 class KMPLAYER_NO_EXPORT KMPlayerPrefSourcePageDVD : public QFrame {
0193     Q_OBJECT
0194 public:
0195     KMPlayerPrefSourcePageDVD (QWidget * parent);
0196     ~KMPlayerPrefSourcePageDVD () {}
0197 
0198     QCheckBox * autoPlayDVD;
0199     KUrlRequester * dvddevice;
0200 };
0201 
0202 /*
0203  * Source from DVD
0204  */
0205 class KMPLAYER_NO_EXPORT KMPlayerDVDSource : public KMPlayer::Source, public KMPlayer::PreferencesPage {
0206     Q_OBJECT
0207 public:
0208     KMPlayerDVDSource(KMPlayerApp* app);
0209     virtual ~KMPlayerDVDSource ();
0210     virtual bool processOutput (const QString & line);
0211     virtual QString filterOptions ();
0212     virtual void setIdentified (bool b = true);
0213     virtual QString prettyName ();
0214     virtual void write (KSharedConfigPtr);
0215     virtual void read (KSharedConfigPtr);
0216     virtual void sync (bool);
0217     virtual void prefLocation (QString & item, QString & icon, QString & tab);
0218     virtual QFrame * prefPage (QWidget * parent);
0219     virtual void activate ();
0220     virtual void deactivate ();
0221 
0222 private:
0223     void setCurrent (KMPlayer::Mrl *);
0224     void play (KMPlayer::Mrl *);
0225     KMPlayerApp* m_app;
0226     KMPlayer::NodePtr disks;
0227     KMPlayerPrefSourcePageDVD * m_configpage;
0228     int m_current_title;
0229     bool m_start_play;
0230 };
0231 
0232 
0233 /*
0234  * Preference page for VCD
0235  */
0236 class KMPLAYER_NO_EXPORT KMPlayerPrefSourcePageVCD : public QFrame {
0237     Q_OBJECT
0238 public:
0239     KMPlayerPrefSourcePageVCD (QWidget * parent);
0240     ~KMPlayerPrefSourcePageVCD () {}
0241     KUrlRequester * vcddevice;
0242     QCheckBox *autoPlayVCD;
0243 };
0244 
0245 
0246 /*
0247  * Source from VCD
0248  */
0249 class KMPLAYER_NO_EXPORT KMPlayerVCDSource : public KMPlayer::Source, public KMPlayer::PreferencesPage {
0250     Q_OBJECT
0251 public:
0252     KMPlayerVCDSource(KMPlayerApp* app);
0253     virtual ~KMPlayerVCDSource ();
0254     virtual bool processOutput (const QString & line);
0255     virtual void setIdentified (bool b = true);
0256     virtual QString prettyName ();
0257     virtual void write (KSharedConfigPtr);
0258     virtual void read (KSharedConfigPtr);
0259     virtual void sync (bool);
0260     virtual void prefLocation (QString & item, QString & icon, QString & tab);
0261     virtual QFrame * prefPage (QWidget * parent);
0262     virtual void activate ();
0263     virtual void deactivate ();
0264 private:
0265     void setCurrent (KMPlayer::Mrl *);
0266     KMPlayerApp* m_app;
0267     KMPlayerPrefSourcePageVCD * m_configpage;
0268     bool m_start_play;
0269 };
0270 
0271 
0272 /*
0273  * Source from AudoCD
0274  */
0275 class KMPLAYER_NO_EXPORT KMPlayerAudioCDSource : public KMPlayer::Source {
0276     Q_OBJECT
0277 public:
0278     KMPlayerAudioCDSource(KMPlayerApp* app);
0279     virtual ~KMPlayerAudioCDSource ();
0280     virtual bool processOutput (const QString & line);
0281     virtual void setIdentified (bool b = true);
0282     virtual QString prettyName ();
0283     virtual void activate ();
0284     virtual void deactivate ();
0285 private:
0286     void setCurrent (KMPlayer::Mrl *);
0287     KMPlayerApp* m_app;
0288 };
0289 
0290 
0291 /*
0292  * Source from stdin (for the backends, not kmplayer)
0293  */
0294 class KMPLAYER_NO_EXPORT KMPlayerPipeSource : public KMPlayer::Source {
0295     Q_OBJECT
0296 public:
0297     KMPlayerPipeSource (KMPlayerApp * app);
0298     virtual ~KMPlayerPipeSource ();
0299     virtual bool hasLength ();
0300     virtual bool isSeekable ();
0301     void setCommand (const QString & cmd);
0302     virtual QString prettyName ();
0303     virtual void activate ();
0304     virtual void deactivate ();
0305 private:
0306     KMPlayerApp * m_app;
0307 };
0308 
0309 #endif // KMPLAYER_H