diff -r c9b6dd9dd4cd -r a5457405cc9b src/misc.cpp --- a/src/misc.cpp Sun Aug 11 16:08:13 2013 +0300 +++ b/src/misc.cpp Sun Sep 08 16:14:58 2013 +0300 @@ -18,46 +18,37 @@ #include "misc.h" +EXTERN_CONFIG (List, devBuildNames) +EXTERN_CONFIG (List, releaseNames) +EXTERN_CONFIG (Map, binaryPaths) + uint32 makeByteID (uint8 a, uint8 b, uint8 c, uint8 d) { return a | (b << 8) | (c << 16) | (d << 24); } // ============================================================================= // ----------------------------------------------------------------------------- +QList getVersions() { + return cfg::devBuildNames + cfg::releaseNames; +} + +// ============================================================================= +// ----------------------------------------------------------------------------- str binaryConfigName (str ver) { return fmt ("binaries/%1", ver); } // ============================================================================= // ----------------------------------------------------------------------------- -list getVersionsList() { - QSettings cfg; - return cfg.value ("binarynames", list()).toList(); -} - -// ============================================================================= -// ----------------------------------------------------------------------------- -list getReleasesList() { - QSettings cfg; - return cfg.value ("releasenames", list()).toList(); -} - -// ============================================================================= -// ----------------------------------------------------------------------------- void addVersion (str name, bool isRelease, str binaryPath) { - QSettings cfg; - list versions = getVersionsList(); - versions << var (name); - cfg.setValue ("binarynames", versions); - cfg.setValue (binaryConfigName (name), binaryPath); + cfg::binaryPaths[name] = binaryPath; - if (isRelease) { - versions = getReleasesList(); - versions << var (name); - cfg.setValue ("releasenames", versions); - } + if (isRelease) + cfg::releaseNames << var (name); + else + cfg::devBuildNames << var (name); - cfg.sync(); + cfg::save(); } // ============================================================================= @@ -69,4 +60,4 @@ return path.mid (lastpos + 1); return path; -} +} \ No newline at end of file