Skip to content

Commit

Permalink
Rewrite the setup dialog (#3820)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sawuare authored Sep 6, 2019
1 parent c2eefe7 commit 84d1091
Show file tree
Hide file tree
Showing 17 changed files with 1,262 additions and 1,299 deletions.
191 changes: 97 additions & 94 deletions include/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "lmms_export.h"


class LmmsCore;


Expand All @@ -57,23 +58,45 @@ 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 & workingDir() const
{
return m_workingDir;
}

const QString & dataDir() const
{
return m_dataDir;
}

const QString & workingDir() const
QString factoryProjectsDir() const
{
return m_workingDir;
return dataDir() + PROJECTS_PATH;
}

QString factoryTemplatesDir() const
{
return factoryProjectsDir() + TEMPLATE_PATH;
}

QString factoryPresetsDir() const
{
return dataDir() + PRESETS_PATH;
}

QString factorySamplesDir() const
{
return dataDir() + SAMPLES_PATH;
}


QString userProjectsDir() const
{
return workingDir() + PROJECTS_PATH;
Expand All @@ -94,155 +117,137 @@ class LMMS_EXPORT ConfigManager : public QObject
return workingDir() + SAMPLES_PATH;
}

QString userGigDir() const
{
return workingDir() + GIG_PATH;
}

QString userSf2Dir() const
{
return workingDir() + SF2_PATH;
}

QString userLadspaDir() const
const QString & vstDir() const
{
return workingDir() + LADSPA_PATH;
return m_vstDir;
}

QString userVstDir() const
const QString & ladspaDir() const
{
return m_vstDir;
return m_ladspaDir;
}

QString factoryProjectsDir() const
const QString & sf2Dir() const
{
return dataDir() + PROJECTS_PATH;
return m_sf2Dir;
}

QString factoryTemplatesDir() const
#ifdef LMMS_HAVE_FLUIDSYNTH
const QString & sf2File() const
{
return factoryProjectsDir() + TEMPLATE_PATH;
return m_sf2File;
}
#endif

QString factoryPresetsDir() const
#ifdef LMMS_HAVE_STK
const QString & stkDir() const
{
return dataDir() + PRESETS_PATH;
return m_stkDir;
}
#endif

QString factorySamplesDir() const
const QString & gigDir() const
{
return dataDir() + SAMPLES_PATH;
return m_gigDir;
}

QString defaultVersion() const;

QString defaultArtworkDir() const
QString userVstDir() const
{
return m_dataDir + DEFAULT_THEME_PATH;
return m_vstDir;
}

QString artworkDir() const
QString userLadspaDir() const
{
return m_artworkDir;
return workingDir() + LADSPA_PATH;
}

QString trackIconsDir() const
QString userSf2Dir() const
{
return m_dataDir + TRACK_ICON_PATH;
return workingDir() + SF2_PATH;
}

QString localeDir() const
QString userGigDir() const
{
return m_dataDir + LOCALE_PATH;
return workingDir() + GIG_PATH;
}

const QString & gigDir() const
QString defaultThemeDir() const
{
return m_gigDir;
return m_dataDir + DEFAULT_THEME_PATH;
}

const QString & sf2Dir() const
QString themeDir() const
{
return m_sf2Dir;
return m_themeDir;
}

const QString & vstDir() const
const QString & backgroundPicFile() const
{
return m_vstDir;
return m_backgroundPicFile;
}

const QString & ladspaDir() const
QString trackIconsDir() const
{
return m_ladDir;
return m_dataDir + TRACK_ICON_PATH;
}

const QString recoveryFile() const
{
return m_workingDir + "recover.mmp";
}

const QString & version() const
{
return m_version;
}

#ifdef LMMS_HAVE_STK
const QString & stkDir() const
inline const QStringList & recentlyOpenedProjects() const
{
return m_stkDir;
return m_recentlyOpenedProjects;
}
#endif

#ifdef LMMS_HAVE_FLUIDSYNTH
const QString & defaultSoundfont() const
QString localeDir() const
{
return m_defaultSoundfont;
return m_dataDir + LOCALE_PATH;
}
#endif

const QString & backgroundArtwork() const
const QString & version() const
{
return m_backgroundArtwork;
return m_version;
}

inline const QStringList & recentlyOpenedProjects() const
{
return m_recentlyOpenedProjects;
}
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:
Expand All @@ -252,29 +257,29 @@ class LMMS_EXPORT ConfigManager : public QObject
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;
Expand All @@ -283,7 +288,5 @@ class LMMS_EXPORT ConfigManager : public QObject


friend class LmmsCore;

} ;

};
#endif
Loading

0 comments on commit 84d1091

Please sign in to comment.