Commit Graph

1322 Commits

Author SHA1 Message Date
Tobias Doerffel
bb933e7643 ResourceTreeModel: dynamic icons for plugin specific resources + caching
Added dynamic generation of icons for plugin specific resources by
drawing the logo of the according plugin onto an empty-sheet-icon.
After generation, cache the result so this expensive operation only
has to be done once.

Furthermore also cache pixmaps for individual ResourceItem types for
not having to load and scale pixmaps for each item.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-07-05 15:58:29 +02:00
Tobias Doerffel
f943df139e InstrumentView: added generic DnD support, renamed/splitted files
Added generic drag'n'drop support for all instrument views. All
resources supported by the according instrument now can be dropped
onto instrument view without any extra code in actual instrument.

Additionally renamed some files and classes related to InstrumentView
class to match new style.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-30 01:19:48 +02:00
Tobias Doerffel
65668f9489 ResourceBrowser: added management-buttons
Added two new buttons "Manage locations" and "Show piano". The first
one will open a resource location management dialog while the latter
one toggles visibility of the preview piano below.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-30 00:25:50 +02:00
Tobias Doerffel
ac4ef21ab7 ConfigManager/SetupDialog: preparations for resource framework migration
Some initial work on saving hash of default soundfont rather than a
filename. Doesn't work yet but will be improved with rewritten setup
dialog.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-29 23:24:10 +02:00
Tobias Doerffel
40e6d26dbb Handle plugin-specific resources in TrackContainerView/ResourcePreviewer
Up to now plugin-specific resources (e.g. ZynAddSubFX presets) were
not previewed or loaded into a track container. This now works by
adding TypePluginSpecificResource to the according switch-block.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-29 14:43:33 +02:00
Tobias Doerffel
77a7db5d2e ResourceItem: dynamically register plugin-processed file types
Dynamically extend the map of file types by plugin-processed file types.
Furthermore renamed type TypePluginSpecificPreset to
TypePluginSpecificResource.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-29 14:43:08 +02:00
Tobias Doerffel
81721b6524 PresetPreviewPlayHandle: removed
Removed unused class PresetPreviewPlayHandle with all its sub- and
helper-classes. Lots of dirty code this way gets cleaned up/removed.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-29 13:16:11 +02:00
Tobias Doerffel
3c5c5f9cb3 FileBrowser: remove from LMMS
Remove deprecated FileBrowser from LMMS as everything is now managed by
ResourceBrowser. This will allow further removal of deprecated
technologies.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-29 12:58:10 +02:00
Tobias Doerffel
a4a6c14af0 Make use of new ResourceAction class
Replaced deprecated (duplicate) code for loading various kind of files
with ResourceAction-based code.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-29 12:53:33 +02:00
Tobias Doerffel
7821dd210e ResourceAction: new class for centralized functionality
Added new class ResourceAction which centralizes functionality of all
actions related to ResourceItems. This includes loading projects,
samples, presets, plugin-specific presets etc.

Using this new class we can avoid duplicate functionality in
ResourcePreviewer, ResourceBrowser, TrackContainerView, InstrumentTrack
etc.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-29 12:48:45 +02:00
Tobias Doerffel
d3cf731dc9 Plugin: initial integration of resource framework
Replaced deprecated Plugin::loadFile(QString) method by
Plugin::loadResource(ResourceItem), a future interface to be adapted
by invididual plugins.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-29 12:41:53 +02:00
Tobias Doerffel
fb5c974365 ResourceDB: new method matchItems(), renamed ItemList to ItemHashMap
Added new method ResourceDB::matchItems() which returns a list of item
which somehow match the given list of keywords.

Furthermore renamed ItemList to ItemHashMap to better reflect actual
container type.

