Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #22

Merged
merged 8 commits into from
Aug 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified data/themes/default/clear_ghost_note.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/themes/default/ghost_note.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/themes/default/loop_points_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/themes/default/loop_points_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/themes/default/record_step_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/themes/default/record_step_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/themes/default/trackop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion include/AutomationEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class AutomationEditor : public QWidget, public JournallingObject

inline bool validPattern() const
{
return m_pattern != nullptr;
return m_pattern != nullptr && m_pattern->hasAutomation();
}

void saveSettings(QDomDocument & doc, QDomElement & parent) override;
Expand Down
6 changes: 6 additions & 0 deletions include/Editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
#include <QMainWindow>
#include <QToolBar>

static const int Quantizations[] = {
1, 2, 4, 8, 16, 32, 64,
3, 6, 12, 24, 48, 96, 192
};


class QAction;

class DropToolBar;
Expand Down
41 changes: 41 additions & 0 deletions include/PathUtil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef PATHUTIL_H
#define PATHUTIL_H

#include "lmms_export.h"

#include <QDir>

namespace PathUtil
{
enum class Base { Absolute, ProjectDir, FactorySample, UserSample, UserVST, Preset,
UserLADSPA, DefaultLADSPA, UserSoundfont, DefaultSoundfont, UserGIG, DefaultGIG };

//! Return the directory associated with a given base as a QString
QString LMMS_EXPORT baseLocation(const Base base);
//! Return the directory associated with a given base as a QDir
QDir LMMS_EXPORT baseQDir (const Base base);
//! Return the prefix used to denote this base in path strings
QString LMMS_EXPORT basePrefix(const Base base);
//! Check the prefix of a path and return the base it corresponds to
//! Defaults to Base::Absolute
Base LMMS_EXPORT baseLookup(const QString & path);

//! Remove the prefix from a path, iff there is one
QString LMMS_EXPORT stripPrefix(const QString & path);
//! Get the filename for a path, handling prefixed paths correctly
QString LMMS_EXPORT cleanName(const QString & path);

//! Upgrade prefix-less relative paths to the new format
QString LMMS_EXPORT oldRelativeUpgrade(const QString & input);

//! Make this path absolute
QString LMMS_EXPORT toAbsolute(const QString & input);
//! Make this path relative to a given base, return an absolute path if that fails
QString LMMS_EXPORT relativeOrAbsolute(const QString & input, const Base base);
//! Make this path relative to any base, choosing the shortest if there are
//! multiple options. Defaults to an absolute path if all bases fail.
QString LMMS_EXPORT toShortestRelative(const QString & input);

}

#endif
5 changes: 1 addition & 4 deletions include/SampleBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class LMMS_EXPORT SampleBuffer : public QObject, public sharedObject
{
m_isBackwards = _backwards;
}

int interpolationMode() const
{
return m_interpolationMode;
Expand Down Expand Up @@ -251,9 +251,6 @@ class LMMS_EXPORT SampleBuffer : public QObject, public sharedObject
m_varLock.unlock();
}

static QString tryToMakeRelative( const QString & _file );
static QString tryToMakeAbsolute(const QString & file);


public slots:
void setAudioFile( const QString & _audio_file );
Expand Down
2 changes: 2 additions & 0 deletions include/SetupDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ private slots:
void toggleCompactTrackButtons(bool enabled);
void toggleOneInstrumentTrackWindow(bool enabled);
void toggleSideBarOnRight(bool enabled);
void toggleSoloLegacyBehavior(bool enabled);
void toggleMMPZ(bool enabled);
void toggleDisableBackup(bool enabled);
void toggleOpenLastProject(bool enabled);
Expand Down Expand Up @@ -132,6 +133,7 @@ private slots:
bool m_compactTrackButtons;
bool m_oneInstrumentTrackWindow;
bool m_sideBarOnRight;
bool m_soloLegacyBehavior;
bool m_MMPZ;
bool m_disableBackup;
bool m_openLastProject;
Expand Down
1 change: 1 addition & 0 deletions include/TimeLineWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ public slots:
void positionChanged( const MidiTime & _t );
void loopPointStateLoaded( int _n );
void positionMarkerMoved();
void loadBehaviourAtStop( int _n );

} ;

Expand Down
2 changes: 0 additions & 2 deletions include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,6 @@ private slots:
void clearTrack();

private:
static QPixmap * s_grip;

TrackView * m_trackView;

QPushButton * m_trackOps;
Expand Down
19 changes: 10 additions & 9 deletions plugins/GigPlayer/GigPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,26 @@
*
*/

