interfaces
view.cpp
Go to the documentation of this file.00001 // Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com> 00002 // 00003 // Permission is hereby granted, free of charge, to any person obtaining a copy 00004 // of this software and associated documentation files (the "Software"), to deal 00005 // in the Software without restriction, including without limitation the rights 00006 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00007 // copies of the Software, and to permit persons to whom the Software is 00008 // furnished to do so, subject to the following conditions: 00009 // 00010 // The above copyright notice and this permission notice shall be included in 00011 // all copies or substantial portions of the Software. 00012 // 00013 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00014 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00015 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00016 // THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00017 // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00018 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00019 // 00020 // Except as contained in this notice, the name(s) of the author(s) shall not be 00021 // used in advertising or otherwise to promote the sale, use or other dealings 00022 // in this Software without prior written authorization from the author(s). 00023 00024 #include <kmediaplayer/view.h> 00025 00026 struct KMediaPlayer::View::Data 00027 { 00028 Data() : videoWidget(0L) {} 00029 00030 QWidget *videoWidget; 00031 }; 00032 00033 KMediaPlayer::View::View(QWidget *parent, const char *name) 00034 : QWidget(parent, name) 00035 , currentButtons((int)All) 00036 , d(new Data()) 00037 { 00038 } 00039 00040 KMediaPlayer::View::~View(void) 00041 { 00042 delete d; 00043 } 00044 00045 int KMediaPlayer::View::buttons(void) 00046 { 00047 return currentButtons; 00048 } 00049 00050 void KMediaPlayer::View::setButtons(int buttons) 00051 { 00052 if(buttons != currentButtons) 00053 { 00054 currentButtons = buttons; 00055 emit buttonsChanged(buttons); 00056 } 00057 } 00058 00059 bool KMediaPlayer::View::button(int b) 00060 { 00061 return currentButtons & b; 00062 } 00063 00064 void KMediaPlayer::View::showButton(int b) 00065 { 00066 setButtons(currentButtons | b); 00067 } 00068 00069 void KMediaPlayer::View::hideButton(int b) 00070 { 00071 setButtons(currentButtons & ~b); 00072 } 00073 00074 void KMediaPlayer::View::toggleButton(int b) 00075 { 00076 setButtons(currentButtons ^ b); 00077 } 00078 00079 void KMediaPlayer::View::setVideoWidget(QWidget *videoWidget) 00080 { 00081 d->videoWidget = videoWidget; 00082 } 00083 00084 QWidget* KMediaPlayer::View::videoWidget() 00085 { 00086 return d->videoWidget; 00087 } 00088 00089 #include "view.moc"