lot of changes in artwork-/theming-handling
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@103 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -68,9 +68,6 @@
|
||||
|
||||
arpAndChordsTabWidget::chord arpAndChordsTabWidget::s_chords[] =
|
||||
{
|
||||
// thanks to the FL-team for this chords *lol* ;-) took me at least 3
|
||||
// hours to get them all out of FL-arpeggiator...
|
||||
|
||||
{ arpAndChordsTabWidget::tr( "octave" ), { 0, -1 } },
|
||||
{ arpAndChordsTabWidget::tr( "Major" ), { 0, 4, 7, -1 } },
|
||||
{ arpAndChordsTabWidget::tr( "Majb5" ), { 0, 4, 6, -1 } },
|
||||
|
||||
@@ -168,7 +168,7 @@ configManager::configManager( void ) :
|
||||
// since real support for qt < 3.2 is senseless too ;-)
|
||||
m_dataDir( "/usr/share/lmms/" ),
|
||||
#endif
|
||||
m_artworkDir( m_dataDir + DEFAULT_THEME_PATH ),
|
||||
m_artworkDir( defaultArtworkDir() ),
|
||||
#if QT_VERSION >= 0x030200
|
||||
m_pluginDir( qApp->applicationDirPath().section( '/', 0, -2 ) +
|
||||
"/lib/lmms/" ),
|
||||
@@ -811,7 +811,7 @@ bool configManager::loadConfigFile( void )
|
||||
m_artworkDir = value( "paths", "artwork" );
|
||||
if( QDir( m_artworkDir ).exists() == FALSE )
|
||||
{
|
||||
m_artworkDir = m_dataDir + DEFAULT_THEME_PATH;
|
||||
m_artworkDir = defaultArtworkDir();
|
||||
}
|
||||
if( m_artworkDir.right( 1 ) != "/" )
|
||||
{
|
||||
|
||||
@@ -38,10 +38,7 @@ instrument::instrument( channelTrack * _channel_track,
|
||||
m_valid( TRUE )
|
||||
{
|
||||
setFixedSize( 250, 250 );
|
||||
QPixmap logo;
|
||||
logo.loadFromData( getDescriptor()->logo.data,
|
||||
getDescriptor()->logo.size );
|
||||
m_channelTrack->setWindowIcon( logo );
|
||||
m_channelTrack->setWindowIcon( *getDescriptor()->logo );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <QApplication>
|
||||
#include <QLocale>
|
||||
#include <QSplashScreen>
|
||||
#include <QTranslator>
|
||||
|
||||
#else
|
||||
|
||||
@@ -40,6 +41,7 @@
|
||||
#if QT_VERSION >= 0x030200
|
||||
#include <qsplashscreen.h>
|
||||
#endif
|
||||
#include <qtranslator.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,6 +65,17 @@ QString file_to_render;
|
||||
int splash_alignment_flags = Qt::AlignTop | Qt::AlignLeft;
|
||||
#endif
|
||||
|
||||
inline void loadTranslation( const QString & _tname )
|
||||
{
|
||||
QTranslator * t = new QTranslator( 0 );
|
||||
QString name = _tname + ".qm";
|
||||
|
||||
t->load( name, configManager::inst()->localeDir() );
|
||||
|
||||
qApp->installTranslator( t );
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main( int argc, char * * argv )
|
||||
{
|
||||
@@ -160,9 +173,9 @@ int main( int argc, char * * argv )
|
||||
QString( QTextCodec::locale() ).section( '_', 0, 0 );
|
||||
#endif
|
||||
// load translation for Qt-widgets/-dialogs
|
||||
embed::loadTranslation( QString( "qt_" ) + pos );
|
||||
loadTranslation( QString( "qt_" ) + pos );
|
||||
// load actual translation for LMMS
|
||||
embed::loadTranslation( pos );
|
||||
loadTranslation( pos );
|
||||
|
||||
#ifdef QT4
|
||||
app.setFont( pointSize<10>( app.font() ) );
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "dummy_plugin.h"
|
||||
|
||||
|
||||
static embed::descriptor dummy_embed = { 0, NULL, "" } ;
|
||||
//static embed::descriptor dummy_embed = { 0, NULL, "" } ;
|
||||
|
||||
static plugin::descriptor dummy_plugin_descriptor =
|
||||
{
|
||||
@@ -58,7 +58,7 @@ static plugin::descriptor dummy_plugin_descriptor =
|
||||
"Tobias Doerffel <tobydox/at/users.sf.net>",
|
||||
0x0100,
|
||||
plugin::UNDEFINED,
|
||||
dummy_embed
|
||||
NULL
|
||||
} ;
|
||||
|
||||
|
||||
@@ -68,6 +68,11 @@ plugin::plugin( const descriptor * _descriptor, engine * _engine ) :
|
||||
engineObject( _engine ),
|
||||
m_descriptor( _descriptor )
|
||||
{
|
||||
if( dummy_plugin_descriptor.logo == NULL )
|
||||
{
|
||||
dummy_plugin_descriptor.logo = new QPixmap();
|
||||
}
|
||||
|
||||
if( m_descriptor == NULL )
|
||||
{
|
||||
m_descriptor = &dummy_plugin_descriptor;
|
||||
|
||||
@@ -114,10 +114,9 @@ pluginDescWidget::pluginDescWidget( const plugin::descriptor & _pd,
|
||||
QWidget( _parent ),
|
||||
engineObject( _engine ),
|
||||
m_pluginDescriptor( _pd ),
|
||||
m_logo(),
|
||||
m_logo( *_pd.logo ),
|
||||
m_mouseOver( FALSE )
|
||||
{
|
||||
m_logo.loadFromData( _pd.logo.data, _pd.logo.size );
|
||||
setFixedHeight( 60 );
|
||||
setMouseTracking( TRUE );
|
||||
#ifndef QT4
|
||||
|
||||
@@ -279,49 +279,7 @@ void timeLine::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( _me->button() == Qt::RightButton )
|
||||
{
|
||||
if( _me->x() >= markerX( loopBegin() ) &&
|
||||
_me->x() <= markerX( loopBegin() ) +
|
||||
s_loopPointPixmap->width() )
|
||||
{
|
||||
m_action = MOVE_LOOP_BEGIN;
|
||||
}
|
||||
else if( _me->x() >= markerX( loopEnd() ) &&
|
||||
_me->x() <= markerX( loopEnd() ) +
|
||||
s_loopPointPixmap->width() )
|
||||
{
|
||||
m_action = MOVE_LOOP_END;
|
||||
}
|
||||
if( m_action != NONE )
|
||||
{
|
||||
m_moveXOff = s_loopPointPixmap->width() / 2;
|
||||
}
|
||||
}
|
||||
else if( _me->button() == Qt::MidButton )
|
||||
{
|
||||
const midiTime t = m_begin +
|
||||
static_cast<Sint32>( _me->x() * 64 / m_ppt );
|
||||
Uint8 pmin = 0;
|
||||
Uint8 pmax = 1;
|
||||
m_action = MOVE_LOOP_BEGIN;
|
||||
if( m_loopPos[pmin] > m_loopPos[pmax] )
|
||||
{
|
||||
qSwap( pmin, pmax );
|
||||
m_action = MOVE_LOOP_END;
|
||||
}
|
||||
if( eng()->getMainWindow()->isShiftPressed() == TRUE )
|
||||
{
|
||||
m_loopPos[pmax] = t;
|
||||
m_action = ( m_action == MOVE_LOOP_BEGIN ) ?
|
||||
MOVE_LOOP_END : MOVE_LOOP_BEGIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_loopPos[pmin] = t;
|
||||
}
|
||||
}
|
||||
else
|
||||
if( _me->button() == Qt::LeftButton )
|
||||
{
|
||||
m_action = MOVE_POS_MARKER;
|
||||
if( _me->x() - m_xOffset < s_posMarkerPixmap->width() )
|
||||
@@ -333,6 +291,23 @@ void timeLine::mousePressEvent( QMouseEvent * _me )
|
||||
m_moveXOff = s_posMarkerPixmap->width() / 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const midiTime t = m_begin +
|
||||
static_cast<Sint32>( _me->x() * 64 / m_ppt );
|
||||
Uint8 pmin = 0;
|
||||
Uint8 pmax = 1;
|
||||
m_action = MOVE_LOOP_BEGIN;
|
||||
if( m_loopPos[0] > m_loopPos[1] )
|
||||
{
|
||||
qSwap( m_loopPos[0], m_loopPos[1] );
|
||||
}
|
||||
if( _me->button() == Qt::RightButton )
|
||||
{
|
||||
m_action = MOVE_LOOP_END;
|
||||
}
|
||||
m_loopPos[( m_action == MOVE_LOOP_BEGIN ) ? 0 : 1] = t;
|
||||
}
|
||||
if( m_action == MOVE_LOOP_BEGIN || m_action == MOVE_LOOP_END )
|
||||
{
|
||||
delete m_hint;
|
||||
|
||||
@@ -100,8 +100,7 @@ trackContentObject::trackContentObject( track * _track ) :
|
||||
if( s_textFloat == NULL )
|
||||
{
|
||||
s_textFloat = new textFloat( this );
|
||||
s_textFloat->setPixmap( embed::getIconPixmap(
|
||||
"xclock", 24, 24 ) );
|
||||
s_textFloat->setPixmap( embed::getIconPixmap( "clock" ) );
|
||||
}
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* embed.cpp - misc stuff for using embedded resources (linked into binary)
|
||||
*
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -29,14 +29,10 @@
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTranslator>
|
||||
#include <QImage>
|
||||
|
||||
#else
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qtranslator.h>
|
||||
#include <qimage.h>
|
||||
|
||||
#endif
|
||||
@@ -63,25 +59,44 @@ QPixmap getIconPixmap( const char * _name, int _w, int _h )
|
||||
if( _w == -1 || _h == -1 )
|
||||
{
|
||||
QString name = QString( _name ) + ".png";
|
||||
|
||||
#ifdef PLUGIN_NAME
|
||||
QPixmap p( configManager::inst()->artworkDir() + "plugins/" +
|
||||
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ) + "_" + name );
|
||||
if( p.isNull() )
|
||||
{
|
||||
p = QPixmap( configManager::inst()->artworkDir() +
|
||||
name );
|
||||
}
|
||||
#else
|
||||
// look whether icon is in artwork-dir
|
||||
QPixmap p( configManager::inst()->artworkDir() + name );
|
||||
#endif
|
||||
if( p.isNull() )
|
||||
{
|
||||
// nothing found, so look in default-artwork-dir
|
||||
p =
|
||||
QPixmap( configManager::inst()->defaultArtworkDir() + name );
|
||||
}
|
||||
if( p.isNull() )
|
||||
{
|
||||
#ifdef QT4
|
||||
const embed::descriptor & e = findEmbeddedData(
|
||||
const embed::descriptor & e = findEmbeddedData(
|
||||
name.toAscii().constData() );
|
||||
#else
|
||||
const embed::descriptor & e = findEmbeddedData( name.ascii() );
|
||||
const embed::descriptor & e = findEmbeddedData(
|
||||
name.ascii() );
|
||||
#endif
|
||||
// not found?
|
||||
if( QString( e.name ) != name )
|
||||
{
|
||||
// then look whether icon is in data-dir
|
||||
QPixmap p( configManager::inst()->artworkDir() + name );
|
||||
if( p.isNull() )
|
||||
// found?
|
||||
if( QString( e.name ) == name )
|
||||
{
|
||||
p.loadFromData( e.data, e.size );
|
||||
}
|
||||
else
|
||||
{
|
||||
p = QPixmap( 1, 1 );
|
||||
}
|
||||
return( p );
|
||||
}
|
||||
QPixmap p;
|
||||
p.loadFromData( e.data, e.size );
|
||||
return( p );
|
||||
}
|
||||
#ifdef QT4
|
||||
@@ -102,38 +117,6 @@ QString getText( const char * _name )
|
||||
}
|
||||
|
||||
|
||||
|
||||
void loadTranslation( const QString & _tname )
|
||||
{
|
||||
QTranslator * t = new QTranslator( 0 );
|
||||
QString name = _tname + ".qm";
|
||||
|
||||
#if QT_VERSION >= 0x030100
|
||||
|
||||
#ifdef QT4
|
||||
const embed::descriptor & e = findEmbeddedData(
|
||||
name.toAscii().constData() );
|
||||
#else
|
||||
const embed::descriptor & e = findEmbeddedData( name.ascii() );
|
||||
#endif
|
||||
// not found?
|
||||
if( QString( e.name ) != name )
|
||||
{
|
||||
#endif
|
||||
// then look whether translation is in data-dir
|
||||
t->load( name, configManager::inst()->localeDir() );
|
||||
#if QT_VERSION >= 0x030100
|
||||
}
|
||||
else
|
||||
{
|
||||
t->load( e.data, (int) e.size );
|
||||
}
|
||||
#endif
|
||||
|
||||
qApp->installTranslator( t );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ void groupBox::updatePixmap( void )
|
||||
|
||||
|
||||
//p.setPen( QColor( 255, 255, 255 ) );
|
||||
p.setPen( colorGroup().highlight() );
|
||||
p.setPen( colorGroup().buttonText() );
|
||||
p.setFont( pointSize<7>( font() ) );
|
||||
p.drawText( 22, 10, m_caption );
|
||||
|
||||
|
||||
@@ -54,13 +54,22 @@ tabWidget::tabWidget( const QString & _caption, QWidget * _parent ) :
|
||||
m_caption( _caption )
|
||||
{
|
||||
setFont( pointSize<7>( font() ) );
|
||||
#ifdef QT4
|
||||
/*#ifdef QT4
|
||||
QPalette pal = palette();
|
||||
pal.setColor( QPalette::Background, QColor( 96, 96, 96 ) );
|
||||
setPalette( pal );
|
||||
#else
|
||||
setPaletteBackgroundColor( QColor( 96, 96, 96 ) );
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
#endif*/
|
||||
QColor bg_color = QApplication::palette().active().background().dark(
|
||||
132 );
|
||||
#ifdef QT4
|
||||
QPalette pal = palette();
|
||||
pal.setColor( QPalette::Background, bg_color );
|
||||
setPalette( pal );
|
||||
#else
|
||||
setPaletteBackgroundColor( bg_color );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ tempoSyncKnob::tempoSyncKnob( int _knob_num, QWidget * _parent,
|
||||
knob( _knob_num, _parent, _name, _engine ),
|
||||
m_tempoSyncMode( NO_SYNC ),
|
||||
m_scale( _scale ),
|
||||
m_tempoSyncIcon( embed::getIconPixmap( "xclock" ) ),
|
||||
m_tempoSyncIcon( embed::getIconPixmap( "tempo_sync" ) ),
|
||||
m_tempoSyncDescription( tr( "Tempo Sync" ) ),
|
||||
m_tempoLastSyncMode( NO_SYNC )
|
||||
{
|
||||
@@ -301,7 +301,7 @@ void tempoSyncKnob::calculateTempoSyncTime( bpm_t _bpm )
|
||||
else
|
||||
{
|
||||
m_tempoSyncDescription = tr( "Tempo Sync" );
|
||||
m_tempoSyncIcon = embed::getIconPixmap( "xclock" );
|
||||
m_tempoSyncIcon = embed::getIconPixmap( "tempo_sync" );
|
||||
}
|
||||
|
||||
if( m_tempoSyncMode != m_tempoLastSyncMode )
|
||||
|
||||
Reference in New Issue
Block a user