Additionally some coding style improvements.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-29 12:38:19 +02:00
Tobias Doerffel
891b46fd65 ResourceItem: added copy constructor
Added copy constructor for ResourceItem class so one can easily
duplicate a ResourceItem.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-23 16:38:04 +02:00
Tobias Doerffel
1f9a7a1c0e TrackContainerView: added support for dropping ResourceItems
Added support for dropping ResourceItems on a TrackContainerView. Now
it's possible to drag samples, presets and soundfonts from the new
ResourceBrowser into Song Editor or BB Editor (code needs to be ported
to new Song Editor later).

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-23 01:02:01 +02:00
Tobias Doerffel
30543d708c ResourceDB: added itemByHash() method
Added itemByHash() method to ResourceDB class allowing safe access to
an item identified with an according hash. If there's no item associated
with the hash, NULL is being returned.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-23 01:00:33 +02:00
Tobias Doerffel
75a45cca5f ResourceBrowser: stop preview when drag operation starts
Make sure preview is stopped as soon as a drag operation starts. This
is done by overloading QAbstractItemView::startDrag() and emit a signal
from there which is connected to an according slot in ResourceBrowser.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-23 00:13:40 +02:00
Tobias Doerffel
65b044c5c1 ResourceTreeView: enable dragging items
Actually enable dragging items. No further code is required here because
everything else is handled by the model and QTreeView base class.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-22 23:49:14 +02:00
Tobias Doerffel
dc90c899aa ResourcesTreeModel: support for dragging ResourceItems
Added initial support for dragging ResourceItems. This is achieved by
using drag'n'drop support offered by Qt's model/view technology.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-22 23:45:26 +02:00
Tobias Doerffel
0c73c5bb17 StringPairDrag: added static createMimeData() method
Added createMimeData() method to StringPairDrag which creates a proper
QMimeData object for StringPairDrag. External code can use it to create
a QMimeData object which can be received by users of StringPairDrag.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-22 23:42:15 +02:00
Tobias Doerffel
ddf3d3dc66 AutomationEditor: set pen for painter outside inner loop
Set pen for drawing automation pattern outside of inner loop. This
might save some CPU cycles.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-22 22:07:51 +02:00
Tobias Doerffel
0ae508d65f ResourceItem: removed support for deprecated filename extension
Do not support deprecated extension ".cs.xml" anymore. This way we do
not have to use QFileInfo::completeSuffix() which lead to unrecognized
file types if the filename contained dots in its regular name.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-22 11:49:19 +02:00
Tobias Doerffel
4bc010cea9 ResourceItem: added property "author"
Added new property "author" for retaining authorship information of
files. Furthermore this allows filtering for authors in ResourceBrowser.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-19 10:12:33 +02:00
Tobias Doerffel
9ca93040de PianoRoll: fixed crash with detune tool
When clicking at an invalid position with the detune tool, LMMS could
crash as an invalid iterator was referenced (closes #2808589).

Furthermore renamed PianoRoll::ModeOpen to PianoRoll::ModeEditDetuning.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-18 23:28:30 +02:00
Tobias Doerffel
e12476f79c Renamed type noteVector to NoteVector
Renamed type noteVector to NoteVector as well as ::iterator to
::Iterator and ::const_iterator to ::ConstIterator.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-18 23:24:56 +02:00
Tobias Doerffel
c4e7aedb58 ResourceBrowser: load non-local projects as templates
Load non-local projects as templates so user has to save it under
a new name. Otherwise it would save to /tmp/qt_temp.XXXXX.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-18 23:05:31 +02:00
Tobias Doerffel
2d5dfc7b15 Pattern: properly advance iterator when removing notes
We must not keep the iterator at the same position when erasing notes
from the m_notes array. This usually is not a problem when using QVector
but we might switch to QList somewhen later.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-18 23:05:14 +02:00
Tobias Doerffel
0d6ba6291b NotePlayHandle: fixed crash at playback of subnotes
Commit 08ea133aa2 uncovered a flaw in
NotePlayHandle::play(...). When iterating over subnotes for each subnote
after playing it, we check whether it is finished. If this is true, the
according subnote gets erased from the m_subNotes array. However we have
to set the subnote iterator to what QList::erase(...) returns instead of
keeping it where it was before. This accidentally worked when using
QVector as type for NotePlayHandle arrays but caused a crash now that
we're using QList.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-18 23:05:03 +02:00
Tobias Doerffel
cf0a91637b Song: reset window title after creating new project from template
Reset window title when creating new project from template (after
actually loading template file). Furthermore do not reset window title
at the beginning of load process anymore.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-18 22:24:25 +02:00
Tobias Doerffel
fe152801f6 ResourcePreviewer: no preview for unhandled resource types
Don't do anything in case a ResourceItem can't be previewed. Up to now
a default sine sound was played back even when just clicking a directory item.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-17 10:37:09 +02:00
Tobias Doerffel
5930b23040 ResourceBrowser: trigger default action on double click
Connect to QTreeView::doubleClicked() signal in order to trigger a
default action. For example projects now can be loaded via simple
double click.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-17 10:27:37 +02:00
Tobias Doerffel
2cc49b8010 PlayHandle: use QList instead of QVector for PlayHandle array
Use QList instead of QVector when using a set of PlayHandle's. QList
has faster insert/remove operations and in most cases we iterate through
the array using iterators so there's no performance drop.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-15 15:04:55 +02:00
Tobias Doerffel
08ea133aa2 NotePlayHandle: cleanups, header dependency reductions etc.
* do not include instrument_track.h in note_play_handle.h by making
  two functions non-inline
* renamed notePlayHandleVector / constNotePlayHandleVector to
  NotePlayHandleList / ConstNotePlayHandleList and changed typedef
  to QList (which has faster insert- and remove-operations).
* removed unused method willFinishThisPeriod()

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-15 14:41:55 +02:00
Tobias Doerffel
8fb10e3d4d ResourceBrowser: implemented loading projects via context menu
Project files can now be loaded via context menu. This also allows
transparent access to files uploaded to LSP.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-15 14:02:47 +02:00
Tobias Doerffel
c0794d0c41 MMP: detect compressed files rather than guessing by extension
Detect whether a given file is compressed by first trying to parse
its content as XML data. If it failed, try to uncompress and
parse again. This is more flexible than just looking whether the
filename extension is "mmpz".

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-15 13:58:40 +02:00
Tobias Doerffel
9804cb7db8 ResourcePreviewer: save and restore default settings of InstrumentTrack
After instantiation of InstrumentTrack save its settings so we can
restore it each time before previewing resources. Otherwise preview
of incomplete presets or just samples could be distorted by settings
of previosly loaded preset.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-11 15:17:25 +02:00
Tobias Doerffel
22716bccf1 ResourceBrowser: added a PianoView widget
Added a PianoView widget to ResourceBrowser so one can easily preview selected
preset, sample etc.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-11 15:15:43 +02:00
Tobias Doerffel
d866015dc9 PianoView: use layout for flexible widget size
Use a vertical box layout for PianoView and and track resize events
in order to keep scrollbar range up to date. This way PianoView's size
is not fixed anymore and the PianoView widget can be placed inside
other layouts without any restrictions.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-11 14:39:25 +02:00
Tobias Doerffel
01a83deee7 InstrumentTrack: renamed getPiano() to pianoModel()
Renamed getPiano() to pianoModel() to better express what this
function does.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-11 13:58:45 +02:00
Tobias Doerffel
e76991ffea ResourcePreviewer: use ResourceFileMapper for previewing samples
So far only local samples and soundfonts could be previewed using
ResourcePreviewer class. By adding an additional abstraction through
ResourceFileMapper also non-local resources can be previewed.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-11 12:20:44 +02:00
Tobias Doerffel
599e920c3f ResourcePreviewer: support for previewing samples and soundfonts
Implemented previewing of samples and soundfonts. This requires further
work as the current implementation only works for local resources.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-11 00:50:07 +02:00
Tobias Doerffel
7d0facf78d ResourceBrowser: preview resource while holding down mouse button
Use our ResourcePreviewer object to actually playback preview sounds
while holding down mouse button.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-11 00:32:58 +02:00
Tobias Doerffel
d11bf48891 ResourcePreviewer: start/stop playback of preview sound
Make the internal InstrumentTrack play the default key in preview()
and stop playback in new method stopPreview().

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-11 00:30:39 +02:00
Tobias Doerffel
fd417de7fd WebResourceProvider: fixed typo in fetchData(...)
The URL where to fetch actual resources still is /WebResources/...
instead of /WebResource/...

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-11 00:24:55 +02:00
Tobias Doerffel
3c9859da9f InstrumentTrack: new method silenceAllNotes()
Added new method silenceAllNotes() which is a replacement for
invalidateAllMyNPH() and also resets m_runningMidiNotes array.

silenceAllNotes() is now used in destructor as well.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-10 23:49:06 +02:00
Tobias Doerffel
0861dd7e88 ResourcePreviewer: implemented destructor
No destructor has been implemented so far. Added one which deletes
preview track.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-10 23:49:06 +02:00
Tobias Doerffel
a1c4992a89 ResourcePreviewer: disable journalling when previewing
Globally disable journalling when previewing a ResourceItem (i.e. load
a preset, sample etc.).

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-10 23:49:06 +02:00
Tobias Doerffel
6fabe26620 ResourceItem: added TypePluginSpecificPreset
Added another type TypePluginSpecificPreset in Types enumeration. This
allows handling for example XIZ files (ZynAddSubFX presets) properly.
2009-06-07 16:28:54 +02:00
Tobias Doerffel
46bd9f51cf ResourceBrowser: initially update filter status label
Initially update filter status label for not showing a blank label
after startup.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-05 01:35:59 +02:00
Tobias Doerffel
0e31b47d3e ResourceItem: do not query full name when computing suffix
Minor optimization: do not query full name of ResourceItem when only
computing suffix via QFileInfo in ResourceItem::guessType().

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-05 01:29:49 +02:00
Tobias Doerffel
264b50fcc6 ResourcePreviewer: initial version
Added initial version of ResourcePreviewer, a replacement for the old
PresetPreviewPlayHandle technology. It can take any ResourceItem and
preview it depending on its type.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-06-05 01:15:11 +02:00