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

@@ -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 * )