diff --git a/.travis.yml b/.travis.yml index 92aa8a9d8..b16a73e8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ compiler: gcc before_install: sudo apt-get update install: sudo apt-get install libqt4-dev libsndfile-dev fftw3-dev libvorbis-dev libogg-dev libasound2-dev libjack-dev libsdl-dev libsamplerate0-dev libstk0-dev libfluidsynth-dev portaudio19-dev wine-dev g++-multilib before_script: mkdir build && cd build -script: cmake .. && make -j8 +script: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make -j8 diff --git a/AUTHORS b/AUTHORS index 9bdf47818..086d6c3a2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,21 +2,25 @@ Tobias Doerffel Maintainer, main-development, artwork etc. +Jonathan Aquilina + + Project Manager + Paul Giblock - development + Development Danny McRae - development + Development Javier Serrano Polo - development + Development Andrew Kelley - development + Development Andreas Brandmaier @@ -24,12 +28,40 @@ Andreas Brandmaier Juan Fabián Simón - version 4.0 plugin artwork + Version 4.0 plugin artwork Sebastian Tilsch - recording of many samples + Recording of many samples -gabriel +Gabriel - additional artwork + Additional artwork + +Vesa Kivimäki + + UI Lead developer + +Gurjot Singh + + Developer + +Hannu Haahti + + Developer + +Uroš Maravić + + UI Developer + +Tobiasz Karoń (unfa) + + UI Developer + +Johannes Lorenz + + Developer + +Rubén Ibarra Pastor + + Developer diff --git a/CMakeLists.txt b/CMakeLists.txt index 92e5d6b67..397eecdeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -335,6 +335,7 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc.in ${CMAKE SET(WERROR_FLAGS "-Wall -Werror -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow") SET(CMAKE_C_FLAGS "-O2 -g ${WERROR_FLAGS} ${CMAKE_C_FLAGS}") SET(CMAKE_CXX_FLAGS "-O2 -g -fno-exceptions ${WERROR_FLAGS} ${CMAKE_CXX_FLAGS}") +set(CMAKE_C_FLAGS_DEBUG "-DLMMS_DEBUG") # people simply updating git will still have this and mess up build with it @@ -346,7 +347,18 @@ FILE(GLOB_RECURSE lmms_SOURCES ${CMAKE_SOURCE_DIR}/src/*.cpp) SET(lmms_MOC ${lmms_INCLUDES}) -SET(lmms_EMBEDDED_RESOURCES ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/COPYING) +# Get list of all committers from git history, ordered by number of commits +FIND_PACKAGE(Git) +IF(GIT_FOUND) + SET(CONTRIBUTORS ${CMAKE_BINARY_DIR}/CONTRIBUTORS) + EXECUTE_PROCESS( + COMMAND ${GIT_EXECUTABLE} shortlog -sne + COMMAND cut -c8- + OUTPUT_FILE ${CONTRIBUTORS} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +ENDIF(GIT_FOUND) + +SET(lmms_EMBEDDED_RESOURCES ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/COPYING ${CONTRIBUTORS}) QT4_WRAP_CPP(lmms_MOC_out ${lmms_MOC} OPTIONS -nw) QT4_WRAP_UI(lmms_UI_out ${lmms_UI}) diff --git a/data/locale/ca.ts b/data/locale/ca.ts index 3295f82ec..d0ff53fa9 100644 --- a/data/locale/ca.ts +++ b/data/locale/ca.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave octava @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS ACORDS diff --git a/data/locale/cs.ts b/data/locale/cs.ts index 1118a1643..af6a41d67 100644 --- a/data/locale/cs.ts +++ b/data/locale/cs.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave oktáva @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS AKORDY diff --git a/data/locale/de.ts b/data/locale/de.ts index cdeb4810d..3ee513bcf 100644 --- a/data/locale/de.ts +++ b/data/locale/de.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave Oktave @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS AKKORDE diff --git a/data/locale/en.ts b/data/locale/en.ts index 8ed3172cb..20e29f33f 100644 --- a/data/locale/en.ts +++ b/data/locale/en.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS diff --git a/data/locale/es.ts b/data/locale/es.ts index b0a0e2e90..a986f5af0 100644 --- a/data/locale/es.ts +++ b/data/locale/es.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave Octava @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS diff --git a/data/locale/fa.ts b/data/locale/fa.ts index b84820ea8..2c7fec6d5 100644 --- a/data/locale/fa.ts +++ b/data/locale/fa.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave نت @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS diff --git a/data/locale/fr.ts b/data/locale/fr.ts index 8ca35588f..e45aca6d1 100644 --- a/data/locale/fr.ts +++ b/data/locale/fr.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave octave @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS ACCORDS diff --git a/data/locale/gl.ts b/data/locale/gl.ts index 546ed3698..21d411161 100644 --- a/data/locale/gl.ts +++ b/data/locale/gl.ts @@ -501,7 +501,7 @@ Se lle interesa traducir o LMMS a outro idioma ou desexa mellorar as traducións - ChordCreator + InstrumentFunctionNoteStacking octave oitava @@ -872,7 +872,7 @@ Se lle interesa traducir o LMMS a outro idioma ou desexa mellorar as traducións - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS ACORDES diff --git a/data/locale/it.ts b/data/locale/it.ts index 95df96983..ccbac12ec 100644 --- a/data/locale/it.ts +++ b/data/locale/it.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave ottava @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS ACCORDI diff --git a/data/locale/ja.ts b/data/locale/ja.ts index 275e35a97..fe1255193 100644 --- a/data/locale/ja.ts +++ b/data/locale/ja.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS diff --git a/data/locale/ko.ts b/data/locale/ko.ts index 584eb9eb5..a18db80cf 100644 --- a/data/locale/ko.ts +++ b/data/locale/ko.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave 옥타브 @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS diff --git a/data/locale/nl.ts b/data/locale/nl.ts index de0acab03..a1c52d034 100644 --- a/data/locale/nl.ts +++ b/data/locale/nl.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave oktaaf @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS AKKOORDEN diff --git a/data/locale/pl.ts b/data/locale/pl.ts index f3d438f20..0f399180c 100644 --- a/data/locale/pl.ts +++ b/data/locale/pl.ts @@ -494,7 +494,7 @@ Zauważone błędy i propozycje zmian tłumaczenia proszę zgłaszać na e-mail: - ChordCreator + InstrumentFunctionNoteStacking octave @@ -861,7 +861,7 @@ Zauważone błędy i propozycje zmian tłumaczenia proszę zgłaszać na e-mail: - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS AKORDY diff --git a/data/locale/pt_br.ts b/data/locale/pt_br.ts index 1ea74f00c..c01038992 100644 --- a/data/locale/pt_br.ts +++ b/data/locale/pt_br.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave oitava @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS ACORDE diff --git a/data/locale/ru.ts b/data/locale/ru.ts index d55cdfc58..90ac1ea1c 100644 --- a/data/locale/ru.ts +++ b/data/locale/ru.ts @@ -492,7 +492,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave Октава @@ -859,7 +859,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS АККОРД diff --git a/data/locale/sv.ts b/data/locale/sv.ts index 1e1749a4e..1cd1b56c5 100644 --- a/data/locale/sv.ts +++ b/data/locale/sv.ts @@ -488,7 +488,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreator + InstrumentFunctionNoteStacking octave oktav @@ -855,7 +855,7 @@ If you're interested in translating LMMS in another language or want to imp - ChordCreatorView + InstrumentFunctionNoteStackingView CHORDS diff --git a/data/projects/CoolSongs/Greippi-ardudar.mmpz b/data/projects/CoolSongs/Greippi-ardudar.mmpz new file mode 100644 index 000000000..17ff90dfd Binary files /dev/null and b/data/projects/CoolSongs/Greippi-ardudar.mmpz differ diff --git a/data/projects/CoolSongs/LICENSES.TXT b/data/projects/CoolSongs/LICENSES.TXT index f97d85007..94b95d9ed 100644 --- a/data/projects/CoolSongs/LICENSES.TXT +++ b/data/projects/CoolSongs/LICENSES.TXT @@ -13,6 +13,10 @@ * Farbro-Tectonic.mmpz - CC (by) - http://lmms.sourceforge.net/lsp/index.php?action=show&file=1327 + +* Greippi-ardudar.mmpz + - CC (by-sa) + - http://lmms.sourceforge.net/lsp/index.php?action=show&file=4916 * Impulslogik-Zen.mmpz - Artistic 2.0 @@ -53,6 +57,10 @@ * TameAnderson-MakeMe.mmpz - Artistic 2.0 - http://lmms.sourceforge.net/lsp/index.php?action=show&file=1060 + +* unfa-Spoken.mmpz + - CC (by-nc) + - http://lmms.sourceforge.net/lsp/index.php?action=show&file=4929 * Zakarra-MainstreamMemory.mmpz - Artistic 2.0 diff --git a/data/projects/CoolSongs/unfa-Spoken.mmpz b/data/projects/CoolSongs/unfa-Spoken.mmpz new file mode 100644 index 000000000..35c5c4b24 Binary files /dev/null and b/data/projects/CoolSongs/unfa-Spoken.mmpz differ diff --git a/include/FileDialog.h b/include/FileDialog.h new file mode 100644 index 000000000..ddc231546 --- /dev/null +++ b/include/FileDialog.h @@ -0,0 +1,42 @@ +/* + * FileDialog.h - declaration of class FileDialog + * + * Copyright (c) 2014 Lukas W + * + * 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. + * + */ + + +#ifndef FILEDIALOG_H +#define FILEDIALOG_H + +#include + +class FileDialog : public QFileDialog +{ + Q_OBJECT +public: + explicit FileDialog( QWidget *parent = 0, const QString &caption = QString(), + const QString &directory = QString(), + const QString &filter = QString() ); + + void clearSelection(); +}; + +#endif // FILEDIALOG_HPP diff --git a/include/InstrumentFunctionViews.h b/include/InstrumentFunctionViews.h index 3b4334147..2a370468a 100644 --- a/include/InstrumentFunctionViews.h +++ b/include/InstrumentFunctionViews.h @@ -1,7 +1,7 @@ /* * InstrumentFunctionViews.h - views for instrument-functions-tab * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -35,23 +35,23 @@ class groupBox; class knob; class TempoSyncKnob; -class Arpeggiator; -class ChordCreator; +class InstrumentFunctionArpeggio; +class InstrumentFunctionNoteStacking; -class ChordCreatorView : public QWidget, public ModelView +class InstrumentFunctionNoteStackingView : public QWidget, public ModelView { Q_OBJECT public: - ChordCreatorView( ChordCreator * _cc, QWidget * _parent ); - virtual ~ChordCreatorView(); + InstrumentFunctionNoteStackingView( InstrumentFunctionNoteStacking* cc, QWidget* parent = NULL ); + virtual ~InstrumentFunctionNoteStackingView(); private: virtual void modelChanged(); - ChordCreator * m_cc; + InstrumentFunctionNoteStacking * m_cc; groupBox * m_chordsGroupBox; comboBox * m_chordsComboBox; @@ -63,26 +63,24 @@ private: -class ArpeggiatorView : public QWidget, public ModelView +class InstrumentFunctionArpeggioView : public QWidget, public ModelView { Q_OBJECT public: - ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ); - virtual ~ArpeggiatorView(); + InstrumentFunctionArpeggioView( InstrumentFunctionArpeggio* arp, QWidget* parent = NULL ); + virtual ~InstrumentFunctionArpeggioView(); private: virtual void modelChanged(); - Arpeggiator * m_a; + InstrumentFunctionArpeggio * m_a; groupBox * m_arpGroupBox; comboBox * m_arpComboBox; knob * m_arpRangeKnob; TempoSyncKnob * m_arpTimeKnob; knob * m_arpGateKnob; - QLabel * m_arpDirectionLbl; - comboBox * m_arpDirectionComboBox; comboBox * m_arpModeComboBox; diff --git a/include/InstrumentFunctions.h b/include/InstrumentFunctions.h index b26460494..14b1ae618 100644 --- a/include/InstrumentFunctions.h +++ b/include/InstrumentFunctions.h @@ -37,7 +37,7 @@ class notePlayHandle; -class ChordCreator : public Model, public JournallingObject +class InstrumentFunctionNoteStacking : public Model, public JournallingObject { Q_OBJECT @@ -48,8 +48,8 @@ private: typedef int8_t ChordSemiTones [MAX_CHORD_POLYPHONY]; public: - ChordCreator( Model * _parent ); - virtual ~ChordCreator(); + InstrumentFunctionNoteStacking( Model * _parent ); + virtual ~InstrumentFunctionNoteStacking(); void processNote( notePlayHandle * _n ); @@ -149,14 +149,14 @@ private: FloatModel m_chordRangeModel; - friend class ChordCreatorView; + friend class InstrumentFunctionNoteStackingView; } ; -class Arpeggiator : public Model, public JournallingObject +class InstrumentFunctionArpeggio : public Model, public JournallingObject { Q_OBJECT public: @@ -169,8 +169,8 @@ public: NumArpDirections } ; - Arpeggiator( Model * _parent ); - virtual ~Arpeggiator(); + InstrumentFunctionArpeggio( Model * _parent ); + virtual ~InstrumentFunctionArpeggio(); void processNote( notePlayHandle * _n ); @@ -203,7 +203,7 @@ private: friend class FlpImport; friend class InstrumentTrack; - friend class ArpeggiatorView; + friend class InstrumentFunctionArpeggioView; } ; diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index 7df268b82..3514b0aa7 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -39,8 +39,8 @@ class QLineEdit; template class QQueue; -class ArpeggiatorView; -class ChordCreatorView; +class InstrumentFunctionArpeggioView; +class InstrumentFunctionNoteStackingView; class EffectRackView; class InstrumentSoundShapingView; class fadeButton; @@ -162,9 +162,9 @@ public: return &m_piano; } - bool isArpeggiatorEnabled() const + bool isArpeggioEnabled() const { - return m_arpeggiator.m_arpEnabledModel.value(); + return m_arpeggio.m_arpEnabledModel.value(); } // simple helper for removing midiport-XML-node when loading presets @@ -238,8 +238,8 @@ private: Instrument * m_instrument; InstrumentSoundShaping m_soundShaping; - Arpeggiator m_arpeggiator; - ChordCreator m_chordCreator; + InstrumentFunctionArpeggio m_arpeggio; + InstrumentFunctionNoteStacking m_noteStacking; Piano m_piano; @@ -402,8 +402,8 @@ private: tabWidget * m_tabWidget; PluginView * m_instrumentView; InstrumentSoundShapingView * m_ssView; - ChordCreatorView * m_chordView; - ArpeggiatorView * m_arpView; + InstrumentFunctionNoteStackingView* m_noteStackingView; + InstrumentFunctionArpeggioView* m_arpeggioView; InstrumentMidiIOView * m_midiView; EffectRackView * m_effectView; diff --git a/include/LfoController.h b/include/LfoController.h index 45118e9e1..59bea8689 100644 --- a/include/LfoController.h +++ b/include/LfoController.h @@ -75,6 +75,8 @@ protected: sample_t (*m_sampleFunction)( const float ); +private: + SampleBuffer * m_userDefSampleBuffer; protected slots: void updateSampleFunction(); @@ -107,6 +109,13 @@ protected: automatableButtonGroup * m_waveBtnGrp; automatableButtonGroup * m_multiplierBtnGrp; + +private: + pixmapButton * m_userWaveBtn; + +private slots: + void askUserDefWave(); + } ; #endif diff --git a/include/MainWindow.h b/include/MainWindow.h index 6335c6401..8a10f1351 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -102,6 +102,7 @@ public slots: void openProject( void ); bool saveProject( void ); bool saveProjectAs( void ); + bool saveProjectAsNewVersion( void ); void showSettingsDialog( void ); void aboutLMMS( void ); void help( void ); diff --git a/include/SampleBuffer.h b/include/SampleBuffer.h index cd5a243e1..e42d3690e 100644 --- a/include/SampleBuffer.h +++ b/include/SampleBuffer.h @@ -172,7 +172,8 @@ public: return m_data; } - QString openAudioFile() const; + QString openAudioFile() const; + QString openAndSetAudioFile(); QString & toBase64( QString & _dst ) const; diff --git a/include/TempoSyncKnob.h b/include/TempoSyncKnob.h index 6f54089f0..964d77cf4 100644 --- a/include/TempoSyncKnob.h +++ b/include/TempoSyncKnob.h @@ -2,7 +2,7 @@ * TempoSyncKnob.h - adds bpm to ms conversion for knob class * * Copyright (c) 2005-2008 Danny McRae - * Copyright (c) 2009 Tobias Doerffel + * Copyright (c) 2009-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -38,8 +38,7 @@ class EXPORT TempoSyncKnob : public knob { Q_OBJECT public: - TempoSyncKnob( int _knob_num, QWidget * _parent, - const QString & _name = QString() ); + TempoSyncKnob( int knobNum, QWidget* parent = NULL, const QString& name = QString() ); virtual ~TempoSyncKnob(); const QString & syncDescription(); diff --git a/include/VersionedSaveDialog.h b/include/VersionedSaveDialog.h new file mode 100644 index 000000000..8041f00f1 --- /dev/null +++ b/include/VersionedSaveDialog.h @@ -0,0 +1,53 @@ +/* + * VersionedSaveDialog.h - declaration of class VersionedSaveDialog, a file save + * dialog that provides buttons to increment or decrement a version which is + * appended to the file name. (e.g. "MyProject-01.mmpz") + * + * Copyright (c) 2014 Lukas W + * + * 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. + * + */ + + +#ifndef VERSIONEDSAVEDIALOG_H +#define VERSIONEDSAVEDIALOG_H + +#include "FileDialog.h" + +class QLineEdit; + + +class VersionedSaveDialog : public FileDialog +{ + Q_OBJECT +public: + explicit VersionedSaveDialog( QWidget *parent = 0, + const QString &caption = QString(), + const QString &directory = QString(), + const QString &filter = QString() ); + + // Returns true if file name was changed, returns false if it wasn't + static bool changeFileNameVersion( QString &fileName, bool increment ); + +public slots: + void incrementVersion(); + void decrementVersion(); +}; + +#endif // VERSIONEDSAVEDIALOG_H diff --git a/include/combobox.h b/include/combobox.h index d4d432640..76bb36163 100644 --- a/include/combobox.h +++ b/include/combobox.h @@ -1,7 +1,7 @@ /* - * combobox.h - class comboBox, a very cool combo-box + * combobox.h - class ComboBox, a combo box view for models * - * Copyright (c) 2006-2008 Tobias Doerffel + * Copyright (c) 2006-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -38,31 +38,33 @@ class EXPORT comboBox : public QWidget, public IntModelView { Q_OBJECT public: - comboBox( QWidget * _parent, const QString & _name = QString() ); + comboBox( QWidget* parent = NULL, const QString& name = QString() ); virtual ~comboBox(); - ComboBoxModel * model() + ComboBoxModel* model() { - return( castModel() ); + return castModel(); } - const ComboBoxModel * model() const + const ComboBoxModel* model() const { - return( castModel() ); + return castModel(); } + virtual QSize sizeHint() const; + protected: - virtual void contextMenuEvent( QContextMenuEvent * _me ); - virtual void mousePressEvent( QMouseEvent * _me ); - virtual void paintEvent( QPaintEvent * _pe ); - virtual void wheelEvent( QWheelEvent * _we ); + virtual void contextMenuEvent( QContextMenuEvent* event ); + virtual void mousePressEvent( QMouseEvent* event ); + virtual void paintEvent( QPaintEvent* event ); + virtual void wheelEvent( QWheelEvent* event ); private: - static QPixmap * s_background; - static QPixmap * s_arrow; - static QPixmap * s_arrowSelected; + static QPixmap* s_background; + static QPixmap* s_arrow; + static QPixmap* s_arrowSelected; QMenu m_menu; @@ -70,7 +72,7 @@ private: private slots: - void setItem( QAction * _item ); + void setItem( QAction* item ); } ; diff --git a/include/debug.h b/include/debug.h index 1b2b3b2bc..64b1a8886 100644 --- a/include/debug.h +++ b/include/debug.h @@ -31,10 +31,12 @@ // set whether debug-stuff (like messages on the console, asserts and other // additional range-checkings) should be compiled -/*#ifdef LMMS_DEBUG*/ -#include +#ifdef LMMS_DEBUG + #include +#else + #define assert(x) ((void)(x)) +#endif #include -/*#endif*/ #endif diff --git a/include/graph.h b/include/graph.h index 9be552f33..20437996e 100644 --- a/include/graph.h +++ b/include/graph.h @@ -151,7 +151,7 @@ public slots: void setWaveToSaw(); void setWaveToSquare(); void setWaveToNoise(); - //void setWaveToUser( ); + QString setWaveToUser( ); void smooth(); void normalize(); diff --git a/include/knob.h b/include/knob.h index c2e6873f6..b459663b2 100644 --- a/include/knob.h +++ b/include/knob.h @@ -60,7 +60,7 @@ class EXPORT knob : public QWidget, public FloatModelView Q_PROPERTY(QColor outerColor READ outerColor WRITE setOuterColor) mapPropertyFromModel(bool,isVolumeKnob,setVolumeKnob,m_volumeKnob); public: - knob( int _knob_num, QWidget * _parent, const QString & _name = QString() ); + knob( int _knob_num, QWidget * _parent = NULL, const QString & _name = QString() ); virtual ~knob(); // TODO: remove diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index df588eeb4..080c424f3 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -243,7 +243,7 @@ void bitInvader::normalize() const float f = fabsf( samples[i] ); if (f > max) { max = f; } } - normalizeFactor = 1.0 / max; + m_normalizeFactor = 1.0 / max; } @@ -270,7 +270,7 @@ void bitInvader::playNote( notePlayHandle * _n, } else { - factor = normalizeFactor; + factor = m_normalizeFactor; } _n->m_pluginData = new bSynth( @@ -350,69 +350,69 @@ bitInvaderView::bitInvaderView( Instrument * _instrument, m_graph->setPalette( pal ); - sinWaveBtn = new pixmapButton( this, tr( "Sine wave" ) ); - sinWaveBtn->move( 188, 120 ); - sinWaveBtn->setActiveGraphic( embed::getIconPixmap( + m_sinWaveBtn = new pixmapButton( this, tr( "Sine wave" ) ); + m_sinWaveBtn->move( 188, 120 ); + m_sinWaveBtn->setActiveGraphic( embed::getIconPixmap( "sin_wave_active" ) ); - sinWaveBtn->setInactiveGraphic( embed::getIconPixmap( + m_sinWaveBtn->setInactiveGraphic( embed::getIconPixmap( "sin_wave_inactive" ) ); - toolTip::add( sinWaveBtn, + toolTip::add( m_sinWaveBtn, tr( "Click for a sine-wave." ) ); - triangleWaveBtn = new pixmapButton( this, tr( "Triangle wave" ) ); - triangleWaveBtn->move( 188, 136 ); - triangleWaveBtn->setActiveGraphic( + m_triangleWaveBtn = new pixmapButton( this, tr( "Triangle wave" ) ); + m_triangleWaveBtn->move( 188, 136 ); + m_triangleWaveBtn->setActiveGraphic( embed::getIconPixmap( "triangle_wave_active" ) ); - triangleWaveBtn->setInactiveGraphic( + m_triangleWaveBtn->setInactiveGraphic( embed::getIconPixmap( "triangle_wave_inactive" ) ); - toolTip::add( triangleWaveBtn, + toolTip::add( m_triangleWaveBtn, tr( "Click here for a triangle-wave." ) ); - sawWaveBtn = new pixmapButton( this, tr( "Saw wave" ) ); - sawWaveBtn->move( 188, 152 ); - sawWaveBtn->setActiveGraphic( embed::getIconPixmap( + m_sawWaveBtn = new pixmapButton( this, tr( "Saw wave" ) ); + m_sawWaveBtn->move( 188, 152 ); + m_sawWaveBtn->setActiveGraphic( embed::getIconPixmap( "saw_wave_active" ) ); - sawWaveBtn->setInactiveGraphic( embed::getIconPixmap( + m_sawWaveBtn->setInactiveGraphic( embed::getIconPixmap( "saw_wave_inactive" ) ); - toolTip::add( sawWaveBtn, + toolTip::add( m_sawWaveBtn, tr( "Click here for a saw-wave." ) ); - sqrWaveBtn = new pixmapButton( this, tr( "Square wave" ) ); - sqrWaveBtn->move( 188, 168 ); - sqrWaveBtn->setActiveGraphic( embed::getIconPixmap( + m_sqrWaveBtn = new pixmapButton( this, tr( "Square wave" ) ); + m_sqrWaveBtn->move( 188, 168 ); + m_sqrWaveBtn->setActiveGraphic( embed::getIconPixmap( "square_wave_active" ) ); - sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap( + m_sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap( "square_wave_inactive" ) ); - toolTip::add( sqrWaveBtn, + toolTip::add( m_sqrWaveBtn, tr( "Click here for a square-wave." ) ); - whiteNoiseWaveBtn = new pixmapButton( this, + m_whiteNoiseWaveBtn = new pixmapButton( this, tr( "White noise wave" ) ); - whiteNoiseWaveBtn->move( 188, 184 ); - whiteNoiseWaveBtn->setActiveGraphic( + m_whiteNoiseWaveBtn->move( 188, 184 ); + m_whiteNoiseWaveBtn->setActiveGraphic( embed::getIconPixmap( "white_noise_wave_active" ) ); - whiteNoiseWaveBtn->setInactiveGraphic( + m_whiteNoiseWaveBtn->setInactiveGraphic( embed::getIconPixmap( "white_noise_wave_inactive" ) ); - toolTip::add( whiteNoiseWaveBtn, + toolTip::add( m_whiteNoiseWaveBtn, tr( "Click here for white-noise." ) ); - usrWaveBtn = new pixmapButton( this, tr( "User defined wave" ) ); - usrWaveBtn->move( 188, 200 ); - usrWaveBtn->setActiveGraphic( embed::getIconPixmap( + m_usrWaveBtn = new pixmapButton( this, tr( "User defined wave" ) ); + m_usrWaveBtn->move( 188, 200 ); + m_usrWaveBtn->setActiveGraphic( embed::getIconPixmap( "usr_wave_active" ) ); - usrWaveBtn->setInactiveGraphic( embed::getIconPixmap( + m_usrWaveBtn->setInactiveGraphic( embed::getIconPixmap( "usr_wave_inactive" ) ); - toolTip::add( usrWaveBtn, + toolTip::add( m_usrWaveBtn, tr( "Click here for a user-defined shape." ) ); - smoothBtn = new pixmapButton( this, tr( "Smooth" ) ); - smoothBtn->move( 35, 200 ); - smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( + m_smoothBtn = new pixmapButton( this, tr( "Smooth" ) ); + m_smoothBtn->move( 35, 200 ); + m_smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth" ) ); - smoothBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( + m_smoothBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth" ) ); - smoothBtn->setChecked( true ); - toolTip::add( smoothBtn, + m_smoothBtn->setChecked( true ); + toolTip::add( m_smoothBtn, tr( "Click here to smooth waveform." ) ); @@ -426,20 +426,20 @@ bitInvaderView::bitInvaderView( Instrument * _instrument, m_normalizeToggle->move( 55, 100 ); - connect( sinWaveBtn, SIGNAL (clicked () ), + connect( m_sinWaveBtn, SIGNAL (clicked () ), this, SLOT ( sinWaveClicked() ) ); - connect( triangleWaveBtn, SIGNAL ( clicked () ), + connect( m_triangleWaveBtn, SIGNAL ( clicked () ), this, SLOT ( triangleWaveClicked() ) ); - connect( sawWaveBtn, SIGNAL (clicked () ), + connect( m_sawWaveBtn, SIGNAL (clicked () ), this, SLOT ( sawWaveClicked() ) ); - connect( sqrWaveBtn, SIGNAL ( clicked () ), + connect( m_sqrWaveBtn, SIGNAL ( clicked () ), this, SLOT ( sqrWaveClicked() ) ); - connect( whiteNoiseWaveBtn, SIGNAL ( clicked () ), + connect( m_whiteNoiseWaveBtn, SIGNAL ( clicked () ), this, SLOT ( noiseWaveClicked() ) ); - connect( usrWaveBtn, SIGNAL ( clicked () ), + connect( m_usrWaveBtn, SIGNAL ( clicked () ), this, SLOT ( usrWaveClicked() ) ); - connect( smoothBtn, SIGNAL ( clicked () ), + connect( m_smoothBtn, SIGNAL ( clicked () ), this, SLOT ( smoothClicked() ) ); connect( m_interpolationToggle, SIGNAL( toggled( bool ) ), @@ -514,6 +514,9 @@ void bitInvaderView::noiseWaveClicked() void bitInvaderView::usrWaveClicked() { + QString fileName = m_graph->model()->setWaveToUser(); + toolTip::add( m_usrWaveBtn, fileName ); + engine::getSong()->setModified(); /* m_graph->model()->setWaveToNoise(); engine::getSong()->setModified(); diff --git a/plugins/bit_invader/bit_invader.h b/plugins/bit_invader/bit_invader.h index c38eb6b41..7a3217b47 100644 --- a/plugins/bit_invader/bit_invader.h +++ b/plugins/bit_invader/bit_invader.h @@ -99,7 +99,7 @@ private: BoolModel m_interpolation; BoolModel m_normalize; - float normalizeFactor; + float m_normalizeFactor; oscillator * m_osc; @@ -136,13 +136,13 @@ private: virtual void modelChanged(); knob * m_sampleLengthKnob; - pixmapButton * sinWaveBtn; - pixmapButton * triangleWaveBtn; - pixmapButton * sqrWaveBtn; - pixmapButton * sawWaveBtn; - pixmapButton * whiteNoiseWaveBtn; - pixmapButton * smoothBtn; - pixmapButton * usrWaveBtn; + pixmapButton * m_sinWaveBtn; + pixmapButton * m_triangleWaveBtn; + pixmapButton * m_sqrWaveBtn; + pixmapButton * m_sawWaveBtn; + pixmapButton * m_whiteNoiseWaveBtn; + pixmapButton * m_smoothBtn; + pixmapButton * m_usrWaveBtn; static QPixmap * s_artwork; diff --git a/plugins/flp_import/FlpImport.cpp b/plugins/flp_import/FlpImport.cpp index 63f0dc881..c374595f8 100644 --- a/plugins/flp_import/FlpImport.cpp +++ b/plugins/flp_import/FlpImport.cpp @@ -1,5 +1,5 @@ /* - * flp_import.cpp - support for importing FLP-files + * FlpImport.cpp - support for importing FLP-files * * Copyright (c) 2006-2014 Tobias Doerffel * @@ -464,7 +464,7 @@ struct FL_Channel : public FL_Plugin filterCut( 10000 ), filterRes( 0.1 ), filterEnabled( false ), - arpDir( Arpeggiator::ArpDirUp ), + arpDir( InstrumentFunctionArpeggio::ArpDirUp ), arpRange( 0 ), selectedArp( 0 ), arpTime( 100 ), @@ -603,14 +603,14 @@ bool FlpImport::tryImport( TrackContainer* tc ) basicFilters<>::NumFilters+basicFilters<>::LowPass } ; - const Arpeggiator::ArpDirections mappedArpDir[] = + const InstrumentFunctionArpeggio::ArpDirections mappedArpDir[] = { - Arpeggiator::ArpDirUp, - Arpeggiator::ArpDirUp, - Arpeggiator::ArpDirDown, - Arpeggiator::ArpDirUpAndDown, - Arpeggiator::ArpDirUpAndDown, - Arpeggiator::ArpDirRandom + InstrumentFunctionArpeggio::ArpDirUp, + InstrumentFunctionArpeggio::ArpDirUp, + InstrumentFunctionArpeggio::ArpDirDown, + InstrumentFunctionArpeggio::ArpDirUpAndDown, + InstrumentFunctionArpeggio::ArpDirUpAndDown, + InstrumentFunctionArpeggio::ArpDirRandom } ; QMap mappedPluginTypes; @@ -1519,7 +1519,7 @@ else } } - Arpeggiator * arp = &t->m_arpeggiator; + InstrumentFunctionArpeggio * arp = &t->m_arpeggio; arp->m_arpDirectionModel.setValue( it->arpDir ); arp->m_arpRangeModel.setValue( it->arpRange ); arp->m_arpModel.setValue( it->selectedArp ); diff --git a/plugins/midi_import/portsmf/allegro.cpp b/plugins/midi_import/portsmf/allegro.cpp index d193a3c9d..c05f279e9 100644 --- a/plugins/midi_import/portsmf/allegro.cpp +++ b/plugins/midi_import/portsmf/allegro.cpp @@ -9,7 +9,7 @@ 04 apr 03 -- fixed bug in add_track that caused infinite loop */ -#include "assert.h" +#include "debug.h" #include "stdlib.h" #include "stdio.h" #include "string.h" @@ -727,8 +727,8 @@ void Alg_event_list::set_start_time(Alg_event *event, double t) // For Alg_track, change the time and move the event to the right place // For Alg_seq, find the track and do the update there - long index, i; - Alg_track_ptr track_ptr; + long index = 0, i; + Alg_track_ptr track_ptr = Alg_track_ptr(); if (type == 'e') { // this is an Alg_event_list // make sure the owner has not changed its event set assert(events_owner && @@ -2283,6 +2283,7 @@ Alg_track_ptr Alg_seq::track(int i) } +#pragma GCC diagnostic ignored "-Wreturn-type" // ok not to return a value here Alg_event_ptr &Alg_seq::operator[](int i) { int ntracks = track_list.length(); @@ -2296,7 +2297,7 @@ Alg_event_ptr &Alg_seq::operator[](int i) } tr++; } - assert(false); // out of bounds + assert(false); // out of bounds } diff --git a/plugins/midi_import/portsmf/allegro.h b/plugins/midi_import/portsmf/allegro.h index 51a7b29c0..e83d4b463 100644 --- a/plugins/midi_import/portsmf/allegro.h +++ b/plugins/midi_import/portsmf/allegro.h @@ -48,7 +48,7 @@ #ifndef __ALLEGRO__ #define __ALLEGRO__ -#include +#include "debug.h" #include "lmmsconfig.h" diff --git a/plugins/midi_import/portsmf/allegrord.cpp b/plugins/midi_import/portsmf/allegrord.cpp index 9d6b9f2c1..7a1f5beed 100644 --- a/plugins/midi_import/portsmf/allegrord.cpp +++ b/plugins/midi_import/portsmf/allegrord.cpp @@ -1,4 +1,4 @@ -#include "assert.h" +#include "debug.h" #include "stdlib.h" #include "string.h" #include "ctype.h" diff --git a/plugins/midi_import/portsmf/allegrosmfrd.cpp b/plugins/midi_import/portsmf/allegrosmfrd.cpp index 813ecd79f..49e2ef03e 100644 --- a/plugins/midi_import/portsmf/allegrosmfrd.cpp +++ b/plugins/midi_import/portsmf/allegrosmfrd.cpp @@ -3,7 +3,7 @@ #include "stdlib.h" #include "stdio.h" #include "string.h" -#include "assert.h" +#include "debug.h" #include #include #include "allegro.h" diff --git a/plugins/midi_import/portsmf/allegrowr.cpp b/plugins/midi_import/portsmf/allegrowr.cpp index f4a76f18a..3b266f84c 100644 --- a/plugins/midi_import/portsmf/allegrowr.cpp +++ b/plugins/midi_import/portsmf/allegrowr.cpp @@ -1,6 +1,6 @@ // allegrowr.cpp -- write sequence to an Allegro file (text) -#include "assert.h" +#include "debug.h" #include "stdlib.h" #include #include diff --git a/plugins/patman/patman.cpp b/plugins/patman/patman.cpp index a5a588b21..b2cdc9d1b 100644 --- a/plugins/patman/patman.cpp +++ b/plugins/patman/patman.cpp @@ -25,7 +25,6 @@ #include "patman.h" -#include #include #include #include @@ -39,6 +38,7 @@ #include "song.h" #include "string_pair_drag.h" #include "tooltip.h" +#include "FileDialog.h" #include "embed.cpp" @@ -508,11 +508,8 @@ PatmanView::~PatmanView() void PatmanView::openFile( void ) { - QFileDialog ofd( NULL, tr( "Open patch file" ) ); -#if QT_VERSION >= 0x040806 - ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif - ofd.setFileMode( QFileDialog::ExistingFiles ); + FileDialog ofd( NULL, tr( "Open patch file" ) ); + ofd.setFileMode( FileDialog::ExistingFiles ); QStringList types; types << tr( "Patch-Files (*.pat)" ); diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index 2467e717c..9091cafef 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -27,9 +27,9 @@ #include #include #include -#include #include +#include "FileDialog.h" #include "sf2_player.h" #include "engine.h" #include "InstrumentTrack.h" @@ -1044,11 +1044,8 @@ void sf2InstrumentView::showFileDialog() { sf2Instrument * k = castModel(); - QFileDialog ofd( NULL, tr( "Open SoundFont file" ) ); -#if QT_VERSION >= 0x040806 - ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif - ofd.setFileMode( QFileDialog::ExistingFiles ); + FileDialog ofd( NULL, tr( "Open SoundFont file" ) ); + ofd.setFileMode( FileDialog::ExistingFiles ); QStringList types; types << tr( "SoundFont2 Files (*.sf2)" ); diff --git a/plugins/triple_oscillator/TripleOscillator.cpp b/plugins/triple_oscillator/TripleOscillator.cpp index ae8510bab..20a017989 100644 --- a/plugins/triple_oscillator/TripleOscillator.cpp +++ b/plugins/triple_oscillator/TripleOscillator.cpp @@ -138,10 +138,9 @@ OscillatorObject::~OscillatorObject() void OscillatorObject::oscUserDefWaveDblClick() { - QString af = m_sampleBuffer->openAudioFile(); + QString af = m_sampleBuffer->openAndSetAudioFile(); if( af != "" ) { - m_sampleBuffer->setAudioFile( af ); // TODO: //toolTip::add( m_usrWaveBtn, m_sampleBuffer->audioFile() ); } diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index 6dfea9f69..e8f59c1f4 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -25,7 +25,6 @@ #include "vestige.h" #include -#include #include #include #include @@ -43,6 +42,7 @@ #include "string_pair_drag.h" #include "text_float.h" #include "tooltip.h" +#include "FileDialog.h" #include "embed.cpp" @@ -613,10 +613,7 @@ void VestigeInstrumentView::modelChanged() void VestigeInstrumentView::openPlugin() { - QFileDialog ofd( NULL, tr( "Open VST-plugin" ) ); -#if QT_VERSION >= 0x040806 - ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif + FileDialog ofd( NULL, tr( "Open VST-plugin" ) ); QString dir; if( m_vi->m_pluginDLL != "" ) @@ -629,7 +626,7 @@ void VestigeInstrumentView::openPlugin() } // change dir to position of previously opened file ofd.setDirectory( dir ); - ofd.setFileMode( QFileDialog::ExistingFiles ); + ofd.setFileMode( FileDialog::ExistingFiles ); // set filters QStringList types; diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index 7464e1daa..7872db7ca 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -728,9 +728,9 @@ void vibedView::noiseWaveClicked() void vibedView::usrWaveClicked() { - // TODO: load file - //m_graph->model()->setWaveToUser(); - //engine::getSongEditor()->setModified(); + QString fileName = m_graph->model()->setWaveToUser(); + toolTip::add( m_usrWaveBtn, fileName ); + engine::getSong()->setModified(); } diff --git a/plugins/vst_base/VstPlugin.cpp b/plugins/vst_base/VstPlugin.cpp index 8e331829b..5ed6164a4 100644 --- a/plugins/vst_base/VstPlugin.cpp +++ b/plugins/vst_base/VstPlugin.cpp @@ -24,7 +24,6 @@ #include "VstPlugin.h" -#include #include #include #include @@ -49,6 +48,7 @@ #include "MainWindow.h" #include "song.h" #include "templates.h" +#include "FileDialog.h" #include @@ -510,12 +510,9 @@ bool VstPlugin::processMessage( const message & _m ) void VstPlugin::openPreset( ) { - QFileDialog ofd( NULL, tr( "Open Preset" ), "", + FileDialog ofd( NULL, tr( "Open Preset" ), "", tr( "Vst Plugin Preset (*.fxp *.fxb)" ) ); -#if QT_VERSION >= 0x040806 - ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif - ofd.setFileMode( QFileDialog::ExistingFiles ); + ofd.setFileMode( FileDialog::ExistingFiles ); if( ofd.exec () == QDialog::Accepted && !ofd.selectedFiles().isEmpty() ) { @@ -571,19 +568,16 @@ void VstPlugin::savePreset( ) QString presName = currentProgramName().isEmpty() ? tr(": default") : currentProgramName(); presName.replace(tr("\""), tr("'")); // QFileDialog unable to handle double quotes properly - QFileDialog sfd( NULL, tr( "Save Preset" ), presName.section(": ", 1, 1) + tr(".fxp"), + FileDialog sfd( NULL, tr( "Save Preset" ), presName.section(": ", 1, 1) + tr(".fxp"), tr( "Vst Plugin Preset (*.fxp *.fxb)" ) ); -#if QT_VERSION >= 0x040806 - sfd.setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif if( p_name != "" ) // remember last directory { sfd.setDirectory( QFileInfo( p_name ).absolutePath() ); } - sfd.setAcceptMode( QFileDialog::AcceptSave ); - sfd.setFileMode( QFileDialog::AnyFile ); + sfd.setAcceptMode( FileDialog::AcceptSave ); + sfd.setFileMode( FileDialog::AnyFile ); if( sfd.exec () == QDialog::Accepted && !sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != "" ) { diff --git a/src/core/Controller.cpp b/src/core/Controller.cpp index 41bff4dcc..d1260fd35 100644 --- a/src/core/Controller.cpp +++ b/src/core/Controller.cpp @@ -3,6 +3,7 @@ * remote-control of AutomatableModels * * Copyright (c) 2008 Paul Giblock + * Copyright (c) 2014 Lukas W * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -53,8 +54,30 @@ Controller::Controller( ControllerTypes _type, Model * _parent, if( _type != DummyController && _type != MidiController ) { s_controllers.append( this ); - m_name = QString( tr( "Controller %1" ) ) - .arg( s_controllers.size() ); + // Determine which name to use + for ( uint i=s_controllers.size(); ; i++ ) + { + QString new_name = QString( tr( "Controller %1" ) ) + .arg( i ); + + // Check if name is already in use + bool name_used = false; + QVector::const_iterator it; + for ( it = s_controllers.constBegin(); + it != s_controllers.constEnd(); ++it ) + { + if ( (*it)->name() == new_name ) + { + name_used = true; + break; + } + } + if ( ! name_used ) + { + m_name = new_name; + break; + } + } } } diff --git a/src/core/InstrumentFunctions.cpp b/src/core/InstrumentFunctions.cpp index f6ef44715..1de453df8 100644 --- a/src/core/InstrumentFunctions.cpp +++ b/src/core/InstrumentFunctions.cpp @@ -33,111 +33,111 @@ -ChordCreator::ChordTable::Init ChordCreator::ChordTable::s_initTable[] = +InstrumentFunctionNoteStacking::ChordTable::Init InstrumentFunctionNoteStacking::ChordTable::s_initTable[] = { - { QT_TRANSLATE_NOOP( "ChordCreator", "octave" ), { 0, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Major" ), { 0, 4, 7, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Majb5" ), { 0, 4, 6, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "minor" ), { 0, 3, 7, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "minb5" ), { 0, 3, 6, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "sus2" ), { 0, 2, 7, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "sus4" ), { 0, 5, 7, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "aug" ), { 0, 4, 8, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "augsus4" ), { 0, 5, 8, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "tri" ), { 0, 3, 6, 9, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "octave" ), { 0, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Major" ), { 0, 4, 7, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Majb5" ), { 0, 4, 6, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "minor" ), { 0, 3, 7, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "minb5" ), { 0, 3, 6, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "sus2" ), { 0, 2, 7, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "sus4" ), { 0, 5, 7, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "aug" ), { 0, 4, 8, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "augsus4" ), { 0, 5, 8, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "tri" ), { 0, 3, 6, 9, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "6" ), { 0, 4, 7, 9, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "6sus4" ), { 0, 5, 7, 9, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "6add9" ), { 0, 4, 7, 9, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m6" ), { 0, 3, 7, 9, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m6add9" ), { 0, 3, 7, 9, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "6" ), { 0, 4, 7, 9, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "6sus4" ), { 0, 5, 7, 9, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "6add9" ), { 0, 4, 7, 9, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m6" ), { 0, 3, 7, 9, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m6add9" ), { 0, 3, 7, 9, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7" ), { 0, 4, 7, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7sus4" ), { 0, 5, 7, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7#5" ), { 0, 4, 8, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7b5" ), { 0, 4, 6, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7#9" ), { 0, 4, 7, 10, 15, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7b9" ), { 0, 4, 7, 10, 13, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7#5#9" ), { 0, 4, 8, 10, 15, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7#5b9" ), { 0, 4, 8, 10, 13, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7b5b9" ), { 0, 4, 6, 10, 13, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7add11" ), { 0, 4, 7, 10, 17, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7add13" ), { 0, 4, 7, 10, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "7#11" ), { 0, 4, 7, 10, 18, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj7" ), { 0, 4, 7, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj7b5" ), { 0, 4, 6, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj7#5" ), { 0, 4, 8, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj7#11" ), { 0, 4, 7, 11, 18, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj7add13" ), { 0, 4, 7, 11, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m7" ), { 0, 3, 7, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m7b5" ), { 0, 3, 6, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m7b9" ), { 0, 3, 7, 10, 13, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m7add11" ), { 0, 3, 7, 10, 17, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m7add13" ), { 0, 3, 7, 10, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m-Maj7" ), { 0, 3, 7, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m-Maj7add11" ), { 0, 3, 7, 11, 17, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m-Maj7add13" ), { 0, 3, 7, 11, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7" ), { 0, 4, 7, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7sus4" ), { 0, 5, 7, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7#5" ), { 0, 4, 8, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7b5" ), { 0, 4, 6, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7#9" ), { 0, 4, 7, 10, 15, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7b9" ), { 0, 4, 7, 10, 13, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7#5#9" ), { 0, 4, 8, 10, 15, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7#5b9" ), { 0, 4, 8, 10, 13, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7b5b9" ), { 0, 4, 6, 10, 13, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7add11" ), { 0, 4, 7, 10, 17, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7add13" ), { 0, 4, 7, 10, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7#11" ), { 0, 4, 7, 10, 18, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj7" ), { 0, 4, 7, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj7b5" ), { 0, 4, 6, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj7#5" ), { 0, 4, 8, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj7#11" ), { 0, 4, 7, 11, 18, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj7add13" ), { 0, 4, 7, 11, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m7" ), { 0, 3, 7, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m7b5" ), { 0, 3, 6, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m7b9" ), { 0, 3, 7, 10, 13, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m7add11" ), { 0, 3, 7, 10, 17, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m7add13" ), { 0, 3, 7, 10, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m-Maj7" ), { 0, 3, 7, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m-Maj7add11" ), { 0, 3, 7, 11, 17, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m-Maj7add13" ), { 0, 3, 7, 11, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "9" ), { 0, 4, 7, 10, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "9sus4" ), { 0, 5, 7, 10, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "add9" ), { 0, 4, 7, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "9#5" ), { 0, 4, 8, 10, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "9b5" ), { 0, 4, 6, 10, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "9#11" ), { 0, 4, 7, 10, 14, 18, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "9b13" ), { 0, 4, 7, 10, 14, 20, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj9" ), { 0, 4, 7, 11, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj9sus4" ), { 0, 5, 7, 11, 15, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj9#5" ), { 0, 4, 8, 11, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj9#11" ), { 0, 4, 7, 11, 14, 18, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m9" ), { 0, 3, 7, 10, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "madd9" ), { 0, 3, 7, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m9b5" ), { 0, 3, 6, 10, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m9-Maj7" ), { 0, 3, 7, 11, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9" ), { 0, 4, 7, 10, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9sus4" ), { 0, 5, 7, 10, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "add9" ), { 0, 4, 7, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9#5" ), { 0, 4, 8, 10, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9b5" ), { 0, 4, 6, 10, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9#11" ), { 0, 4, 7, 10, 14, 18, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9b13" ), { 0, 4, 7, 10, 14, 20, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj9" ), { 0, 4, 7, 11, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj9sus4" ), { 0, 5, 7, 11, 15, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj9#5" ), { 0, 4, 8, 11, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj9#11" ), { 0, 4, 7, 11, 14, 18, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m9" ), { 0, 3, 7, 10, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "madd9" ), { 0, 3, 7, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m9b5" ), { 0, 3, 6, 10, 14, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m9-Maj7" ), { 0, 3, 7, 11, 14, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "11" ), { 0, 4, 7, 10, 14, 17, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "11b9" ), { 0, 4, 7, 10, 13, 17, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj11" ), { 0, 4, 7, 11, 14, 17, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m11" ), { 0, 3, 7, 10, 14, 17, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m-Maj11" ), { 0, 3, 7, 11, 14, 17, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "11" ), { 0, 4, 7, 10, 14, 17, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "11b9" ), { 0, 4, 7, 10, 13, 17, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj11" ), { 0, 4, 7, 11, 14, 17, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m11" ), { 0, 3, 7, 10, 14, 17, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m-Maj11" ), { 0, 3, 7, 11, 14, 17, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "13" ), { 0, 4, 7, 10, 14, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "13#9" ), { 0, 4, 7, 10, 15, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "13b9" ), { 0, 4, 7, 10, 13, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "13b5b9" ), { 0, 4, 6, 10, 13, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Maj13" ), { 0, 4, 7, 11, 14, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m13" ), { 0, 3, 7, 10, 14, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "m-Maj13" ), { 0, 3, 7, 11, 14, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "13" ), { 0, 4, 7, 10, 14, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "13#9" ), { 0, 4, 7, 10, 15, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "13b9" ), { 0, 4, 7, 10, 13, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "13b5b9" ), { 0, 4, 6, 10, 13, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj13" ), { 0, 4, 7, 11, 14, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m13" ), { 0, 3, 7, 10, 14, 21, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m-Maj13" ), { 0, 3, 7, 11, 14, 21, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Major" ), { 0, 2, 4, 5, 7, 9, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Harmonic minor" ), { 0, 2, 3, 5, 7, 8, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Melodic minor" ), { 0, 2, 3, 5, 7, 9, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Whole tone" ), { 0, 2, 4, 6, 8, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Diminished" ), { 0, 2, 3, 5, 6, 8, 9, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Major pentatonic" ), { 0, 2, 4, 7, 9, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Minor pentatonic" ), { 0, 3, 5, 7, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Jap in sen" ), { 0, 1, 5, 7, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Major bebop" ), { 0, 2, 4, 5, 7, 8, 9, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Dominant bebop" ), { 0, 2, 4, 5, 7, 9, 10, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Blues" ), { 0, 3, 5, 6, 7, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Arabic" ), { 0, 1, 4, 5, 7, 8, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Enigmatic" ), { 0, 1, 4, 6, 8, 10, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Neopolitan" ), { 0, 1, 3, 5, 7, 9, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Neopolitan minor" ), { 0, 1, 3, 5, 7, 8, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Hungarian minor" ), { 0, 2, 3, 6, 7, 8, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Dorian" ), { 0, 2, 3, 5, 7, 9, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Phrygolydian" ), { 0, 1, 3, 5, 7, 8, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Lydian" ), { 0, 2, 4, 6, 7, 9, 11, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Mixolydian" ), { 0, 2, 4, 5, 7, 9, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Aeolian" ), { 0, 2, 3, 5, 7, 8, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Locrian" ), { 0, 1, 3, 5, 6, 8, 10, -1 } }, - { QT_TRANSLATE_NOOP( "ChordCreator", "Minor" ), { 0, 2, 3, 5, 7, 8, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Major" ), { 0, 2, 4, 5, 7, 9, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Harmonic minor" ), { 0, 2, 3, 5, 7, 8, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Melodic minor" ), { 0, 2, 3, 5, 7, 9, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Whole tone" ), { 0, 2, 4, 6, 8, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Diminished" ), { 0, 2, 3, 5, 6, 8, 9, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Major pentatonic" ), { 0, 2, 4, 7, 9, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Minor pentatonic" ), { 0, 3, 5, 7, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Jap in sen" ), { 0, 1, 5, 7, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Major bebop" ), { 0, 2, 4, 5, 7, 8, 9, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Dominant bebop" ), { 0, 2, 4, 5, 7, 9, 10, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Blues" ), { 0, 3, 5, 6, 7, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Arabic" ), { 0, 1, 4, 5, 7, 8, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Enigmatic" ), { 0, 1, 4, 6, 8, 10, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Neopolitan" ), { 0, 1, 3, 5, 7, 9, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Neopolitan minor" ), { 0, 1, 3, 5, 7, 8, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Hungarian minor" ), { 0, 2, 3, 6, 7, 8, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Dorian" ), { 0, 2, 3, 5, 7, 9, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Phrygolydian" ), { 0, 1, 3, 5, 7, 8, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Lydian" ), { 0, 2, 4, 6, 7, 9, 11, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Mixolydian" ), { 0, 2, 4, 5, 7, 9, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Aeolian" ), { 0, 2, 3, 5, 7, 8, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Locrian" ), { 0, 1, 3, 5, 6, 8, 10, -1 } }, + { QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Minor" ), { 0, 2, 3, 5, 7, 8, 10, -1 } }, } ; -ChordCreator::Chord::Chord( const char * n, const ChordSemiTones & semi_tones ) : - m_name( ChordCreator::tr( n ) ) +InstrumentFunctionNoteStacking::Chord::Chord( const char * n, const ChordSemiTones & semi_tones ) : + m_name( InstrumentFunctionNoteStacking::tr( n ) ) { for( m_size = 0; m_size < MAX_CHORD_POLYPHONY; m_size++ ) { @@ -153,7 +153,7 @@ ChordCreator::Chord::Chord( const char * n, const ChordSemiTones & semi_tones ) -bool ChordCreator::Chord::hasSemiTone( int8_t semi_tone ) const +bool InstrumentFunctionNoteStacking::Chord::hasSemiTone( int8_t semi_tone ) const { for( int i = 0; i < size(); ++i ) { @@ -168,7 +168,7 @@ bool ChordCreator::Chord::hasSemiTone( int8_t semi_tone ) const -ChordCreator::ChordTable::ChordTable() : +InstrumentFunctionNoteStacking::ChordTable::ChordTable() : QVector() { for( int i = 0; @@ -182,7 +182,7 @@ ChordCreator::ChordTable::ChordTable() : -const ChordCreator::Chord & ChordCreator::ChordTable::getByName( const QString & name, bool is_scale ) const +const InstrumentFunctionNoteStacking::Chord & InstrumentFunctionNoteStacking::ChordTable::getByName( const QString & name, bool is_scale ) const { for( int i = 0; i < size(); i++ ) { @@ -197,7 +197,7 @@ const ChordCreator::Chord & ChordCreator::ChordTable::getByName( const QString & -ChordCreator::ChordCreator( Model * _parent ) : +InstrumentFunctionNoteStacking::InstrumentFunctionNoteStacking( Model * _parent ) : Model( _parent, tr( "Chords" ) ), m_chordsEnabledModel( false, this ), m_chordsModel( this, tr( "Chord type" ) ), @@ -213,14 +213,14 @@ ChordCreator::ChordCreator( Model * _parent ) : -ChordCreator::~ChordCreator() +InstrumentFunctionNoteStacking::~InstrumentFunctionNoteStacking() { } -void ChordCreator::processNote( notePlayHandle * _n ) +void InstrumentFunctionNoteStacking::processNote( notePlayHandle * _n ) { const int base_note_key = _n->key(); const ChordTable & chord_table = ChordTable::getInstance(); @@ -229,9 +229,7 @@ void ChordCreator::processNote( notePlayHandle * _n ) // at the same time we only add sub-notes if nothing of the note was // played yet, because otherwise we would add chord-subnotes every // time an audio-buffer is rendered... - if( ( ( _n->isTopNote() && - _n->instrumentTrack()->isArpeggiatorEnabled() == false ) || - _n->isPartOfArpeggio() ) && + if( ( ( _n->isTopNote() && _n->instrumentTrack()->isArpeggioEnabled() == false ) || _n->isPartOfArpeggio() ) && _n->totalFramesPlayed() == 0 && m_chordsEnabledModel.value() == true ) { @@ -282,7 +280,7 @@ void ChordCreator::processNote( notePlayHandle * _n ) -void ChordCreator::saveSettings( QDomDocument & _doc, QDomElement & _this ) +void InstrumentFunctionNoteStacking::saveSettings( QDomDocument & _doc, QDomElement & _this ) { m_chordsEnabledModel.saveSettings( _doc, _this, "chord-enabled" ); m_chordsModel.saveSettings( _doc, _this, "chord" ); @@ -292,7 +290,7 @@ void ChordCreator::saveSettings( QDomDocument & _doc, QDomElement & _this ) -void ChordCreator::loadSettings( const QDomElement & _this ) +void InstrumentFunctionNoteStacking::loadSettings( const QDomElement & _this ) { m_chordsEnabledModel.loadSettings( _this, "chord-enabled" ); m_chordsModel.loadSettings( _this, "chord" ); @@ -305,7 +303,7 @@ void ChordCreator::loadSettings( const QDomElement & _this ) -Arpeggiator::Arpeggiator( Model * _parent ) : +InstrumentFunctionArpeggio::InstrumentFunctionArpeggio( Model * _parent ) : Model( _parent, tr( "Arpeggio" ) ), m_arpEnabledModel( false ), m_arpModel( this, tr( "Arpeggio type" ) ), @@ -317,7 +315,7 @@ Arpeggiator::Arpeggiator( Model * _parent ) : m_arpDirectionModel( this, tr( "Arpeggio direction" ) ), m_arpModeModel( this, tr( "Arpeggio mode" ) ) { - const ChordCreator::ChordTable & chord_table = ChordCreator::ChordTable::getInstance(); + const InstrumentFunctionNoteStacking::ChordTable & chord_table = InstrumentFunctionNoteStacking::ChordTable::getInstance(); for( int i = 0; i < chord_table.size(); ++i ) { m_arpModel.addItem( chord_table[i].getName() ); @@ -339,14 +337,14 @@ Arpeggiator::Arpeggiator( Model * _parent ) : -Arpeggiator::~Arpeggiator() +InstrumentFunctionArpeggio::~InstrumentFunctionArpeggio() { } -void Arpeggiator::processNote( notePlayHandle * _n ) +void InstrumentFunctionArpeggio::processNote( notePlayHandle * _n ) { const int base_note_key = _n->key(); if( _n->isTopNote() == false || @@ -375,7 +373,7 @@ void Arpeggiator::processNote( notePlayHandle * _n ) } } - const ChordCreator::ChordTable & chord_table = ChordCreator::ChordTable::getInstance(); + const InstrumentFunctionNoteStacking::ChordTable & chord_table = InstrumentFunctionNoteStacking::ChordTable::getInstance(); const int cur_chord_size = chord_table[selected_arp].size(); const int range = (int)( cur_chord_size * m_arpRangeModel.value() ); const int total_range = range * cnphv.size(); @@ -512,7 +510,7 @@ void Arpeggiator::processNote( notePlayHandle * _n ) -void Arpeggiator::saveSettings( QDomDocument & _doc, QDomElement & _this ) +void InstrumentFunctionArpeggio::saveSettings( QDomDocument & _doc, QDomElement & _this ) { m_arpEnabledModel.saveSettings( _doc, _this, "arp-enabled" ); m_arpModel.saveSettings( _doc, _this, "arp" ); @@ -527,7 +525,7 @@ void Arpeggiator::saveSettings( QDomDocument & _doc, QDomElement & _this ) -void Arpeggiator::loadSettings( const QDomElement & _this ) +void InstrumentFunctionArpeggio::loadSettings( const QDomElement & _this ) { m_arpEnabledModel.loadSettings( _this, "arp-enabled" ); m_arpModel.loadSettings( _this, "arp" ); diff --git a/src/core/LfoController.cpp b/src/core/LfoController.cpp index a189d500e..fa14c8b2d 100644 --- a/src/core/LfoController.cpp +++ b/src/core/LfoController.cpp @@ -49,7 +49,8 @@ LfoController::LfoController( Model * _parent ) : m_duration( 1000 ), m_phaseCorrection( 0 ), m_phaseOffset( 0 ), - m_sampleFunction( &Oscillator::sinSample ) + m_sampleFunction( &Oscillator::sinSample ), + m_userDefSampleBuffer( new SampleBuffer ) { connect( &m_waveModel, SIGNAL( dataChanged() ), @@ -61,6 +62,7 @@ LfoController::LfoController( Model * _parent ) : LfoController::~LfoController() { + sharedObject::unref( m_userDefSampleBuffer ); m_baseModel.disconnect( this ); m_speedModel.disconnect( this ); m_amountModel.disconnect( this ); @@ -164,7 +166,9 @@ float LfoController::value( int _offset ) // 44100 frames/sec return m_baseModel.value() + ( m_amountModel.value() * - m_sampleFunction(sampleFrame) + ( m_sampleFunction != NULL ? + m_sampleFunction(sampleFrame): + m_userDefSampleBuffer->userWaveSample(sampleFrame) ) / 2.0f ); } @@ -196,6 +200,14 @@ void LfoController::updateSampleFunction() case Oscillator::WhiteNoise: m_sampleFunction = &Oscillator::noiseSample; break; + case Oscillator::UserDefinedWave: + m_sampleFunction = NULL; + /*TODO: If C++11 is allowed, should change the type of + m_sampleFunction be std::function + and use the line below: + */ + //m_sampleFunction = &(m_userDefSampleBuffer->userWaveSample) + break; } } diff --git a/src/core/SampleBuffer.cpp b/src/core/SampleBuffer.cpp index 3308faf60..5b21b220c 100644 --- a/src/core/SampleBuffer.cpp +++ b/src/core/SampleBuffer.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -61,6 +60,8 @@ #include "interpolation.h" #include "templates.h" +#include "FileDialog.h" + SampleBuffer::SampleBuffer( const QString & _audio_file, bool _is_base64_data ) : @@ -829,10 +830,7 @@ void SampleBuffer::visualize( QPainter & _p, const QRect & _dr, QString SampleBuffer::openAudioFile() const { - QFileDialog ofd( NULL, tr( "Open audio file" ) ); -#if QT_VERSION >= 0x040806 - ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif + FileDialog ofd( NULL, tr( "Open audio file" ) ); QString dir; if( !m_audioFile.isEmpty() ) @@ -855,7 +853,7 @@ QString SampleBuffer::openAudioFile() const } // change dir to position of previously opened file ofd.setDirectory( dir ); - ofd.setFileMode( QFileDialog::ExistingFiles ); + ofd.setFileMode( FileDialog::ExistingFiles ); // set filters QStringList types; @@ -894,6 +892,23 @@ QString SampleBuffer::openAudioFile() const } + + +QString SampleBuffer::openAndSetAudioFile() +{ + QString fileName = this->openAudioFile(); + + if(!fileName.isEmpty()) + { + this->setAudioFile( fileName ); + } + + return fileName; +} + + + + #undef LMMS_HAVE_FLAC_STREAM_ENCODER_H /* not yet... */ #undef LMMS_HAVE_FLAC_STREAM_DECODER_H diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index 9654cde23..88482599c 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -2,7 +2,7 @@ * note_play_handle.cpp - implementation of class notePlayHandle, part of * rendering engine * - * Copyright (c) 2004-2012 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -101,7 +101,7 @@ notePlayHandle::notePlayHandle( InstrumentTrack * _it, setFrames( _frames ); - if( !isTopNote() || !instrumentTrack()->isArpeggiatorEnabled() ) + if( !isTopNote() || !instrumentTrack()->isArpeggioEnabled() ) { // send MIDI-note-on-event m_instrumentTrack->processOutEvent( midiEvent( MidiNoteOn, @@ -339,7 +339,7 @@ void notePlayHandle::noteOff( const f_cnt_t _s ) m_releaseFramesToDo = qMax( 0, // 10, m_instrumentTrack->m_soundShaping.releaseFrames() ); - if( !isTopNote() || !instrumentTrack()->isArpeggiatorEnabled() ) + if( !isTopNote() || !instrumentTrack()->isArpeggioEnabled() ) { // send MIDI-note-off-event m_instrumentTrack->processOutEvent( midiEvent( MidiNoteOff, @@ -387,8 +387,7 @@ float notePlayHandle::volumeLevel( const f_cnt_t _frame ) bool notePlayHandle::isArpeggioBaseNote() const { - return isTopNote() && ( m_partOfArpeggio || - m_instrumentTrack->isArpeggiatorEnabled() ); + return isTopNote() && ( m_partOfArpeggio || m_instrumentTrack->isArpeggioEnabled() ); } diff --git a/src/core/song.cpp b/src/core/song.cpp index a2c5457aa..a32f453d7 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -47,6 +46,7 @@ #include "ImportFilter.h" #include "InstrumentTrack.h" #include "MainWindow.h" +#include "FileDialog.h" #include "MidiClient.h" #include "mmp.h" #include "note_play_handle.h" @@ -1310,7 +1310,7 @@ bool song::guiSaveProjectAs( const QString & _file_name ) void song::importProject() { - QFileDialog ofd( NULL, tr( "Import file" ), + FileDialog ofd( NULL, tr( "Import file" ), configManager::inst()->userProjectsDir(), tr("MIDI sequences") + " (*.mid *.midi *.rmi);;" + @@ -1320,11 +1320,8 @@ void song::importProject() " (*.h2song);;" + tr("All file types") + " (*.*)"); -#if QT_VERSION >= 0x040806 - ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif - ofd.setFileMode( QFileDialog::ExistingFiles ); + ofd.setFileMode( FileDialog::ExistingFiles ); if( ofd.exec () == QDialog::Accepted && !ofd.selectedFiles().isEmpty() ) { ImportFilter::import( ofd.selectedFiles()[0], this ); @@ -1377,13 +1374,10 @@ void song::exportProject(bool multiExport) return; } - QFileDialog efd( engine::mainWindow() ); -#if QT_VERSION >= 0x040806 - efd.setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif + FileDialog efd( engine::mainWindow() ); if (multiExport) { - efd.setFileMode( QFileDialog::Directory); + efd.setFileMode( FileDialog::Directory); efd.setWindowTitle( tr( "Select directory for writing exported tracks..." ) ); if( !m_fileName.isEmpty() ) { @@ -1392,7 +1386,7 @@ void song::exportProject(bool multiExport) } else { - efd.setFileMode( QFileDialog::AnyFile ); + efd.setFileMode( FileDialog::AnyFile ); int idx = 0; QStringList types; while( __fileEncodeDevices[idx].m_fileFormat != @@ -1417,7 +1411,7 @@ void song::exportProject(bool multiExport) efd.setWindowTitle( tr( "Select file for project-export..." ) ); } - efd.setAcceptMode( QFileDialog::AcceptSave ); + efd.setAcceptMode( FileDialog::AcceptSave ); if( efd.exec() == QDialog::Accepted && diff --git a/src/core/timeline.cpp b/src/core/timeline.cpp index d392ff8c4..74d754eba 100644 --- a/src/core/timeline.cpp +++ b/src/core/timeline.cpp @@ -301,13 +301,20 @@ void timeLine::mousePressEvent( QMouseEvent* event ) m_loopPos[( m_action == MoveLoopBegin ) ? 0 : 1] = t; } - if( m_action == MoveLoopBegin || m_action == MoveLoopEnd ) + if( m_action == MoveLoopBegin ) { delete m_hint; m_hint = textFloat::displayMessage( tr( "Hint" ), tr( "Press to disable magnetic loop points." ), embed::getIconPixmap( "hint" ), 0 ); } + else if( m_action == MoveLoopEnd ) + { + delete m_hint; + m_hint = textFloat::displayMessage( tr( "Hint" ), + tr( "Hold to move the begin loop point; Press to disable magnetic loop points." ), + embed::getIconPixmap( "hint" ), 0 ); + } mouseMoveEvent( event ); } diff --git a/src/gui/LfoControllerDialog.cpp b/src/gui/LfoControllerDialog.cpp index 05458085e..3aa9f7c0a 100644 --- a/src/gui/LfoControllerDialog.cpp +++ b/src/gui/LfoControllerDialog.cpp @@ -178,15 +178,17 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent toolTip::add( white_noise_btn, tr( "Click here for white-noise." ) ); - pixmapButton * uwb = new pixmapButton( this, NULL ); - uwb->move( CD_LFO_SHAPES_X + 45, CD_LFO_SHAPES_Y + 15 ); - uwb->setActiveGraphic( embed::getIconPixmap( + m_userWaveBtn = new pixmapButton( this, NULL ); + m_userWaveBtn->move( CD_LFO_SHAPES_X + 45, CD_LFO_SHAPES_Y + 15 ); + m_userWaveBtn->setActiveGraphic( embed::getIconPixmap( "usr_wave_active" ) ); - uwb->setInactiveGraphic( embed::getIconPixmap( + m_userWaveBtn->setInactiveGraphic( embed::getIconPixmap( "usr_wave_inactive" ) ); - uwb->setEnabled( false ); - toolTip::add( uwb, tr( "Click here for a user-defined " - "shape." ) ); + connect( m_userWaveBtn, + SIGNAL( doubleClicked() ), + this, SLOT( askUserDefWave() ) ); + toolTip::add( m_userWaveBtn, + tr( "Click here for a user-defined shape.\nDouble click to pick a file." ) ); m_waveBtnGrp = new automatableButtonGroup( this ); m_waveBtnGrp->addButton( sin_wave_btn ); @@ -196,7 +198,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent m_waveBtnGrp->addButton( moog_saw_wave_btn ); m_waveBtnGrp->addButton( exp_wave_btn ); m_waveBtnGrp->addButton( white_noise_btn ); - m_waveBtnGrp->addButton( uwb ); + m_waveBtnGrp->addButton( m_userWaveBtn ); pixmapButton * x1 = new pixmapButton( this, NULL ); @@ -240,11 +242,26 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent LfoControllerDialog::~LfoControllerDialog() { + m_userWaveBtn->disconnect( this ); //delete m_subWindow; } +void LfoControllerDialog::askUserDefWave() +{ + SampleBuffer * sampleBuffer = dynamic_cast(this->model())-> + m_userDefSampleBuffer; + QString fileName = sampleBuffer->openAndSetAudioFile(); + if( fileName.isEmpty() == false ) + { + // TODO: + toolTip::add( m_userWaveBtn, sampleBuffer->audioFile() ); + } +} + + + void LfoControllerDialog::contextMenuEvent( QContextMenuEvent * ) { /* diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 30fa8d925..682be6868 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -62,6 +61,8 @@ #include "ProjectJournal.h" #include "AutomationEditor.h" #include "templates.h" +#include "FileDialog.h" +#include "VersionedSaveDialog.h" @@ -242,6 +243,10 @@ void MainWindow::finalize( void ) this, SLOT( saveProject() ), Qt::CTRL + Qt::Key_S ); + project_menu->addAction( embed::getIconPixmap( "project_save" ), + tr( "Save as new &version" ), + this, SLOT( saveProjectAsNewVersion() ), + Qt::CTRL + Qt::ALT + Qt::Key_S ); project_menu->addAction( embed::getIconPixmap( "project_saveas" ), tr( "Save &As..." ), this, SLOT( saveProjectAs() ), @@ -681,18 +686,15 @@ void MainWindow::createNewProjectFromTemplate( QAction * _idx ) - void MainWindow::openProject( void ) { if( mayChangeProject() ) { - QFileDialog ofd( this, tr( "Open project" ), "", + FileDialog ofd( this, tr( "Open project" ), "", tr( "MultiMedia Project (*.mmp *.mmpz *.xml)" ) ); -#if QT_VERSION >= 0x040806 - ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif + ofd.setDirectory( configManager::inst()->userProjectsDir() ); - ofd.setFileMode( QFileDialog::ExistingFiles ); + ofd.setFileMode( FileDialog::ExistingFiles ); if( ofd.exec () == QDialog::Accepted && !ofd.selectedFiles().isEmpty() ) { @@ -751,14 +753,9 @@ bool MainWindow::saveProject( void ) bool MainWindow::saveProjectAs( void ) { - QFileDialog sfd( this, tr( "Save project" ), "", + VersionedSaveDialog sfd( this, tr( "Save project" ), "", tr( "MultiMedia Project (*.mmp *.mmpz);;" "MultiMedia Project Template (*.mpt)" ) ); -#if QT_VERSION >= 0x040806 - sfd.setOption( QFileDialog::DontUseCustomDirectoryIcons ); -#endif - sfd.setAcceptMode( QFileDialog::AcceptSave ); - sfd.setFileMode( QFileDialog::AnyFile ); QString f = engine::getSong()->projectFileName(); if( f != "" ) { @@ -770,7 +767,7 @@ bool MainWindow::saveProjectAs( void ) sfd.setDirectory( configManager::inst()->userProjectsDir() ); } - if( sfd.exec () == QFileDialog::Accepted && + if( sfd.exec () == FileDialog::Accepted && !sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != "" ) { engine::getSong()->guiSaveProjectAs( @@ -783,6 +780,24 @@ bool MainWindow::saveProjectAs( void ) +bool MainWindow::saveProjectAsNewVersion( void ) +{ + QString fileName = engine::getSong()->projectFileName(); + if( fileName == "" ) + { + return saveProjectAs(); + } + else + { + VersionedSaveDialog::changeFileNameVersion( fileName, true ); + engine::getSong()->guiSaveProjectAs( fileName ); + return true; + } +} + + + + void MainWindow::showSettingsDialog( void ) { setupDialog sd; diff --git a/src/gui/about_dialog.cpp b/src/gui/about_dialog.cpp index 41a502696..cd9cca16c 100644 --- a/src/gui/about_dialog.cpp +++ b/src/gui/about_dialog.cpp @@ -79,7 +79,19 @@ aboutDialog::aboutDialog() : authorLabel->setPlainText( embed::getText( "AUTHORS" ) ); licenseLabel->setPlainText( embed::getText( "COPYING" ) ); + + QString contText = embed::getText( "CONTRIBUTORS" ); + if ( contText.length() >= 2 ) + { + QWidget *widget = new QWidget(); + QVBoxLayout *layout = new QVBoxLayout(); + QTextEdit *contWidget = new QTextEdit(); + contWidget->setReadOnly(true); + contWidget->setText( contText ); + + layout->addWidget( new QLabel( tr("Contributors ordered by number of commits:"), this ) ); + layout->addWidget( contWidget ); + widget->setLayout( layout ); + tabWidget->insertTab( 2, widget, tr("Involved") ); + } } - - - diff --git a/src/gui/dialogs/FileDialog.cpp b/src/gui/dialogs/FileDialog.cpp new file mode 100644 index 000000000..ba25bf80e --- /dev/null +++ b/src/gui/dialogs/FileDialog.cpp @@ -0,0 +1,68 @@ +/* + * FileDialog.cpp - implementation of class FileDialog + * + * Copyright (c) 2014 Lukas W + * + * 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 "config_mgr.h" +#include "FileDialog.h" + + +FileDialog::FileDialog( QWidget *parent, const QString &caption, + const QString &directory, const QString &filter ) : + QFileDialog( parent, caption, directory, filter ) +{ +#if QT_VERSION >= 0x040806 + setOption( QFileDialog::DontUseCustomDirectoryIcons ); +#endif + + // Add additional locations to the sidebar + QList urls = sidebarUrls(); + urls << QUrl::fromLocalFile( QDesktopServices::storageLocation( QDesktopServices::DesktopLocation ) ); + // Find downloads directory + QDir downloadDir( QDir::homePath() + "/Downloads" ); + if ( ! downloadDir.exists() ) + downloadDir = QDesktopServices::storageLocation( QDesktopServices::DocumentsLocation ) + "/Downloads"; + if ( downloadDir.exists() ) + urls << QUrl::fromLocalFile( downloadDir.absolutePath() ); + + urls << QUrl::fromLocalFile( QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) ); + urls << QUrl::fromLocalFile( configManager::inst()->workingDir() ); + + setSidebarUrls(urls); +} + + + +void FileDialog::clearSelection() +{ + static QListView *view = findChild(); + Q_ASSERT( view ); + view->clearSelection(); +} + + +#include "moc_FileDialog.cxx" diff --git a/src/gui/dialogs/VersionedSaveDialog.cpp b/src/gui/dialogs/VersionedSaveDialog.cpp new file mode 100644 index 000000000..c52f47dc2 --- /dev/null +++ b/src/gui/dialogs/VersionedSaveDialog.cpp @@ -0,0 +1,139 @@ +/* + * VersionedSaveDialog.cpp - implementation of class VersionedSaveDialog + * + * Copyright (c) 2014 Lukas W + * + * 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 "VersionedSaveDialog.h" + + + + +VersionedSaveDialog::VersionedSaveDialog( QWidget *parent, + const QString &caption, + const QString &directory, + const QString &filter ) : + FileDialog(parent, caption, directory, filter) +{ + setAcceptMode( QFileDialog::AcceptSave ); + setFileMode( QFileDialog::AnyFile ); + + // Create + and - buttons + QPushButton *plusButton( new QPushButton( "+", this) ); + plusButton->setToolTip( tr( "Increment version number" ) ); + QPushButton *minusButton( new QPushButton( "-", this ) ); + minusButton->setToolTip( tr( "Decrement version number" ) ); + plusButton->setFixedWidth( plusButton->fontMetrics().width( "+" ) + 30 ); + minusButton->setFixedWidth( minusButton->fontMetrics().width( "+" ) + 30 ); + + // Add buttons to grid layout. For doing this, remove the lineEdit and + // replace it with a HBox containing lineEdit and the buttons. + QGridLayout *layout = dynamic_cast( this->layout() ); + QWidget *lineEdit = findChild(); + layout->removeWidget( lineEdit ); + + QHBoxLayout* hLayout( new QHBoxLayout() ); + hLayout->addWidget( lineEdit ); + hLayout->addWidget( plusButton ); + hLayout->addWidget( minusButton ); + layout->addLayout( hLayout, 2, 1 ); + + // Connect + and - buttons + connect( plusButton, SIGNAL( clicked() ), this, SLOT( incrementVersion() )); + connect( minusButton, SIGNAL( clicked() ), this, SLOT( decrementVersion() )); +} + + + + +bool VersionedSaveDialog::changeFileNameVersion(QString &fileName, bool increment ) +{ + static QRegExp regexp( "-\\d+(\\.\\w+)?$" ); + + int idx = regexp.indexIn( fileName ); + // For file names without extension (no ".mmpz") + int insertIndex = fileName.lastIndexOf( '.' ); + if ( insertIndex < idx+1 ) + insertIndex = fileName.size(); + + if ( idx == -1 ) + { + // Can't decrement if there is no version number + if ( increment == false ) + return false; + else + fileName.insert( insertIndex, "-01" ); + } + else + { + // Find current version number + QString number = fileName.mid( idx+1, insertIndex - idx - 1 ); + bool ok; + ushort version = number.toUShort( &ok ); + Q_ASSERT( ok ); + + // Can't decrement 0 + if ( !increment and version == 0 ) + return false; + // Replace version number + version = increment ? version + 1 : version - 1; + QString newnumber = QString( "%1" ).arg( version, 2, 10, QChar( '0' ) ); + + fileName.replace( idx+1, number.length(), newnumber ); + } + return true; +} + + + + +void VersionedSaveDialog::incrementVersion() +{ + const QStringList& selected = selectedFiles(); + if ( selected.size() != 1 ) + return; + QString file = selected[0]; + changeFileNameVersion( file, true ); + clearSelection(); + selectFile( file ); +} + + + + +void VersionedSaveDialog::decrementVersion() +{ + const QStringList& selected = selectedFiles(); + if ( selected.size() != 1 ) + return; + QString file = selected[0]; + changeFileNameVersion( file, false ); + clearSelection(); + selectFile( file ); +} + +#include "moc_VersionedSaveDialog.cxx" diff --git a/src/gui/dialogs/about_dialog.ui b/src/gui/dialogs/about_dialog.ui index b795fd0f8..39c1974b9 100644 --- a/src/gui/dialogs/about_dialog.ui +++ b/src/gui/dialogs/about_dialog.ui @@ -1,3 +1,4 @@ + AboutDialog @@ -125,7 +126,7 @@ - Copyright (c) 2004-2013, LMMS developers + Copyright (c) 2004-2014, LMMS developers true @@ -151,7 +152,7 @@ - http://lmms.sourceforge.net + <html><head/><body><p><a href="http://lmms.sourceforge.net"><span style=" text-decoration: underline; color:#0000ff;">http://lmms.sourceforge.net</span></a></p></body></html> true diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 27ebbcace..0c854808d 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -520,7 +520,7 @@ pianoRoll::pianoRoll() : this, SLOT( quantizeChanged() ) ); - const ChordCreator::ChordTable & chord_table = ChordCreator::ChordTable::getInstance(); + const InstrumentFunctionNoteStacking::ChordTable & chord_table = InstrumentFunctionNoteStacking::ChordTable::getInstance(); // setup scale-stuff QLabel * scale_lbl = new QLabel( m_toolBar ); @@ -644,7 +644,7 @@ void pianoRoll::changeNoteEditMode( int i ) void pianoRoll::markSemiTone( int i ) { const int key = getKey( mapFromGlobal( m_semiToneMarkerMenu->pos() ).y() ); - const ChordCreator::Chord * chord = 0; + const InstrumentFunctionNoteStacking::Chord * chord = 0; switch( static_cast( i ) ) { @@ -665,13 +665,13 @@ void pianoRoll::markSemiTone( int i ) break; } case stmaMarkCurrentScale: - chord = & ChordCreator::ChordTable::getInstance() + chord = & InstrumentFunctionNoteStacking::ChordTable::getInstance() .getScaleByName( m_scaleModel.currentText() ); case stmaMarkCurrentChord: { if( ! chord ) { - chord = & ChordCreator::ChordTable::getInstance() + chord = & InstrumentFunctionNoteStacking::ChordTable::getInstance() .getChordByName( m_chordModel.currentText() ); } @@ -1602,7 +1602,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) new_note.setVolume( m_lastNoteVolume ); created_new_note = m_pattern->addNote( new_note ); - const ChordCreator::Chord & chord = ChordCreator::ChordTable::getInstance() + const InstrumentFunctionNoteStacking::Chord & chord = InstrumentFunctionNoteStacking::ChordTable::getInstance() .getChordByName( m_chordModel.currentText() ); if( ! chord.isEmpty() ) @@ -3855,10 +3855,10 @@ int pianoRoll::quantization() const void pianoRoll::updateSemiToneMarkerMenu() { - const ChordCreator::Chord & scale = ChordCreator::ChordTable::getInstance() + const InstrumentFunctionNoteStacking::Chord & scale = InstrumentFunctionNoteStacking::ChordTable::getInstance() .getScaleByName( m_scaleModel.currentText() ); - const ChordCreator::Chord & chord = ChordCreator::ChordTable::getInstance() + const InstrumentFunctionNoteStacking::Chord & chord = InstrumentFunctionNoteStacking::ChordTable::getInstance() .getChordByName( m_chordModel.currentText() ); emit semiToneMarkerMenuScaleSetEnabled( ! scale.isEmpty() ); diff --git a/src/gui/plugin_browser.cpp b/src/gui/plugin_browser.cpp index 1ecdebbb8..649f36add 100644 --- a/src/gui/plugin_browser.cpp +++ b/src/gui/plugin_browser.cpp @@ -35,6 +35,13 @@ #include "string_pair_drag.h" +bool pluginBefore( const Plugin::Descriptor& d1, const Plugin::Descriptor& d2 ) +{ + return qstricmp( d1.displayName, d2.displayName ) < 0 ? true : false; +} + + + pluginBrowser::pluginBrowser( QWidget * _parent ) : SideBarWidget( tr( "Instrument plugins" ), @@ -61,6 +68,7 @@ pluginBrowser::pluginBrowser( QWidget * _parent ) : view_layout->addWidget( hint ); Plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors ); + qSort( m_pluginDescriptors.begin(), m_pluginDescriptors.end(), pluginBefore ); for( Plugin::DescriptorList::ConstIterator it = m_pluginDescriptors.begin(); it != m_pluginDescriptors.end(); ++it ) diff --git a/src/gui/setup_dialog.cpp b/src/gui/setup_dialog.cpp index dcda537de..0b0526aee 100644 --- a/src/gui/setup_dialog.cpp +++ b/src/gui/setup_dialog.cpp @@ -23,7 +23,6 @@ */ #include -#include #include #include #include @@ -46,6 +45,7 @@ #include "tooltip.h" #include "led_checkbox.h" #include "lcd_spinbox.h" +#include "FileDialog.h" // platform-specific audio-interface-classes @@ -1056,13 +1056,8 @@ void setupDialog::toggleOneInstrumentTrackWindow( bool _enabled ) void setupDialog::openWorkingDir() { - QString new_dir = QFileDialog::getExistingDirectory( this, - tr( "Choose LMMS working directory" ), - m_workingDir -#if QT_VERSION >= 0x040806 - , QFileDialog::DontUseCustomDirectoryIcons -#endif - ); + QString new_dir = FileDialog::getExistingDirectory( this, + tr( "Choose LMMS working directory" ), m_workingDir ); if( new_dir != QString::null ) { m_wdLineEdit->setText( new_dir ); @@ -1082,7 +1077,7 @@ void setupDialog::setWorkingDir( const QString & _wd ) void setupDialog::openVSTDir() { - QString new_dir = QFileDialog::getExistingDirectory( this, + QString new_dir = FileDialog::getExistingDirectory( this, tr( "Choose your VST-plugin directory" ), m_vstDir ); if( new_dir != QString::null ) @@ -1104,7 +1099,7 @@ void setupDialog::setVSTDir( const QString & _vd ) void setupDialog::openArtworkDir() { - QString new_dir = QFileDialog::getExistingDirectory( this, + QString new_dir = FileDialog::getExistingDirectory( this, tr( "Choose artwork-theme directory" ), m_artworkDir ); if( new_dir != QString::null ) @@ -1126,7 +1121,7 @@ void setupDialog::setArtworkDir( const QString & _ad ) void setupDialog::openFLDir() { - QString new_dir = QFileDialog::getExistingDirectory( this, + QString new_dir = FileDialog::getExistingDirectory( this, tr( "Choose FL Studio installation directory" ), m_flDir ); if( new_dir != QString::null ) @@ -1140,7 +1135,7 @@ void setupDialog::openFLDir() void setupDialog::openLADSPADir() { - QString new_dir = QFileDialog::getExistingDirectory( this, + QString new_dir = FileDialog::getExistingDirectory( this, tr( "Choose LADSPA plugin directory" ), m_ladDir ); if( new_dir != QString::null ) @@ -1163,7 +1158,7 @@ void setupDialog::openLADSPADir() void setupDialog::openSTKDir() { #ifdef LMMS_HAVE_STK - QString new_dir = QFileDialog::getExistingDirectory( this, + QString new_dir = FileDialog::getExistingDirectory( this, tr( "Choose STK rawwave directory" ), m_stkDir ); if( new_dir != QString::null ) @@ -1179,7 +1174,7 @@ void setupDialog::openSTKDir() void setupDialog::openDefaultSoundfont() { #ifdef LMMS_HAVE_FLUIDSYNTH - QString new_file = QFileDialog::getOpenFileName( this, + QString new_file = FileDialog::getOpenFileName( this, tr( "Choose default SoundFont" ), m_defaultSoundfont, "SoundFont2 Files (*.sf2)" ); @@ -1212,7 +1207,7 @@ void setupDialog::openBackgroundArtwork() QString dir = ( m_backgroundArtwork.isEmpty() ) ? m_artworkDir : m_backgroundArtwork; - QString new_file = QFileDialog::getOpenFileName( this, + QString new_file = FileDialog::getOpenFileName( this, tr( "Choose background artwork" ), dir, "Image Files (" + fileTypes + ")" ); diff --git a/src/gui/widgets/InstrumentFunctionViews.cpp b/src/gui/widgets/InstrumentFunctionViews.cpp index 1e8e29ad3..e2305906e 100644 --- a/src/gui/widgets/InstrumentFunctionViews.cpp +++ b/src/gui/widgets/InstrumentFunctionViews.cpp @@ -23,6 +23,7 @@ */ #include +#include #include "InstrumentFunctions.h" #include "InstrumentFunctionViews.h" @@ -37,50 +38,43 @@ #include "tooltip.h" - -const int CHORDS_GROUPBOX_X = 4; -const int CHORDS_GROUPBOX_Y = 5; -const int CHORDS_GROUPBOX_WIDTH = 242; -const int CHORDS_GROUPBOX_HEIGHT = 65; -const int ARP_GROUPBOX_X = CHORDS_GROUPBOX_X; -const int ARP_GROUPBOX_Y = 10 + CHORDS_GROUPBOX_Y + CHORDS_GROUPBOX_HEIGHT; -const int ARP_GROUPBOX_WIDTH = CHORDS_GROUPBOX_WIDTH; -const int ARP_GROUPBOX_HEIGHT = 240 - ARP_GROUPBOX_Y; - - - -ChordCreatorView::ChordCreatorView( ChordCreator * _cc, QWidget * _parent ) : - QWidget( _parent ), +InstrumentFunctionNoteStackingView::InstrumentFunctionNoteStackingView( InstrumentFunctionNoteStacking* cc, QWidget* parent ) : + QWidget( parent ), ModelView( NULL, this ), - m_cc( _cc ), - m_chordsGroupBox( new groupBox( tr( "CHORDS" ), this ) ), - m_chordsComboBox( new comboBox( m_chordsGroupBox ) ), - m_chordRangeKnob( new knob( knobBright_26, m_chordsGroupBox ) ) + m_cc( cc ), + m_chordsGroupBox( new groupBox( tr( "STACKING" ) ) ), + m_chordsComboBox( new comboBox() ), + m_chordRangeKnob( new knob( knobBright_26 ) ) { - move( CHORDS_GROUPBOX_X, CHORDS_GROUPBOX_Y ); - setFixedSize( 250, CHORDS_GROUPBOX_HEIGHT ); - m_chordsGroupBox->setGeometry( 0, 0, CHORDS_GROUPBOX_WIDTH, - CHORDS_GROUPBOX_HEIGHT ); + QHBoxLayout* topLayout = new QHBoxLayout( this ); + topLayout->setMargin( 0 ); + topLayout->addWidget( m_chordsGroupBox ); + QGridLayout* mainLayout = new QGridLayout( m_chordsGroupBox ); + mainLayout->setContentsMargins( 8, 18, 8, 8 ); + mainLayout->setColumnStretch( 0, 1 ); + mainLayout->setHorizontalSpacing( 20 ); + mainLayout->setVerticalSpacing( 1 ); - m_chordsComboBox->setGeometry( 10, 25, 140, 22 ); - + QLabel* chordLabel = new QLabel( tr( "Chord:" ) ); + chordLabel->setFont( pointSize<8>( chordLabel->font() ) ); m_chordRangeKnob->setLabel( tr( "RANGE" ) ); - m_chordRangeKnob->move( 164, 24 ); - m_chordRangeKnob->setHintText( tr( "Chord range:" ) + " ", " " + - tr( "octave(s)" ) ); + m_chordRangeKnob->setHintText( tr( "Chord range:" ) + " ", " " + tr( "octave(s)" ) ); m_chordRangeKnob->setWhatsThis( tr( "Use this knob for setting the chord range in octaves. " "The selected chord will be played within specified " "number of octaves." ) ); + mainLayout->addWidget( chordLabel, 0, 0 ); + mainLayout->addWidget( m_chordsComboBox, 1, 0 ); + mainLayout->addWidget( m_chordRangeKnob, 0, 1, 2, 1, Qt::AlignHCenter ); } -ChordCreatorView::~ChordCreatorView() +InstrumentFunctionNoteStackingView::~InstrumentFunctionNoteStackingView() { delete m_chordsGroupBox; } @@ -88,9 +82,9 @@ ChordCreatorView::~ChordCreatorView() -void ChordCreatorView::modelChanged() +void InstrumentFunctionNoteStackingView::modelChanged() { - m_cc = castModel(); + m_cc = castModel(); m_chordsGroupBox->setModel( &m_cc->m_chordsEnabledModel ); m_chordsComboBox->setModel( &m_cc->m_chordsModel ); m_chordRangeKnob->setModel( &m_cc->m_chordRangeModel ); @@ -102,22 +96,27 @@ void ChordCreatorView::modelChanged() -ArpeggiatorView::ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ) : - QWidget( _parent ), +InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFunctionArpeggio* arp, QWidget* parent ) : + QWidget( parent ), ModelView( NULL, this ), - m_a( _arp ), - m_arpGroupBox( new groupBox( tr( "ARPEGGIO" ), this ) ), - m_arpComboBox( new comboBox( m_arpGroupBox) ), - m_arpRangeKnob( new knob( knobBright_26, m_arpGroupBox ) ), - m_arpTimeKnob( new TempoSyncKnob( knobBright_26, m_arpGroupBox ) ), - m_arpGateKnob( new knob( knobBright_26, m_arpGroupBox ) ), - m_arpDirectionComboBox( new comboBox( m_arpGroupBox ) ), - m_arpModeComboBox( new comboBox( m_arpGroupBox ) ) + m_a( arp ), + m_arpGroupBox( new groupBox( tr( "ARPEGGIO" ) ) ), + m_arpComboBox( new comboBox() ), + m_arpRangeKnob( new knob( knobBright_26 ) ), + m_arpTimeKnob( new TempoSyncKnob( knobBright_26 ) ), + m_arpGateKnob( new knob( knobBright_26 ) ), + m_arpDirectionComboBox( new comboBox() ), + m_arpModeComboBox( new comboBox() ) { - move( ARP_GROUPBOX_X, ARP_GROUPBOX_Y ); - setFixedSize( 250, ARP_GROUPBOX_HEIGHT ); - m_arpGroupBox->setGeometry( 0, 0, ARP_GROUPBOX_WIDTH, - ARP_GROUPBOX_HEIGHT ); + QHBoxLayout* topLayout = new QHBoxLayout( this ); + topLayout->setMargin( 0 ); + topLayout->addWidget( m_arpGroupBox ); + + QGridLayout* mainLayout = new QGridLayout( m_arpGroupBox ); + mainLayout->setContentsMargins( 8, 18, 8, 8 ); + mainLayout->setColumnStretch( 0, 1 ); + mainLayout->setHorizontalSpacing( 20 ); + mainLayout->setVerticalSpacing( 1 ); m_arpGroupBox->setWhatsThis( tr( "An arpeggio is a method playing (especially plucked) " @@ -130,13 +129,8 @@ ArpeggiatorView::ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ) : "possible chords, you can select." ) ); - m_arpComboBox->setGeometry( 10, 25, 140, 22 ); - - m_arpRangeKnob->setLabel( tr( "RANGE" ) ); - m_arpRangeKnob->move( 164, 24 ); - m_arpRangeKnob->setHintText( tr( "Arpeggio range:" ) + " ", " " + - tr( "octave(s)" ) ); + m_arpRangeKnob->setHintText( tr( "Arpeggio range:" ) + " ", " " + tr( "octave(s)" ) ); m_arpRangeKnob->setWhatsThis( tr( "Use this knob for setting the arpeggio range in octaves. " "The selected arpeggio will be played within specified " @@ -144,9 +138,7 @@ ArpeggiatorView::ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ) : m_arpTimeKnob->setLabel( tr( "TIME" ) ); - m_arpTimeKnob->move( 164, 70 ); - m_arpTimeKnob->setHintText( tr( "Arpeggio time:" ) + " ", " " + - tr( "ms" ) ); + m_arpTimeKnob->setHintText( tr( "Arpeggio time:" ) + " ", " " + tr( "ms" ) ); m_arpTimeKnob->setWhatsThis( tr( "Use this knob for setting the arpeggio time in " "milliseconds. The arpeggio time specifies how long " @@ -154,7 +146,6 @@ ArpeggiatorView::ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ) : m_arpGateKnob->setLabel( tr( "GATE" ) ); - m_arpGateKnob->move( 204, 70 ); m_arpGateKnob->setHintText( tr( "Arpeggio gate:" ) + " ", tr( "%" ) ); m_arpGateKnob->setWhatsThis( tr( "Use this knob for setting the arpeggio gate. The " @@ -162,24 +153,34 @@ ArpeggiatorView::ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ) : "arpeggio-tone that should be played. With this you " "can make cool staccato arpeggios." ) ); - m_arpDirectionLbl = new QLabel( tr( "Direction:" ), m_arpGroupBox ); - m_arpDirectionLbl->setGeometry( 10, 60, 64, 10 ); - m_arpDirectionLbl->setFont( pointSize<8>( m_arpDirectionLbl->font() ) ); + QLabel* arpChordLabel = new QLabel( tr( "Chord:" ) ); + arpChordLabel->setFont( pointSize<8>( arpChordLabel->font() ) ); - m_arpDirectionComboBox->setGeometry( 10, 74, 140, 22 ); + QLabel* arpDirectionLabel = new QLabel( tr( "Direction:" ) ); + arpDirectionLabel->setFont( pointSize<8>( arpDirectionLabel->font() ) ); + QLabel* arpModeLabel = new QLabel( tr( "Mode:" ) ); + arpModeLabel->setFont( pointSize<8>( arpModeLabel->font() ) ); - QLabel * mode_lbl = new QLabel( tr( "Mode:" ), m_arpGroupBox ); - mode_lbl->setGeometry( 10, 110, 64, 10 ); - mode_lbl->setFont( pointSize<8>( mode_lbl->font() ) ); + mainLayout->addWidget( arpChordLabel, 0, 0 ); + mainLayout->addWidget( m_arpComboBox, 1, 0 ); + mainLayout->addWidget( arpDirectionLabel, 3, 0 ); + mainLayout->addWidget( m_arpDirectionComboBox, 4, 0 ); + mainLayout->addWidget( arpModeLabel, 6, 0 ); + mainLayout->addWidget( m_arpModeComboBox, 7, 0 ); - m_arpModeComboBox->setGeometry( 10, 124, 128, 22 ); + mainLayout->addWidget( m_arpRangeKnob, 0, 1, 2, 1, Qt::AlignHCenter ); + mainLayout->addWidget( m_arpTimeKnob, 3, 1, 2, 1, Qt::AlignHCenter ); + mainLayout->addWidget( m_arpGateKnob, 6, 1, 2, 1, Qt::AlignHCenter ); + + mainLayout->setRowMinimumHeight( 2, 10 ); + mainLayout->setRowMinimumHeight( 5, 10 ); } -ArpeggiatorView::~ArpeggiatorView() +InstrumentFunctionArpeggioView::~InstrumentFunctionArpeggioView() { delete m_arpGroupBox; } @@ -187,9 +188,9 @@ ArpeggiatorView::~ArpeggiatorView() -void ArpeggiatorView::modelChanged() +void InstrumentFunctionArpeggioView::modelChanged() { - m_a = castModel(); + m_a = castModel(); m_arpGroupBox->setModel( &m_a->m_arpEnabledModel ); m_arpComboBox->setModel( &m_a->m_arpModel ); m_arpRangeKnob->setModel( &m_a->m_arpRangeModel ); diff --git a/src/gui/widgets/combobox.cpp b/src/gui/widgets/combobox.cpp index 9244344b9..c78e59ff7 100644 --- a/src/gui/widgets/combobox.cpp +++ b/src/gui/widgets/combobox.cpp @@ -1,7 +1,7 @@ /* - * combobox.cpp - implementation of LMMS-combobox + * combobox.cpp - implementation of LMMS combobox * - * Copyright (c) 2006-2011 Tobias Doerffel + * Copyright (c) 2006-2014 Tobias Doerffel * Copyright (c) 2008-2009 Paul Giblock * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net @@ -88,6 +88,22 @@ comboBox::~comboBox() +QSize comboBox::sizeHint() const +{ + int maxTextWidth = 0; + for( int i = 0; i < model()->size(); ++i ) + { + int w = fontMetrics().width( model()->itemText( i ) ); + if( w > maxTextWidth ) + { + maxTextWidth = w; + } + } + + return QSize( 32 + maxTextWidth, 22 ); +} + + void comboBox::contextMenuEvent( QContextMenuEvent * _me ) { diff --git a/src/gui/widgets/graph.cpp b/src/gui/widgets/graph.cpp index 538bb2544..9a4347647 100644 --- a/src/gui/widgets/graph.cpp +++ b/src/gui/widgets/graph.cpp @@ -482,6 +482,25 @@ void graphModel::setWaveToNoise() emit samplesChanged( 0, length() - 1 ); }; +QString graphModel::setWaveToUser() +{ + SampleBuffer * sampleBuffer = new SampleBuffer; + QString fileName = sampleBuffer->openAndSetAudioFile(); + if( fileName.isEmpty() == false ) + { + for( int i = 0; i < length(); i++ ) + { + m_samples[i] = sampleBuffer->userWaveSample( + i / static_cast( length() ) ); + } + } + + sharedObject::unref( sampleBuffer ); + + emit samplesChanged( 0, length() - 1 ); + return fileName; +}; + void graphModel::smooth() diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 44e78341f..a88f07fcb 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -38,6 +37,7 @@ #include #include +#include "FileDialog.h" #include "InstrumentTrack.h" #include "AudioPort.h" #include "AutomationPattern.h" @@ -108,8 +108,8 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) : m_effectChannelModel( 0, 0, NumFxChannels, this, tr( "FX channel" ) ), m_instrument( NULL ), m_soundShaping( this ), - m_arpeggiator( this ), - m_chordCreator( this ), + m_arpeggio( this ), + m_noteStacking( this ), m_piano( this ) { m_pitchModel.setCenterValue( 0 ); @@ -490,8 +490,8 @@ void InstrumentTrack::playNote( notePlayHandle * _n, { // arpeggio- and chord-widget has to do its work -> adding sub-notes // for chords/arpeggios - m_chordCreator.processNote( _n ); - m_arpeggiator.processNote( _n ); + m_noteStacking.processNote( _n ); + m_arpeggio.processNote( _n ); if( !_n->isArpeggioBaseNote() && m_instrument != NULL ) { @@ -782,8 +782,8 @@ void InstrumentTrack::saveTrackSpecificSettings( QDomDocument & _doc, _this.appendChild( i ); } m_soundShaping.saveState( _doc, _this ); - m_chordCreator.saveState( _doc, _this ); - m_arpeggiator.saveState( _doc, _this ); + m_noteStacking.saveState( _doc, _this ); + m_arpeggio.saveState( _doc, _this ); m_midiPort.saveState( _doc, _this ); m_audioPort.effects()->saveState( _doc, _this ); } @@ -842,13 +842,13 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & _this ) { m_soundShaping.restoreState( node.toElement() ); } - else if( m_chordCreator.nodeName() == node.nodeName() ) + else if( m_noteStacking.nodeName() == node.nodeName() ) { - m_chordCreator.restoreState( node.toElement() ); + m_noteStacking.restoreState( node.toElement() ); } - else if( m_arpeggiator.nodeName() == node.nodeName() ) + else if( m_arpeggio.nodeName() == node.nodeName() ) { - m_arpeggiator.restoreState( node.toElement() ); + m_arpeggio.restoreState( node.toElement() ); } else if( m_midiPort.nodeName() == node.nodeName() ) { @@ -1351,10 +1351,22 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // create tab-widgets m_ssView = new InstrumentSoundShapingView( m_tabWidget ); + + // FUNC tab QWidget* instrumentFunctions = new QWidget( m_tabWidget ); - m_chordView = new ChordCreatorView( &m_track->m_chordCreator, instrumentFunctions ); - m_arpView= new ArpeggiatorView( &m_track->m_arpeggiator, instrumentFunctions ); + QVBoxLayout* instrumentFunctionsLayout = new QVBoxLayout( instrumentFunctions ); + instrumentFunctionsLayout->setMargin( 5 ); + m_noteStackingView = new InstrumentFunctionNoteStackingView( &m_track->m_noteStacking ); + m_arpeggioView = new InstrumentFunctionArpeggioView( &m_track->m_arpeggio ); + + instrumentFunctionsLayout->addWidget( m_noteStackingView ); + instrumentFunctionsLayout->addWidget( m_arpeggioView ); + instrumentFunctionsLayout->addStretch(); + + // MIDI tab m_midiView = new InstrumentMidiIOView( m_tabWidget ); + + // FX tab m_effectView = new EffectRackView( m_track->m_audioPort.effects(), m_tabWidget ); m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), 1 ); @@ -1451,8 +1463,8 @@ void InstrumentTrackWindow::modelChanged() } m_ssView->setModel( &m_track->m_soundShaping ); - m_chordView->setModel( &m_track->m_chordCreator ); - m_arpView->setModel( &m_track->m_arpeggiator ); + m_noteStackingView->setModel( &m_track->m_noteStacking ); + m_arpeggioView->setModel( &m_track->m_arpeggio ); m_midiView->setModel( &m_track->m_midiPort ); m_effectView->setModel( m_track->m_audioPort.effects() ); updateName(); @@ -1463,7 +1475,7 @@ void InstrumentTrackWindow::modelChanged() void InstrumentTrackWindow::saveSettingsBtnClicked() { - QFileDialog sfd( this, tr( "Save preset" ), "", + FileDialog sfd( this, tr( "Save preset" ), "", tr( "XML preset file (*.xpf)" ) ); QString preset_root = configManager::inst()->userPresetsDir(); @@ -1476,9 +1488,9 @@ void InstrumentTrackWindow::saveSettingsBtnClicked() QDir( preset_root ).mkdir( m_track->instrumentName() ); } - sfd.setAcceptMode( QFileDialog::AcceptSave ); + sfd.setAcceptMode( FileDialog::AcceptSave ); sfd.setDirectory( preset_root + m_track->instrumentName() ); - sfd.setFileMode( QFileDialog::AnyFile ); + sfd.setFileMode( FileDialog::AnyFile ); if( sfd.exec () == QDialog::Accepted && !sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != "" )