From cddc8405e08b53c5425747015b99b702646bdc46 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Wed, 28 May 2008 04:07:33 +0000 Subject: [PATCH] Re-added controller renaming git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1029 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 6 +++++- include/controller_view.h | 1 + src/gui/widgets/controller_view.cpp | 32 +++++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 225212afb..78d5d47af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,11 @@ Restore gain setting when loading a project and keep gain setting when changing sample rate -2008-05-26 Paul Giblock + * include/controller_view.h: + * src/gui/widgets/controller_view.cpp: + reverted toby's controllerView changes. + +2008-05-25 Tobias Doerffel * include/controller_view.h: * src/gui/widgets/controller_view.cpp: diff --git a/include/controller_view.h b/include/controller_view.h index 68e6e227f..e9200f3d9 100644 --- a/include/controller_view.h +++ b/include/controller_view.h @@ -78,6 +78,7 @@ protected: virtual void contextMenuEvent( QContextMenuEvent * _me ); virtual void paintEvent( QPaintEvent * _pe ); virtual void modelChanged( void ); + virtual void mouseDoubleClickEvent( QMouseEvent * event ); private: diff --git a/src/gui/widgets/controller_view.cpp b/src/gui/widgets/controller_view.cpp index 6bbceddbf..5d9142976 100644 --- a/src/gui/widgets/controller_view.cpp +++ b/src/gui/widgets/controller_view.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "caption_menu.h" #include "controller_dialog.h" @@ -52,12 +53,12 @@ controllerView::controllerView( controller * _model, QWidget * _parent ) : m_controllerDlg( NULL ), m_show( TRUE ) { - setFixedSize( 210, 20 ); + setFixedSize( 210, 32 ); setAttribute( Qt::WA_OpaquePaintEvent, TRUE ); m_bypass = new ledCheckBox( "", this, tr( "Turn the controller off" ) ); - m_bypass->move( 3, 3 ); + m_bypass->move( 3, 2 ); m_bypass->setWhatsThis( tr( "Toggles the controller on or off." ) ); toolTip::add( m_bypass, tr( "On/Off" ) ); @@ -140,13 +141,36 @@ void controllerView::paintEvent( QPaintEvent * ) f.setBold( TRUE ); p.setFont( f ); - p.drawText( 6, 55, castModel()->publicName() ); + controller * c = castModel(); + + p.setPen( QColor( 64, 64, 64 ) ); + p.drawText( 21, 13, c->publicName() ); p.setPen( Qt::white ); - p.drawText( 5, 54, castModel()->publicName() ); + p.drawText( 20, 12, c->publicName() ); + + f.setBold( FALSE ); + p.setFont( f ); + p.drawText( 6, 26, c->name() ); } +void controllerView::mouseDoubleClickEvent( QMouseEvent * event ) +{ + bool ok; + controller * c = castModel(); + QString new_name = QInputDialog::getText( this, + tr( "Rename controller" ), + tr( "Enter the new name for this controller" ), + QLineEdit::Normal, c->name() , &ok ); + if( ok && !new_name.isEmpty() ) + { + c->setName( new_name ); + update(); + } +} + + void controllerView::modelChanged( void ) {