Rewrite the setup dialog (#3820)
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "lmms_export.h"
|
||||
|
||||
|
||||
class LmmsCore;
|
||||
|
||||
|
||||
@@ -57,61 +58,22 @@ class LMMS_EXPORT ConfigManager : public QObject
|
||||
public:
|
||||
static inline ConfigManager * inst()
|
||||
{
|
||||
if( s_instanceOfMe == NULL )
|
||||
if(s_instanceOfMe == NULL )
|
||||
{
|
||||
s_instanceOfMe = new ConfigManager();
|
||||
}
|
||||
return s_instanceOfMe;
|
||||
}
|
||||
|
||||
const QString & dataDir() const
|
||||
{
|
||||
return m_dataDir;
|
||||
}
|
||||
|
||||
const QString & workingDir() const
|
||||
{
|
||||
return m_workingDir;
|
||||
}
|
||||
|
||||
QString userProjectsDir() const
|
||||
const QString & dataDir() const
|
||||
{
|
||||
return workingDir() + PROJECTS_PATH;
|
||||
}
|
||||
|
||||
QString userTemplateDir() const
|
||||
{
|
||||
return workingDir() + TEMPLATE_PATH;
|
||||
}
|
||||
|
||||
QString userPresetsDir() const
|
||||
{
|
||||
return workingDir() + PRESETS_PATH;
|
||||
}
|
||||
|
||||
QString userSamplesDir() const
|
||||
{
|
||||
return workingDir() + SAMPLES_PATH;
|
||||
}
|
||||
|
||||
QString userGigDir() const
|
||||
{
|
||||
return workingDir() + GIG_PATH;
|
||||
}
|
||||
|
||||
QString userSf2Dir() const
|
||||
{
|
||||
return workingDir() + SF2_PATH;
|
||||
}
|
||||
|
||||
QString userLadspaDir() const
|
||||
{
|
||||
return workingDir() + LADSPA_PATH;
|
||||
}
|
||||
|
||||
QString userVstDir() const
|
||||
{
|
||||
return m_vstDir;
|
||||
return m_dataDir;
|
||||
}
|
||||
|
||||
QString factoryProjectsDir() const
|
||||
@@ -134,37 +96,27 @@ public:
|
||||
return dataDir() + SAMPLES_PATH;
|
||||
}
|
||||
|
||||
QString defaultVersion() const;
|
||||
|
||||
QString defaultArtworkDir() const
|
||||
QString userProjectsDir() const
|
||||
{
|
||||
return m_dataDir + DEFAULT_THEME_PATH;
|
||||
return workingDir() + PROJECTS_PATH;
|
||||
}
|
||||
|
||||
QString artworkDir() const
|
||||
QString userTemplateDir() const
|
||||
{
|
||||
return m_artworkDir;
|
||||
return workingDir() + TEMPLATE_PATH;
|
||||
}
|
||||
|
||||
QString trackIconsDir() const
|
||||
QString userPresetsDir() const
|
||||
{
|
||||
return m_dataDir + TRACK_ICON_PATH;
|
||||
return workingDir() + PRESETS_PATH;
|
||||
}
|
||||
|
||||
QString localeDir() const
|
||||
QString userSamplesDir() const
|
||||
{
|
||||
return m_dataDir + LOCALE_PATH;
|
||||
return workingDir() + SAMPLES_PATH;
|
||||
}
|
||||
|
||||
const QString & gigDir() const
|
||||
{
|
||||
return m_gigDir;
|
||||
}
|
||||
|
||||
const QString & sf2Dir() const
|
||||
{
|
||||
return m_sf2Dir;
|
||||
}
|
||||
|
||||
const QString & vstDir() const
|
||||
{
|
||||
@@ -173,18 +125,20 @@ public:
|
||||
|
||||
const QString & ladspaDir() const
|
||||
{
|
||||
return m_ladDir;
|
||||
return m_ladspaDir;
|
||||
}
|
||||
|
||||
const QString recoveryFile() const
|
||||
const QString & sf2Dir() const
|
||||
{
|
||||
return m_workingDir + "recover.mmp";
|
||||
return m_sf2Dir;
|
||||
}
|
||||
|
||||
const QString & version() const
|
||||
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
const QString & sf2File() const
|
||||
{
|
||||
return m_version;
|
||||
return m_sf2File;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LMMS_HAVE_STK
|
||||
const QString & stkDir() const
|
||||
@@ -193,16 +147,55 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
const QString & defaultSoundfont() const
|
||||
const QString & gigDir() const
|
||||
{
|
||||
return m_defaultSoundfont;
|
||||
return m_gigDir;
|
||||
}
|
||||
#endif
|
||||
|
||||
const QString & backgroundArtwork() const
|
||||
|
||||
QString userVstDir() const
|
||||
{
|
||||
return m_backgroundArtwork;
|
||||
return m_vstDir;
|
||||
}
|
||||
|
||||
QString userLadspaDir() const
|
||||
{
|
||||
return workingDir() + LADSPA_PATH;
|
||||
}
|
||||
|
||||
QString userSf2Dir() const
|
||||
{
|
||||
return workingDir() + SF2_PATH;
|
||||
}
|
||||
|
||||
QString userGigDir() const
|
||||
{
|
||||
return workingDir() + GIG_PATH;
|
||||
}
|
||||
|
||||
QString defaultThemeDir() const
|
||||
{
|
||||
return m_dataDir + DEFAULT_THEME_PATH;
|
||||
}
|
||||
|
||||
QString themeDir() const
|
||||
{
|
||||
return m_themeDir;
|
||||
}
|
||||
|
||||
const QString & backgroundPicFile() const
|
||||
{
|
||||
return m_backgroundPicFile;
|
||||
}
|
||||
|
||||
QString trackIconsDir() const
|
||||
{
|
||||
return m_dataDir + TRACK_ICON_PATH;
|
||||
}
|
||||
|
||||
const QString recoveryFile() const
|
||||
{
|
||||
return m_workingDir + "recover.mmp";
|
||||
}
|
||||
|
||||
inline const QStringList & recentlyOpenedProjects() const
|
||||
@@ -210,39 +203,51 @@ public:
|
||||
return m_recentlyOpenedProjects;
|
||||
}
|
||||
|
||||
QString localeDir() const
|
||||
{
|
||||
return m_dataDir + LOCALE_PATH;
|
||||
}
|
||||
|
||||
const QString & version() const
|
||||
{
|
||||
return m_version;
|
||||
}
|
||||
|
||||
QString defaultVersion() const;
|
||||
|
||||
|
||||
static QStringList availabeVstEmbedMethods();
|
||||
QString vstEmbedMethod() const;
|
||||
|
||||
// returns true if the working dir (e.g. ~/lmms) exists on disk
|
||||
// Returns true if the working dir (e.g. ~/lmms) exists on disk.
|
||||
bool hasWorkingDir() const;
|
||||
|
||||
void addRecentlyOpenedProject( const QString & _file );
|
||||
void addRecentlyOpenedProject(const QString & _file);
|
||||
|
||||
const QString & value( const QString & cls,
|
||||
const QString & attribute ) const;
|
||||
const QString & value( const QString & cls,
|
||||
const QString & value(const QString & cls,
|
||||
const QString & attribute) const;
|
||||
const QString & value(const QString & cls,
|
||||
const QString & attribute,
|
||||
const QString & defaultVal ) const;
|
||||
void setValue( const QString & cls, const QString & attribute,
|
||||
const QString & value );
|
||||
void deleteValue( const QString & cls, const QString & attribute);
|
||||
const QString & defaultVal) const;
|
||||
void setValue(const QString & cls, const QString & attribute,
|
||||
const QString & value);
|
||||
void deleteValue(const QString & cls, const QString & attribute);
|
||||
|
||||
void loadConfigFile( const QString & configFile = "" );
|
||||
void loadConfigFile(const QString & configFile = "");
|
||||
void saveConfigFile();
|
||||
|
||||
|
||||
void setWorkingDir( const QString & _wd );
|
||||
void setVSTDir( const QString & _vd );
|
||||
void setArtworkDir( const QString & _ad );
|
||||
void setLADSPADir( const QString & _fd );
|
||||
void setVersion( const QString & _cv );
|
||||
void setSTKDir( const QString & _fd );
|
||||
void setDefaultSoundfont( const QString & _sf );
|
||||
void setBackgroundArtwork( const QString & _ba );
|
||||
void setGIGDir( const QString & gd );
|
||||
void setSF2Dir( const QString & sfd );
|
||||
void setWorkingDir(const QString & workingDir);
|
||||
void setVSTDir(const QString & vstDir);
|
||||
void setLADSPADir(const QString & ladspaDir);
|
||||
void setSF2Dir(const QString & sf2Dir);
|
||||
void setSF2File(const QString & sf2File);
|
||||
void setSTKDir(const QString & stkDir);
|
||||
void setGIGDir(const QString & gigDir);
|
||||
void setThemeDir(const QString & themeDir);
|
||||
void setBackgroundPicFile(const QString & backgroundPicFile);
|
||||
|
||||
// creates the working directory & subdirectories on disk.
|
||||
// Creates the working directory & subdirectories on disk.
|
||||
void createWorkingDir();
|
||||
|
||||
signals:
|
||||
@@ -252,29 +257,29 @@ private:
|
||||
static ConfigManager * s_instanceOfMe;
|
||||
|
||||
ConfigManager();
|
||||
ConfigManager( const ConfigManager & _c );
|
||||
ConfigManager(const ConfigManager & _c);
|
||||
~ConfigManager();
|
||||
|
||||
void upgrade_1_1_90();
|
||||
void upgrade_1_1_91();
|
||||
void upgrade();
|
||||
|
||||
QString m_lmmsRcFile;
|
||||
QString m_workingDir;
|
||||
QString m_dataDir;
|
||||
QString m_artworkDir;
|
||||
QString m_vstDir;
|
||||
QString m_ladDir;
|
||||
QString m_gigDir;
|
||||
QString m_ladspaDir;
|
||||
QString m_sf2Dir;
|
||||
QString m_version;
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
QString m_sf2File;
|
||||
#endif
|
||||
#ifdef LMMS_HAVE_STK
|
||||
QString m_stkDir;
|
||||
#endif
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
QString m_defaultSoundfont;
|
||||
#endif
|
||||
QString m_backgroundArtwork;
|
||||
QString m_gigDir;
|
||||
QString m_themeDir;
|
||||
QString m_backgroundPicFile;
|
||||
QString m_lmmsRcFile;
|
||||
QString m_version;
|
||||
QStringList m_recentlyOpenedProjects;
|
||||
|
||||
typedef QVector<QPair<QString, QString> > stringPairVector;
|
||||
@@ -283,7 +288,5 @@ private:
|
||||
|
||||
|
||||
friend class LmmsCore;
|
||||
|
||||
} ;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* SetupDialog.h - dialog for setting up LMMS
|
||||
*
|
||||
@@ -23,20 +22,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SETUP_DIALOG_H
|
||||
#define SETUP_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtCore/QMap>
|
||||
|
||||
#include "AudioDevice.h"
|
||||
#include "AudioDeviceSetupWidget.h"
|
||||
#include "LedCheckbox.h"
|
||||
#include "lmmsconfig.h"
|
||||
#include "AudioDevice.h"
|
||||
#include "MidiClient.h"
|
||||
#include "MidiSetupWidget.h"
|
||||
|
||||
#include "AudioDeviceSetupWidget.h"
|
||||
|
||||
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
@@ -48,17 +47,18 @@ class TabBar;
|
||||
class SetupDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum ConfigTabs
|
||||
{
|
||||
GeneralSettings,
|
||||
PathSettings,
|
||||
PerformanceSettings,
|
||||
AudioSettings,
|
||||
MidiSettings
|
||||
} ;
|
||||
MidiSettings,
|
||||
PathsSettings
|
||||
};
|
||||
|
||||
SetupDialog( ConfigTabs _tab_to_open = GeneralSettings );
|
||||
SetupDialog(ConfigTabs tab_to_open = GeneralSettings);
|
||||
virtual ~SetupDialog();
|
||||
|
||||
|
||||
@@ -67,148 +67,136 @@ protected slots:
|
||||
|
||||
|
||||
private slots:
|
||||
// general settings widget
|
||||
void setBufferSize( int _value );
|
||||
void resetBufSize();
|
||||
// General settings widget.
|
||||
void toggleDisplaydBFS(bool enabled);
|
||||
void toggleTooltips(bool enabled);
|
||||
void toggleDisplayWaveform(bool enabled);
|
||||
void toggleNoteLabels(bool enabled);
|
||||
void toggleCompactTrackButtons(bool enabled);
|
||||
void toggleOneInstrumentTrackWindow(bool enabled);
|
||||
void toggleMMPZ(bool enabled);
|
||||
void toggleDisableBackup(bool enabled);
|
||||
void toggleOpenLastProject(bool enabled);
|
||||
void setLanguage(int lang);
|
||||
|
||||
// path settings widget
|
||||
void setWorkingDir( const QString & _wd );
|
||||
void setVSTDir( const QString & _vd );
|
||||
void setGIGDir( const QString & _gd );
|
||||
void setSF2Dir( const QString & _sfd );
|
||||
void setArtworkDir( const QString & _ad );
|
||||
void setLADSPADir( const QString & _ld );
|
||||
void setSTKDir( const QString & _sd );
|
||||
void setDefaultSoundfont( const QString & _sf );
|
||||
void setBackgroundArtwork( const QString & _ba );
|
||||
|
||||
// performance settings widget
|
||||
void setAutoSaveInterval( int time );
|
||||
// Performance settings widget.
|
||||
void setAutoSaveInterval(int time);
|
||||
void resetAutoSave();
|
||||
|
||||
// audio settings widget
|
||||
void audioInterfaceChanged( const QString & _driver );
|
||||
|
||||
// MIDI settings widget
|
||||
void midiInterfaceChanged( const QString & _driver );
|
||||
|
||||
|
||||
void toggleToolTips( bool _enabled );
|
||||
void toggleWarnAfterSetup( bool _enabled );
|
||||
void toggleDisplaydBFS( bool _enabled );
|
||||
void toggleMMPZ( bool _enabled );
|
||||
void toggleDisableBackup( bool _enabled );
|
||||
void toggleOpenLastProject( bool _enabled );
|
||||
void toggleHQAudioDev( bool _enabled );
|
||||
|
||||
void openWorkingDir();
|
||||
void openVSTDir();
|
||||
void openGIGDir();
|
||||
void openSF2Dir();
|
||||
void openArtworkDir();
|
||||
void openLADSPADir();
|
||||
void openSTKDir();
|
||||
void openDefaultSoundfont();
|
||||
void openBackgroundArtwork();
|
||||
|
||||
void toggleSmoothScroll( bool _enabled );
|
||||
void toggleAutoSave( bool _enabled );
|
||||
void toggleRunningAutoSave( bool _enabled );
|
||||
void toggleOneInstrumentTrackWindow( bool _enabled );
|
||||
void toggleCompactTrackButtons( bool _enabled );
|
||||
void toggleSyncVSTPlugins( bool _enabled );
|
||||
void toggleAnimateAFP( bool _enabled );
|
||||
void toggleNoteLabels( bool en );
|
||||
void toggleDisplayWaveform( bool en );
|
||||
void toggleDisableAutoquit( bool en );
|
||||
|
||||
void toggleAutoSave(bool enabled);
|
||||
void toggleRunningAutoSave(bool enabled);
|
||||
void toggleSmoothScroll(bool enabled);
|
||||
void toggleAnimateAFP(bool enabled);
|
||||
void toggleSyncVSTPlugins(bool enabled);
|
||||
void vstEmbedMethodChanged();
|
||||
void toggleVSTAlwaysOnTop( bool en );
|
||||
void toggleVSTAlwaysOnTop(bool en);
|
||||
void toggleDisableAutoQuit(bool enabled);
|
||||
|
||||
void setLanguage( int lang );
|
||||
// Audio settings widget.
|
||||
void audioInterfaceChanged(const QString & driver);
|
||||
void toggleHQAudioDev(bool enabled);
|
||||
void setBufferSize(int value);
|
||||
void resetBufferSize();
|
||||
|
||||
// MIDI settings widget.
|
||||
void midiInterfaceChanged(const QString & driver);
|
||||
|
||||
// Paths settings widget.
|
||||
void openWorkingDir();
|
||||
void setWorkingDir(const QString & workingDir);
|
||||
void openVSTDir();
|
||||
void setVSTDir(const QString & vstDir);
|
||||
void openLADSPADir();
|
||||
void setLADSPADir(const QString & ladspaDir);
|
||||
void openSF2Dir();
|
||||
void setSF2Dir(const QString & sf2Dir);
|
||||
void openSF2File();
|
||||
void setSF2File(const QString & sf2File);
|
||||
void openGIGDir();
|
||||
void setGIGDir(const QString & gigDir);
|
||||
void openThemeDir();
|
||||
void setThemeDir(const QString & themeDir);
|
||||
void openBackgroundPicFile();
|
||||
void setBackgroundPicFile(const QString & backgroundPicFile);
|
||||
|
||||
void showRestartWarning();
|
||||
|
||||
private:
|
||||
TabBar * m_tabBar;
|
||||
|
||||
QSlider * m_bufSizeSlider;
|
||||
QLabel * m_bufSizeLbl;
|
||||
int m_bufferSize;
|
||||
|
||||
bool m_toolTips;
|
||||
bool m_warnAfterSetup;
|
||||
// General settings widgets.
|
||||
bool m_displaydBFS;
|
||||
bool m_tooltips;
|
||||
bool m_displayWaveform;
|
||||
bool m_printNoteLabels;
|
||||
bool m_compactTrackButtons;
|
||||
bool m_oneInstrumentTrackWindow;
|
||||
bool m_MMPZ;
|
||||
bool m_disableBackup;
|
||||
bool m_openLastProject;
|
||||
bool m_NaNHandler;
|
||||
bool m_hqAudioDev;
|
||||
QString m_lang;
|
||||
QStringList m_languages;
|
||||
|
||||
|
||||
QLineEdit * m_wdLineEdit;
|
||||
QLineEdit * m_vdLineEdit;
|
||||
QLineEdit * m_adLineEdit;
|
||||
QLineEdit * m_ladLineEdit;
|
||||
QLineEdit * m_gigLineEdit;
|
||||
QLineEdit * m_sf2LineEdit;
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
QLineEdit * m_sfLineEdit;
|
||||
#endif
|
||||
#ifdef LMMS_HAVE_STK
|
||||
QLineEdit * m_stkLineEdit;
|
||||
#endif
|
||||
QLineEdit * m_baLineEdit;
|
||||
|
||||
QString m_workingDir;
|
||||
QString m_vstDir;
|
||||
QString m_artworkDir;
|
||||
QString m_ladDir;
|
||||
QString m_gigDir;
|
||||
QString m_sf2Dir;
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
QString m_defaultSoundfont;
|
||||
#endif
|
||||
#ifdef LMMS_HAVE_STK
|
||||
QString m_stkDir;
|
||||
#endif
|
||||
QString m_backgroundArtwork;
|
||||
|
||||
bool m_smoothScroll;
|
||||
// Performance settings widgets.
|
||||
int m_saveInterval;
|
||||
bool m_enableAutoSave;
|
||||
bool m_enableRunningAutoSave;
|
||||
int m_saveInterval;
|
||||
QSlider * m_saveIntervalSlider;
|
||||
QLabel * m_saveIntervalLbl;
|
||||
LedCheckBox * m_autoSave;
|
||||
LedCheckBox * m_runningAutoSave;
|
||||
|
||||
bool m_oneInstrumentTrackWindow;
|
||||
bool m_compactTrackButtons;
|
||||
bool m_syncVSTPlugins;
|
||||
bool m_smoothScroll;
|
||||
bool m_animateAFP;
|
||||
bool m_printNoteLabels;
|
||||
bool m_displayWaveform;
|
||||
QLabel * m_vstEmbedLbl;
|
||||
QComboBox* m_vstEmbedComboBox;
|
||||
QString m_vstEmbedMethod;
|
||||
LedCheckBox * m_vstAlwaysOnTopCheckBox;
|
||||
bool m_vstAlwaysOnTop;
|
||||
bool m_syncVSTPlugins;
|
||||
bool m_disableAutoQuit;
|
||||
|
||||
|
||||
typedef QMap<QString, AudioDeviceSetupWidget *> AswMap;
|
||||
typedef QMap<QString, MidiSetupWidget *> MswMap;
|
||||
typedef QMap<QString, QString> trMap;
|
||||
|
||||
// Audio settings widgets.
|
||||
QComboBox * m_audioInterfaces;
|
||||
AswMap m_audioIfaceSetupWidgets;
|
||||
trMap m_audioIfaceNames;
|
||||
bool m_NaNHandler;
|
||||
bool m_hqAudioDev;
|
||||
int m_bufferSize;
|
||||
QSlider * m_bufferSizeSlider;
|
||||
QLabel * m_bufferSizeLbl;
|
||||
|
||||
// MIDI settings widgets.
|
||||
QComboBox * m_midiInterfaces;
|
||||
MswMap m_midiIfaceSetupWidgets;
|
||||
trMap m_midiIfaceNames;
|
||||
|
||||
QComboBox* m_vstEmbedComboBox;
|
||||
QString m_vstEmbedMethod;
|
||||
LedCheckBox * m_vstAlwaysOnTopCheckBox;
|
||||
bool m_vstAlwaysOnTop;
|
||||
} ;
|
||||
|
||||
|
||||
// Paths settings widgets.
|
||||
QString m_workingDir;
|
||||
QString m_vstDir;
|
||||
QString m_ladspaDir;
|
||||
QString m_gigDir;
|
||||
QString m_sf2Dir;
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
QString m_sf2File;
|
||||
#endif
|
||||
QString m_themeDir;
|
||||
QString m_backgroundPicFile;
|
||||
|
||||
QLineEdit * m_workingDirLineEdit;
|
||||
QLineEdit * m_vstDirLineEdit;
|
||||
QLineEdit * m_themeDirLineEdit;
|
||||
QLineEdit * m_ladspaDirLineEdit;
|
||||
QLineEdit * m_gigDirLineEdit;
|
||||
QLineEdit * m_sf2DirLineEdit;
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
QLineEdit * m_sf2FileLineEdit;
|
||||
#endif
|
||||
QLineEdit * m_backgroundPicFileLineEdit;
|
||||
|
||||
QLabel * restartWarningLbl;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -103,7 +103,7 @@ bool MidiImport::tryImport( TrackContainer* tc )
|
||||
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
if( gui != NULL &&
|
||||
ConfigManager::inst()->defaultSoundfont().isEmpty() )
|
||||
ConfigManager::inst()->sf2File().isEmpty() )
|
||||
{
|
||||
QMessageBox::information( gui->mainWindow(),
|
||||
tr( "Setup incomplete" ),
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
if( it_inst )
|
||||
{
|
||||
isSF2 = true;
|
||||
it_inst->loadFile( ConfigManager::inst()->defaultSoundfont() );
|
||||
it_inst->loadFile( ConfigManager::inst()->sf2File() );
|
||||
it_inst->childModel( "bank" )->setValue( 0 );
|
||||
it_inst->childModel( "patch" )->setValue( 0 );
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) :
|
||||
m_chorusDepth.setInitValue(settingVal);
|
||||
#endif
|
||||
|
||||
loadFile( ConfigManager::inst()->defaultSoundfont() );
|
||||
loadFile( ConfigManager::inst()->sf2File() );
|
||||
|
||||
updateSampleRate();
|
||||
updateReverbOn();
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <QDomElement>
|
||||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
@@ -36,9 +37,10 @@
|
||||
|
||||
#include "lmmsversion.h"
|
||||
|
||||
static inline QString ensureTrailingSlash( const QString & s )
|
||||
|
||||
static inline QString ensureTrailingSlash(const QString & s )
|
||||
{
|
||||
if( ! s.isEmpty() && !s.endsWith('/') && !s.endsWith('\\') )
|
||||
if(! s.isEmpty() && !s.endsWith('/') && !s.endsWith('\\'))
|
||||
{
|
||||
return s + '/';
|
||||
}
|
||||
@@ -50,14 +52,14 @@ ConfigManager * ConfigManager::s_instanceOfMe = NULL;
|
||||
|
||||
|
||||
ConfigManager::ConfigManager() :
|
||||
m_lmmsRcFile( QDir::home().absolutePath() +"/.lmmsrc.xml" ),
|
||||
m_workingDir( QStandardPaths::writableLocation( QStandardPaths::DocumentsLocation ) + "/lmms/"),
|
||||
m_dataDir( "data:/" ),
|
||||
m_artworkDir( defaultArtworkDir() ),
|
||||
m_vstDir( m_workingDir + "vst/" ),
|
||||
m_gigDir( m_workingDir + GIG_PATH ),
|
||||
m_sf2Dir( m_workingDir + SF2_PATH ),
|
||||
m_version( defaultVersion() )
|
||||
m_workingDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/lmms/"),
|
||||
m_dataDir("data:/"),
|
||||
m_vstDir(m_workingDir + "vst/"),
|
||||
m_sf2Dir(m_workingDir + SF2_PATH),
|
||||
m_gigDir(m_workingDir + GIG_PATH),
|
||||
m_themeDir(defaultThemeDir()),
|
||||
m_lmmsRcFile(QDir::home().absolutePath() +"/.lmmsrc.xml"),
|
||||
m_version(defaultVersion())
|
||||
{
|
||||
// Detect < 1.2.0 working directory as a courtesy
|
||||
if ( QFileInfo( QDir::home().absolutePath() + "/lmms/projects/" ).exists() )
|
||||
@@ -125,19 +127,19 @@ ConfigManager::~ConfigManager()
|
||||
void ConfigManager::upgrade_1_1_90()
|
||||
{
|
||||
// Remove trailing " (bad latency!)" string which was once saved with PulseAudio
|
||||
if( value( "mixer", "audiodev" ).startsWith( "PulseAudio (" ) )
|
||||
if(value("mixer", "audiodev").startsWith("PulseAudio ("))
|
||||
{
|
||||
setValue("mixer", "audiodev", "PulseAudio");
|
||||
}
|
||||
|
||||
// MidiAlsaRaw used to store the device info as "Device" instead of "device"
|
||||
if ( value( "MidiAlsaRaw", "device" ).isNull() )
|
||||
if (value("MidiAlsaRaw", "device").isNull())
|
||||
{
|
||||
// copy "device" = "Device" and then delete the old "Device" (further down)
|
||||
QString oldDevice = value( "MidiAlsaRaw", "Device" );
|
||||
QString oldDevice = value("MidiAlsaRaw", "Device");
|
||||
setValue("MidiAlsaRaw", "device", oldDevice);
|
||||
}
|
||||
if ( !value( "MidiAlsaRaw", "device" ).isNull() )
|
||||
if (!value("MidiAlsaRaw", "device").isNull())
|
||||
{
|
||||
// delete the old "Device" in the case that we just copied it to "device"
|
||||
// or if the user somehow set both the "Device" and "device" fields
|
||||
@@ -149,9 +151,9 @@ void ConfigManager::upgrade_1_1_90()
|
||||
void ConfigManager::upgrade_1_1_91()
|
||||
{
|
||||
// rename displaydbv to displaydbfs
|
||||
if ( !value( "app", "displaydbv" ).isNull() ) {
|
||||
setValue( "app", "displaydbfs", value( "app", "displaydbv" ) );
|
||||
deleteValue( "app", "displaydbv" );
|
||||
if (!value("app", "displaydbv").isNull()) {
|
||||
setValue("app", "displaydbfs", value("app", "displaydbv"));
|
||||
deleteValue("app", "displaydbv");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,27 +161,27 @@ void ConfigManager::upgrade_1_1_91()
|
||||
void ConfigManager::upgrade()
|
||||
{
|
||||
// Skip the upgrade if versions match
|
||||
if ( m_version == LMMS_VERSION )
|
||||
if (m_version == LMMS_VERSION)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ProjectVersion createdWith = m_version;
|
||||
|
||||
if ( createdWith.setCompareType(ProjectVersion::Build) < "1.1.90" )
|
||||
if (createdWith.setCompareType(ProjectVersion::Build) < "1.1.90")
|
||||
{
|
||||
upgrade_1_1_90();
|
||||
}
|
||||
|
||||
if ( createdWith.setCompareType(ProjectVersion::Build) < "1.1.91" )
|
||||
if (createdWith.setCompareType(ProjectVersion::Build) < "1.1.91")
|
||||
{
|
||||
upgrade_1_1_91();
|
||||
}
|
||||
|
||||
// Don't use old themes as they break the UI (i.e. 0.4 != 1.0, etc)
|
||||
if ( createdWith.setCompareType(ProjectVersion::Minor) != LMMS_VERSION )
|
||||
if (createdWith.setCompareType(ProjectVersion::Minor) != LMMS_VERSION)
|
||||
{
|
||||
m_artworkDir = defaultArtworkDir();
|
||||
m_themeDir = defaultThemeDir();
|
||||
}
|
||||
|
||||
// Bump the version, now that we are upgraded
|
||||
@@ -221,107 +223,115 @@ QString ConfigManager::vstEmbedMethod() const
|
||||
|
||||
bool ConfigManager::hasWorkingDir() const
|
||||
{
|
||||
return QDir( m_workingDir ).exists();
|
||||
return QDir(m_workingDir).exists();
|
||||
}
|
||||
|
||||
|
||||
void ConfigManager::setWorkingDir( const QString & wd )
|
||||
void ConfigManager::setWorkingDir(const QString & workingDir)
|
||||
{
|
||||
m_workingDir = ensureTrailingSlash( QDir::cleanPath( wd ) );
|
||||
m_workingDir = ensureTrailingSlash(QDir::cleanPath(workingDir));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ConfigManager::setVSTDir( const QString & _vd )
|
||||
void ConfigManager::setVSTDir(const QString & vstDir)
|
||||
{
|
||||
m_vstDir = ensureTrailingSlash( _vd );
|
||||
m_vstDir = ensureTrailingSlash(vstDir);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ConfigManager::setArtworkDir( const QString & _ad )
|
||||
void ConfigManager::setLADSPADir(const QString & ladspaDir)
|
||||
{
|
||||
m_artworkDir = ensureTrailingSlash( _ad );
|
||||
m_ladspaDir = ladspaDir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ConfigManager::setLADSPADir( const QString & _fd )
|
||||
{
|
||||
m_ladDir = _fd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ConfigManager::setSTKDir( const QString & _fd )
|
||||
void ConfigManager::setSTKDir(const QString & stkDir)
|
||||
{
|
||||
#ifdef LMMS_HAVE_STK
|
||||
m_stkDir = ensureTrailingSlash( _fd );
|
||||
m_stkDir = ensureTrailingSlash(stkDir);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ConfigManager::setDefaultSoundfont( const QString & _sf )
|
||||
void ConfigManager::setSF2Dir(const QString & sf2Dir)
|
||||
{
|
||||
m_sf2Dir = sf2Dir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ConfigManager::setSF2File(const QString & sf2File)
|
||||
{
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
m_defaultSoundfont = _sf;
|
||||
m_sf2File = sf2File;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ConfigManager::setBackgroundArtwork( const QString & _ba )
|
||||
void ConfigManager::setGIGDir(const QString & gigDir)
|
||||
{
|
||||
m_backgroundArtwork = _ba;
|
||||
m_gigDir = gigDir;
|
||||
}
|
||||
|
||||
void ConfigManager::setGIGDir(const QString &gd)
|
||||
|
||||
|
||||
|
||||
void ConfigManager::setThemeDir(const QString & themeDir)
|
||||
{
|
||||
m_gigDir = gd;
|
||||
m_themeDir = ensureTrailingSlash(themeDir);
|
||||
}
|
||||
|
||||
void ConfigManager::setSF2Dir(const QString &sfd)
|
||||
|
||||
|
||||
|
||||
void ConfigManager::setBackgroundPicFile(const QString & backgroundPicFile)
|
||||
{
|
||||
m_sf2Dir = sfd;
|
||||
m_backgroundPicFile = backgroundPicFile;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ConfigManager::createWorkingDir()
|
||||
{
|
||||
QDir().mkpath( m_workingDir );
|
||||
QDir().mkpath(m_workingDir);
|
||||
|
||||
QDir().mkpath( userProjectsDir() );
|
||||
QDir().mkpath( userTemplateDir() );
|
||||
QDir().mkpath( userSamplesDir() );
|
||||
QDir().mkpath( userPresetsDir() );
|
||||
QDir().mkpath( userGigDir() );
|
||||
QDir().mkpath( userSf2Dir() );
|
||||
QDir().mkpath( userVstDir() );
|
||||
QDir().mkpath( userLadspaDir() );
|
||||
QDir().mkpath(userProjectsDir());
|
||||
QDir().mkpath(userTemplateDir());
|
||||
QDir().mkpath(userSamplesDir());
|
||||
QDir().mkpath(userPresetsDir());
|
||||
QDir().mkpath(userGigDir());
|
||||
QDir().mkpath(userSf2Dir());
|
||||
QDir().mkpath(userVstDir());
|
||||
QDir().mkpath(userLadspaDir());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ConfigManager::addRecentlyOpenedProject( const QString & file )
|
||||
void ConfigManager::addRecentlyOpenedProject(const QString & file)
|
||||
{
|
||||
QFileInfo recentFile( file );
|
||||
if( recentFile.suffix().toLower() == "mmp" ||
|
||||
QFileInfo recentFile(file);
|
||||
if(recentFile.suffix().toLower() == "mmp" ||
|
||||
recentFile.suffix().toLower() == "mmpz" ||
|
||||
recentFile.suffix().toLower() == "mpt" )
|
||||
recentFile.suffix().toLower() == "mpt")
|
||||
{
|
||||
m_recentlyOpenedProjects.removeAll( file );
|
||||
if( m_recentlyOpenedProjects.size() > 50 )
|
||||
m_recentlyOpenedProjects.removeAll(file);
|
||||
if(m_recentlyOpenedProjects.size() > 50)
|
||||
{
|
||||
m_recentlyOpenedProjects.removeLast();
|
||||
}
|
||||
m_recentlyOpenedProjects.push_front( file );
|
||||
m_recentlyOpenedProjects.push_front(file);
|
||||
ConfigManager::inst()->saveConfigFile();
|
||||
}
|
||||
}
|
||||
@@ -329,18 +339,18 @@ void ConfigManager::addRecentlyOpenedProject( const QString & file )
|
||||
|
||||
|
||||
|
||||
const QString & ConfigManager::value( const QString & cls,
|
||||
const QString & attribute ) const
|
||||
const QString & ConfigManager::value(const QString & cls,
|
||||
const QString & attribute) const
|
||||
{
|
||||
if( m_settings.contains( cls ) )
|
||||
if(m_settings.contains(cls))
|
||||
{
|
||||
for( stringPairVector::const_iterator it =
|
||||
for(stringPairVector::const_iterator it =
|
||||
m_settings[cls].begin();
|
||||
it != m_settings[cls].end(); ++it )
|
||||
it != m_settings[cls].end(); ++it)
|
||||
{
|
||||
if( ( *it ).first == attribute )
|
||||
if((*it).first == attribute)
|
||||
{
|
||||
return ( *it ).second ;
|
||||
return (*it).second ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,49 +360,49 @@ const QString & ConfigManager::value( const QString & cls,
|
||||
|
||||
|
||||
|
||||
const QString & ConfigManager::value( const QString & cls,
|
||||
const QString & ConfigManager::value(const QString & cls,
|
||||
const QString & attribute,
|
||||
const QString & defaultVal ) const
|
||||
const QString & defaultVal) const
|
||||
{
|
||||
const QString & val = value( cls, attribute );
|
||||
const QString & val = value(cls, attribute);
|
||||
return val.isEmpty() ? defaultVal : val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ConfigManager::setValue( const QString & cls,
|
||||
void ConfigManager::setValue(const QString & cls,
|
||||
const QString & attribute,
|
||||
const QString & value )
|
||||
const QString & value)
|
||||
{
|
||||
if( m_settings.contains( cls ) )
|
||||
if(m_settings.contains(cls))
|
||||
{
|
||||
for( QPair<QString, QString>& pair : m_settings[cls])
|
||||
for(QPair<QString, QString>& pair : m_settings[cls])
|
||||
{
|
||||
if( pair.first == attribute )
|
||||
if(pair.first == attribute)
|
||||
{
|
||||
if ( pair.second != value )
|
||||
if (pair.second != value)
|
||||
{
|
||||
pair.second = value;
|
||||
emit valueChanged( cls, attribute, value );
|
||||
emit valueChanged(cls, attribute, value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// not in map yet, so we have to add it...
|
||||
m_settings[cls].push_back( qMakePair( attribute, value ) );
|
||||
m_settings[cls].push_back(qMakePair(attribute, value));
|
||||
}
|
||||
|
||||
|
||||
void ConfigManager::deleteValue( const QString & cls, const QString & attribute)
|
||||
void ConfigManager::deleteValue(const QString & cls, const QString & attribute)
|
||||
{
|
||||
if( m_settings.contains( cls ) )
|
||||
if(m_settings.contains(cls))
|
||||
{
|
||||
for( stringPairVector::iterator it = m_settings[cls].begin();
|
||||
it != m_settings[cls].end(); ++it )
|
||||
for(stringPairVector::iterator it = m_settings[cls].begin();
|
||||
it != m_settings[cls].end(); ++it)
|
||||
{
|
||||
if( ( *it ).first == attribute )
|
||||
if((*it).first == attribute)
|
||||
{
|
||||
m_settings[cls].erase(it);
|
||||
return;
|
||||
@@ -402,23 +412,23 @@ void ConfigManager::deleteValue( const QString & cls, const QString & attribute)
|
||||
}
|
||||
|
||||
|
||||
void ConfigManager::loadConfigFile( const QString & configFile )
|
||||
void ConfigManager::loadConfigFile(const QString & configFile)
|
||||
{
|
||||
// read the XML file and create DOM tree
|
||||
// Allow configuration file override through --config commandline option
|
||||
if ( !configFile.isEmpty() )
|
||||
if (!configFile.isEmpty())
|
||||
{
|
||||
m_lmmsRcFile = configFile;
|
||||
}
|
||||
|
||||
QFile cfg_file( m_lmmsRcFile );
|
||||
QFile cfg_file(m_lmmsRcFile);
|
||||
QDomDocument dom_tree;
|
||||
|
||||
if( cfg_file.open( QIODevice::ReadOnly ) )
|
||||
if(cfg_file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
QString errorString;
|
||||
int errorLine, errorCol;
|
||||
if( dom_tree.setContent( &cfg_file, false, &errorString, &errorLine, &errorCol ) )
|
||||
if(dom_tree.setContent(&cfg_file, false, &errorString, &errorLine, &errorCol))
|
||||
{
|
||||
// get the head information from the DOM
|
||||
QDomElement root = dom_tree.documentElement();
|
||||
@@ -426,41 +436,41 @@ void ConfigManager::loadConfigFile( const QString & configFile )
|
||||
QDomNode node = root.firstChild();
|
||||
|
||||
// Cache the config version for upgrade()
|
||||
if ( !root.attribute( "version" ).isNull() ) {
|
||||
m_version = root.attribute( "version" );
|
||||
if (!root.attribute("version").isNull()) {
|
||||
m_version = root.attribute("version");
|
||||
}
|
||||
|
||||
// create the settings-map out of the DOM
|
||||
while( !node.isNull() )
|
||||
while(!node.isNull())
|
||||
{
|
||||
if( node.isElement() &&
|
||||
node.toElement().hasAttributes () )
|
||||
if(node.isElement() &&
|
||||
node.toElement().hasAttributes ())
|
||||
{
|
||||
stringPairVector attr;
|
||||
QDomNamedNodeMap node_attr =
|
||||
node.toElement().attributes();
|
||||
for( int i = 0; i < node_attr.count();
|
||||
++i )
|
||||
for(int i = 0; i < node_attr.count();
|
||||
++i)
|
||||
{
|
||||
QDomNode n = node_attr.item( i );
|
||||
if( n.isAttr() )
|
||||
QDomNode n = node_attr.item(i);
|
||||
if(n.isAttr())
|
||||
{
|
||||
attr.push_back( qMakePair( n.toAttr().name(),
|
||||
n.toAttr().value() ) );
|
||||
attr.push_back(qMakePair(n.toAttr().name(),
|
||||
n.toAttr().value()));
|
||||
}
|
||||
}
|
||||
m_settings[node.nodeName()] = attr;
|
||||
}
|
||||
else if( node.nodeName() == "recentfiles" )
|
||||
else if(node.nodeName() == "recentfiles")
|
||||
{
|
||||
m_recentlyOpenedProjects.clear();
|
||||
QDomNode n = node.firstChild();
|
||||
while( !n.isNull() )
|
||||
while(!n.isNull())
|
||||
{
|
||||
if( n.isElement() && n.toElement().hasAttributes() )
|
||||
if(n.isElement() && n.toElement().hasAttributes())
|
||||
{
|
||||
m_recentlyOpenedProjects <<
|
||||
n.toElement().attribute( "path" );
|
||||
n.toElement().attribute("path");
|
||||
}
|
||||
n = n.nextSibling();
|
||||
}
|
||||
@@ -468,45 +478,45 @@ void ConfigManager::loadConfigFile( const QString & configFile )
|
||||
node = node.nextSibling();
|
||||
}
|
||||
|
||||
if( value( "paths", "artwork" ) != "" )
|
||||
if(value("paths", "theme") != "")
|
||||
{
|
||||
m_artworkDir = value( "paths", "artwork" );
|
||||
m_themeDir = value("paths", "theme");
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
// Detect a QDir/QFile hang on Windows
|
||||
// see issue #3417 on github
|
||||
bool badPath = ( m_artworkDir == "/" || m_artworkDir == "\\" );
|
||||
bool badPath = (m_themeDir == "/" || m_themeDir == "\\");
|
||||
#else
|
||||
bool badPath = false;
|
||||
#endif
|
||||
|
||||
if( badPath || !QDir( m_artworkDir ).exists() ||
|
||||
!QFile( m_artworkDir + "/style.css" ).exists() )
|
||||
if(badPath || !QDir(m_themeDir).exists() ||
|
||||
!QFile(m_themeDir + "/style.css").exists())
|
||||
{
|
||||
m_artworkDir = defaultArtworkDir();
|
||||
m_themeDir = defaultThemeDir();
|
||||
}
|
||||
m_artworkDir = ensureTrailingSlash(m_artworkDir);
|
||||
m_themeDir = ensureTrailingSlash(m_themeDir);
|
||||
}
|
||||
setWorkingDir( value( "paths", "workingdir" ) );
|
||||
setWorkingDir(value("paths", "workingdir"));
|
||||
|
||||
setGIGDir( value( "paths", "gigdir" ) == "" ? gigDir() : value( "paths", "gigdir" ) );
|
||||
setSF2Dir( value( "paths", "sf2dir" ) == "" ? sf2Dir() : value( "paths", "sf2dir" ) );
|
||||
setVSTDir( value( "paths", "vstdir" ) );
|
||||
setLADSPADir( value( "paths", "laddir" ) );
|
||||
setGIGDir(value("paths", "gigdir") == "" ? gigDir() : value("paths", "gigdir"));
|
||||
setSF2Dir(value("paths", "sf2dir") == "" ? sf2Dir() : value("paths", "sf2dir"));
|
||||
setVSTDir(value("paths", "vstdir"));
|
||||
setLADSPADir(value("paths", "ladspadir"));
|
||||
#ifdef LMMS_HAVE_STK
|
||||
setSTKDir( value( "paths", "stkdir" ) );
|
||||
setSTKDir(value("paths", "stkdir"));
|
||||
#endif
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
setDefaultSoundfont( value( "paths", "defaultsf2" ) );
|
||||
setSF2File(value("paths", "defaultsf2"));
|
||||
#endif
|
||||
setBackgroundArtwork( value( "paths", "backgroundartwork" ) );
|
||||
setBackgroundPicFile(value("paths", "backgroundtheme"));
|
||||
}
|
||||
else if( gui )
|
||||
else if(gui)
|
||||
{
|
||||
QMessageBox::warning( NULL, MainWindow::tr( "Configuration file" ),
|
||||
MainWindow::tr( "Error while parsing configuration file at line %1:%2: %3" ).
|
||||
arg( errorLine ).
|
||||
arg( errorCol ).
|
||||
arg( errorString ) );
|
||||
QMessageBox::warning(NULL, MainWindow::tr("Configuration file"),
|
||||
MainWindow::tr("Error while parsing configuration file at line %1:%2: %3").
|
||||
arg(errorLine).
|
||||
arg(errorCol).
|
||||
arg(errorString));
|
||||
}
|
||||
cfg_file.close();
|
||||
}
|
||||
@@ -517,21 +527,21 @@ void ConfigManager::loadConfigFile( const QString & configFile )
|
||||
!QDir( m_vstDir ).exists() )
|
||||
{
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
QString programFiles = QString::fromLocal8Bit( getenv( "ProgramFiles" ) );
|
||||
QString programFiles = QString::fromLocal8Bit(getenv("ProgramFiles"));
|
||||
m_vstDir = programFiles + "/VstPlugins/";
|
||||
#else
|
||||
m_vstDir = m_workingDir + "plugins/vst/";
|
||||
#endif
|
||||
}
|
||||
|
||||
if( m_ladDir.isEmpty() )
|
||||
if(m_ladspaDir.isEmpty() )
|
||||
{
|
||||
m_ladDir = userLadspaDir();
|
||||
m_ladspaDir = userLadspaDir();
|
||||
}
|
||||
|
||||
#ifdef LMMS_HAVE_STK
|
||||
if( m_stkDir.isEmpty() || m_stkDir == QDir::separator() || m_stkDir == "/" ||
|
||||
!QDir( m_stkDir ).exists() )
|
||||
if(m_stkDir.isEmpty() || m_stkDir == QDir::separator() || m_stkDir == "/" ||
|
||||
!QDir(m_stkDir).exists())
|
||||
{
|
||||
#if defined(LMMS_BUILD_WIN32)
|
||||
m_stkDir = m_dataDir + "stk/rawwaves/";
|
||||
@@ -557,11 +567,11 @@ void ConfigManager::loadConfigFile( const QString & configFile )
|
||||
QStringList searchPaths;
|
||||
if(! qgetenv("LMMS_THEME_PATH").isNull())
|
||||
searchPaths << qgetenv("LMMS_THEME_PATH");
|
||||
searchPaths << artworkDir() << defaultArtworkDir();
|
||||
QDir::setSearchPaths( "resources", searchPaths);
|
||||
searchPaths << themeDir() << defaultThemeDir();
|
||||
QDir::setSearchPaths("resources", searchPaths);
|
||||
|
||||
// Create any missing subdirectories in the working dir, but only if the working dir exists
|
||||
if( hasWorkingDir() )
|
||||
if(hasWorkingDir())
|
||||
{
|
||||
createWorkingDir();
|
||||
}
|
||||
@@ -572,72 +582,72 @@ void ConfigManager::loadConfigFile( const QString & configFile )
|
||||
|
||||
void ConfigManager::saveConfigFile()
|
||||
{
|
||||
setValue( "paths", "artwork", m_artworkDir );
|
||||
setValue( "paths", "workingdir", m_workingDir );
|
||||
setValue( "paths", "vstdir", m_vstDir );
|
||||
setValue( "paths", "gigdir", m_gigDir );
|
||||
setValue( "paths", "sf2dir", m_sf2Dir );
|
||||
setValue( "paths", "laddir", m_ladDir );
|
||||
setValue("paths", "theme", m_themeDir);
|
||||
setValue("paths", "workingdir", m_workingDir);
|
||||
setValue("paths", "vstdir", m_vstDir);
|
||||
setValue("paths", "gigdir", m_gigDir);
|
||||
setValue("paths", "sf2dir", m_sf2Dir);
|
||||
setValue("paths", "ladspadir", m_ladspaDir);
|
||||
#ifdef LMMS_HAVE_STK
|
||||
setValue( "paths", "stkdir", m_stkDir );
|
||||
setValue("paths", "stkdir", m_stkDir);
|
||||
#endif
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
setValue( "paths", "defaultsf2", m_defaultSoundfont );
|
||||
setValue("paths", "defaultsf2", m_sf2File);
|
||||
#endif
|
||||
setValue( "paths", "backgroundartwork", m_backgroundArtwork );
|
||||
setValue("paths", "backgroundtheme", m_backgroundPicFile);
|
||||
|
||||
QDomDocument doc( "lmms-config-file" );
|
||||
QDomDocument doc("lmms-config-file");
|
||||
|
||||
QDomElement lmms_config = doc.createElement( "lmms" );
|
||||
lmms_config.setAttribute( "version", m_version );
|
||||
doc.appendChild( lmms_config );
|
||||
QDomElement lmms_config = doc.createElement("lmms");
|
||||
lmms_config.setAttribute("version", m_version);
|
||||
doc.appendChild(lmms_config);
|
||||
|
||||
for( settingsMap::iterator it = m_settings.begin();
|
||||
it != m_settings.end(); ++it )
|
||||
for(settingsMap::iterator it = m_settings.begin();
|
||||
it != m_settings.end(); ++it)
|
||||
{
|
||||
QDomElement n = doc.createElement( it.key() );
|
||||
for( stringPairVector::iterator it2 = ( *it ).begin();
|
||||
it2 != ( *it ).end(); ++it2 )
|
||||
QDomElement n = doc.createElement(it.key());
|
||||
for(stringPairVector::iterator it2 = (*it).begin();
|
||||
it2 != (*it).end(); ++it2)
|
||||
{
|
||||
n.setAttribute( ( *it2 ).first, ( *it2 ).second );
|
||||
n.setAttribute((*it2).first, (*it2).second);
|
||||
}
|
||||
lmms_config.appendChild( n );
|
||||
lmms_config.appendChild(n);
|
||||
}
|
||||
|
||||
QDomElement recent_files = doc.createElement( "recentfiles" );
|
||||
QDomElement recent_files = doc.createElement("recentfiles");
|
||||
|
||||
for( QStringList::iterator it = m_recentlyOpenedProjects.begin();
|
||||
it != m_recentlyOpenedProjects.end(); ++it )
|
||||
for(QStringList::iterator it = m_recentlyOpenedProjects.begin();
|
||||
it != m_recentlyOpenedProjects.end(); ++it)
|
||||
{
|
||||
QDomElement n = doc.createElement( "file" );
|
||||
n.setAttribute( "path", *it );
|
||||
recent_files.appendChild( n );
|
||||
QDomElement n = doc.createElement("file");
|
||||
n.setAttribute("path", *it);
|
||||
recent_files.appendChild(n);
|
||||
}
|
||||
lmms_config.appendChild( recent_files );
|
||||
lmms_config.appendChild(recent_files);
|
||||
|
||||
QString xml = "<?xml version=\"1.0\"?>\n" + doc.toString( 2 );
|
||||
QString xml = "<?xml version=\"1.0\"?>\n" + doc.toString(2);
|
||||
|
||||
QFile outfile( m_lmmsRcFile );
|
||||
if( !outfile.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
|
||||
QFile outfile(m_lmmsRcFile);
|
||||
if(!outfile.open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
{
|
||||
QString title, message;
|
||||
title = MainWindow::tr( "Could not open file" );
|
||||
message = MainWindow::tr( "Could not open file %1 "
|
||||
title = MainWindow::tr("Could not open file");
|
||||
message = MainWindow::tr("Could not open file %1 "
|
||||
"for writing.\nPlease make "
|
||||
"sure you have write "
|
||||
"permission to the file and "
|
||||
"the directory containing the "
|
||||
"file and try again!"
|
||||
).arg( m_lmmsRcFile );
|
||||
if( gui )
|
||||
).arg(m_lmmsRcFile);
|
||||
if(gui)
|
||||
{
|
||||
QMessageBox::critical( NULL, title, message,
|
||||
QMessageBox::critical(NULL, title, message,
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::NoButton );
|
||||
QMessageBox::NoButton);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
outfile.write( xml.toUtf8() );
|
||||
outfile.write(xml.toUtf8());
|
||||
outfile.close();
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ AudioJack::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
m_clientName = new QLineEdit( cn, this );
|
||||
m_clientName->setGeometry( 10, 20, 160, 20 );
|
||||
|
||||
QLabel * cn_lbl = new QLabel( tr( "CLIENT-NAME" ), this );
|
||||
QLabel * cn_lbl = new QLabel( tr( "Client name" ), this );
|
||||
cn_lbl->setFont( pointSize<7>( cn_lbl->font() ) );
|
||||
cn_lbl->setGeometry( 10, 40, 160, 10 );
|
||||
|
||||
@@ -466,7 +466,7 @@ AudioJack::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
|
||||
m_channels = new LcdSpinBox( 1, this );
|
||||
m_channels->setModel( m );
|
||||
m_channels->setLabel( tr( "CHANNELS" ) );
|
||||
m_channels->setLabel( tr( "Channels" ) );
|
||||
m_channels->move( 180, 20 );
|
||||
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ AudioOss::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
m_device = new QLineEdit( probeDevice(), this );
|
||||
m_device->setGeometry( 10, 20, 160, 20 );
|
||||
|
||||
QLabel * dev_lbl = new QLabel( tr( "DEVICE" ), this );
|
||||
QLabel * dev_lbl = new QLabel( tr( "Device" ), this );
|
||||
dev_lbl->setFont( pointSize<7>( dev_lbl->font() ) );
|
||||
dev_lbl->setGeometry( 10, 40, 160, 10 );
|
||||
|
||||
@@ -339,7 +339,7 @@ AudioOss::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
|
||||
m_channels = new LcdSpinBox( 1, this );
|
||||
m_channels->setModel( m );
|
||||
m_channels->setLabel( tr( "CHANNELS" ) );
|
||||
m_channels->setLabel( tr( "Channels" ) );
|
||||
m_channels->move( 180, 20 );
|
||||
|
||||
}
|
||||
|
||||
@@ -412,14 +412,14 @@ AudioPortAudio::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
m_backend = new ComboBox( this, "BACKEND" );
|
||||
m_backend->setGeometry( 64, 15, 260, 20 );
|
||||
|
||||
QLabel * backend_lbl = new QLabel( tr( "BACKEND" ), this );
|
||||
QLabel * backend_lbl = new QLabel( tr( "Backend" ), this );
|
||||
backend_lbl->setFont( pointSize<7>( backend_lbl->font() ) );
|
||||
backend_lbl->move( 8, 18 );
|
||||
|
||||
m_device = new ComboBox( this, "DEVICE" );
|
||||
m_device->setGeometry( 64, 35, 260, 20 );
|
||||
|
||||
QLabel * dev_lbl = new QLabel( tr( "DEVICE" ), this );
|
||||
QLabel * dev_lbl = new QLabel( tr( "Device" ), this );
|
||||
dev_lbl->setFont( pointSize<7>( dev_lbl->font() ) );
|
||||
dev_lbl->move( 8, 38 );
|
||||
|
||||
@@ -431,7 +431,7 @@ AudioPortAudio::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
|
||||
m_channels = new LcdSpinBox( 1, this );
|
||||
m_channels->setModel( m );
|
||||
m_channels->setLabel( tr( "CHANNELS" ) );
|
||||
m_channels->setLabel( tr( "Channels" ) );
|
||||
m_channels->move( 308, 20 );*/
|
||||
|
||||
connect( &m_setupUtil.m_backendModel, SIGNAL( dataChanged() ),
|
||||
|
||||
@@ -314,7 +314,7 @@ AudioPulseAudio::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
m_device = new QLineEdit( AudioPulseAudio::probeDevice(), this );
|
||||
m_device->setGeometry( 10, 20, 160, 20 );
|
||||
|
||||
QLabel * dev_lbl = new QLabel( tr( "DEVICE" ), this );
|
||||
QLabel * dev_lbl = new QLabel( tr( "Device" ), this );
|
||||
dev_lbl->setFont( pointSize<7>( dev_lbl->font() ) );
|
||||
dev_lbl->setGeometry( 10, 40, 160, 10 );
|
||||
|
||||
@@ -326,7 +326,7 @@ AudioPulseAudio::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
|
||||
m_channels = new LcdSpinBox( 1, this );
|
||||
m_channels->setModel( m );
|
||||
m_channels->setLabel( tr( "CHANNELS" ) );
|
||||
m_channels->setLabel( tr( "Channels" ) );
|
||||
m_channels->move( 180, 20 );
|
||||
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ AudioSdl::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
m_device = new QLineEdit( dev, this );
|
||||
m_device->setGeometry( 10, 20, 160, 20 );
|
||||
|
||||
QLabel * dev_lbl = new QLabel( tr( "DEVICE" ), this );
|
||||
QLabel * dev_lbl = new QLabel( tr( "Device" ), this );
|
||||
dev_lbl->setFont( pointSize<7>( dev_lbl->font() ) );
|
||||
dev_lbl->setGeometry( 10, 40, 160, 10 );
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ AudioSndio::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
m_device = new QLineEdit( "", this );
|
||||
m_device->setGeometry( 10, 20, 160, 20 );
|
||||
|
||||
QLabel * dev_lbl = new QLabel( tr( "DEVICE" ), this );
|
||||
QLabel * dev_lbl = new QLabel( tr( "Device" ), this );
|
||||
dev_lbl->setFont( pointSize<6>( dev_lbl->font() ) );
|
||||
dev_lbl->setGeometry( 10, 40, 160, 10 );
|
||||
|
||||
@@ -205,7 +205,7 @@ AudioSndio::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
|
||||
m_channels = new LcdSpinBox( 1, this );
|
||||
m_channels->setModel( m );
|
||||
m_channels->setLabel( tr( "CHANNELS" ) );
|
||||
m_channels->setLabel( tr( "Channels" ) );
|
||||
m_channels->move( 180, 20 );
|
||||
|
||||
}
|
||||
|
||||
@@ -426,14 +426,14 @@ AudioSoundIo::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
m_backend = new ComboBox( this, "BACKEND" );
|
||||
m_backend->setGeometry( 64, 15, 260, 20 );
|
||||
|
||||
QLabel * backend_lbl = new QLabel( tr( "BACKEND" ), this );
|
||||
QLabel * backend_lbl = new QLabel( tr( "Backend" ), this );
|
||||
backend_lbl->setFont( pointSize<7>( backend_lbl->font() ) );
|
||||
backend_lbl->move( 8, 18 );
|
||||
|
||||
m_device = new ComboBox( this, "DEVICE" );
|
||||
m_device->setGeometry( 64, 35, 260, 20 );
|
||||
|
||||
QLabel * dev_lbl = new QLabel( tr( "DEVICE" ), this );
|
||||
QLabel * dev_lbl = new QLabel( tr( "Device" ), this );
|
||||
dev_lbl->setFont( pointSize<7>( dev_lbl->font() ) );
|
||||
dev_lbl->move( 8, 38 );
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
|
||||
#include "AudioDeviceSetupWidget.h"
|
||||
|
||||
AudioDeviceSetupWidget::AudioDeviceSetupWidget( const QString & _caption, QWidget * _parent ) :
|
||||
TabWidget( TabWidget::tr( "Settings for %1" ).arg(TabWidget::tr( _caption.toLatin1() ) ).toUpper(),
|
||||
_parent )
|
||||
|
||||
AudioDeviceSetupWidget::AudioDeviceSetupWidget(const QString & caption, QWidget * parent) :
|
||||
TabWidget(TabWidget::tr("Settings for %1").arg(TabWidget::tr(caption.toLatin1())), parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ GuiApplication::GuiApplication()
|
||||
ConfigManager::inst()->createWorkingDir();
|
||||
}
|
||||
// Init style and palette
|
||||
QDir::addSearchPath("artwork", ConfigManager::inst()->artworkDir());
|
||||
QDir::addSearchPath("artwork", ConfigManager::inst()->defaultArtworkDir());
|
||||
QDir::addSearchPath("artwork", ConfigManager::inst()->themeDir());
|
||||
QDir::addSearchPath("artwork", ConfigManager::inst()->defaultThemeDir());
|
||||
QDir::addSearchPath("artwork", ":/artwork");
|
||||
|
||||
LmmsStyle* lmmsstyle = new LmmsStyle();
|
||||
|
||||
@@ -174,16 +174,16 @@ MainWindow::MainWindow() :
|
||||
m_workspace = new QMdiArea( splitter );
|
||||
|
||||
// Load background
|
||||
emit initProgress(tr("Loading background artwork"));
|
||||
QString bgArtwork = ConfigManager::inst()->backgroundArtwork();
|
||||
QImage bgImage;
|
||||
if( !bgArtwork.isEmpty() )
|
||||
emit initProgress(tr("Loading background picture"));
|
||||
QString backgroundPicFile = ConfigManager::inst()->backgroundPicFile();
|
||||
QImage backgroundPic;
|
||||
if( !backgroundPicFile.isEmpty() )
|
||||
{
|
||||
bgImage = QImage( bgArtwork );
|
||||
backgroundPic = QImage( backgroundPicFile );
|
||||
}
|
||||
if( !bgImage.isNull() )
|
||||
if( !backgroundPicFile.isNull() )
|
||||
{
|
||||
m_workspace->setBackground( bgImage );
|
||||
m_workspace->setBackground( backgroundPic );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -29,23 +29,22 @@
|
||||
#include "ConfigManager.h"
|
||||
#include "gui_templates.h"
|
||||
|
||||
MidiSetupWidget::MidiSetupWidget( const QString & caption, const QString & configSection,
|
||||
const QString & devName, QWidget * parent ) :
|
||||
TabWidget( TabWidget::tr( "Settings for %1" ).arg(
|
||||
tr( caption.toLatin1() ) ).toUpper(), parent ),
|
||||
MidiSetupWidget::MidiSetupWidget(const QString & caption, const QString & configSection,
|
||||
const QString & devName, QWidget * parent) :
|
||||
TabWidget(TabWidget::tr("Settings for %1").arg(tr(caption.toLatin1())), parent),
|
||||
m_configSection(configSection),
|
||||
m_device(nullptr)
|
||||
{
|
||||
// supply devName=QString() (distinct from QString(""))
|
||||
// to indicate that there is no editable DEVICE field
|
||||
// to indicate that there is no editable device field
|
||||
if (!devName.isNull())
|
||||
{
|
||||
m_device = new QLineEdit( devName, this );
|
||||
m_device->setGeometry( 10, 20, 160, 20 );
|
||||
m_device = new QLineEdit(devName, this);
|
||||
m_device->setGeometry(10, 20, 160, 20);
|
||||
|
||||
QLabel * dev_lbl = new QLabel( tr( "DEVICE" ), this );
|
||||
dev_lbl->setFont( pointSize<7>( dev_lbl->font() ) );
|
||||
dev_lbl->setGeometry( 10, 40, 160, 10 );
|
||||
QLabel * dev_lbl = new QLabel(tr("Device"), this);
|
||||
dev_lbl->setFont(pointSize<7>(dev_lbl->font()));
|
||||
dev_lbl->setGeometry(10, 40, 160, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +52,8 @@ void MidiSetupWidget::saveSettings()
|
||||
{
|
||||
if (!m_configSection.isEmpty() && m_device)
|
||||
{
|
||||
ConfigManager::inst()->setValue( m_configSection, "device",
|
||||
m_device->text() );
|
||||
ConfigManager::inst()->setValue(m_configSection, "device",
|
||||
m_device->text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,4 +64,3 @@ void MidiSetupWidget::show()
|
||||
parentWidget()->setVisible(visible);
|
||||
QWidget::setVisible(visible);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user