You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
207 lines
5.9 KiB
207 lines
5.9 KiB
/***************************************************************************
|
|
kplayerslideraction.h
|
|
---------------------
|
|
begin : Sat Jan 11 2003
|
|
copyright : (C) 2003 by kiriuja
|
|
email : kplayer-dev@en-directo.net
|
|
***************************************************************************/
|
|
|
|
/***************************************************************************
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
***************************************************************************/
|
|
|
|
#ifndef KPLAYERSLIDERACTION_H
|
|
#define KPLAYERSLIDERACTION_H
|
|
|
|
#include <kaction.h>
|
|
#include <tqslider.h>
|
|
|
|
/**KPlayer's slider widget. Works around the TQt upside-down slider bug.
|
|
* Taken from kplayer CVS 2003-09-21 (kplayer > 0.3.1) by Jonathan Riddell
|
|
*@author kiriuja
|
|
*/
|
|
class KPlayerSlider : public TQSlider
|
|
{
|
|
Q_OBJECT
|
|
TQ_OBJECT
|
|
|
|
public:
|
|
/** The KPlayerSlider constructor. Parameters are passed on to TQSlider.
|
|
*/
|
|
explicit KPlayerSlider (Qt::Orientation, TQWidget* parent = 0, const char* name = 0);
|
|
/** The KPlayerSlider destructor. Does nothing.
|
|
*/
|
|
virtual ~KPlayerSlider();
|
|
|
|
/** The size hint.
|
|
*/
|
|
virtual TQSize sizeHint() const;
|
|
/** The minimum size hint.
|
|
*/
|
|
virtual TQSize minimumSizeHint() const;
|
|
|
|
/** The minimum value.
|
|
*/
|
|
int minValue (void) const;
|
|
/** Sets the minimum value.
|
|
*/
|
|
void setMinValue (int);
|
|
/** The maximum value.
|
|
*/
|
|
int maxValue (void) const;
|
|
/** Sets the maximum value.
|
|
*/
|
|
void setMaxValue (int);
|
|
/** The line step.
|
|
*/
|
|
int lineStep (void) const;
|
|
/** Sets the line step.
|
|
*/
|
|
void setLineStep (int);
|
|
/** The page step.
|
|
*/
|
|
int pageStep (void) const;
|
|
/** Sets the page step.
|
|
*/
|
|
void setPageStep (int);
|
|
/** The current value.
|
|
*/
|
|
int value (void) const;
|
|
/** Sets the current value. The extra parameter prevents overriding of the virtual TQSlider::setValue.
|
|
*/
|
|
void setValue (int, int = 0); // do not override the virtual setValue
|
|
|
|
/** Sets up the slider by setting five options in one go.
|
|
*/
|
|
void setup (int minValue, int maxValue, int value, int pageStep, int lineStep = 1);
|
|
/** Sets the slider orientation.
|
|
*/
|
|
virtual void setOrientation (Qt::Orientation);
|
|
|
|
signals:
|
|
/** Emitted when the slider value changes.
|
|
*/
|
|
void changed (int);
|
|
|
|
protected slots:
|
|
/** Receives the valueChanged signal from TQSlider.
|
|
*/
|
|
void sliderValueChanged (int);
|
|
|
|
protected:
|
|
// Recursion prevention. Should be private.
|
|
bool m_changing_orientation;
|
|
|
|
friend class KPlayerSliderAction;
|
|
friend class KPlayerPopupSliderAction;
|
|
};
|
|
|
|
/**KPlayer popup frame.
|
|
*@author kiriuja
|
|
*/
|
|
class KPlayerPopupFrame : public TQFrame
|
|
{
|
|
Q_OBJECT
|
|
TQ_OBJECT
|
|
|
|
public:
|
|
/** The KPlayerPopupFrame constructor. Parameters are passed on to TQFrame.
|
|
*/
|
|
KPlayerPopupFrame (TQWidget* parent = 0, const char* name = 0)
|
|
: TQFrame (parent, name, TQt::WType_Popup) { }
|
|
/** The KPlayerPopupFrame destructor. Does nothing.
|
|
*/
|
|
virtual ~KPlayerPopupFrame() { }
|
|
|
|
protected:
|
|
/** Closes the popup frame when Alt, Tab, Esc, Enter or Return is pressed.
|
|
*/
|
|
virtual void keyPressEvent (TQKeyEvent*);
|
|
};
|
|
|
|
/**Action representing a popup slider activated by a toolbar button.
|
|
*@author kiriuja
|
|
*/
|
|
class KPlayerPopupSliderAction : public KAction
|
|
{
|
|
Q_OBJECT
|
|
TQ_OBJECT
|
|
|
|
public:
|
|
/** The KPlayerPopupSliderAction constructor. Parameters are passed on to KAction.
|
|
*/
|
|
KPlayerPopupSliderAction (const TQString& text, const TQString& pix, const KShortcut& shortcut,
|
|
const TQObject* receiver, const char* slot, TQObject* parent = 0, const char* name = 0);
|
|
/** The KPlayerPopupSliderAction destructor. Deletes the KPlayerPopupFrame.
|
|
*/
|
|
virtual ~KPlayerPopupSliderAction();
|
|
|
|
/** Returns a pointer to the KPlayerSlider object.
|
|
*/
|
|
KPlayerSlider* slider (void)
|
|
{ return m_slider; }
|
|
|
|
/** Plugs the action into the toolbar. Reparents the slider into the toolbar. */
|
|
//virtual int plug (TQWidget*, int = -1);
|
|
/** Unplugs the action from the toolbar. Reparents the slider out of the toolbar. */
|
|
//virtual void unplug (TQWidget*);
|
|
|
|
protected slots:
|
|
/** Pops up the slider.
|
|
*/
|
|
virtual void slotActivated (void);
|
|
|
|
protected:
|
|
/** The slider.
|
|
*/
|
|
KPlayerSlider* m_slider;
|
|
/** The popup frame.
|
|
*/
|
|
KPlayerPopupFrame* m_frame;
|
|
};
|
|
|
|
/**Slider action suitable for insertion into a toolbar.
|
|
*@author kiriuja
|
|
*/
|
|
class KPlayerSliderAction : public KWidgetAction
|
|
{
|
|
Q_OBJECT
|
|
TQ_OBJECT
|
|
|
|
public:
|
|
/** The KPlayerSliderAction constructor. Parameters are passed on to KAction.
|
|
*/
|
|
KPlayerSliderAction (const TQString& text, const KShortcut&, const TQObject* receiver,
|
|
const char* slot, KActionCollection* parent = 0, const char* name = 0);
|
|
/** The KPlayerSliderAction destructor. Does nothing.
|
|
*/
|
|
virtual ~KPlayerSliderAction();
|
|
|
|
/** Returns a pointer to the KPlayerSlider object.
|
|
*/
|
|
KPlayerSlider* slider (void)
|
|
{ return (KPlayerSlider*) widget(); }
|
|
|
|
/** Plugs the slider into the toolbar.
|
|
*/
|
|
virtual int plug (TQWidget* widget, int index = -1);
|
|
/** Unplugs the slider from the toolbar.
|
|
*/
|
|
virtual void unplug (TQWidget* widget);
|
|
|
|
protected slots:
|
|
/** Changes the slider orientation when the toolbar orientation changes.
|
|
*/
|
|
void orientationChanged (Qt::Orientation);
|
|
|
|
protected:
|
|
/** The slider.
|
|
*/
|
|
//KPlayerSlider* m_slider;
|
|
};
|
|
|
|
#endif
|