From 7a5acc719bb54471f76846ae1f02b5375acac851 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 3 Jun 2008 16:02:48 +0000 Subject: [PATCH] use automatableModelView::addDefaultActions() git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1065 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/gui/widgets/automatable_button.cpp | 5 +---- src/gui/widgets/automatable_slider.cpp | 5 +---- src/gui/widgets/lcd_spinbox.cpp | 31 ++++++++++++++++++++++---- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/gui/widgets/automatable_button.cpp b/src/gui/widgets/automatable_button.cpp index bac81e00d..770cae271 100644 --- a/src/gui/widgets/automatable_button.cpp +++ b/src/gui/widgets/automatable_button.cpp @@ -113,10 +113,7 @@ void automatableButton::contextMenuEvent( QContextMenuEvent * _me ) } captionMenu contextMenu( target->accessibleName() ); - contextMenu.addAction( embed::getIconPixmap( "automation" ), - tr( "&Open in automation editor" ), - pattern, - SLOT( openInAutomationEditor() ) ); + addDefaultActions( &contextMenu ); contextMenu.exec( QCursor::pos() ); } diff --git a/src/gui/widgets/automatable_slider.cpp b/src/gui/widgets/automatable_slider.cpp index 1165f31f6..12e13c7b6 100644 --- a/src/gui/widgets/automatable_slider.cpp +++ b/src/gui/widgets/automatable_slider.cpp @@ -64,10 +64,7 @@ automatableSlider::~automatableSlider() void automatableSlider::contextMenuEvent( QContextMenuEvent * _me ) { captionMenu contextMenu( accessibleName() ); - contextMenu.addAction( embed::getIconPixmap( "automation" ), - tr( "&Open in automation editor" ), - model()->getAutomationPattern(), - SLOT( openInAutomationEditor() ) ); + addDefaultActions( &contextMenu ); contextMenu.exec( QCursor::pos() ); } diff --git a/src/gui/widgets/lcd_spinbox.cpp b/src/gui/widgets/lcd_spinbox.cpp index 47b893bc2..10b92c9b6 100644 --- a/src/gui/widgets/lcd_spinbox.cpp +++ b/src/gui/widgets/lcd_spinbox.cpp @@ -64,6 +64,8 @@ lcdSpinBox::lcdSpinBox( int _num_digits, QWidget * _parent, } + + lcdSpinBox::lcdSpinBox( int _num_digits, const QString & _lcd_style, QWidget * _parent, const QString & _name ) : QWidget( _parent ), @@ -89,12 +91,16 @@ lcdSpinBox::lcdSpinBox( int _num_digits, const QString & _lcd_style, } + + lcdSpinBox::~lcdSpinBox() { delete m_lcdPixmap; } + + void lcdSpinBox::paintEvent( QPaintEvent * _me ) { QRect ur = _me->rect(); @@ -183,6 +189,8 @@ void lcdSpinBox::paintEvent( QPaintEvent * _me ) } + + void lcdSpinBox::update( void ) { QString s = m_textForValue[model()->value()]; @@ -203,6 +211,8 @@ void lcdSpinBox::update( void ) } + + void lcdSpinBox::setLabel( const QString & _txt ) { m_label = _txt; @@ -210,12 +220,16 @@ void lcdSpinBox::setLabel( const QString & _txt ) } + + void lcdSpinBox::setEnabled( bool _on ) { QWidget::setEnabled( _on ); } + + void lcdSpinBox::setMarginWidth( int _width ) { m_marginWidth = _width; @@ -224,6 +238,8 @@ void lcdSpinBox::setMarginWidth( int _width ) } + + void lcdSpinBox::updateSize() { int margin = 1; @@ -242,6 +258,8 @@ void lcdSpinBox::updateSize() } + + void lcdSpinBox::contextMenuEvent( QContextMenuEvent * _me ) { m_origMousePos = _me->globalPos(); @@ -259,14 +277,13 @@ void lcdSpinBox::contextMenuEvent( QContextMenuEvent * _me ) mouseReleaseEvent( NULL ); captionMenu contextMenu( accessibleName() ); - contextMenu.addAction( embed::getIconPixmap( "automation" ), - tr( "&Open in automation editor" ), - model()->getAutomationPattern(), - SLOT( openInAutomationEditor() ) ); + addDefaultActions( &contextMenu ); contextMenu.exec( QCursor::pos() ); } + + void lcdSpinBox::mousePressEvent( QMouseEvent * _me ) { if( _me->button() == Qt::LeftButton && _me->y() < m_cellHeight + 2 ) @@ -278,6 +295,8 @@ void lcdSpinBox::mousePressEvent( QMouseEvent * _me ) } + + void lcdSpinBox::mouseMoveEvent( QMouseEvent * _me ) { if( _me->buttons() & Qt::LeftButton ) @@ -294,6 +313,8 @@ void lcdSpinBox::mouseMoveEvent( QMouseEvent * _me ) } + + void lcdSpinBox::mouseReleaseEvent( QMouseEvent * _me ) { model()->addJournalEntryFromOldToCurVal(); @@ -303,6 +324,8 @@ void lcdSpinBox::mouseReleaseEvent( QMouseEvent * _me ) } + + void lcdSpinBox::wheelEvent( QWheelEvent * _we ) { _we->accept();