new fader tag style

This commit is contained in:
Volker Fischer 2009-05-08 04:34:06 +00:00
parent fb35fe3b2d
commit 85951a6588
2 changed files with 24 additions and 14 deletions

View file

@ -50,6 +50,14 @@ CChannelFader::CChannelFader ( QWidget* pNW,
pcbSolo->setEnabled ( false ); pcbSolo->setEnabled ( false );
// setup fader tag label (use white background of label)
QPalette newPalette = pLabel->palette();
newPalette.setColor ( QPalette::Active, QPalette::Window,
newPalette.color ( QPalette::Active, QPalette::Base ) );
pLabel->setPalette ( newPalette );
pLabel->setAutoFillBackground ( true );
// add user controls to grid // add user controls to grid
pMainGrid->addWidget( pFader, 0, Qt::AlignHCenter ); pMainGrid->addWidget( pFader, 0, Qt::AlignHCenter );
pMainGrid->addWidget( pcbMute, 0, Qt::AlignHCenter ); pMainGrid->addWidget( pcbMute, 0, Qt::AlignHCenter );
@ -127,24 +135,27 @@ void CChannelFader::SetText ( const QString sText )
{ {
const int iBreakPos = 7; const int iBreakPos = 7;
// make sure we insert an HTML space (" ") at each beginning and end
// of line for nicer look
// break text at predefined position, if text is too short, break anyway to // break text at predefined position, if text is too short, break anyway to
// make sure we have two lines for fader tag // make sure we have two lines for fader tag
QString sModText = sText; QString sModText = sText;
if ( sModText.length() > iBreakPos ) if ( sModText.length() > iBreakPos )
{ {
sModText.insert ( iBreakPos, QString ( "<br>" ) ); sModText.insert ( iBreakPos, QString ( "&nbsp;<br>&nbsp;" ) );
} }
else else
{ {
// insert line break at the beginning of the string -> make sure // insert line break at the beginning of the string -> make sure
// if we only have one line that the text appears at the bottom line // if we only have one line that the text appears at the bottom line
sModText.insert ( 0, QString ( "<br>" ) ); sModText.insert ( 0, QString ( "&nbsp;<br>&nbsp;" ) );
} }
// use bold text // use bold centered text
sModText.prepend ( "<b>" ); sModText.prepend ( "<center><b>&nbsp;" );
sModText.append ( "</b>" ); sModText.append ( "&nbsp;</b></center>" );
pLabel->setText ( sModText ); pLabel->setText ( sModText );
} }
@ -156,17 +167,16 @@ double CChannelFader::CalcFaderGain ( const int value )
return static_cast<double> ( value ) / AUD_MIX_FADER_MAX; return static_cast<double> ( value ) / AUD_MIX_FADER_MAX;
} }
CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags f ) : QFrame ( parent, f ) CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags f ) :
QGroupBox ( parent )
{ {
// set modified style // set title text and title properties
setFrameShape ( QFrame::StyledPanel ); setTitle ( "Server" );
setFrameShadow ( QFrame::Sunken ); setAlignment ( Qt::AlignHCenter );
// add hboxlayout with horizontal spacer // add hboxlayout
pMainLayout = new QHBoxLayout ( this ); pMainLayout = new QHBoxLayout ( this );
pMainLayout->addItem ( new QSpacerItem ( 0, 0, QSizePolicy::Expanding ) );
// create all mixer controls and make them invisible // create all mixer controls and make them invisible
vecpChanFader.Init ( MAX_NUM_CHANNELS ); vecpChanFader.Init ( MAX_NUM_CHANNELS );
for ( int i = 0; i < MAX_NUM_CHANNELS; i++ ) for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )

View file

@ -25,7 +25,7 @@
#if !defined ( MIXERBOARD_H__FD6B49E1606C2AC__INCLUDED_ ) #if !defined ( MIXERBOARD_H__FD6B49E1606C2AC__INCLUDED_ )
#define MIXERBOARD_H__FD6B49E1606C2AC__INCLUDED_ #define MIXERBOARD_H__FD6B49E1606C2AC__INCLUDED_
#include <qframe.h> #include <qgroupbox.h>
#include <qlabel.h> #include <qlabel.h>
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qlayout.h> #include <qlayout.h>
@ -84,7 +84,7 @@ signals:
}; };
class CAudioMixerBoard : public QFrame class CAudioMixerBoard : public QGroupBox
{ {
Q_OBJECT Q_OBJECT