* plugins and core: use new pluginPixmapLoader

* lmmsStyle-class: load stylesheet here
* comboBox/comboBoxModel: use pixmapLoader-pointers rather than QPixmap-pointers
* in plugin-descriptor, hold a pointer to pixmapLoader instead of QPixmap itself
* embed-framework: introduced pixmapLoader and pluginPixmapLoader-classes for abstracting QPixmap-instantiation - models can hold pixmapLoaders without actually instantiating a QPixmap-object and views can access the pixmap
* main-window: removed settings-menu and moved setup-dialog to edit-menu
* config-manager: removed all the obsolete first-startup-wizard-code



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@999 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-05-20 23:41:45 +00:00
parent 895cde07b1
commit aa08d06068
45 changed files with 309 additions and 746 deletions

View File

@@ -34,6 +34,8 @@
#include "automatable_model.h"
#include "templates.h"
class pixmapLoader;
class comboBoxModel : public intModel
{
@@ -44,7 +46,7 @@ public:
{
}
void addItem( const QString & _item, QPixmap * _data = NULL );
void addItem( const QString & _item, pixmapLoader * _loader = NULL );
void clear( void );
@@ -55,7 +57,7 @@ public:
return( m_items[value()].first );
}
inline const QPixmap * currentData( void ) const
inline const pixmapLoader * currentData( void ) const
{
return( m_items[value()].second );
}
@@ -66,10 +68,10 @@ public:
first );
}
inline const QPixmap * itemPixmap( int _i ) const
inline const pixmapLoader * itemPixmap( int _i ) const
{
return( m_items[tLimit<int>( _i, minValue(), maxValue() )].
second );
second );
}
inline int size( void ) const
@@ -78,14 +80,10 @@ public:
}
private:
typedef QPair<QString, QPixmap *> item;
typedef QPair<QString, pixmapLoader *> item;
QVector<item> m_items;
signals:
void itemPixmapRemoved( QPixmap * _item );
} ;
@@ -108,16 +106,6 @@ public:
}
virtual void modelChanged( void )
{
if( model() != NULL )
{
QWidget::connect( model(), SIGNAL( itemPixmapRemoved( QPixmap * ) ),
this, SLOT( deletePixmap( QPixmap * ) ) );
}
}
protected:
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void mousePressEvent( QMouseEvent * _me );
@@ -136,7 +124,6 @@ private:
private slots:
void deletePixmap( QPixmap * _pixmap );
void setItem( QAction * _item );
} ;

View File

