Commit 92df268e authored by Andres Krapf's avatar Andres Krapf

initial import - still buggy, crashes on exit, etc.

the playlist and the popup are unimplemented.
parent d072e40d
###############################################################################
# vlc (VideoLAN Client) kde module Makefile
# (c)2001 VideoLAN
###############################################################################
#
# Objects
#
PLUGIN_KDE = kde.o \
kdeinterface.o \
kinterfacemain.o \
kvlcslider.o \
kdiskdialog.o \
knetdialog.o \
ktitlemenu.o
PLUGIN_KDE_MOC = kinterfacemain.moc.o \
kvlcslider.moc.o \
kdiskdialog.moc.o \
knetdialog.moc.o \
ktitlemenu.moc.o
#BUILTIN_KDE = $(PLUGIN_KDE:%.o=BUILTIN_%.o)
#BUILTIN_KDE_MOC = $(PLUGIN_KDE_MOC:%.o=BUILTIN_%.o)
ALL_OBJ = $(PLUGIN_KDE) $(PLUGIN_KDE_MOC) $(BUILTIN_KDE) $(BUILTIN_KDE_MOC)
#
# Virtual targets
#
include ../../Makefile.modules
$(PLUGIN_KDE): %.o: .dep/%.dpp
$(PLUGIN_KDE): %.o: %.cpp
$(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/kde -I/usr/include/qt -c -o $@ $<
$(PLUGIN_KDE_MOC): %.o: .dep/%.dpp
$(PLUGIN_KDE_MOC): %.o: %.cpp
$(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/kde -I/usr/include/qt -c -o $@ $<
$(PLUGIN_KDE_MOC:%.moc.o=%.moc.cpp): %.moc.cpp: %.h
moc $< -o $@
#$(BUILTIN_KDE): BUILTIN_%.o: .dep/%.dpp
#$(BUILTIN_KDE): BUILTIN_%.o: %.cpp
# $(CC) $(CFLAGS) -DBUILTIN -I/usr/include/kde -I/usr/include/qt -c -o $@ $<
#$(BUILTIN_KDE_MOC): BUILTIN_%.o: dep/%.dpp
#$(BUILTIN_KDE_MOC): BUILTIN_%.o: %.cpp
# $(CC) $(CFLAGS) -DBUILTIN -I/usr/include/kde -I/usr/include/qt -c -o $@ $<
#$(BUILTIN_KDE_MOC: %.moc.o=%.cpp): %.moc.cpp: %.h
# $(MOC) $< -o $@
#
# Real targets
#
../../lib/kde.so: $(PLUGIN_KDE) $(PLUGIN_KDE_MOC)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_KDE) -lkfile
#../../lib/kde.a: $(BUILTIN_KDE)
# ar r $@ $^
# $(RANLIB) $@
/***************************************************************************
intf_plugin.h - description
-------------------
begin : Mon Apr 9 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#ifndef _INTF_PLUGIN_H_
#define _INTF_PLUGIN_H_
extern "C"
{
#include "modules_inner.h"
#include "defs.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "modules.h"
#include "stream_control.h"
#include "input_ext-intf.h"
#include "intf_msg.h"
#include "intf_playlist.h"
#include "interface.h"
#include "main.h"
}
#endif /* _INTF_PLUGIN_H_ */
\ No newline at end of file
/***************************************************************************
kde.cpp - description
-------------------
begin : Sun Mar 25 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#define MODULE_NAME kde
#include "intf_plugin.h"
extern "C"
{
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for KDE module" )
ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_END
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
void _M( intf_getfunctions )( function_list_t * p_function_list );
/*****************************************************************************
* InitModule: get the module structure and configuration.
*****************************************************************************
* We have to fill psz_name, psz_longname and psz_version. These variables
* will be strdup()ed later by the main application because the module can
* be unloaded later to save memory, and we want to be able to access this
* data even after the module has been unloaded.
*****************************************************************************/
MODULE_INIT
{
p_module->psz_name = MODULE_STRING;
p_module->psz_longname = "KDE interface module";
p_module->psz_version = VERSION;
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_INTF;
return( 0 );
}
/*****************************************************************************
* ActivateModule: set the module to an usable state.
*****************************************************************************
* This function fills the capability functions and the configuration
* structure. Once ActivateModule() has been called, the i_usage can
* be set to 0 and calls to NeedModule() be made to increment it. To unload
* the module, one has to wait until i_usage == 0 and call DeactivateModule().
*****************************************************************************/
MODULE_ACTIVATE
{
p_module->p_functions =
( module_functions_t * )malloc( sizeof( module_functions_t ) );
if( p_module->p_functions == NULL )
{
return( -1 );
}
_M( intf_getfunctions )( &p_module->p_functions->intf );
p_module->p_config = p_config;
return( 0 );
}
/*****************************************************************************
* DeactivateModule: make sure the module can be unloaded.
*****************************************************************************
* This function must only be called when i_usage == 0. If it successfully
* returns, i_usage can be set to -1 and the module unloaded. Be careful to
* lock usage_lock during the whole process.
*****************************************************************************/
MODULE_DEACTIVATE
{
free( p_module->p_functions );
return( 0 );
}
} /* extern "C" */
/***************************************************************************
kdeinterface.cpp - description
-------------------
begin : Sun Mar 25 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#define MODULE_NAME kde
#include "intf_plugin.h"
#include "kdeinterface.h"
#include "kinterfacemain.h"
#include <iostream>
#include <kaction.h>
#include <kapp.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kmainwindow.h>
#include <kstdaction.h>
#include <qwidget.h>
/*****************************************************************************
* Functions exported as capabilities.
*****************************************************************************/
extern "C"
{
void _M( intf_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = KDEInterface::probe;
p_function_list->functions.intf.pf_open = KDEInterface::open;
p_function_list->functions.intf.pf_close = KDEInterface::close;
p_function_list->functions.intf.pf_run = KDEInterface::run;
}
}
/*****************************************************************************
* KDEInterface::KDEInterface: KDE interface constructor
*****************************************************************************/
KDEInterface::KDEInterface(intf_thread_t *p_intf)
{
fAboutData = new KAboutData("VideoLAN Client", I18N_NOOP("Kvlc"),
VERSION,
"This is the VideoLAN client, a DVD and MPEG player. It can play MPEG and MPEG 2 files from a file or from a network source.", KAboutData::License_GPL,
"(C) 1996, 1997, 1998, 1999, 2000, 2001 - the VideoLAN Team", 0, 0, "dae@chez.com");
char *authors[][2] = {
{ "Rgis Duchesne", "<regis@via.ecp.fr>" },
{ "Michel Lespinasse", "<walken@zoy.org>" },
{ "Olivier Pomel", "<pomel@via.ecp.fr>" },
{ "Pierre Baillet", "<oct@zoy.org>" },
{ "Jean-Philippe Grimaldi", "<jeanphi@via.ecp.fr>" },
{ "Andres Krapf", "<dae@via.ecp.fr>" },
{ "Christophe Massiot", "<massiot@via.ecp.fr>" },
{ "Vincent Seguin", "<seguin@via.ecp.fr>" },
{ "Benoit Steiner", "<benny@via.ecp.fr>" },
{ "Arnaud de Bossoreille de Ribou", "<bozo@via.ecp.fr>" },
{ "Jean-Marc Dressler", "<polux@via.ecp.fr>" },
{ "Gal Hendryckx", "<jimmy@via.ecp.fr>" },
{ "Samuel Hocevar","<sam@zoy.org>" },
{ "Brieuc Jeunhomme", "<bbp@via.ecp.fr>" },
{ "Michel Kaempf", "<maxx@via.ecp.fr>" },
{ "Stphane Borel", "<stef@via.ecp.fr>" },
{ "Renaud Dartus", "<reno@via.ecp.fr>" },
{ "Henri Fallon", "<henri@via.ecp.fr>" },
{ NULL, NULL },
};
for ( int i = 0; NULL != authors[i][0]; i++ ) {
fAboutData->addAuthor( authors[i][0], 0, authors[i][1] );
}
int argc = 1;
char *argv[] = { "" };
KCmdLineArgs::init( argc, argv, fAboutData );
fApplication = new KApplication();
fWindow = new KInterfaceMain(p_intf);
fWindow->setCaption( VOUT_TITLE " (KDE interface)" );
}
/*****************************************************************************
* KDEInterface::~KDEInterface: KDE interface destructor
*****************************************************************************/
KDEInterface::~KDEInterface()
{
cerr << "entering ~KDEInterface()\n";
// delete ( fApplication );
cerr << "leaving ~KDEInterface()\n";
}
/*****************************************************************************
* KDEInterface::probe: probe the interface and return a score
*****************************************************************************
* This function tries to initialize KDE and returns a score to the
* plugin manager so that it can select the best plugin.
*****************************************************************************/
int KDEInterface::probe(probedata_t *p_data )
{
if ( TestMethod( INTF_METHOD_VAR, "kde" ) )
{
return ( 999 );
}
if ( TestProgram( "kvlc" ) )
{
return ( 180 );
}
return ( 80 );
}
/*****************************************************************************
* KDEInterface::open: initialize and create window
*****************************************************************************/
int KDEInterface::open(intf_thread_t *p_intf)
{
p_intf->p_sys = (intf_sys_s*) new KDEInterface(p_intf); // XXX static_cast ?
return ( 0 );
}
/*****************************************************************************
* KDEInterface::close: destroy interface window
*****************************************************************************/
void KDEInterface::close(intf_thread_t *p_intf)
{
// delete ( ( KDEInterface* ) p_intf->p_sys );
}
/*****************************************************************************
* KDEInterface::run: KDE thread
*****************************************************************************
* This part of the interface is in a separate thread so that we can call
* exec() from within it without annoying the rest of the program.
*****************************************************************************/
void KDEInterface::run(intf_thread_t *p_intf)
{
// XXX static_cast ?
KDEInterface *kdeInterface = (KDEInterface*) p_intf->p_sys;
kdeInterface->fWindow->show();
kdeInterface->fApplication->exec();
}
/***************************************************************************
kdeinterface.h - description
-------------------
begin : Sun Mar 25 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#ifndef _KDEINTERFACE_H_
#define _KDEINTERFACE_H_
class KApplication;
class KInterfaceMain;
class KAboutData;
class KDEInterface
{
private:
KDEInterface ( KDEInterface &kdeInterface ) {};
KDEInterface &operator= ( KDEInterface &kdeInterface ) { return ( *this ); };
public:
KDEInterface(intf_thread_t *p_intf);
~KDEInterface();
// These methods get exported to the core
static int probe ( probedata_t *p_data );
static int open ( intf_thread_t *p_intf );
static void close ( intf_thread_t *p_intf );
static void run ( intf_thread_t *p_intf );
private:
KApplication *fApplication;
KInterfaceMain *fWindow;
KAboutData *fAboutData;
};
#endif /* _KDEINTERFACE_H_ */
/***************************************************************************
kdiskdialog.cpp - description
-------------------
begin : Sat Apr 7 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#include "kdiskdialog.h"
#include <qhbox.h>
#include <qlabel.h>
#include <qradiobutton.h>
#include <qspinbox.h>
#include <qstring.h>
#include <qvbox.h>
#include <qvbuttongroup.h>
#include <qvgroupbox.h>
#include <qwidget.h>
#include <kdialogbase.h>
#include <klineedit.h>
KDiskDialog::KDiskDialog( QWidget *parent, const char *name ) :
KDialogBase( parent, name, true, QString::null, Ok|Cancel, Ok, true )
{
QVBox *pageVBox = makeVBoxMainWidget();
QHBox *deviceSelectHBox = new QHBox( pageVBox );
deviceSelectHBox->setSpacing( 5 );
fButtonGroup = new QVButtonGroup( "Disk type", deviceSelectHBox );
fDVDButton = new QRadioButton( "DVD", fButtonGroup);
fDVDButton->setChecked( true );
fVCDButton = new QRadioButton( "VCD", fButtonGroup);
fVCDButton->setEnabled( false );
QVGroupBox *startVBox = new QVGroupBox( "Starting position", deviceSelectHBox );
QHBox *titleHBox = new QHBox( startVBox );
QLabel *titleLabel = new QLabel( "Title ", titleHBox );
fTitle = new QSpinBox( titleHBox );
QHBox *chapterHBox = new QHBox( startVBox );
QLabel *chapterLabel = new QLabel( "Chapter ", chapterHBox );
fChapter = new QSpinBox( chapterHBox );
QHBox *deviceNameHBox = new QHBox( pageVBox );
QLabel *deviceNameLabel = new QLabel( "Device name ", deviceNameHBox );
fLineEdit = new KLineEdit( "/dev/dvd", deviceNameHBox );
}
KDiskDialog::~KDiskDialog()
{
}
QString KDiskDialog::type() const
{
if ( fDVDButton->isChecked() )
{
return ( QString("dvd") );
}
else
{
return ( QString("vcd") );
}
}
QString KDiskDialog::device() const
{
return ( fLineEdit->text() );
}
int KDiskDialog::title() const
{
return ( fTitle->value() );
}
int KDiskDialog::chapter() const
{
return ( fChapter->value() );
}
\ No newline at end of file
/***************************************************************************
kdiskdialog.h - description
-------------------
begin : Sat Apr 7 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#ifndef KDISKDIALOG_H
#define KDISKDIALOG_H
#include <kdialogbase.h>
#include <qstring.h>
class QVButtonGroup;
class QRadioButton;
class QSpinBox;
class KLineEdit;
/**
*@author andres
*/
class KDiskDialog : public KDialogBase {
Q_OBJECT
public:
KDiskDialog( QWidget *parent=0, const char *name=0 );
~KDiskDialog();
QString type() const;
QString device() const;
int title() const;
int chapter() const;
private:
QVButtonGroup *fButtonGroup;
QRadioButton *fDVDButton;
QRadioButton *fVCDButton;
QSpinBox *fTitle;
QSpinBox *fChapter;
KLineEdit *fLineEdit;
};
#endif
This diff is collapsed.
/***************************************************************************
kinterfacemain.h - description
-------------------
begin : Sun Mar 25 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#ifndef _KINTERFACEMAIN_H_
#define _KINTERFACEMAIN_H_
#define MODULE_NAME kde
#include "intf_plugin.h"
#include <kmainwindow.h>
#include <kurl.h>
#include <qdragobject.h>
#include <qstring.h>
#include <qwidget.h>
class KDiskDialog;
class KNetDialog;
class KRecentFilesAction;
class KTitleMenu;
class KToggleAction;
class KVLCSlider;
/**Main Window for the KDE vlc interface
*@author andres
*/
class KInterfaceMain : public KMainWindow {
Q_OBJECT
public:
KInterfaceMain(intf_thread_t *p_intf, QWidget *parent=0,
const char *name=0);
~KInterfaceMain();
public slots:
/** open a file and load it into the document*/
void slotFileOpen();
/** opens a file from the recent files menu */
void slotFileOpenRecent(const KURL& url);
/** asks for saving if the file is modified, then closes the actual file and window*/
void slotFileClose();
/** closes all open windows by calling close() on each memberList item until the list is empty, then quits the application.
* If queryClose() returns false because the user canceled the saveModified() dialog, the closing breaks.
*/
void slotFileQuit();
/** toggles the toolbar
*/
void slotViewToolBar();
/** toggles the statusbar
*/
void slotViewStatusBar();
/** changes the statusbar contents for the standard label permanently, used to indicate current actions.
* @param text the text that is displayed in the statusbar
*/
void slotStatusMsg( const QString &text );
protected:
/** initializes the KActions of the application */
void initActions();
/** sets up the statusbar for the main window by initialzing a statuslabel.
*/
void initStatusBar();
virtual void dragEnterEvent( QDragEnterEvent *event );
virtual void dropEvent( QDropEvent *event );
private slots:
/** we use this to manage the communication with the vlc core */
void slotManage();
/** this slot is called when we drag the position seek bar */
void slotSliderMoved( int position );
/** called every time the slider changes values */
void slotSliderChanged( int position );
void slotOpenDisk();
void slotOpenStream();
void slotPlay();
void slotPause();
void slotStop();
void slotBackward();
void slotForward();
void slotSlow();
void slotFast();
private:
intf_thread_t *fInterfaceThread;
/** to call p_intf->pf_manage every now and then */
QTimer *fTimer;
/** slider which works well with user movement */
KVLCSlider *fSlider;
/** open dvd/vcd */
KDiskDialog *fDiskDialog;
/** open net stream */
KNetDialog *fNetDialog;
KTitleMenu *fTitleMenu;
// KAction pointers to enable/disable actions
KAction *fileOpen;
KAction *diskOpen;
KAction *streamOpen;
KRecentFilesAction *fileOpenRecent;
KAction *fileClose;
KAction *fileQuit;
KToggleAction *viewToolBar;
KToggleAction *viewStatusBar;
KAction *play;
KAction *pause;
KAction *stop;
KAction *backward;
KAction *forward;
KAction *slow;
KAction *fast;
};
#endif /* _KINTERFACEMAIN_H_ */
/***************************************************************************
knetdialog.cpp - description
-------------------
begin : Mon Apr 9 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#include "knetdialog.h"
#include <kdialogbase.h>
#include <klineedit.h>
#include <qhbox.h>
#include <qlabel.h>
#include <qradiobutton.h>
#include <qspinbox.h>
#include <qstring.h>
#include <qvbox.h>
#include <qvbuttongroup.h>
#include <qvgroupbox.h>
#include <qwidget.h>
KNetDialog::KNetDialog( QWidget *parent, const char *name ) :
KDialogBase( parent, name, true, QString::null, Ok|Cancel, Ok, true )
{
QVBox *pageVBox = makeVBoxMainWidget();
QHBox *layout = new QHBox( pageVBox );
layout->setSpacing( 5 );
fButtonGroup = new QVButtonGroup( "Protocol", layout );
fTSButton = new QRadioButton( "TS", fButtonGroup);
fTSButton->setChecked( true );
fRTPButton = new QRadioButton( "RTP", fButtonGroup);
fRTPButton->setEnabled( false );
fHTTPButton = new QRadioButton( "HTTP", fButtonGroup);
fHTTPButton->setEnabled( false );
QVGroupBox *serverVBox = new QVGroupBox( "Starting position", layout );
QHBox *titleHBox = new QHBox( serverVBox );
QLabel *titleLabel = new QLabel( "Address ", titleHBox );
fAddress = new KLineEdit( "vls", titleHBox );
QHBox *portHBox = new QHBox( serverVBox );
QLabel *portLabel = new QLabel( "Port ", portHBox );
fPort = new QSpinBox( 0, 65535, 1, portHBox );
}
KNetDialog::~KNetDialog()
{
}
QString KNetDialog::protocol() const
{
if ( fTSButton->isChecked() )
{
return ( QString( "ts" ) );
}
else if ( fRTPButton->isChecked() )
{
return ( QString( "rtp" ) );
}
else
{
return ( QString( "http" ) );
}
}
QString KNetDialog::server() const
{
return ( fAddress->text() );
}
int KNetDialog::port() const
{
return ( fPort->value() );
}
/***************************************************************************
knetdialog.h - description
-------------------
begin : Mon Apr 9 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#ifndef _KNETDIALOG_H_
#define _KNETDIALOG_H_
#include <qwidget.h>
#include <kdialogbase.h>
class QVButtonGroup;
class QRadioButton;
class QSpinBox;
class KLineEdit;
/**
*@author andres
*/
class KNetDialog : public KDialogBase {
Q_OBJECT
public:
KNetDialog(QWidget *parent=0, const char *name=0);
~KNetDialog();
QString protocol() const;
QString server() const;
int port() const;
private:
QVButtonGroup *fButtonGroup;
QRadioButton *fTSButton;
QRadioButton *fRTPButton;
QRadioButton *fHTTPButton;
KLineEdit *fAddress;
QSpinBox *fPort;
};
#endif /* _KNETDIALOG_H_ */
/***************************************************************************
ktitlemenu.cpp - description
-------------------
begin : Thu Apr 12 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#include "ktitlemenu.h"
#include <kaction.h>
#include <klocale.h>
KTitleMenu::KTitleMenu( intf_thread_t *p_intf, QWidget *parent, const char *name ) : KPopupMenu( parent, name )
{
fInterfaceThread = p_intf;
connect( this, SIGNAL( aboutToShow() ), this, SLOT( regenerateSlot() ) );
fLanguageList = new KActionMenu( "Language", 0, this );
}
KTitleMenu::~KTitleMenu()
{
}
void KTitleMenu::regenerateSlot()
{
// removal of elements and disconnection of signal/slots happen transparently on delete
delete fLanguageList;
fLanguageList = new KActionMenu( "Language", 0, this );
int i_item = 0;
vlc_mutex_lock( &fInterfaceThread->p_input->stream.stream_lock );
for( int i = 0 ; i < fInterfaceThread->p_input->stream.i_es_number ; i++ )
{
if( fInterfaceThread->p_input->stream.pp_es[i]->i_cat /* == i_cat */ )
{
i_item++;
QString language( fInterfaceThread->p_input->stream.pp_es[i]->psz_desc );
if ( QString::null == language )
{
language += i18n( "Language" );
language += " " + i_item;
}
KRadioAction *action = new KRadioAction( language, 0, this, "language_action" );
fLanguageList->insert( action );
if( /* p_es == */ fInterfaceThread->p_input->stream.pp_es[i] )
{
/* don't lose p_item when we append into menu */
//p_item_active = p_item;
}
}
}
vlc_mutex_unlock( &fInterfaceThread->p_input->stream.stream_lock );
// /* link the new menu to the menubar item */
// gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
//
// /* acitvation will call signals so we can only do it
// * when submenu is attached to menu - to get intf_window */
// if( p_item_active != NULL )
// {
// gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
// TRUE );
// }
/* be sure that menu is sensitive if non empty */
if ( i_item > 0 )
{
fLanguageList->setEnabled( true );
}
}
/** this method is called when the user selects a language */
void KTitleMenu::languageSelectedSlot()
{
}
/***************************************************************************
ktitlemenu.h - description
-------------------
begin : Thu Apr 12 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#ifndef _KTITLEMENU_H_
#define _KTITLEMENU_H_
#define MODULE_NAME kde
#include "intf_plugin.h"
#include <qwidget.h>
#include <kpopupmenu.h>
class KActionMenu;
/**
*@author andres
*/
class KTitleMenu : public KPopupMenu {
Q_OBJECT
public:
KTitleMenu( intf_thread_t *p_intf, QWidget *parent=0, const char *name=0 );
~KTitleMenu();
private:
intf_thread_t *fInterfaceThread;
KActionMenu *fLanguageList;
private slots: // Private slots
/** this method regenerates the popup menu */
void regenerateSlot();
/** this method is called when the user selects a language */
void languageSelectedSlot();
};
#endif /* _KTITLEMENU_H_ */
/***************************************************************************
kinterfacemain.cpp - description
-------------------
begin : Sun Mar 25 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
/***************************************************************************
shamelessly copied from noatun's excellent interface
****************************************************************************/
#include "kvlcslider.h"
KVLCSlider::KVLCSlider(QWidget * parent, const char * name) :
QSlider(parent,name), pressed(false)
{
}
KVLCSlider::KVLCSlider(Orientation o, QWidget * parent, const char * name) :
QSlider(o,parent,name), pressed(false)
{
}
KVLCSlider::KVLCSlider(int minValue, int maxValue, int pageStep, int value,
Orientation o, QWidget * parent, const char * name) :
QSlider(minValue, maxValue, pageStep, value, o, parent,name), pressed(false)
{
}
void KVLCSlider::setValue(int i)
{
if ( !pressed )
{
QSlider::setValue( i );
}
}
void KVLCSlider::mousePressEvent( QMouseEvent *e )
{
if ( e->button() != RightButton )
{
pressed=true;
QSlider::mousePressEvent( e );
}
}
void KVLCSlider::mouseReleaseEvent( QMouseEvent *e )
{
pressed=false;
QSlider::mouseReleaseEvent( e );
emit userChanged( value() );
}
/***************************************************************************
kvlcslider.h - description
-------------------
begin : Sun Apr 03 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
/***************************************************************************
shamelessly copied from noatun's excellent interface
****************************************************************************/
#ifndef _KVLCSLIDER_H_
#define _KVLCSLIDER_H_
#include <qslider.h>
/**
* This slider can be changed by the vlc while not dragged by the user
*/
class KVLCSlider : public QSlider
{
Q_OBJECT
public:
KVLCSlider(QWidget * parent, const char * name=0);
KVLCSlider(Orientation, QWidget * parent, const char * name=0);
KVLCSlider(int minValue, int maxValue, int pageStep, int value,
Orientation, QWidget * parent, const char * name=0);
signals:
/**
* emmited only when the user changes the value by hand
*/
void userChanged( int value );
public slots:
virtual void setValue( int );
protected:
virtual void mousePressEvent( QMouseEvent * e );
virtual void mouseReleaseEvent( QMouseEvent * e );
private:
bool pressed; // set this to true when the user drags the slider
};
#endif /* _KVLCSLIDER_H_ */
<!DOCTYPE kpartgui>
<kpartgui name="kvlc" version="0.1">
<ActionProperties>
<Action name="open_disk" icon="dvd_unmount"/>
<Action name="open_stream" icon="connect_no"/>
<Action name="play" icon="1rightarrow"/>
<Action name="pause" icon = "player_pause"/>
<Action name="stop" icon="player_stop"/>
<Action name="backward" icon="player_start"/>
<Action name="forward" icon="player_end"/>
<Action name="fast" icon="2rightarrow"/>
<Action name="slow" icon="2leftarrow"/>
</ActionProperties>
<MenuBar>
<Menu name="file" noMerge="1"><text>&amp;File</text>
<Action name="file_open"/>
<Action name="file_open_recent"/>
<Action name="open_disk"/>
<Action name="open_stream"/>
<Separator lineSeparator="true"/>
<Action name="file_close"/>
<Separator lineSeparator="true"/>
<Action name="file_quit"/>
</Menu>
</MenuBar>
<ToolBar name="mainToolBar" noMerge="1">
</ToolBar>
<ToolBar name="main" iconText="icononly" iconSize="32">
<Action name="file_open"/>
<Action name="open_disk"/>
<Action name="open_stream"/>
<Separator lineSeparator="true"/>
<Action name="backward"/>
<Action name="play"/>
<Action name="pause"/>
<Action name="stop"/>
<Action name="forward"/>
<Action name="slow"/>
<Action name="fast"/>
</ToolBar>
</kpartgui>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment