File indexing completed on 2024-04-21 15:38:16
0001 /** 0002 * Copyright (C) 2002-2003 by Koos Vriezen <koos.vriezen@gmail.com> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Library General Public 0006 * License version 2 as published by the Free Software Foundation. 0007 * 0008 * This library is distributed in the hope that it will be useful, 0009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0011 * Library General Public License for more details. 0012 * 0013 * You should have received a copy of the GNU Library General Public License 0014 * along with this library; see the file COPYING.LIB. If not, write to 0015 * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, 0016 * Boston, MA 02110-1301, USA. 0017 **/ 0018 0019 #ifndef _KMPLAYERCONFIG_H_ 0020 #define _KMPLAYERCONFIG_H_ 0021 0022 #include "config-kmplayer.h" 0023 0024 #include <qobject.h> 0025 #include <QColor> 0026 #include <QFont> 0027 #include <qstringlist.h> 0028 #include <qmap.h> 0029 0030 #include <ksharedconfig.h> 0031 0032 #include "kmplayer_def.h" 0033 0034 class KSharedConfig; 0035 class QFrame; 0036 0037 namespace KMPlayer { 0038 0039 class PartBase; 0040 class Preferences; 0041 class View; 0042 0043 class KDE_NO_EXPORT OutputDriver { 0044 public: 0045 const char * driver; 0046 const QString description; 0047 }; 0048 0049 class KDE_NO_EXPORT ColorSetting { 0050 public: 0051 QString title; 0052 QString option; 0053 QColor color; 0054 QColor newcolor; 0055 enum Target { 0056 playlist_background = 0, playlist_foreground, playlist_active, 0057 console_background, console_foreground, 0058 video_background, area_background, 0059 infowindow_background, infowindow_foreground, 0060 last_target 0061 } target; 0062 }; 0063 0064 class KDE_NO_EXPORT FontSetting { 0065 public: 0066 QString title; 0067 QString option; // for ini file 0068 QFont font; 0069 QFont newfont; 0070 enum Target { 0071 playlist, infowindow, last_target 0072 } target; 0073 }; 0074 0075 template <class T> 0076 struct Deleter { 0077 void operator ()(T * t) { 0078 delete t; 0079 } 0080 }; 0081 0082 /* 0083 * Base class for all dynamic preferance pages 0084 */ 0085 class KMPLAYER_EXPORT PreferencesPage { 0086 public: 0087 virtual ~PreferencesPage () {} 0088 virtual void write (KSharedConfigPtr) = 0; 0089 virtual void read (KSharedConfigPtr) = 0; 0090 virtual void sync (bool fromUI) = 0; 0091 virtual void prefLocation (QString & item, QString & icon, QString & tab) = 0; 0092 virtual QFrame * prefPage (QWidget * parent) = 0; 0093 PreferencesPage * next; 0094 }; 0095 0096 /* 0097 * Class for storing all actual settings and reading/writing them 0098 */ 0099 class KMPLAYER_EXPORT Settings : public QObject { 0100 Q_OBJECT 0101 public: 0102 Settings (PartBase *, KSharedConfigPtr part) KDE_NO_CDTOR_EXPORT; 0103 ~Settings () KDE_NO_CDTOR_EXPORT; 0104 bool createDialog () KDE_NO_EXPORT; 0105 void show (const char * pagename = 0L); 0106 void addPage (PreferencesPage *); 0107 void removePage (PreferencesPage *); 0108 void applyColorSetting (bool only_changed_ones) KDE_NO_EXPORT; 0109 Preferences *configDialog() const { return configdialog; } 0110 View * defaultView (); 0111 KSharedConfigPtr kconfig () { return m_config; } 0112 0113 QStringList urllist; 0114 QStringList sub_urllist; 0115 int volume; 0116 int contrast; 0117 int brightness; 0118 int hue; 0119 int saturation; 0120 int prefbitrate; 0121 int maxbitrate; 0122 bool usearts : 1; 0123 bool no_intro : 1; 0124 bool sizeratio : 1; 0125 bool remembersize : 1; 0126 bool autoresize : 1; 0127 bool docksystray : 1; 0128 bool loop : 1; 0129 bool framedrop : 1; 0130 bool autoadjustvolume : 1; 0131 bool autoadjustcolors : 1; 0132 bool showcnfbutton : 1; 0133 bool showplaylistbutton : 1; 0134 bool showrecordbutton : 1; 0135 bool showbroadcastbutton : 1; 0136 bool autohideslider : 1; 0137 bool clicktoplay : 1; 0138 bool grabhref : 1; 0139 // postproc thingies 0140 bool postprocessing : 1; 0141 bool disableppauto : 1; 0142 bool pp_default : 1; // -vf pp=de 0143 bool pp_fast : 1; // -vf pp=fa 0144 bool pp_custom : 1; // coming up 0145 0146 bool pp_custom_hz : 1; // horizontal deblocking 0147 bool pp_custom_hz_aq : 1; // - autoquality 0148 bool pp_custom_hz_ch : 1; // - chrominance 0149 0150 bool pp_custom_vt : 1; // vertical deblocking 0151 bool pp_custom_vt_aq : 1; // - autoquality 0152 bool pp_custom_vt_ch : 1; // - chrominance 0153 0154 bool pp_custom_dr : 1; // dering filter 0155 bool pp_custom_dr_aq : 1; // - autoquality 0156 bool pp_custom_dr_ch : 1; // - chrominance 0157 0158 bool pp_custom_al : 1; // pp=al 0159 bool pp_custom_al_f : 1;// - fullrange 0160 0161 bool pp_custom_tn : 1; // pp=tn 0162 int pp_custom_tn_s : 1; // - noise reducer strength (1 <= x <= 3) 0163 0164 bool pp_lin_blend_int : 1; // linear blend deinterlacer 0165 bool pp_lin_int : 1; // - interpolating - 0166 bool pp_cub_int : 1; // cubic - - 0167 bool pp_med_int : 1; // median interlacer 0168 bool pp_ffmpeg_int : 1; // ffmpeg interlacer 0169 // end of postproc 0170 // recording 0171 bool recordcopy : 1; 0172 enum Recorder { MEncoder = 0, FFMpeg, MPlayerDumpstream }; 0173 Recorder recorder; 0174 enum ReplayOption { ReplayNo = 0, ReplayFinished, ReplayAfter }; 0175 ReplayOption replayoption; 0176 int replaytime; 0177 QString mencoderarguments; 0178 QString ffmpegarguments; 0179 QString recordfile; 0180 int seektime; 0181 int videodriver; 0182 int audiodriver; 0183 OutputDriver * audiodrivers; 0184 OutputDriver * videodrivers; 0185 ColorSetting colors [ColorSetting::last_target]; 0186 FontSetting fonts [FontSetting::last_target]; 0187 QString dvddevice; 0188 QString vcddevice; 0189 QMap <QString, QString> backends; 0190 PreferencesPage * pagelist; 0191 signals: 0192 void configChanged (); 0193 public slots: 0194 void readConfig () KDE_NO_EXPORT; 0195 void writeConfig (); 0196 private slots: 0197 void okPressed () KDE_NO_EXPORT; 0198 void getHelp () KDE_NO_EXPORT; 0199 private: 0200 Preferences * configdialog; 0201 KSharedConfigPtr m_config; 0202 PartBase * m_player; 0203 }; 0204 0205 } // namespace 0206 0207 #endif //_KMPLAYERCONFIG_H_