bug fixes, GUI-improvements and more

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@31 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2005-12-12 14:25:32 +00:00
parent f67bf64acb
commit d5a5f3abca
37 changed files with 886 additions and 335 deletions

79
include/cpuload_widget.h Normal file
View File

@@ -0,0 +1,79 @@
/*
* cpuload_widget.h - widget for displaying CPU-load (partly based on
* Hydrogen's CPU-load-widget)
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _CPULOAD_WIDGET_H
#define _CPULOAD_WIDGET_H
#include "qt3support.h"
#ifdef QT4
#include <QWidget>
#include <QPixmap>
#include <QTimer>
#else
#include <qwidget.h>
#include <qpixmap.h>
#include <qtimer.h>
#endif
#include "types.h"
class cpuloadWidget : public QWidget
{
Q_OBJECT
public:
cpuloadWidget( QWidget * _parent );
~cpuloadWidget();
protected:
void paintEvent( QPaintEvent * _ev );
protected slots:
void updateCpuLoad();
private:
Uint8 m_currentLoad;
QPixmap m_temp;
QPixmap m_background;
QPixmap m_leds;
bool m_changed;
QTimer m_updateTimer;
} ;
#endif

View File

@@ -92,7 +92,7 @@ private:
lcdSpinBox * m_outputChannelSpinBox;
ledCheckBox * m_receiveCheckBox;
ledCheckBox * m_sendCheckBox;
ledCheckBox * m_routeCheckBox;
QMenu * m_readablePorts;
QMenu * m_writeablePorts;

View File

@@ -125,6 +125,10 @@ public:
return( m_framesPerAudioBuffer );
}
inline Uint8 cpuLoad( void ) const
{
return( m_cpuLoad );
}
inline bool highQuality( void ) const
{
@@ -295,16 +299,13 @@ private:
surroundSampleFrame * m_curBuf;
surroundSampleFrame * m_nextBuf;
/* bool m_discardCurBuf;*/
Uint8 m_cpuLoad;
playHandleVector m_playHandles;
playHandleVector m_playHandlesToRemove;
Uint8 m_qualityLevel;
volatile float m_masterGain;
/* volatile bool m_quit;*/
float m_masterGain;
audioDevice * m_audioDev;
@@ -317,7 +318,6 @@ private:
QMutex m_mixMutex;
/* QMutex m_devMutex;*/
friend class lmmsMainWin;

View File

@@ -49,6 +49,7 @@ public:
{
UNKNOWN,
SONG_PROJECT,
SONG_PROJECT_TEMPLATE,
CHANNEL_SETTINGS,
EFFECT_SETTINGS,
VIDEO_PROJECT, // will come later...

View File

@@ -34,22 +34,21 @@
#ifdef QT4
#include <QPushButton>
#include <QPixmap>
#include <QVector>
#include <QPair>
#else
#include <qpushbutton.h>
#include <qpixmap.h>
#include <qvaluevector.h>
#include <qpair.h>
#endif
#include "tool_button.h"
class nStateButton : public QPushButton
class nStateButton : public toolButton
{
Q_OBJECT
public:
@@ -77,7 +76,6 @@ signals:
protected:
/* virtual void paintEvent( QPaintEvent * _pe );*/
virtual void mousePressEvent( QMouseEvent * _me );

View File

@@ -35,6 +35,7 @@
#include <QWidget>
#include <QMutex>
#include <QDialog>
#include <QThread>
#else
@@ -42,6 +43,7 @@
#include <qwidget.h>
#include <qmutex.h>
#include <qdialog.h>
#include <qthread.h>
#endif
@@ -51,16 +53,18 @@
#include "mixer.h"
class channelTrack;
class sampleBuffer;
class QProgressBar;
class QPushButton;
class QPixmap;
class channelTrack;
class patternFreezeThread;
class sampleBuffer;
const int MAX_BEATS_PER_TACT = 16;
const int MAIN_BEATS_PER_TACT = 4;
const int DEFAULT_STEPS_PER_TACT = 16;
const int BEATS_PER_TACT = 4;
class pattern : public trackContentObject
@@ -76,6 +80,9 @@ public:
pattern( const pattern & _pat_to_copy ) FASTCALL;
virtual ~pattern();
void init( void );
virtual void FASTCALL movePosition( const midiTime & _pos );
@@ -130,6 +137,8 @@ public:
return( m_frozenPattern != NULL );
}
// if channel-track recognizes that this pattern is frozen, it calls
// this instead of playing all the notes
void FASTCALL playFrozenData( sampleFrame * _ab, Uint32 _start_frame,
Uint32 _frames );
@@ -150,6 +159,7 @@ public:
protected slots:
void openInPianoRoll( bool _c );
void openInPianoRoll( void );
void clear( void );
void resetName( void );
void changeName( void );
@@ -157,6 +167,9 @@ protected slots:
void unfreeze( void );
void abortFreeze( void );
void addSteps( int _n );
void removeSteps( int _n );
protected:
void paintEvent( QPaintEvent * _pe );
@@ -174,19 +187,30 @@ private:
static QPixmap * s_stepBtnOffLight;
static QPixmap * s_frozen;
static void initPixmaps( void );
// general stuff
channelTrack * m_channelTrack;
patternTypes m_patternType;
QString m_name;
noteVector m_notes;
// data-stuff
noteVector m_notes;
int m_steps;
// pattern freezing
QMutex m_frozenPatternMutex;
sampleBuffer * m_frozenPattern;
bool m_freezing;
volatile bool m_freezeAborted;
// as in Qt4 QThread is inherits from QObject and our base
// trackContentObject is a QWidget (=QObject), we cannot inherit from
// QThread. That's why we have to put pattern-freezing into separate
// thread-class -> patternFreezeThread
friend class patternFreezeThread;
} ;
@@ -196,7 +220,7 @@ class patternFreezeStatusDialog : public QDialog
{
Q_OBJECT
public:
patternFreezeStatusDialog();
patternFreezeStatusDialog( QThread * _thread );
~patternFreezeStatusDialog();
void FASTCALL setProgress( int _p );
@@ -208,12 +232,17 @@ protected:
protected slots:
void cancelBtnClicked( void );
void updateProgress( void );
private:
QProgressBar * m_progressBar;
QPushButton * m_cancelBtn;
QThread * m_freezeThread;
int m_progress;
signals:
void aborted( void );
@@ -221,4 +250,25 @@ signals:
} ;
class patternFreezeThread : public QThread
{
public:
patternFreezeThread( pattern * _pattern );
virtual ~patternFreezeThread();
protected:
virtual void run( void );
private:
pattern * m_pattern;
patternFreezeStatusDialog * m_statusDlg;
} ;
#endif

