File indexing completed on 2024-04-28 04:50:49
0001 /* 0002 * mainwindow.h 0003 * 0004 * Copyright (C) 2007-2011 Christoph Pfister <christophpfister@gmail.com> 0005 * 0006 * This program is free software; you can redistribute it and/or modify 0007 * it under the terms of the GNU General Public License as published by 0008 * the Free Software Foundation; either version 2 of the License, or 0009 * (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License along 0017 * with this program; if not, write to the Free Software Foundation, Inc., 0018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 0019 */ 0020 0021 #ifndef MAINWINDOW_H 0022 #define MAINWINDOW_H 0023 0024 #include <KMainWindow> 0025 #include <QCommandLineParser> 0026 #include <QSystemTrayIcon> 0027 #include "mediawidget.h" 0028 0029 class KAboutData; 0030 class QStackedLayout; 0031 class KCmdLineOptions; 0032 class KRecentFilesAction; 0033 class QTabBar; 0034 class DvbTab; 0035 class PlayerTab; 0036 class PlaylistTab; 0037 class TabBase; 0038 0039 class MainWindow : public QMainWindow 0040 { 0041 Q_OBJECT 0042 public: 0043 MainWindow(KAboutData *aboutData, QCommandLineParser *parser); 0044 ~MainWindow(); 0045 0046 void run(); 0047 void parseArgs(const QString workingDirectory = ""); 0048 0049 signals: 0050 void mayCloseApplication(bool *ok, QWidget *parent); 0051 0052 private slots: 0053 void displayModeChanged(); 0054 void open(); 0055 void close(); 0056 void openUrl(); 0057 void openUrl(const QUrl &url); 0058 void openAudioCd(const QString &device = QString()); 0059 void openVideoCd(const QString &device = QString()); 0060 void openDvd(const QString &device = QString()); 0061 void playDvdFolder(); 0062 void playDvb(); 0063 void configureKeys(); 0064 void configureKaffeine(); 0065 void navigationBarOrientationChanged(Qt::Orientation orientation); 0066 void activateTab(int tabIndex); 0067 void hideCursor(); 0068 void trayShowHide(QSystemTrayIcon::ActivationReason reason); 0069 0070 private: 0071 enum TabIndex { 0072 StartTabId = 0, 0073 PlayerTabId = 1, 0074 PlaylistTabId = 2, 0075 DvbTabId = 3 0076 }; 0077 0078 void readSettings(); 0079 void writeSettings(); 0080 void closeEvent(QCloseEvent *event) override; 0081 bool event(QEvent *event) override; 0082 void keyPressEvent(QKeyEvent *event) override; 0083 void leaveEvent(QEvent *event) override; 0084 0085 KAboutData *aboutData; 0086 QCommandLineParser *parser; 0087 0088 QSystemTrayIcon *trayIcon; 0089 0090 KActionCollection *collection; 0091 KRecentFilesAction *actionOpenRecent; 0092 QToolBar *navigationBar; 0093 QTabBar *tabBar; 0094 QToolBar *controlBar; 0095 bool autoHideControlBar; 0096 QTimer *cursorHideTimer; 0097 QList<QUrl> temporaryUrls; 0098 0099 MediaWidget *mediaWidget; 0100 QStackedLayout *stackedLayout; 0101 QList<TabBase *> tabs; 0102 int currentTabIndex; 0103 0104 PlayerTab *playerTab; 0105 PlaylistTab *playlistTab; 0106 DvbTab *dvbTab; 0107 }; 0108 0109 #endif /* MAINWINDOW_H */