Refactor Clipboard methods (#5627)
* Moves mimeType from StringPairDrag to Clipboard * Simplifies decodeKey and decodeValue methods * Adds method to copy a string to clipboard * Adds method to copy a string pair to the Clipboard * Adds convenience methods to Clipboard.h to retrieve the QMimeData from the clipboard and checking whether a particular mime type format is present on it * Uses only the TCOV copy/paste methods on the song editor To keep consistency on the behavior of the TCOV copy and paste operations, we now only use the TCOV::copy() and TCOV::paste() methods for copying both individual and multiple TCOs. * Removes obsolete TrackContentObject::cut() and merge copy() and paste() methods to single function TrackContentObject::copyStateTo() * Adds Clipboard::getString method to get data for particular mime type * Makes AutomatableModelView.cpp use the Clipboard class instead of calling Qt clipboard directly
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "Lv2SubPluginFeatures.h"
|
||||
#include "Mixer.h"
|
||||
#include "StringPairDrag.h"
|
||||
#include "Clipboard.h"
|
||||
|
||||
#include "embed.h"
|
||||
#include "plugin_export.h"
|
||||
@@ -238,12 +239,15 @@ Lv2InsView::Lv2InsView(Lv2Instrument *_instrument, QWidget *_parent) :
|
||||
|
||||
void Lv2InsView::dragEnterEvent(QDragEnterEvent *_dee)
|
||||
{
|
||||
// For mimeType() and MimeType enum class
|
||||
using namespace Clipboard;
|
||||
|
||||
void (QDragEnterEvent::*reaction)(void) = &QDragEnterEvent::ignore;
|
||||
|
||||
if (_dee->mimeData()->hasFormat(StringPairDrag::mimeType()))
|
||||
if (_dee->mimeData()->hasFormat( mimeType( MimeType::StringPair )))
|
||||
{
|
||||
const QString txt =
|
||||
_dee->mimeData()->data(StringPairDrag::mimeType());
|
||||
_dee->mimeData()->data( mimeType( MimeType::StringPair ) );
|
||||
if (txt.section(':', 0, 0) == "pluginpresetfile") {
|
||||
reaction = &QDragEnterEvent::acceptProposedAction;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "Song.h"
|
||||
#include "StringPairDrag.h"
|
||||
#include "ToolTip.h"
|
||||
#include "Clipboard.h"
|
||||
|
||||
#include "embed.h"
|
||||
#include "plugin_export.h"
|
||||
@@ -568,10 +569,13 @@ AudioFileProcessorView::~AudioFileProcessorView()
|
||||
|
||||
void AudioFileProcessorView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
if( _dee->mimeData()->hasFormat( StringPairDrag::mimeType() ) )
|
||||
// For mimeType() and MimeType enum class
|
||||
using namespace Clipboard;
|
||||
|
||||
if( _dee->mimeData()->hasFormat( mimeType( MimeType::StringPair ) ) )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
StringPairDrag::mimeType() );
|
||||
mimeType( MimeType::StringPair ) );
|
||||
if( txt.section( ':', 0, 0 ) == QString( "tco_%1" ).arg(
|
||||
Track::SampleTrack ) )
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "Song.h"
|
||||
#include "StringPairDrag.h"
|
||||
#include "ToolTip.h"
|
||||
#include "Clipboard.h"
|
||||
|
||||
#include "embed.h"
|
||||
|
||||
@@ -580,10 +581,13 @@ void PatmanView::updateFilename( void )
|
||||
|
||||
void PatmanView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
if( _dee->mimeData()->hasFormat( StringPairDrag::mimeType() ) )
|
||||
// For mimeType() and MimeType enum class
|
||||
using namespace Clipboard;
|
||||
|
||||
if( _dee->mimeData()->hasFormat( mimeType( MimeType::StringPair ) ) )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
StringPairDrag::mimeType() );
|
||||
mimeType( MimeType::StringPair ) );
|
||||
if( txt.section( ':', 0, 0 ) == "samplefile" )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "StringPairDrag.h"
|
||||
#include "TextFloat.h"
|
||||
#include "ToolTip.h"
|
||||
#include "Clipboard.h"
|
||||
|
||||
|
||||
#include "embed.h"
|
||||
@@ -833,10 +834,13 @@ void VestigeInstrumentView::noteOffAll( void )
|
||||
|
||||
void VestigeInstrumentView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
if( _dee->mimeData()->hasFormat( StringPairDrag::mimeType() ) )
|
||||
// For mimeType() and MimeType enum class
|
||||
using namespace Clipboard;
|
||||
|
||||
if( _dee->mimeData()->hasFormat( mimeType( MimeType::StringPair ) ) )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
StringPairDrag::mimeType() );
|
||||
mimeType( MimeType::StringPair ) );
|
||||
if( txt.section( ':', 0, 0 ) == "vstplugin" )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
@@ -1175,10 +1179,13 @@ void manageVestigeInstrumentView::syncParameterText()
|
||||
|
||||
void manageVestigeInstrumentView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
if( _dee->mimeData()->hasFormat( StringPairDrag::mimeType() ) )
|
||||
// For mimeType() and MimeType enum class
|
||||
using namespace Clipboard;
|
||||
|
||||
if( _dee->mimeData()->hasFormat( mimeType( MimeType::StringPair ) ) )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
StringPairDrag::mimeType() );
|
||||
mimeType( MimeType::StringPair ) );
|
||||
if( txt.section( ':', 0, 0 ) == "vstplugin" )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "LocalZynAddSubFx.h"
|
||||
#include "Mixer.h"
|
||||
#include "ControllerConnection.h"
|
||||
#include "Clipboard.h"
|
||||
|
||||
#include "embed.h"
|
||||
#include "plugin_export.h"
|
||||
@@ -578,10 +579,13 @@ ZynAddSubFxView::~ZynAddSubFxView()
|
||||
|
||||
void ZynAddSubFxView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
if( _dee->mimeData()->hasFormat( StringPairDrag::mimeType() ) )
|
||||
// For mimeType() and MimeType enum class
|
||||
using namespace Clipboard;
|
||||
|
||||
if( _dee->mimeData()->hasFormat( mimeType( MimeType::StringPair ) ) )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
StringPairDrag::mimeType() );
|
||||
mimeType( MimeType::StringPair ) );
|
||||
if( txt.section( ':', 0, 0 ) == "pluginpresetfile" )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
|
||||
Reference in New Issue
Block a user