Fix segfault when reopening controller dialog

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@919 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2008-04-14 18:09:41 +00:00
parent c80d587633
commit 5fc7ffe42d
6 changed files with 103 additions and 34 deletions

View File

@@ -4,6 +4,13 @@
* plugins/sf2_player/sf2_player.h:
support HQ-mode except for interpolation for sampleRates > 96k
* include/controller_dialog.h:
* include/controller_view.h:
* src/gui/controller_dialog.cpp:
* src/gui/widgets/controller_view.cpp:
* Makefile.am:
fix segfault when trying to show a controller dialog the second time
2008-04-12 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/lb302/lb302.cpp:

View File

@@ -219,6 +219,7 @@ lmms_SOURCES = \
$(srcdir)/src/gui/automation_editor.cpp \
$(srcdir)/src/gui/bb_editor.cpp \
$(srcdir)/src/gui/controller_connection_dialog.cpp \
$(srcdir)/src/gui/controller_dialog.cpp \
$(srcdir)/src/gui/effect_control_dialog.cpp \
$(srcdir)/src/gui/effect_select_dialog.cpp \
$(srcdir)/src/gui/embed.cpp \

View File

@@ -34,28 +34,21 @@
class controllerDialog : public QWidget, public modelView
{
Q_OBJECT
public:
controllerDialog( controller * _controller, QWidget * _parent ) :
modelView( _controller ),
QWidget( _parent )
{};
controllerDialog( controller * _controller, QWidget * _parent );
virtual ~controllerDialog() {};
virtual ~controllerDialog();
public slots:
//void editControls( void );
//void deletePlugin( void );
//void displayHelp( void );
//void closeEffects( void );
signals:
void closed();
protected:
virtual void contextMenuEvent( QContextMenuEvent * _me ) {};
virtual void paintEvent( QPaintEvent * _pe ) {};
virtual void modelChanged( void ) {};
virtual void closeEvent( QCloseEvent * _ce );
} ;

View File

@@ -49,23 +49,23 @@ class controllerView : public QWidget, public modelView
public:
controllerView( controller * _controller, QWidget * _parent );
virtual ~controllerView();
/*
inline effect * getEffect( void )
inline controller * getController( void )
{
return( castModel<effect>() );
return( castModel<controller>() );
}
inline const effect * getEffect( void ) const
inline const controller * getController( void ) const
{
return( castModel<effect>() );
return( castModel<controller>() );
}
*/
public slots:
void editControls( void );
//void deletePlugin( void );
//void displayHelp( void );
//void closeEffects( void );
void closeControls( void );
signals:

View File

@@ -0,0 +1,57 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* controller_dialog.cpp - per-controller-specific view for changing a
* controller's settings
*
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include <QtGui/QWidget>
#include <QtGui/QCloseEvent>
#include "controller_dialog.h"
#include "controller.h"
controllerDialog::controllerDialog( controller * _controller, QWidget * _parent ) :
modelView( _controller ),
QWidget( _parent )
{
};
controllerDialog::~controllerDialog()
{
};
void controllerDialog::closeEvent( QCloseEvent * _ce )
{
_ce->ignore();
emit( closed() );
};
#include "controller_dialog.moc"
#endif

View File

@@ -62,15 +62,23 @@ controllerView::controllerView( controller * _model, QWidget * _parent ) :
toolTip::add( m_bypass, tr( "On/Off" ) );
QPushButton * ctls_btn = new QPushButton( tr( "Controls" ),
this );
QFont f = ctls_btn->font();
ctls_btn->setFont( pointSize<7>( f ) );
ctls_btn->setGeometry( 140, 2, 50, 14 );
connect( ctls_btn, SIGNAL( clicked() ),
this, SLOT( editControls() ) );
this );
QFont f = ctls_btn->font();
ctls_btn->setFont( pointSize<7>( f ) );
ctls_btn->setGeometry( 140, 2, 50, 14 );
connect( ctls_btn, SIGNAL( clicked() ),
this, SLOT( editControls() ) );
//m_subWindow = new QMdiSubWindow( getMainWindow()->workspace() );
//m_subWindow->hide();
m_controllerDlg = getController()->createDialog( NULL );
m_subWindow = engine::getMainWindow()->workspace()->addSubWindow(
m_controllerDlg );
connect( m_controllerDlg, SIGNAL( closed() ),
this, SLOT( closeControls() ) );
m_subWindow->hide();
/*
if( getEffect()->getControls()->getControlCount() > 0 )
@@ -98,7 +106,7 @@ controllerView::controllerView( controller * _model, QWidget * _parent ) :
controllerView::~controllerView()
{
//delete m_subWindow;
delete m_subWindow;
}
@@ -106,7 +114,7 @@ controllerView::~controllerView()
void controllerView::editControls( void )
{
/*if( m_show )
if( m_show )
{
m_subWindow->show();
m_subWindow->raise();
@@ -116,7 +124,10 @@ void controllerView::editControls( void )
{
m_subWindow->hide();
m_show = TRUE;
}*/
}
}
/*
//engine::getMainWindow()->workspace()->addSubWindow( NULL );
controller * c = castModel<controller>();
@@ -130,7 +141,7 @@ void controllerView::editControls( void )
m_subWindow->raise();
}
*/
/*
void effectView::displayHelp( void )
@@ -139,15 +150,15 @@ void effectView::displayHelp( void )
whatsThis() );
}
*/
void effectView::closeEffects( void )
void controllerView::closeControls( void )
{
m_subWindow->hide();
m_show = TRUE;
}
*/
void controllerView::contextMenuEvent( QContextMenuEvent * )