View File

@@ -56,7 +56,6 @@ class pattern;
class projectNotes;
class timeLine;
class toolButton;
class visualizationWidget;
const int MIN_BPM = 10;
@@ -283,8 +282,6 @@ private:
QSlider * m_masterVolumeSlider;
QSlider * m_masterPitchSlider;
visualizationWidget * m_masterOutputGraph;
toolButton * m_addBBTrackButton;
toolButton * m_addSampleTrackButton;

View File

@@ -119,6 +119,7 @@ public slots:
void toggleAutoScroll( int _n );
void toggleLoopPoints( int _n );
void toggleBehaviourAtStop( int _n );
void checkForUpdatedPosition( void );
protected:
@@ -144,6 +145,8 @@ private:
loopPointStates m_loopPoints;
behaviourAtStopStates m_behaviourAtStop;
bool m_changedPosition;
int m_xOffset;
int m_posMarkerX;
float m_ppt;

View File

@@ -26,44 +26,60 @@
#ifndef _TOOL_BUTTON_H
#define _TOOL_BUTTON_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QPushButton>
#include <QToolButton>
#include <QColor>
#else
#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qcolor.h>
#endif
#include "tooltip.h"
class toolButton : public QPushButton
class toolButton : public QToolButton
{
public:
toolButton( const QPixmap & _pixmap, const QString & _tooltip,
QObject * _receiver, const char * _slot,
QWidget * _parent ) :
QPushButton( _parent )
QWidget * _parent );
inline toolButton( QWidget * _parent ) :
QToolButton( _parent ),
m_colorStandard( s_stdColor ),
m_colorHighlighted( s_hlColor )
{
connect( this, SIGNAL( clicked() ), _receiver, _slot );
toolTip::add( this, _tooltip );
setPaletteBackgroundColor( QColor( 224, 224, 224 ) );
setFixedSize( 30, 30 );
setPixmap( _pixmap );
}
~toolButton()
~toolButton();
inline void setStandardColor( const QColor & _color )
{
m_colorStandard = _color;
}
inline void setHighlightedColor( const QColor & _color )
{
m_colorHighlighted = _color;
}
protected:
virtual void enterEvent( QEvent * _ev );
virtual void leaveEvent( QEvent * _ev );
private:
static const QColor s_stdColor;
static const QColor s_hlColor;
QColor m_colorStandard;
QColor m_colorHighlighted;
} ;
#endif