diff --git a/ChangeLog b/ChangeLog index e3fecf130..31c5b3fd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,67 @@ +2008-05-21 Tobias Doerffel + + * plugins/ladspa_effect/ladspa_effect.cpp: + * plugins/patman/patman.cpp: + * plugins/lb302/lb302.cpp: + * plugins/organic/organic.cpp: + * plugins/stereo_matrix/stereo_matrix.cpp: + * plugins/bass_booster/bass_booster.cpp: + * plugins/bit_invader/bit_invader.cpp: + * plugins/vst_effect/vst_effect.cpp: + * plugins/vibed/vibed.cpp: + * plugins/triple_oscillator/triple_oscillator.cpp: + * plugins/singerbot/singerbot.cpp: + * plugins/live_tool/live_tool.cpp: + * plugins/audio_file_processor/audio_file_processor.cpp: + * plugins/stk/mallets/mallets.cpp: + * plugins/stereo_enhancer/stereo_enhancer.cpp: + * plugins/sf2_player/sf2_player.cpp: + * plugins/vestige/vestige.cpp: + * plugins/vst_base/vst_base.cpp: + * plugins/ladspa_browser/ladspa_browser.cpp: + * plugins/kicker/kicker.cpp: + * plugins/Makefile.am: + * plugins/flp_import/flp_import.cpp: + * plugins/midi_import/midi_import.cpp: + * include/track.h: + * src/gui/piano_roll.cpp: + * src/gui/plugin_browser.cpp: + * src/gui/main_window.cpp: + * src/core/plugin.cpp: + * src/core/bb_track_container.cpp: + * src/core/tool.cpp: + * src/core/instrument_sound_shaping.cpp: + * src/core/instrument_functions.cpp: + * src/core/track.cpp: + * src/core/instrument.cpp: + use new pluginPixmapLoader + + * include/lmms_style.h: + * src/gui/lmms_style.cpp: + load stylesheet here + + * include/combobox.h: + * src/gui/widgets/combobox.cpp: + use pixmapLoader-pointers rather than QPixmap-pointers in comboBoxModel + + * include/plugin.h: + in plugin-descriptor, hold a pointer to pixmapLoader instead of + QPixmap itself + + * include/embed.h: + * src/gui/embed.cpp: + 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 + + * src/gui/main_window.cpp: + removed settings-menu and moved setup-dialog to edit-menu + + * Makefile.am: + * include/config_mgr.h: + * src/core/config_mgr.cpp: + removed all the obsolete first-startup-wizard-code + 2008-05-19 Tobias Doerffel * configure.in: diff --git a/Makefile.am b/Makefile.am index fb570781f..f22d0407b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,7 +61,6 @@ lmms_MOC = \ ./caption_menu.moc \ ./instrument_track.moc \ ./combobox.moc \ - ./config_mgr.moc \ ./controller.moc \ ./controller_connection_dialog.moc \ ./controller_dialog.moc \ diff --git a/include/combobox.h b/include/combobox.h index 1e124d65b..5e26f77f6 100644 --- a/include/combobox.h +++ b/include/combobox.h @@ -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( _i, minValue(), maxValue() )]. - second ); + second ); } inline int size( void ) const @@ -78,14 +80,10 @@ public: } private: - typedef QPair item; + typedef QPair item; QVector 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 ); } ; diff --git a/include/config_mgr.h b/include/config_mgr.h index 66915723f..8d799b428 100644 --- a/include/config_mgr.h +++ b/include/config_mgr.h @@ -31,19 +31,11 @@ #endif -#include #include #include #include -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 > 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; } ; diff --git a/include/embed.h b/include/embed.h index 8ff591ff5..880fe9539 100644 --- a/include/embed.h +++ b/include/embed.h @@ -1,7 +1,7 @@ /* * embed.h - misc. stuff for using embedded data (resources linked into binary) * - * Copyright (c) 2004-2007 Tobias Doerffel + * Copyright (c) 2004-2008 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -30,6 +30,10 @@ #include +#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 diff --git a/include/lmms_style.h b/include/lmms_style.h index 7190ff902..736422d8f 100644 --- a/include/lmms_style.h +++ b/include/lmms_style.h @@ -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 + * Copyright (c) 2007-2008 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -28,24 +29,24 @@ #include + 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 diff --git a/include/plugin.h b/include/plugin.h index fa4c3c7f5..870ec3661 100644 --- a/include/plugin.h +++ b/include/plugin.h @@ -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: diff --git a/include/track.h b/include/track.h index 55f67a5b6..3f7198dcd 100644 --- a/include/track.h +++ b/include/track.h @@ -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 tcoVector; diff --git a/plugins/Makefile.am b/plugins/Makefile.am index f9e6c1c16..90dfb5f56 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -25,10 +25,10 @@ SUBDIRS = \ patman \ sf2_player \ $(SINGERBOT_DIR) \ - $(STK_DIR) \ - triple_oscillator \ - $(VST_DIRS) \ - vibed \ stereo_enhancer \ stereo_matrix \ + $(STK_DIR) \ + triple_oscillator \ + vibed \ + $(VST_DIRS) \ $(EXTRA_PLUGINS) diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index b4ab4c5e8..3cc2635e9 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -61,7 +61,7 @@ plugin::descriptor audiofileprocessor_plugin_descriptor = "Tobias Doerffel ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), new audioFileProcessor::subPluginFeatures( plugin::Instrument ) } ; diff --git a/plugins/bass_booster/bass_booster.cpp b/plugins/bass_booster/bass_booster.cpp index 3c6a56f38..981ca9401 100644 --- a/plugins/bass_booster/bass_booster.cpp +++ b/plugins/bass_booster/bass_booster.cpp @@ -44,7 +44,7 @@ plugin::descriptor bassbooster_plugin_descriptor = "Tobias Doerffel ", 0x0100, plugin::Effect, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index d2ec26ff6..ef617537b 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -60,7 +60,7 @@ plugin::descriptor bitinvader_plugin_descriptor = "Andreas Brandmaier ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/flp_import/flp_import.cpp b/plugins/flp_import/flp_import.cpp index 1797e0603..d11c6ab87 100644 --- a/plugins/flp_import/flp_import.cpp +++ b/plugins/flp_import/flp_import.cpp @@ -50,6 +50,7 @@ #include "song.h" #include "tempo_sync_knob.h" #include "track_container.h" +#include "embed.h" #ifdef HAVE_CONFIG_H #include @@ -75,7 +76,7 @@ plugin::descriptor flpimport_plugin_descriptor = "Tobias Doerffel ", 0x0100, plugin::ImportFilter, - new QPixmap(), + NULL, NULL } ; diff --git a/plugins/kicker/kicker.cpp b/plugins/kicker/kicker.cpp index 5d23fbcd8..4b1f12cfe 100644 --- a/plugins/kicker/kicker.cpp +++ b/plugins/kicker/kicker.cpp @@ -50,7 +50,7 @@ plugin::descriptor kicker_plugin_descriptor = "Tobias Doerffel ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/ladspa_browser/ladspa_browser.cpp b/plugins/ladspa_browser/ladspa_browser.cpp index 55b5a7f15..78962dbe7 100644 --- a/plugins/ladspa_browser/ladspa_browser.cpp +++ b/plugins/ladspa_browser/ladspa_browser.cpp @@ -56,7 +56,7 @@ plugin::descriptor ladspa_browser_plugin_descriptor = "Danny McRae ", 0x0100, plugin::Tool, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/ladspa_effect/ladspa_effect.cpp b/plugins/ladspa_effect/ladspa_effect.cpp index e5089c4e4..132a6f24f 100644 --- a/plugins/ladspa_effect/ladspa_effect.cpp +++ b/plugins/ladspa_effect/ladspa_effect.cpp @@ -53,7 +53,7 @@ plugin::descriptor ladspaeffect_plugin_descriptor = "Danny McRae ", 0x0100, plugin::Effect, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), new ladspaSubPluginFeatures( plugin::Effect ) } ; diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index dcc5dc01e..fae319a9f 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -87,7 +87,7 @@ plugin::descriptor lb302_plugin_descriptor = "Paul Giblock ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL }; diff --git a/plugins/live_tool/live_tool.cpp b/plugins/live_tool/live_tool.cpp index 2c23f9a0f..7bec9cc48 100644 --- a/plugins/live_tool/live_tool.cpp +++ b/plugins/live_tool/live_tool.cpp @@ -55,7 +55,7 @@ plugin::descriptor live_tool_plugin_descriptor = "Javier Serrano Polo ", 0x0100, plugin::Tool, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/midi_import/midi_import.cpp b/plugins/midi_import/midi_import.cpp index a3639ee41..cb4f0dc90 100644 --- a/plugins/midi_import/midi_import.cpp +++ b/plugins/midi_import/midi_import.cpp @@ -36,6 +36,7 @@ #include "level_object.h" #include "instrument.h" #include "debug.h" +#include "embed.h" #define makeID(_c0, _c1, _c2, _c3) \ @@ -55,7 +56,7 @@ plugin::descriptor midiimport_plugin_descriptor = "Tobias Doerffel ", 0x0100, plugin::ImportFilter, - new QPixmap(), + NULL, NULL } ; diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index a79b0a94d..e7a84f49f 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -56,7 +56,7 @@ plugin::descriptor organic_plugin_descriptor = "Andreas Brandmaier ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/patman/patman.cpp b/plugins/patman/patman.cpp index 9fe68dad9..e84ebe207 100644 --- a/plugins/patman/patman.cpp +++ b/plugins/patman/patman.cpp @@ -57,7 +57,7 @@ plugin::descriptor patman_plugin_descriptor = "Javier Serrano Polo ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), new patmanInstrument::subPluginFeatures( plugin::Instrument ) } ; diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index 28bde1344..ddc4a51cd 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -59,7 +59,7 @@ plugin::descriptor sf2player_plugin_descriptor = "Paul Giblock ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/singerbot/singerbot.cpp b/plugins/singerbot/singerbot.cpp index 5529e3346..40228f4d3 100644 --- a/plugins/singerbot/singerbot.cpp +++ b/plugins/singerbot/singerbot.cpp @@ -60,7 +60,7 @@ plugin::descriptor singerbot_plugin_descriptor = "Javier Serrano Polo ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/stereo_enhancer/stereo_enhancer.cpp b/plugins/stereo_enhancer/stereo_enhancer.cpp index b0b7cafe0..32740311d 100644 --- a/plugins/stereo_enhancer/stereo_enhancer.cpp +++ b/plugins/stereo_enhancer/stereo_enhancer.cpp @@ -42,7 +42,7 @@ plugin::descriptor stereoenhancer_plugin_descriptor = "Lou Herard ", 0x0100, plugin::Effect, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/stereo_matrix/stereo_matrix.cpp b/plugins/stereo_matrix/stereo_matrix.cpp index f71ddfaee..c0af53f15 100644 --- a/plugins/stereo_matrix/stereo_matrix.cpp +++ b/plugins/stereo_matrix/stereo_matrix.cpp @@ -42,7 +42,7 @@ plugin::descriptor stereomatrix_plugin_descriptor = "Paul Giblock ", 0x0100, plugin::Effect, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/stk/mallets/mallets.cpp b/plugins/stk/mallets/mallets.cpp index 617e3588d..877f3a16e 100644 --- a/plugins/stk/mallets/mallets.cpp +++ b/plugins/stk/mallets/mallets.cpp @@ -51,7 +51,7 @@ plugin::descriptor malletsstk_plugin_descriptor = "Danny McRae ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/triple_oscillator/triple_oscillator.cpp b/plugins/triple_oscillator/triple_oscillator.cpp index ec02aad13..487edd2e6 100644 --- a/plugins/triple_oscillator/triple_oscillator.cpp +++ b/plugins/triple_oscillator/triple_oscillator.cpp @@ -59,7 +59,7 @@ plugin::descriptor tripleoscillator_plugin_descriptor = "Tobias Doerffel ", 0x0110, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index afacd1c95..a7f952682 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -58,7 +58,7 @@ plugin::descriptor vestige_plugin_descriptor = "Tobias Doerffel ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL } ; diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index 20a9119aa..8a16434c0 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -59,7 +59,7 @@ plugin::descriptor vibedstrings_plugin_descriptor = "Danny McRae ", 0x0100, plugin::Instrument, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), NULL }; diff --git a/plugins/vst_base/vst_base.cpp b/plugins/vst_base/vst_base.cpp index 9c4dbd10f..9c3c34e87 100644 --- a/plugins/vst_base/vst_base.cpp +++ b/plugins/vst_base/vst_base.cpp @@ -2,7 +2,7 @@ * vst_base.cpp - VST-base-code to be used by any LMMS-plugins dealing with VST- * plugins * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2008 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -25,6 +25,7 @@ #include "plugin.h" +#include "embed.h" extern "C" diff --git a/plugins/vst_effect/vst_effect.cpp b/plugins/vst_effect/vst_effect.cpp index 1dac04ed4..5b7344019 100644 --- a/plugins/vst_effect/vst_effect.cpp +++ b/plugins/vst_effect/vst_effect.cpp @@ -49,7 +49,7 @@ plugin::descriptor vsteffect_plugin_descriptor = "Tobias Doerffel ", 0x0200, plugin::Effect, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new pluginPixmapLoader( "logo" ), new vstSubPluginFeatures( plugin::Effect ) } ; diff --git a/src/core/bb_track_container.cpp b/src/core/bb_track_container.cpp index 37b91c703..0722ef32e 100644 --- a/src/core/bb_track_container.cpp +++ b/src/core/bb_track_container.cpp @@ -26,6 +26,7 @@ #include "bb_track_container.h" #include "bb_track.h" #include "combobox.h" +#include "embed.h" #include "engine.h" #include "song.h" @@ -214,8 +215,7 @@ void bbTrackContainer::updateComboBox( void ) { bbTrack * bbt = bbTrack::findBBTrack( i ); m_bbComboBoxModel.addItem( bbt->name(), - bbt->pixmap() ? new QPixmap( *bbt->pixmap() ) - : NULL ); + new pixmapLoader( bbt->icon() ) ); } setCurrentBB( cur_bb ); } diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index 4c43255b8..e4be2d1b0 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -33,64 +33,11 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include #include #include "config_mgr.h" -#include "embed.h" -#include "gui_templates.h" - - - -/* -void linkFile( const QString & _src, const QString & _dst ) -{ -#ifdef QT4 - // simple clean solution with Qt4... - QFile::link( _src, _dst ); -#else - // ...but Qt3 needs additional (unportable) code... - symlink( _src.ascii(), _dst.ascii() ); -#endif -} - - - - -void copyFile( const QString & _src, const QString & _dst ) -{ -#ifdef QT4 - // simple clean solution with Qt4... - QFile::copy( _src, _dst ); -#else - // ...but Qt3 needs additional code... - QFile in( _src ); - QFile out( _dst ); - in.open( IO_ReadOnly ); - out.open( IO_WriteOnly ); - char buffer[1024]; - while( !in.atEnd() ) - { - Q_LONG read = in.readBlock( buffer, 1024 ); - if( read == -1 ) - { - break; - } - if( out.writeBlock( buffer, read ) == -1 ) - { - break; - } - } -#endif -} -*/ +#include "main_window.h" @@ -98,7 +45,6 @@ configManager * configManager::s_instanceOfMe = NULL; configManager::configManager( void ) : - QDialog(), m_lmmsRcFile( QDir::home().absolutePath() + "/.lmmsrc.xml" ), m_workingDir( QDir::home().absolutePath() + "/lmms" ), m_dataDir( qApp->applicationDirPath().section( '/', 0, -2 ) + @@ -107,9 +53,7 @@ configManager::configManager( void ) : m_pluginDir( qApp->applicationDirPath().section( '/', 0, -2 ) + "/lib/lmms/" ), m_vstDir( QDir::home().absolutePath() ), - m_flDir( QDir::home().absolutePath() ), - m_currentPage( 0 ), - m_mainLayout( NULL ) + m_flDir( QDir::home().absolutePath() ) { } @@ -124,308 +68,7 @@ configManager::~configManager() -void configManager::createWidgets( void ) -{ - m_mainLayout = new QHBoxLayout( this ); - m_mainLayout->setMargin( 0 ); - m_mainLayout->setSpacing( 10 ); - m_mainLayout->addSpacing( 8 ); - setLayout( m_mainLayout ); - - m_contentWidget = new QWidget( this ); - m_contentLayout = new QVBoxLayout( m_contentWidget ); - m_contentLayout->setMargin( 0 ); - m_contentLayout->setSpacing( 10 ); - m_contentLayout->addSpacing( 8 ); - m_contentWidget->setLayout( m_contentLayout ); - m_mainLayout->addWidget( m_contentWidget ); - m_mainLayout->addSpacing( 8 ); - - // wizard-init - m_hbar = new QFrame( m_contentWidget ); - m_hbar->setFrameStyle( QFrame::Sunken + QFrame::HLine ); - m_hbar->setFixedHeight( 4 ); - m_title = new QLabel( m_contentWidget ); - m_title->setFixedHeight( 16 ); - QFont f = m_title->font(); - f.setBold( TRUE ); - m_title->setFont( pointSize<12>( f ) ); - - - QWidget * button_widget = new QWidget( m_contentWidget ); - button_widget->setFixedHeight( 40 ); - m_buttonLayout = new QHBoxLayout( button_widget ); - m_buttonLayout->setMargin( 0 ); - m_buttonLayout->setSpacing( 0 ); - m_buttonLayout->addStretch( 1 ); - button_widget->setLayout( m_buttonLayout ); - - m_cancelButton = new QPushButton( tr( "&Cancel" ), button_widget ); - m_backButton = new QPushButton( tr( "< &Back" ), button_widget ); - m_nextButton = new QPushButton( tr( "&Next >" ), button_widget ); - m_finishButton = new QPushButton( tr( "&Finish" ), button_widget ); - - connect( m_cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( m_backButton, SIGNAL( clicked() ), this, - SLOT( backButtonClicked() ) ); - connect( m_nextButton, SIGNAL( clicked() ), this, - SLOT( nextButtonClicked() ) ); - connect( m_finishButton, SIGNAL( clicked() ), this, - SLOT( accept() ) ); - m_buttonLayout->addWidget( m_cancelButton ); - m_buttonLayout->addWidget( m_backButton ); - m_buttonLayout->addWidget( m_nextButton ); - m_buttonLayout->addWidget( m_finishButton ); - m_buttonLayout->addSpacing( 15 ); - - m_contentLayout->addWidget( m_title ); - m_contentLayout->addWidget( m_hbar ); - m_contentLayout->addWidget( button_widget ); - m_contentLayout->addSpacing( 8 ); - - // wizard-setup - setWindowTitle( tr( "Setup LMMS" ) ); - setWindowIcon( embed::getIconPixmap( "wizard" ) ); - - m_pageIntro = new QWidget( m_contentWidget ); - QHBoxLayout * intro_layout = new QHBoxLayout( m_pageIntro ); - intro_layout->setMargin( 0 ); - intro_layout->setSpacing( 15 ); - m_pageIntro->setLayout( intro_layout ); - - QLabel * intro_logo_lbl = new QLabel( m_pageIntro ); - intro_logo_lbl->setPixmap( embed::getIconPixmap( "wizard_intro" ) ); - intro_logo_lbl->setFrameStyle( QFrame::Panel | QFrame::Sunken ); - intro_logo_lbl->setFixedSize( 240, 300 ); - - QLabel * intro_txt_lbl = new QLabel( tr( "LMMS needs to be setup in " - "order to run properly. " - "This wizard will help you to " - "setup your personal LMMS-" - "installation.\n\n" - "If you're unsure what to do " - "at a step, just click on " - "'Next'. LMMS will " - "automatically select the best " - "options for you.\n\n\n" - "Now click on 'Next' to get to " - "the next page." ), - m_pageIntro ); - intro_txt_lbl->setWordWrap( TRUE ); - - intro_layout->addWidget( intro_logo_lbl ); - intro_layout->addWidget( intro_txt_lbl ); - - - m_pageWorkingDir = new QWidget( m_contentWidget ); - QHBoxLayout * workingdir_layout = new QHBoxLayout( m_pageWorkingDir ); - workingdir_layout->setMargin( 0 ); - workingdir_layout->setSpacing( 15 ); - - QLabel * workingdir_logo_lbl = new QLabel( m_pageWorkingDir ); - workingdir_logo_lbl->setPixmap( embed::getIconPixmap( - "wizard_workingdir" ) ); - workingdir_logo_lbl->setFrameStyle( QFrame::Panel | QFrame::Sunken ); - workingdir_logo_lbl->setFixedSize( 240, 300 ); - - QWidget * workingdir_content = new QWidget( m_pageWorkingDir ); - QVBoxLayout * workingdir_content_layout = new QVBoxLayout( - workingdir_content ); - workingdir_content_layout->setMargin( 0 ); - workingdir_content_layout->setSpacing( 0 ); - - QLabel * workingdir_txt_lbl = new QLabel( - tr( "When working with LMMS there needs to " - "be a working-directory.\nThis " - "directory is used for storing your " - "projects, presets, samples etc.\n\n\n" - "Please select a directory:" ), - workingdir_content ); - workingdir_txt_lbl->setWordWrap( TRUE ); - - QWidget * workingdir_input_fields = new QWidget( workingdir_content ); - QHBoxLayout * workingdir_input_fields_layout = new QHBoxLayout( - workingdir_input_fields ); - workingdir_input_fields_layout->setSpacing( 10 ); - workingdir_input_fields_layout->setMargin( 0 ); - - m_wdLineEdit = new QLineEdit( m_workingDir, workingdir_input_fields ); - connect( m_wdLineEdit, SIGNAL( textChanged( const QString & ) ), this, - SLOT( setWorkingDir( const QString & ) ) ); - - QPushButton * workingdir_select_btn = new QPushButton( - embed::getIconPixmap( "project_open" ), "", - workingdir_input_fields ); - workingdir_select_btn->setFixedSize( 24, 24 ); - connect( workingdir_select_btn, SIGNAL( clicked() ), this, - SLOT( openWorkingDir() ) ); - - workingdir_input_fields_layout->addWidget( m_wdLineEdit ); - workingdir_input_fields_layout->addWidget( workingdir_select_btn ); - - workingdir_content_layout->addWidget( workingdir_txt_lbl ); - workingdir_content_layout->addWidget( workingdir_input_fields ); - - workingdir_layout->addWidget( workingdir_logo_lbl ); - workingdir_layout->addWidget( workingdir_content ); - - -/* - // page for files-management - m_pageFiles = new QWidget( m_contentWidget ); - QHBoxLayout * files_layout = new QHBoxLayout( m_pageFiles ); - files_layout->setSpacing( 15 ); - files_layout->setMargin( 0 ); - - QWidget * files_content = new QWidget( m_pageFiles ); - QVBoxLayout * files_content_layout = new QVBoxLayout( files_content ); - files_content_layout->setSpacing( 10 ); - files_content_layout->setMargin( 0 ); -#ifdef QT4 - files_content->setLayout( files_content_layout ); -#endif - - QLabel * files_logo_lbl = new QLabel( m_pageFiles ); - files_logo_lbl->setPixmap( embed::getIconPixmap( "wizard_files" ) ); - files_logo_lbl->setFrameStyle( QFrame::Panel | QFrame::Sunken ); - files_logo_lbl->setFixedSize( 240, 300 ); - - QLabel * files_txt_lbl = new QLabel( - tr( "For using the ready presets and samples of " - "LMMS and enjoying the demo-songs the " - "according files have to be copied or " - "linked into your LMMS-working-" - "directory.\nWhen copying files, you " - "can modify them, but they need " - "additional space in your working-" - "directory. If you link files, you " - "cannot modify them, but they need " - "no extra space. So it's recommended " - "to copy presets and demo-projects " - "and link samples, which are bigger " - "in size.\n" ), files_content ); -#ifdef QT4 - files_txt_lbl->setWordWrap( TRUE ); -#else - files_txt_lbl->setAlignment( files_txt_lbl->alignment() | WordBreak ); -#endif - - - QWidget * samples_widget = new QWidget( files_content ); - QHBoxLayout * samples_layout = new QHBoxLayout( samples_widget ); - samples_layout->setSpacing( 5 ); - samples_layout->setMargin( 0 ); - - QLabel * samples_pic_lbl = new QLabel( samples_widget ); - samples_pic_lbl->setPixmap( embed::getIconPixmap( "sound_file" ) ); - QLabel * samples_txt_lbl = new QLabel( tr( "samples:" ), - samples_widget ); - samples_txt_lbl->setFixedWidth( 144 ); - - QButtonGroup * samples_bg = new QButtonGroup( samples_widget ); -#ifndef qt4 - samples_bg->hide(); -#endif - m_samplesCopyRB = new QRadioButton( tr( "copy" ), samples_widget ); - QRadioButton * samples_link_rb = new QRadioButton( tr( "link" ), - samples_widget ); - samples_link_rb->setChecked( TRUE ); - samples_bg->addButton( m_samplesCopyRB ); - samples_bg->addButton( samples_link_rb ); - - samples_layout->addWidget( samples_pic_lbl ); - samples_layout->addWidget( samples_txt_lbl ); - samples_layout->addWidget( m_samplesCopyRB ); - samples_layout->addSpacing( 15 ); - samples_layout->addWidget( samples_link_rb ); - samples_layout->addStretch( 400 ); - - - - QWidget * presets_widget = new QWidget( files_content ); - QHBoxLayout * presets_layout = new QHBoxLayout( presets_widget ); - presets_layout->setSpacing( 5 ); - presets_layout->setMargin( 0 ); - - QLabel * presets_pic_lbl = new QLabel( presets_widget ); - presets_pic_lbl->setPixmap( embed::getIconPixmap( "preset_file" ) ); - QLabel * presets_txt_lbl = new QLabel( tr( "presets:" ), - presets_widget ); - presets_txt_lbl->setFixedWidth( 144 ); - - QButtonGroup * presets_bg = new QButtonGroup( presets_widget ); -#ifndef QT4 - presets_bg->hide(); -#endif - m_presetsCopyRB = new QRadioButton( tr( "copy" ), presets_widget ); - m_presetsCopyRB->setChecked( TRUE ); - QRadioButton * presets_link_rb = new QRadioButton( tr( "link" ), - presets_widget ); - presets_bg->addButton( m_presetsCopyRB ); - presets_bg->addButton( presets_link_rb ); - - presets_layout->addWidget( presets_pic_lbl ); - presets_layout->addWidget( presets_txt_lbl ); - presets_layout->addWidget( m_presetsCopyRB ); - presets_layout->addSpacing( 15 ); - presets_layout->addWidget( presets_link_rb ); - presets_layout->addStretch( 400 ); - - - - QWidget * projects_widget = new QWidget( files_content ); - QHBoxLayout * projects_layout = new QHBoxLayout( projects_widget ); - projects_layout->setSpacing( 5 ); - projects_layout->setMargin( 0 ); - - QLabel * projects_pic_lbl = new QLabel( projects_widget ); - projects_pic_lbl->setPixmap( embed::getIconPixmap( "project_file" ) ); - QLabel * projects_txt_lbl = new QLabel( tr( "demo projects:" ), - projects_widget ); - projects_txt_lbl->setFixedWidth( 144 ); - - QButtonGroup * projects_bg = new QButtonGroup( projects_widget ); -#ifndef QT4 - projects_bg->hide(); -#endif - m_projectsCopyRB = new QRadioButton( tr( "copy" ), projects_widget ); - m_projectsCopyRB->setChecked( TRUE ); - QRadioButton * projects_link_rb = new QRadioButton( tr( "link" ), - projects_widget ); - projects_bg->addButton( m_projectsCopyRB ); - projects_bg->addButton( projects_link_rb ); - - projects_layout->addWidget( projects_pic_lbl ); - projects_layout->addWidget( projects_txt_lbl ); - projects_layout->addWidget( m_projectsCopyRB ); - projects_layout->addSpacing( 15 ); - projects_layout->addWidget( projects_link_rb ); - projects_layout->addStretch( 400 ); - - - - - files_content_layout->addWidget( files_txt_lbl ); - files_content_layout->addWidget( samples_widget ); - files_content_layout->addWidget( presets_widget ); - files_content_layout->addWidget( projects_widget ); - - - files_layout->addWidget( files_logo_lbl ); - files_layout->addWidget( files_content ); -*/ - - - addPage( m_pageIntro, tr( "Welcome to LMMS" ) ); - addPage( m_pageWorkingDir, tr( "Select working directory" ) ); - //addPage( m_pageFiles, tr( "Copy or link files" ) ); - switchPage( static_cast( 0 ) ); -} - - - - -void configManager::openWorkingDir( void ) +/*void configManager::openWorkingDir( void ) { QString new_dir = QFileDialog::getExistingDirectory( this, tr( "Choose LMMS working directory" ), @@ -434,7 +77,7 @@ void configManager::openWorkingDir( void ) { m_wdLineEdit->setText( new_dir ); } -} +}*/ @@ -488,7 +131,7 @@ void configManager::setSTKDir( const QString & _fd ) - +/* void configManager::accept( void ) { if( m_workingDir.right( 1 ) != "/" ) @@ -517,100 +160,12 @@ void configManager::accept( void ) QDir().mkpath( userProjectsDir() ); QDir().mkpath( userSamplesDir() ); QDir().mkpath( userPresetsDir() ); -/* processFilesRecursively( m_dataDir + "samples/", m_workingDir + - "samples/", - m_samplesCopyRB->isChecked() ? - ©File : - &linkFile ); - processFilesRecursively( m_dataDir + "presets/", m_workingDir + - "presets/", - m_presetsCopyRB->isChecked() ? - ©File : - &linkFile ); - processFilesRecursively( m_dataDir + "projects/", m_workingDir + - "projects/", - m_projectsCopyRB->isChecked() ? - ©File : - &linkFile );*/ + saveConfigFile(); QDialog::accept(); } - - - - -void configManager::backButtonClicked( void ) -{ - switchPage( m_currentPage-1 ); -} - - - - -void configManager::nextButtonClicked( void ) -{ - switchPage( m_currentPage+1 ); -} - - - - -void configManager::switchPage( int _pg ) -{ - if( m_currentPage >= 0 && m_currentPage < m_pages.size() ) - { - m_pages[m_currentPage].first->hide(); - m_contentLayout->removeWidget( m_pages[m_currentPage].first ); - } - if( _pg < m_pages.size() ) - { - QWidget * p = m_pages[_pg].first; - m_contentLayout->insertWidget( 2, p ); - p->show(); - p->setFocus(); - m_title->setText( m_pages[_pg].second ); - m_currentPage = _pg; - } - m_backButton->setEnabled( _pg > 0 ); - if( _pg == m_pages.size() - 1 ) - { - m_nextButton->setEnabled( FALSE ); - m_finishButton->setEnabled( TRUE ); - m_finishButton->setDefault( TRUE ); - } - else - { - m_nextButton->setEnabled( TRUE ); - m_nextButton->setDefault( TRUE ); - m_finishButton->setEnabled( FALSE ); - } -} - - - - -void configManager::switchPage( QWidget * _pg ) -{ - for( int i = 0; i < m_pages.size(); ++i ) - { - if( m_pages[i].first == _pg ) - { - switchPage( i ); - break; - } - } -} - - - - -void configManager::addPage( QWidget * _w, const QString & _title ) -{ - _w->hide(); - m_pages.push_back( qMakePair( _w, _title ) ); -} - +*/ @@ -674,24 +229,16 @@ void configManager::setValue( const QString & _class, bool configManager::loadConfigFile( void ) { - if( !m_mainLayout ) - { - createWidgets(); - } - // read the XML file and create DOM tree QFile cfg_file( m_lmmsRcFile ); if( !cfg_file.open( QIODevice::ReadOnly ) ) { - if( !( exec() && cfg_file.open( QIODevice::ReadOnly ) ) ) - { - return( FALSE ); - } + return( FALSE ); } QDomDocument dom_tree; if( !dom_tree.setContent( &cfg_file ) ) { - QMessageBox::critical( 0, tr( "Error in configuration-file" ), +/* QMessageBox::critical( 0, tr( "Error in configuration-file" ), tr( "Error while parsing " "configuration-file %1.\n" "The setup-wizard will be " @@ -703,9 +250,9 @@ bool configManager::loadConfigFile( void ) return( loadConfigFile() ); } else - { + {*/ return( FALSE ); - } + //} } cfg_file.close(); @@ -796,40 +343,9 @@ bool configManager::loadConfigFile( void ) } #endif - if( root.isElement() ) - { - QString cfg_file_ver = root.toElement().attribute( "version" ); - if( ( cfg_file_ver.length() == 0 || cfg_file_ver != VERSION ) && - value( "app", "nowizard" ).toInt() == FALSE && - QMessageBox::question - ( 0, tr( "Version mismatches" ), - tr( "Accordingly to the information in " - "your LMMS-configuration-file " - "you seem to have run a " - "different (probably older) " - "version of LMMS before.\n" - "It is recommended to run the " - "setup-wizard again to ensure " - "that the latest samples, " - "presets, demo-projects etc. " - "are installed in your " - "LMMS-working-directory.\n" - "Run the setup-wizard now?" ), - QMessageBox::Yes, QMessageBox::No ) - == QMessageBox::Yes ) - { - if( exec() ) - { - return( loadConfigFile() ); - } - } - } - QDir::setSearchPaths( "resources", QStringList() << artworkDir() << defaultArtworkDir() ); - loadStyleSheet(); - return( TRUE ); } @@ -881,15 +397,14 @@ void configManager::saveConfigFile( void ) QFile outfile( m_lmmsRcFile ); if( !outfile.open( QIODevice::WriteOnly | QIODevice::Truncate ) ) { - QMessageBox::critical( NULL, tr( "Could not save config-file" ), - tr( "Could not save configuration " - "file %1. You probably are not " - "permitted to write to this " - "file.\n" - "Please make sure you have " - "write-access to the file and " - "try again." ).arg( - m_lmmsRcFile ) ); + QMessageBox::critical( NULL, + mainWindow::tr( "Could not save config-file" ), + mainWindow::tr( "Could not save configuration file %1. " + "You're probably not permitted to " + "write to this file.\n" + "Please make sure you have write-" + "access to the file and try again." ). + arg( m_lmmsRcFile ) ); return; } @@ -899,45 +414,4 @@ void configManager::saveConfigFile( void ) - -void configManager::loadStyleSheet( void ) -{ - QFile file( "resources:style.css" ); - file.open( QIODevice::ReadOnly ); - qApp->setStyleSheet( file.readAll() ); -} - - - -/* -void configManager::processFilesRecursively( const QString & _src_dir, - const QString & _dst_dir, - void( * _proc_func )( const QString & _src, const QString & _dst ) ) -{ - QDir().mkpath( _dst_dir ); - QStringList files = QDir( _src_dir ).entryList(); - for( QStringList::iterator it = files.begin(); it != files.end(); ++it ) - { - if( ( *it )[0] == '.' ) - { - continue; - } - if( QFileInfo( _src_dir + *it ).isFile() ) - { - _proc_func( _src_dir + *it, _dst_dir + *it ); - } - else if( QFileInfo( _src_dir + *it ).isDir () ) - { - processFilesRecursively( _src_dir + *it + "/", - _dst_dir + *it + "/", - _proc_func ); - } - } -} -*/ - - - -#include "config_mgr.moc" - #endif diff --git a/src/core/instrument.cpp b/src/core/instrument.cpp index 7b77efd05..13a61059b 100644 --- a/src/core/instrument.cpp +++ b/src/core/instrument.cpp @@ -30,6 +30,7 @@ #include "instrument_track.h" #include "dummy_instrument.h" #include "note_play_handle.h" +#include "embed.h" instrument::instrument( instrumentTrack * _instrument_track, @@ -153,8 +154,8 @@ void instrumentView::setModel( ::model * _model, bool ) if( dynamic_cast( _model ) != NULL ) { modelView::setModel( _model ); - getInstrumentTrackWindow()->setWindowIcon( *( model()-> - getDescriptor()->logo ) ); + getInstrumentTrackWindow()->setWindowIcon( + model()->getDescriptor()->logo->pixmap() ); connect( model(), SIGNAL( destroyed( QObject * ) ), this, SLOT( close() ) ); } diff --git a/src/core/instrument_functions.cpp b/src/core/instrument_functions.cpp index 331f9af14..e551d3b89 100644 --- a/src/core/instrument_functions.cpp +++ b/src/core/instrument_functions.cpp @@ -310,12 +310,9 @@ arpeggiator::arpeggiator( instrumentTrack * _instrument_track ) : m_arpDirectionModel.setInitValue( ArpDirUp ); m_arpModeModel.setTrack( _instrument_track ); - m_arpModeModel.addItem( tr( "Free" ), new QPixmap( - embed::getIconPixmap( "arp_free" ) ) ); - m_arpModeModel.addItem( tr( "Sort" ), new QPixmap( - embed::getIconPixmap( "arp_sort" ) ) ); - m_arpModeModel.addItem( tr( "Sync" ), new QPixmap( - embed::getIconPixmap( "arp_sync" ) ) ); + m_arpModeModel.addItem( tr( "Free" ), new pixmapLoader( "arp_free" ) ); + m_arpModeModel.addItem( tr( "Sort" ), new pixmapLoader( "arp_sort" ) ); + m_arpModeModel.addItem( tr( "Sync" ), new pixmapLoader( "arp_sync" ) ); } diff --git a/src/core/instrument_sound_shaping.cpp b/src/core/instrument_sound_shaping.cpp index 16e085a33..cee927503 100644 --- a/src/core/instrument_sound_shaping.cpp +++ b/src/core/instrument_sound_shaping.cpp @@ -79,22 +79,22 @@ instrumentSoundShaping::instrumentSoundShaping( m_filterEnabledModel.setTrack( _instrument_track ); - m_filterModel.addItem( tr( "LowPass" ), new QPixmap( - embed::getIconPixmap( "filter_lp" ) ) ); - m_filterModel.addItem( tr( "HiPass" ), new QPixmap( - embed::getIconPixmap( "filter_hp" ) ) ); - m_filterModel.addItem( tr( "BandPass csg" ), new QPixmap( - embed::getIconPixmap( "filter_bp" ) ) ); - m_filterModel.addItem( tr( "BandPass czpg" ), new QPixmap( - embed::getIconPixmap( "filter_bp" ) ) ); - m_filterModel.addItem( tr( "Notch" ), new QPixmap( - embed::getIconPixmap( "filter_notch" ) ) ); - m_filterModel.addItem( tr( "Allpass" ), new QPixmap( - embed::getIconPixmap( "filter_ap" ) ) ); - m_filterModel.addItem( tr( "Moog" ), new QPixmap( - embed::getIconPixmap( "filter_lp" ) ) ); - m_filterModel.addItem( tr( "2x LowPass" ), new QPixmap( - embed::getIconPixmap( "filter_2lp" ) ) ); + m_filterModel.addItem( tr( "LowPass" ), + new pixmapLoader( "filter_lp" ) ); + m_filterModel.addItem( tr( "HiPass" ), + new pixmapLoader( "filter_hp" ) ); + m_filterModel.addItem( tr( "BandPass csg" ), + new pixmapLoader( "filter_bp" ) ); + m_filterModel.addItem( tr( "BandPass czpg" ), + new pixmapLoader( "filter_bp" ) ); + m_filterModel.addItem( tr( "Notch" ), + new pixmapLoader( "filter_notch" ) ); + m_filterModel.addItem( tr( "Allpass" ), + new pixmapLoader( "filter_ap" ) ); + m_filterModel.addItem( tr( "Moog" ), + new pixmapLoader( "filter_lp" ) ); + m_filterModel.addItem( tr( "2x LowPass" ), + new pixmapLoader( "filter_2lp" ) ); m_filterModel.setTrack( _instrument_track ); m_filterCutModel.setTrack( _instrument_track ); diff --git a/src/core/plugin.cpp b/src/core/plugin.cpp index 0d8f99458..f5fef24af 100644 --- a/src/core/plugin.cpp +++ b/src/core/plugin.cpp @@ -32,6 +32,7 @@ #include "plugin.h" +#include "embed.h" #include "mixer.h" #include "config_mgr.h" #include "dummy_plugin.h" @@ -60,7 +61,7 @@ plugin::plugin( const descriptor * _descriptor, model * _parent ) : { if( dummy_plugin_descriptor.logo == NULL ) { - dummy_plugin_descriptor.logo = new QPixmap(); + dummy_plugin_descriptor.logo = new pixmapLoader; } if( m_descriptor == NULL ) diff --git a/src/core/tool.cpp b/src/core/tool.cpp index 5b8fd8aae..f4107ddf9 100644 --- a/src/core/tool.cpp +++ b/src/core/tool.cpp @@ -27,9 +27,9 @@ #include "tool.h" -#include #include +#include "embed.h" #include "engine.h" #include "main_window.h" @@ -86,7 +86,7 @@ toolView::toolView( tool * _tool ) : } window->setWindowTitle( _tool->publicName() ); - window->setWindowIcon( *_tool->getDescriptor()->logo ); + window->setWindowIcon( _tool->getDescriptor()->logo->pixmap() ); } diff --git a/src/core/track.cpp b/src/core/track.cpp index e1bc53709..56ee90899 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -1312,7 +1312,7 @@ track::track( TrackTypes _type, trackContainer * _tc ) : m_trackContainer( _tc ), m_type( _type ), m_name(), - m_pixmap( NULL ), + m_pixmapLoader( NULL ), m_mutedModel( FALSE, this ), m_trackContentObjects(), m_automationPatterns() diff --git a/src/gui/embed.cpp b/src/gui/embed.cpp index ae3d0014b..ab294f063 100644 --- a/src/gui/embed.cpp +++ b/src/gui/embed.cpp @@ -3,7 +3,7 @@ /* * embed.cpp - misc stuff for using embedded resources (linked into binary) * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2008 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * diff --git a/src/gui/lmms_style.cpp b/src/gui/lmms_style.cpp index 16f5141c2..9666aad11 100644 --- a/src/gui/lmms_style.cpp +++ b/src/gui/lmms_style.cpp @@ -1,17 +1,57 @@ +/* + * lmms_style.cpp - the graphical style used by LMMS to create a consistent + * interface + * + * Copyright (c) 2007-2008 Tobias Doerffel + * + * 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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include +#include +#include +#include #include #include -#include -#include -#include #include "lmms_style.h" + +lmmsStyle::lmmsStyle() : + QPlastiqueStyle() +{ + QFile file( "resources:style.css" ); + file.open( QIODevice::ReadOnly ); + qApp->setStyleSheet( file.readAll() ); +} + + + + void lmmsStyle::drawPrimitive( PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { - if( element == QStyle::PE_Frame || element == QStyle::PE_FrameLineEdit || + if( element == QStyle::PE_Frame || + element == QStyle::PE_FrameLineEdit || element == QStyle::PE_PanelLineEdit ) { const QRect rect = option->rect; @@ -32,10 +72,14 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element, // 50% black.setAlpha(a100); painter->setPen(QPen(black, 0)); - lines[0] = QLine(rect.left() + 2, rect.top() + 1, rect.right() - 2, rect.top() + 1); - lines[1] = QLine(rect.left() + 2, rect.bottom() - 1, rect.right() - 2, rect.bottom() - 1); - lines[2] = QLine(rect.left() + 1, rect.top() + 2, rect.left() + 1, rect.bottom() - 2); - lines[3] = QLine(rect.right() - 1, rect.top() + 2, rect.right() - 1, rect.bottom() - 2); + lines[0] = QLine(rect.left() + 2, rect.top() + 1, + rect.right() - 2, rect.top() + 1); + lines[1] = QLine(rect.left() + 2, rect.bottom() - 1, + rect.right() - 2, rect.bottom() - 1); + lines[2] = QLine(rect.left() + 1, rect.top() + 2, + rect.left() + 1, rect.bottom() - 2); + lines[3] = QLine(rect.right() - 1, rect.top() + 2, + rect.right() - 1, rect.bottom() - 2); painter->drawLines(lines, 4); // black inside dots @@ -52,8 +96,10 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element, // 100% shadow.setAlpha(a75); painter->setPen(QPen(shadow, 0)); - lines[0] = QLine(rect.left() + 2, rect.top(), rect.right() - 2, rect.top()); - lines[1] = QLine(rect.left(), rect.top() + 2, rect.left(), rect.bottom() - 2); + lines[0] = QLine(rect.left() + 2, rect.top(), + rect.right() - 2, rect.top()); + lines[1] = QLine(rect.left(), rect.top() + 2, + rect.left(), rect.bottom() - 2); painter->drawLines(lines, 2); // outside corner dots - shadow @@ -79,8 +125,10 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element, // 100% highlight.setAlpha(a75); painter->setPen(QPen(highlight, 0)); - lines[0] = QLine(rect.left() + 2, rect.bottom(), rect.right() - 2, rect.bottom()); - lines[1] = QLine(rect.right(), rect.top() + 2, rect.right(), rect.bottom() - 2); + lines[0] = QLine(rect.left() + 2, rect.bottom(), + rect.right() - 2, rect.bottom()); + lines[1] = QLine(rect.right(), rect.top() + 2, + rect.right(), rect.bottom() - 2); painter->drawLines(lines, 2); // outside corner dots - highlight @@ -103,13 +151,15 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element, } else { - QPlastiqueStyle::drawPrimitive( element, option, painter, widget ); + QPlastiqueStyle::drawPrimitive( element, option, painter, + widget ); } } -int lmmsStyle::pixelMetric( PixelMetric _metric, const QStyleOption * _option, const QWidget * _widget ) const +int lmmsStyle::pixelMetric( PixelMetric _metric, const QStyleOption * _option, + const QWidget * _widget ) const { switch( _metric ) { @@ -120,7 +170,8 @@ int lmmsStyle::pixelMetric( PixelMetric _metric, const QStyleOption * _option, c return 20; default: - return QPlastiqueStyle::pixelMetric( _metric, _option, _widget ); + return QPlastiqueStyle::pixelMetric( _metric, _option, + _widget ); } } diff --git a/src/gui/main_window.cpp b/src/gui/main_window.cpp index ba08d7e4c..3d8713a49 100644 --- a/src/gui/main_window.cpp +++ b/src/gui/main_window.cpp @@ -405,16 +405,9 @@ void mainWindow::finalize( void ) tr( "Redo" ), this, SLOT( redo() ), Qt::CTRL + Qt::Key_R ); - - - QMenu * settings_menu = new QMenu( this ); - menuBar()->addMenu( settings_menu )->setText( tr( "&Settings" ) ); - settings_menu->addAction( embed::getIconPixmap( "setup_general" ), - tr( "Show settings dialog" ), + edit_menu->addAction( embed::getIconPixmap( "setup_general" ), + tr( "Settings" ), this, SLOT( showSettingsDialog() ) ); - settings_menu->addAction( embed::getIconPixmap( "wizard" ), - tr( "Show setup wizard" ), - configManager::inst(), SLOT( exec() ) ); m_toolsMenu = new QMenu( this ); @@ -426,7 +419,8 @@ void mainWindow::finalize( void ) { if( it->type == plugin::Tool ) { - m_toolsMenu->addAction( *it->logo, it->public_name ); + m_toolsMenu->addAction( it->logo->pixmap(), + it->public_name ); m_tools.push_back( tool::instantiate( it->name, /*this*/NULL )->createView( this ) ); } diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index fc61f2fae..f69e0bc73 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -379,16 +379,14 @@ pianoRoll::pianoRoll( void ) : QLabel * note_len_lbl = new QLabel( m_toolBar ); note_len_lbl->setPixmap( embed::getIconPixmap( "note" ) ); - m_noteLenModel->addItem( tr( "Last note" ), new QPixmap( - embed::getIconPixmap( "edit_draw" ) ) ); + m_noteLenModel->addItem( tr( "Last note" ), + new pixmapLoader( "edit_draw" ) ); const QString pixmaps[] = { "whole", "half", "quarter", "eighth", "sixteenth", "thirtysecond" } ; for( int i = 0; i < 6; ++i ) { m_noteLenModel->addItem( "1/" + QString::number( 1 << i ), - new QPixmap( embed::getIconPixmap( - QString( "note_" + pixmaps[i] ). - toAscii().constData() ) ) ); + new pixmapLoader( "note_" + pixmaps[i] ) ); } m_noteLenModel->addItem( "1/192" ); m_noteLenModel->setValue( 0 ); diff --git a/src/gui/plugin_browser.cpp b/src/gui/plugin_browser.cpp index aa0ef9ecc..bd9043c64 100644 --- a/src/gui/plugin_browser.cpp +++ b/src/gui/plugin_browser.cpp @@ -101,7 +101,7 @@ pluginDescWidget::pluginDescWidget( const plugin::descriptor & _pd, QWidget( _parent ), m_updateTimer( this ), m_pluginDescriptor( _pd ), - m_logo( *_pd.logo ), + m_logo( _pd.logo->pixmap() ), m_mouseOver( FALSE ), m_targetHeight( 24 ) { diff --git a/src/gui/widgets/combobox.cpp b/src/gui/widgets/combobox.cpp index 11891dfcd..83cb5e2e7 100644 --- a/src/gui/widgets/combobox.cpp +++ b/src/gui/widgets/combobox.cpp @@ -128,8 +128,8 @@ void comboBox::mousePressEvent( QMouseEvent * _me ) for( int i = 0; i < model()->size(); ++i ) { QAction * a = m_menu.addAction( - model()->itemPixmap( i ) ? - *model()->itemPixmap( i ) : + model()->itemPixmap( i ) ? + model()->itemPixmap( i )->pixmap() : QPixmap(), model()->itemText( i ) ); a->setData( i ); @@ -201,11 +201,11 @@ void comboBox::paintEvent( QPaintEvent * _pe ) p.setFont( font() ); p.setClipRect( QRect( 5, 2, width() - CB_ARROW_BTN_WIDTH - 8, height() - 2 ) ); - const QPixmap * item_pm = model()->currentData(); + QPixmap pm = model()->currentData() ? + model()->currentData()->pixmap() : QPixmap(); int tx = 4; - if( item_pm != NULL ) + if( !pm.isNull() ) { - QPixmap pm = *item_pm; if( pm.height() > 16 ) { pm = pm.scaledToHeight( 16, @@ -237,14 +237,6 @@ void comboBox::wheelEvent( QWheelEvent * _we ) -void comboBox::deletePixmap( QPixmap * _pixmap ) -{ - delete _pixmap; -} - - - - void comboBox::setItem( QAction * _item ) { model()->setInitValue( _item->data().toInt() ); @@ -258,9 +250,9 @@ void comboBox::setItem( QAction * _item ) -void comboBoxModel::addItem( const QString & _item, QPixmap * _pixmap ) +void comboBoxModel::addItem( const QString & _item, pixmapLoader * _pl ) { - m_items.push_back( qMakePair( _item, _pixmap ) ); + m_items.push_back( qMakePair( _item, _pl ) ); setRange( 0, m_items.size() - 1 ); } @@ -272,7 +264,7 @@ void comboBoxModel::clear( void ) setRange( 0, 0 ); foreach( const item & _i, m_items ) { - emit itemPixmapRemoved( _i.second ); + delete _i.second; } m_items.clear(); emit propertiesChanged();