#include "GigPlayer.h"

#include <cstring>
#include <QDebug>
#include <QLayout>
#include <QLabel>
#include <QDomDocument>

#include "FileDialog.h"
#include "GigPlayer.h"
#include "ConfigManager.h"
#include "endian_handling.h"
#include "Engine.h"
#include "FileDialog.h"
#include "InstrumentTrack.h"
#include "InstrumentPlayHandle.h"
#include "Knob.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "Knob.h"
#include "PathUtil.h"
#include "SampleBuffer.h"
#include "Song.h"
#include "ConfigManager.h"
#include "endian_handling.h"

#include "PatchesDialog.h"
#include "ToolTip.h"
Expand Down Expand Up @@ -211,8 +212,8 @@ void GigInstrument::openFile( const QString & _gigFile, bool updateTrackName )

try
{
m_instance = new GigInstance( SampleBuffer::tryToMakeAbsolute( _gigFile ) );
m_filename = SampleBuffer::tryToMakeRelative( _gigFile );
m_instance = new GigInstance( PathUtil::toAbsolute( _gigFile ) );
m_filename = PathUtil::toShortestRelative( _gigFile );
}
catch( ... )
{
Expand All @@ -225,7 +226,7 @@ void GigInstrument::openFile( const QString & _gigFile, bool updateTrackName )

if( updateTrackName == true )
{
instrumentTrack()->setName( QFileInfo( _gigFile ).baseName() );
instrumentTrack()->setName(PathUtil::cleanName( _gigFile ) );
updatePatch();
}
}
Expand Down Expand Up @@ -1057,7 +1058,7 @@ void GigInstrumentView::showFileDialog()

if( k->m_filename != "" )
{
QString f = SampleBuffer::tryToMakeAbsolute( k->m_filename );
QString f = PathUtil::toAbsolute( k->m_filename );
ofd.setDirectory( QFileInfo( f ).absolutePath() );
ofd.selectFile( QFileInfo( f ).fileName() );
}
Expand Down
29 changes: 13 additions & 16 deletions plugins/audio_file_processor/audio_file_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*
*/

#include "audio_file_processor.h"

#include <QPainter>
#include <QBitmap>
Expand All @@ -31,18 +32,18 @@

#include <samplerate.h>

#include "audio_file_processor.h"
#include "ConfigManager.h"
#include "DataFile.h"
#include "Engine.h"
#include "Song.h"
#include "gui_templates.h"
#include "InstrumentTrack.h"
#include "interpolation.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "interpolation.h"
#include "gui_templates.h"
#include "ToolTip.h"
#include "PathUtil.h"
#include "Song.h"
#include "StringPairDrag.h"
#include "DataFile.h"
#include "ToolTip.h"

#include "embed.h"
#include "plugin_export.h"
Expand Down Expand Up @@ -97,13 +98,13 @@ audioFileProcessor::audioFileProcessor( InstrumentTrack * _instrument_track ) :
this, SLOT( loopPointChanged() ) );
connect( &m_stutterModel, SIGNAL( dataChanged() ),
this, SLOT( stutterModelChanged() ) );

//interpolation modes
m_interpolationModel.addItem( tr( "None" ) );
m_interpolationModel.addItem( tr( "Linear" ) );
m_interpolationModel.addItem( tr( "Sinc" ) );
m_interpolationModel.setValue( 1 );

pointChanged();
}

Expand Down Expand Up @@ -237,7 +238,7 @@ void audioFileProcessor::loadSettings( const QDomElement & _this )
{
setAudioFile( _this.attribute( "src" ), false );

QString absolutePath = m_sampleBuffer.tryToMakeAbsolute( m_sampleBuffer.audioFile() );
QString absolutePath = PathUtil::toAbsolute( m_sampleBuffer.audioFile() );
if ( !QFileInfo( absolutePath ).exists() )
{
QString message = tr( "Sample not found: %1" ).arg( m_sampleBuffer.audioFile() );
Expand Down Expand Up @@ -329,7 +330,7 @@ void audioFileProcessor::setAudioFile( const QString & _audio_file,
m_sampleBuffer.audioFile().isEmpty() ) )
{
// then set it to new one
instrumentTrack()->setName( QFileInfo( _audio_file).fileName() );
instrumentTrack()->setName( PathUtil::cleanName( _audio_file ) );
}
// else we don't touch the track-name, because the user named it self

Expand Down Expand Up @@ -363,7 +364,7 @@ void audioFileProcessor::stutterModelChanged()
}


