From ebf8d3e6eca8cef280904e470aa84fb752e981eb Mon Sep 17 00:00:00 2001 From: Javier Serrano Polo Date: Mon, 26 Feb 2007 23:39:38 +0000 Subject: [PATCH] simplified fade button timer usage git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@463 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 8 ++++++++ configure.in | 4 ++-- src/core/config_mgr.cpp | 10 +++++++--- src/widgets/fade_button.cpp | 22 +++++----------------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 241febb32..2235c1607 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-02-27 Javier Serrano Polo + + * src/widgets/fade_button.cpp: + simplified timer usage, fixes frozen leds and hopefully the segfaults + + * src/core/config_mgr.cpp: + create widgets once + 2007-02-25 Javier Serrano Polo * plugins/singerbot/singerbot.cpp: diff --git a/configure.in b/configure.in index 28a7fe876..e0596e64a 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) -AC_INIT(lmms, 0.2.1-svn20070225, lmms-devel/at/lists/dot/sf/dot/net) -AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20070225) +AC_INIT(lmms, 0.2.1-svn20070227, lmms-devel/at/lists/dot/sf/dot/net) +AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20070227) AM_CONFIG_HEADER(config.h) diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index 6c9bfceac..571a7c1df 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -3,7 +3,7 @@ /* * config_mgr.cpp - implementation of class configManager * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -181,7 +181,8 @@ configManager::configManager( void ) : #endif m_vstDir( QDir::home().absolutePath() ), m_flDir( QDir::home().absolutePath() ), - m_currentPage( 0 ) + m_currentPage( 0 ), + m_mainLayout( NULL ) { } @@ -771,7 +772,10 @@ void configManager::setValue( const QString & _class, bool configManager::loadConfigFile( void ) { - createWidgets(); + if( !m_mainLayout ) + { + createWidgets(); + } // read the XML file and create DOM tree QFile cfg_file( m_lmmsRcFile ); diff --git a/src/widgets/fade_button.cpp b/src/widgets/fade_button.cpp index a3b40b898..4138b9570 100644 --- a/src/widgets/fade_button.cpp +++ b/src/widgets/fade_button.cpp @@ -3,7 +3,7 @@ /* * fade_button.cpp - implementation of fade-button * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -52,6 +52,7 @@ fadeButton::fadeButton( const QColor & _normal_color, #ifndef QT4 setBackgroundMode( NoBackground ); #endif + QTimer::singleShot( 20, this, SLOT( nextState( void ) ) ); } @@ -66,15 +67,7 @@ fadeButton::~fadeButton() void fadeButton::activate( void ) { - if( m_state > 0.0f ) - { - m_state = 1.00f; - } - else - { - m_state = 1.1f; - nextState(); - } + m_state = 1.00f; update(); } @@ -125,12 +118,6 @@ void fadeButton::paintEvent( QPaintEvent * _pe ) // and blit all the drawn stuff on the screen... bitBlt( this, rect().topLeft(), &draw_pm ); #endif - if( m_state > 0.0f ) - { - // we might be called out of another thread than the GUI-/ - // event-loop-thread, so let the timer update ourself - QTimer::singleShot( 20, this, SLOT( update( void ) ) ); - } } @@ -141,8 +128,9 @@ void fadeButton::nextState( void ) if( m_state > 0.0f ) { m_state -= 0.1f; - QTimer::singleShot( 20, this, SLOT( nextState( void ) ) ); + update(); } + QTimer::singleShot( 20, this, SLOT( nextState( void ) ) ); }