@@ -31,19 +31,11 @@
#endif
#include <QtGui/QDialog>
#include <QtCore/QMap>
#include <QtCore/QVector>
#include <QtCore/QPair>
class QLineEdit;
class QLabel;
class QRadioButton;
class QHBoxLayout;
class QVBoxLayout;
class QFrame;
class engine;
@@ -55,9 +47,8 @@ const QString TRACK_ICON_PATH = "track_icons/";
const QString LOCALE_PATH = "locale/";
class configManager : public QDialog
class configManager
{
Q_OBJECT
public:
static inline configManager * inst( void )
{
@@ -171,7 +162,6 @@ public:
void saveConfigFile( void );
public slots:
void setWorkingDir( const QString & _wd );
void setVSTDir( const QString & _vd );
void setArtworkDir( const QString & _ad );
@@ -180,17 +170,6 @@ public slots:
void setSTKDir( const QString & _fd );
protected slots:
void openWorkingDir( void );
virtual void accept( void );
void backButtonClicked( void );
void nextButtonClicked( void );
void switchPage( int _pg );
void switchPage( QWidget * _pg );
private:
static configManager * s_instanceOfMe;
@@ -198,13 +177,6 @@ private:
configManager( const configManager & _c );
~configManager();
void createWidgets( void );
void addPage( QWidget * _w, const QString & _title );
void loadStyleSheet( void );
const QString m_lmmsRcFile;
QString m_workingDir;
@@ -225,31 +197,6 @@ private:
settingsMap m_settings;
QWidget * m_pageIntro;
QWidget * m_pageWorkingDir;
QWidget * m_pageFiles;
QRadioButton * m_samplesCopyRB;
QRadioButton * m_presetsCopyRB;
QRadioButton * m_projectsCopyRB;
QLineEdit * m_wdLineEdit;
// wizard stuff
QList<QPair<QWidget *, QString> > m_pages;
int m_currentPage;
QFrame * m_hbar;
QWidget * m_contentWidget;
QLabel * m_title;
QPushButton * m_cancelButton;
QPushButton * m_backButton;
QPushButton * m_nextButton;
QPushButton * m_finishButton;
QHBoxLayout * m_buttonLayout;
QHBoxLayout * m_mainLayout;
QVBoxLayout * m_contentLayout;
friend class engine;
} ;

View File

@@ -1,7 +1,7 @@
/*
* embed.h - misc. stuff for using embedded data (resources linked into binary)
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -30,6 +30,10 @@
#include <QtCore/QString>
#define STRINGIFY_PLUGIN_NAME(s) STR(s)
#define STR(PN) #PN
namespace embed
{
@@ -58,4 +62,56 @@ QPixmap getIconPixmap( const char * _name, int _w = -1, int _h = -1 );
#endif
class pixmapLoader
{
public:
pixmapLoader( const pixmapLoader * _ref ) :
m_name( _ref != NULL ? _ref->m_name : QString::null )
{
}
pixmapLoader( const QString & _name = QString::null ) :
m_name( _name )
{
}
virtual QPixmap pixmap( void ) const
{
if( !m_name.isEmpty() )
{
return( embed::getIconPixmap(
m_name.toAscii().constData() ) );
}
return( QPixmap() );
}
protected:
QString m_name;
} ;
#ifdef PLUGIN_NAME
class pluginPixmapLoader : public pixmapLoader
{
public:
pluginPixmapLoader( const QString & _name = QString::null ) :
pixmapLoader( _name )
{
}
virtual QPixmap pixmap( void ) const
{
if( !m_name.isEmpty() )
{
return( PLUGIN_NAME::getIconPixmap(
m_name.toAscii().constData() ) );
}
return( QPixmap() );
}
} ;
#endif
#endif

View File

@@ -1,7 +1,8 @@
/*
* lmms_style.h - the graphical style used my LMMS to create a consistent interface
* lmms_style.h - the graphical style used by LMMS to create a consistent
* interface
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2007-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,24 +29,24 @@
#include <QtGui/QPlastiqueStyle>
class lmmsStyle : public QPlastiqueStyle
{
public:
lmmsStyle() :
QPlastiqueStyle ()
{
}
lmmsStyle();
virtual ~lmmsStyle()
{
}
virtual void drawPrimitive( PrimitiveElement element, const QStyleOption *option,
QPainter *painter, const QWidget *widget = 0 ) const;
virtual void drawPrimitive( PrimitiveElement element,
const QStyleOption *option,
QPainter *painter,
const QWidget *widget = 0 ) const;
virtual int pixelMetric ( PixelMetric metric, const QStyleOption * option = 0,
const QWidget * widget = 0 ) const;
virtual int pixelMetric( PixelMetric metric,
const QStyleOption * option = 0,
const QWidget * widget = 0 ) const;
};
} ;
#endif

View File

@@ -36,13 +36,10 @@
#include "base64.h"
#define STRINGIFY_PLUGIN_NAME(s) STR(s)
#define STR(PN) #PN
class QPixmap;
class QWidget;
class pixmapLoader;
class pluginView;
@@ -57,7 +54,7 @@ public:
ExportFilter, // filter for exporting a file
Tool, // additional tool (level-meter etc)
Library, // simple library holding a code-base for
// several other plugins (e.g. LADSPA-support)
// several other plugins (e.g. VST-support)
Other,
Undefined = 255
} ;
@@ -73,7 +70,7 @@ public:
const char * author;
int version;
PluginTypes type;
const QPixmap * logo;
const pixmapLoader * logo;
class subPluginFeatures
{
public:

View File

@@ -53,6 +53,7 @@ class QPushButton;
class automationPattern;
class bbTrack;
class pixmapButton;
class pixmapLoader;
class textFloat;
class track;
class trackContentObjectView;
@@ -418,9 +419,9 @@ public:
return( m_name );
}
inline const QPixmap * pixmap( void )
inline const pixmapLoader * icon( void ) const
{
return( m_pixmap );
return( m_pixmapLoader );
}
using model::dataChanged;
@@ -441,7 +442,7 @@ private:
trackContainer * m_trackContainer;
TrackTypes m_type;
QString m_name;
QPixmap * m_pixmap;
pixmapLoader * m_pixmapLoader;
boolModel m_mutedModel;
typedef QVector<trackContentObject *> tcoVector;