void audioFileProcessor::startPointChanged( void )
void audioFileProcessor::startPointChanged( void )
{
// check if start is over end and swap values if so
if( m_startPointModel.value() > m_endPointModel.value() )
Expand All @@ -390,7 +391,7 @@ void audioFileProcessor::startPointChanged( void )
{
m_endPointModel.setValue( qMin( m_endPointModel.value() + 0.001f, 1.0f ) );
}

pointChanged();

}
Expand Down Expand Up @@ -1284,7 +1285,3 @@ PLUGIN_EXPORT Plugin * lmms_plugin_main(Model * model, void *)


}




22 changes: 8 additions & 14 deletions plugins/patman/patman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Copyright (c) 2007-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2009-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -32,15 +32,15 @@
#include "ConfigManager.h"
#include "endian_handling.h"
#include "Engine.h"
#include "FileDialog.h"
#include "gui_templates.h"
#include "InstrumentTrack.h"
#include "NotePlayHandle.h"
#include "PathUtil.h"
#include "PixmapButton.h"
#include "Song.h"
#include "StringPairDrag.h"
#include "ToolTip.h"
#include "FileDialog.h"
#include "ConfigManager.h"

#include "embed.h"

Expand Down Expand Up @@ -192,14 +192,13 @@ void patmanInstrument::setFile( const QString & _patch_file, bool _rename )
m_patchFile == "" ) )
{
// then set it to new one
instrumentTrack()->setName( QFileInfo( _patch_file
).fileName() );
instrumentTrack()->setName( PathUtil::cleanName( _patch_file ) );
}
// else we don't touch the instrument-track-name, because the user
// named it self

m_patchFile = SampleBuffer::tryToMakeRelative( _patch_file );
LoadErrors error = loadPatch( SampleBuffer::tryToMakeAbsolute( _patch_file ) );
m_patchFile = PathUtil::toShortestRelative( _patch_file );
LoadErrors error = loadPatch( PathUtil::toAbsolute( _patch_file ) );
if( error )
{
printf("Load error\n");
Expand Down Expand Up @@ -625,8 +624,8 @@ void PatmanView::paintEvent( QPaintEvent * )
QPainter p( this );

p.setFont( pointSize<8>( font() ) );
p.drawText( 8, 116, 235, 16,
Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignVCenter,
p.drawText( 8, 116, 235, 16,
Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignVCenter,
m_displayFilename );
}

Expand All @@ -641,8 +640,3 @@ void PatmanView::modelChanged( void )
connect( m_pi, SIGNAL( fileChanged() ),
this, SLOT( updateFilename() ) );
}





14 changes: 8 additions & 6 deletions plugins/sf2_player/sf2_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@
*
*/

#include "sf2_player.h"

#include <QDebug>
#include <QLayout>
#include <QLabel>
#include <QDomDocument>

#include "ConfigManager.h"
#include "FileDialog.h"
#include "sf2_player.h"
#include "ConfigManager.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "InstrumentPlayHandle.h"
#include "Knob.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "Knob.h"
#include "PathUtil.h"
#include "SampleBuffer.h"
#include "Song.h"

Expand Down Expand Up @@ -372,8 +374,8 @@ void sf2Instrument::openFile( const QString & _sf2File, bool updateTrackName )
emit fileLoading();

// Used for loading file
char * sf2Ascii = qstrdup( qPrintable( SampleBuffer::tryToMakeAbsolute( _sf2File ) ) );
QString relativePath = SampleBuffer::tryToMakeRelative( _sf2File );
char * sf2Ascii = qstrdup( qPrintable( PathUtil::toAbsolute( _sf2File ) ) );
QString relativePath = PathUtil::toShortestRelative( _sf2File );

// free reference to soundfont if one is selected
freeFont();
Expand Down Expand Up @@ -435,7 +437,7 @@ void sf2Instrument::openFile( const QString & _sf2File, bool updateTrackName )

if( updateTrackName || instrumentTrack()->displayName() == displayName() )
{
instrumentTrack()->setName( QFileInfo( _sf2File ).baseName() );
instrumentTrack()->setName( PathUtil::cleanName( _sf2File ) );
}
}

Expand Down Expand Up @@ -1145,7 +1147,7 @@ void sf2InstrumentView::showFileDialog()

if( k->m_filename != "" )
{
QString f = SampleBuffer::tryToMakeAbsolute( k->m_filename );
QString f = PathUtil::toAbsolute( k->m_filename );
ofd.setDirectory( QFileInfo( f ).absolutePath() );
ofd.selectFile( QFileInfo( f ).fileName() );
}
Expand Down
Loading