diff options
Diffstat (limited to 'kmix/mdwslider.cpp')
-rw-r--r-- | kmix/mdwslider.cpp | 83 |
1 files changed, 41 insertions, 42 deletions
diff --git a/kmix/mdwslider.cpp b/kmix/mdwslider.cpp index 6b4c3f51..acdcb2b6 100644 --- a/kmix/mdwslider.cpp +++ b/kmix/mdwslider.cpp @@ -25,7 +25,7 @@ #include <tdeconfig.h> #include <tdeaction.h> #include <tdepopupmenu.h> -#include <kglobalaccel.h> +#include <tdeglobalaccel.h> #include <kkeydialog.h> #include <kdebug.h> @@ -57,36 +57,36 @@ */ MDWSlider::MDWSlider(Mixer *mixer, MixDevice* md, bool showMuteLED, bool showRecordLED, - bool small, Qt::Orientation orientation, + bool small, TQt::Orientation orientation, TQWidget* parent, ViewBase* mw, const char* name) : MixDeviceWidget(mixer,md,small,orientation,parent,mw,name), m_linked(true), m_valueStyle( NNONE), m_iconLabel( 0 ), m_muteLED( 0 ), m_recordLED( 0 ), m_label( 0 ), _layout(0) { // create actions (on _mdwActions, see MixDeviceWidget) - new TDEToggleAction( i18n("&Split Channels"), 0, TQT_TQOBJECT(this), TQT_SLOT(toggleStereoLinked()), + new TDEToggleAction( i18n("&Split Channels"), 0, this, TQ_SLOT(toggleStereoLinked()), _mdwActions, "stereo" ); - new TDEToggleAction( i18n("&Hide"), 0, TQT_TQOBJECT(this), TQT_SLOT(setDisabled()), _mdwActions, "hide" ); + new TDEToggleAction( i18n("&Hide"), 0, this, TQ_SLOT(setDisabled()), _mdwActions, "hide" ); TDEToggleAction *a = new TDEToggleAction(i18n("&Muted"), 0, 0, 0, _mdwActions, "mute" ); - connect( a, TQT_SIGNAL(toggled(bool)), TQT_SLOT(toggleMuted()) ); + connect( a, TQ_SIGNAL(toggled(bool)), TQ_SLOT(toggleMuted()) ); if( m_mixdevice->isRecordable() ) { a = new TDEToggleAction( i18n("Set &Record Source"), 0, 0, 0, _mdwActions, "recsrc" ); - connect( a, TQT_SIGNAL(toggled(bool)), TQT_SLOT( toggleRecsrc()) ); + connect( a, TQ_SIGNAL(toggled(bool)), TQ_SLOT( toggleRecsrc()) ); } - new TDEAction( i18n("C&onfigure Global Shortcuts..."), 0, TQT_TQOBJECT(this), TQT_SLOT(defineKeys()), _mdwActions, "keys" ); + new TDEAction( i18n("C&onfigure Global Shortcuts..."), 0, this, TQ_SLOT(defineKeys()), _mdwActions, "keys" ); // create widgets createWidgets( showMuteLED, showRecordLED ); m_keys->insert( "Increase volume", i18n( "Increase Volume of '%1'" ).arg(m_mixdevice->name().utf8().data()), TQString(), - TDEShortcut(), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT( increaseVolume() ) ); + TDEShortcut(), TDEShortcut(), this, TQ_SLOT( increaseVolume() ) ); m_keys->insert( "Decrease volume", i18n( "Decrease Volume of '%1'" ).arg(m_mixdevice->name().utf8().data()), TQString(), - TDEShortcut(), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT( decreaseVolume() ) ); + TDEShortcut(), TDEShortcut(), this, TQ_SLOT( decreaseVolume() ) ); m_keys->insert( "Toggle mute", i18n( "Toggle Mute of '%1'" ).arg(m_mixdevice->name().utf8().data()), TQString(), - TDEShortcut(), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT( toggleMuted() ) ); + TDEShortcut(), TDEShortcut(), this, TQ_SLOT( toggleMuted() ) ); installEventFilter( this ); // filter for popup @@ -96,7 +96,7 @@ MDWSlider::MDWSlider(Mixer *mixer, MixDevice* md, TQSizePolicy MDWSlider::sizePolicy() const { - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { return TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Expanding ); } else { @@ -113,18 +113,17 @@ TQSizePolicy MDWSlider::sizePolicy() const */ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) { - if ( _orientation == Qt::Vertical ) { - _layout = new TQVBoxLayout( this ); - _layout->setAlignment(TQt::AlignCenter); + if ( _orientation == TQt::Vertical ) { + _layout = new TQVBoxLayout( this ); } else { - _layout = new TQHBoxLayout( this ); - _layout->setAlignment(TQt::AlignCenter); + _layout = new TQHBoxLayout( this ); } + _layout->setAlignment(TQt::AlignCenter); // -- MAIN SLIDERS LAYOUT --- TQBoxLayout *slidersLayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { slidersLayout = new TQHBoxLayout( _layout ); slidersLayout->setAlignment(TQt::AlignVCenter); } @@ -136,14 +135,14 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) /* cesken: This is inconsistent. Why should vertical and horizontal layout differ? * Also it eats too much space - especially when you don't show sliders at all. * Even more on the vertical panel applet (see Bug #97667) - if ( _orientation == Qt::Horizontal ) + if ( _orientation == TQt::Horizontal ) slidersLayout->addSpacing( 10 ); */ // -- LABEL LAYOUT TO POSITION TQBoxLayout *labelLayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { labelLayout = new TQVBoxLayout( slidersLayout ); labelLayout->setAlignment(TQt::AlignHCenter); } @@ -151,7 +150,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) labelLayout = new TQHBoxLayout( slidersLayout ); labelLayout->setAlignment(TQt::AlignVCenter); } - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { m_label = new VerticalText( this, m_mixdevice->name().utf8().data() ); TQToolTip::add( m_label, m_mixdevice->name() ); @@ -166,7 +165,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) /* This addSpacing() looks VERY bizarre => removing it (cesken, 21.2.2006). Also horizontal and vertical spacing differs. This doesn't look sensible. - if ( _orientation == Qt::Horizontal ) + if ( _orientation == TQt::Horizontal ) labelLayout->addSpacing( 36 ); */ labelLayout->addWidget( m_label ); @@ -174,14 +173,14 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) /* This addSpacing() looks VERY bizarre => removing it (cesken, 21.2.2006) Also horizontal and vertical spacing differs. This doesn't look sensible. - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { labelLayout->addSpacing( 18 ); } */ // -- SLIDERS, LEDS AND ICON TQBoxLayout *sliLayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { sliLayout = new TQVBoxLayout( slidersLayout ); sliLayout->setAlignment(TQt::AlignHCenter); } @@ -192,7 +191,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) // --- ICON ---------------------------- TQBoxLayout *iconLayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { iconLayout = new TQHBoxLayout( sliLayout ); iconLayout->setAlignment(TQt::AlignVCenter); } @@ -214,7 +213,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) // --- MUTE LED if ( showMuteLED ) { TQBoxLayout *ledlayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { ledlayout = new TQHBoxLayout( sliLayout ); ledlayout->setAlignment(TQt::AlignVCenter); } @@ -233,7 +232,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) m_muteLED->resize( TQSize(16, 16) ); ledlayout->addWidget( m_muteLED ); TQToolTip::add( m_muteLED, i18n( "Mute" ) ); - connect( m_muteLED, TQT_SIGNAL(stateChanged(bool)), this, TQT_SLOT(toggleMuted()) ); + connect( m_muteLED, TQ_SIGNAL(stateChanged(bool)), this, TQ_SLOT(toggleMuted()) ); m_muteLED->installEventFilter( this ); ledlayout->addStretch(); } // has Mute LED @@ -251,7 +250,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) // --- SLIDERS --------------------------- TQBoxLayout *volLayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { volLayout = new TQHBoxLayout( sliLayout ); volLayout->setAlignment(TQt::AlignVCenter); } @@ -271,7 +270,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) int maxvol = m_mixdevice->getVolume().maxVolume(); int minvol = m_mixdevice->getVolume().minVolume(); - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { slinumLayout = new TQVBoxLayout( volLayout ); slinumLayout->setAlignment(TQt::AlignHCenter); } @@ -317,7 +316,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) slinumLayout->addWidget( slider ); // add to layout m_sliders.append ( slider ); // add to list _slidersChids.append(chid); // Remember slider-chid association - connect( slider, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(volumeChange(int)) ); + connect( slider, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(volumeChange(int)) ); } // for all channels of this device @@ -328,7 +327,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) // --- LED LAYOUT TO CENTER --- TQBoxLayout *reclayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { reclayout = new TQHBoxLayout( sliLayout ); reclayout->setAlignment(TQt::AlignVCenter); } @@ -344,7 +343,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) KLed::Sunken, KLed::Circular, this, "RecordLED" ); m_recordLED->setFixedSize( TQSize(16, 16) ); reclayout->addWidget( m_recordLED ); - connect(m_recordLED, TQT_SIGNAL(stateChanged(bool)), this, TQT_SLOT(setRecsrc(bool))); + connect(m_recordLED, TQ_SIGNAL(stateChanged(bool)), this, TQ_SLOT(setRecsrc(bool))); m_recordLED->installEventFilter( this ); TQToolTip::add( m_recordLED, i18n( "Record" ) ); reclayout->addStretch(); @@ -471,7 +470,7 @@ MDWSlider::setStereoLinked(bool value) ***********************************************************/ int firstSliderValue = 0; bool firstSliderValueValid = false; - if (slider->isA(TQSLIDER_OBJECT_NAME_STRING) ) { + if (slider->isA("TQSlider") ) { TQSlider *sld = static_cast<TQSlider*>(slider); firstSliderValue = sld->value(); firstSliderValueValid = true; @@ -494,7 +493,7 @@ MDWSlider::setStereoLinked(bool value) if ( firstSliderValueValid ) { // Remark: firstSlider== 0 could happen, if the static_cast<TQRangeControl*> above fails. // It's a safety measure, if we got other Slider types in the future. - if (slider->isA(TQSLIDER_OBJECT_NAME_STRING) ) { + if (slider->isA("TQSlider") ) { TQSlider *sld = static_cast<TQSlider*>(slider); sld->setValue( firstSliderValue ); } @@ -539,7 +538,7 @@ MDWSlider::setTicks( bool ticks ) slider = m_sliders.first(); - if ( slider->inherits( TQSLIDER_OBJECT_NAME_STRING ) ) + if ( slider->inherits( "TQSlider" ) ) { if( ticks ) if( isStereoLinked() ) @@ -651,7 +650,7 @@ void MDWSlider::volumeChange( int ) else { TQSlider *slider = dynamic_cast<TQSlider *>(m_sliders.first()); if (slider) { - if ( _orientation == Qt::Vertical ) + if ( _orientation == TQt::Vertical ) sliderValue= slider->maxValue() - slider->value(); else sliderValue= slider->value(); @@ -691,7 +690,7 @@ void MDWSlider::volumeChange( int ) { TQSlider *bigSlider = dynamic_cast<TQSlider *>(slider); if (bigSlider) - if ( _orientation == Qt::Vertical ) + if ( _orientation == TQt::Vertical ) vol.setVolume( chid, bigSlider->maxValue() - bigSlider->value() ); else vol.setVolume( chid, bigSlider->value() ); @@ -808,7 +807,7 @@ void MDWSlider::update() // show the top of both volumes, and not strangely low down // the main volume by half - if ( _orientation == Qt::Vertical ) + if ( _orientation == TQt::Vertical ) bigSlider->setValue( vol.maxVolume() - vol.getTopStereoVolume( Volume::MMAIN ) ); else bigSlider->setValue( vol.getTopStereoVolume( Volume::MMAIN ) ); @@ -844,7 +843,7 @@ void MDWSlider::update() { TQSlider *bigSlider = dynamic_cast<TQSlider *>(slider); if (bigSlider) - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { bigSlider->setValue( vol.maxVolume() - vol[i] ); } else { @@ -909,7 +908,7 @@ void MDWSlider::showContextMenu() a = _mdwActions->action( "keys" ); if ( a && m_keys ) { - TDEActionSeparator sep( TQT_TQOBJECT(this) ); + TDEActionSeparator sep( this ); sep.plug( menu ); a->plug( menu ); } @@ -935,15 +934,15 @@ TQSize MDWSlider::sizeHint() const { bool MDWSlider::eventFilter( TQObject* obj, TQEvent* e ) { if (e->type() == TQEvent::MouseButtonPress) { - TQMouseEvent *qme = TQT_TQMOUSEEVENT(e); - if (qme->button() == Qt::RightButton) { + TQMouseEvent *qme = static_cast<TQMouseEvent*>(e); + if (qme->button() == TQt::RightButton) { showContextMenu(); return true; } } // Attention: We don't filter WheelEvents for KSmallSlider, because it handles WheelEvents itself else if ( (e->type() == TQEvent::Wheel) && !obj->isA("KSmallSlider") ) { - TQWheelEvent *qwe = TQT_TQWHEELEVENT(e); + TQWheelEvent *qwe = static_cast<TQWheelEvent*>(e); if (qwe->delta() > 0) { increaseVolume(); } |