Mercurial > projects > mde
diff mde/lookup/Options.d @ 112:fe061009029d
EnumContent; log level can be selected from a popup list.
New EnumContent, with code to load translations in Items. Editable as an AStringContent.
Hacked OptionsMisc to use an EnumContent.
Implemented a EnumContentWidget providing a pop-up list to select from (still needs improving).
Moved IContent to its own module.
ContentExceptions thrown via WDCCheck now.
Fixed a small bug with reloading translations.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 13 Dec 2008 12:54:43 +0000 |
parents | 08651e8a8c51 |
children | 1b1e2297e2fc |
line wrap: on
line diff
--- a/mde/lookup/Options.d Sat Dec 06 17:41:42 2008 +0000 +++ b/mde/lookup/Options.d Sat Dec 13 12:54:43 2008 +0000 @@ -430,7 +430,23 @@ impl creates a this() function; if you want to include your own CTOR see impl's ddoc. */ const A = "bool exitImmediately; int maxThreads, logLevel, logOutput; double pollInterval; char[] L10n;"; //pragma (msg, impl!(A)); - mixin (impl!(A)); + //mixin (impl!(A)); + BoolContent exitImmediately; + IntContent maxThreads, logOutput; + EnumContent logLevel; + DoubleContent pollInterval; + StringContent L10n; + + this(char[] name){ + optionChanges = new OptionChanges; + super (name); + opts["exitImmediately"] = (exitImmediately = new BoolContent ("exitImmediately")).addCallback (&optionChanges.set); + opts["maxThreads"] = (maxThreads = new IntContent ("maxThreads")).addCallback (&optionChanges.set); + opts["logLevel"] = (logLevel = new EnumContent ("logLevel", ["Trace", "Info", "Warn", "Error", "Fatal", "None"])).addCallback (&optionChanges.set); + opts["logOutput"] = (logOutput = new IntContent ("logOutput")).addCallback (&optionChanges.set); + opts["pollInterval"] = (pollInterval = new DoubleContent ("pollInterval")).addCallback (&optionChanges.set); + opts["L10n"] = (L10n = new StringContent ("L10n")).addCallback (&optionChanges.set); + } // Overriding validate allows limits to be enforced on variables at load time. Currently // there's no infrastructure for enforcing limits when options are set at run-time. @@ -440,7 +456,7 @@ logger.warn ("maxThreads must be in the range 1-64. Defaulting to 4."); maxThreads = 4; } - if (pollInterval() !<= 1.0 || pollInterval() !>= 0.0) + if (pollInterval() !<= 0.1 || pollInterval() !>= 0.0) pollInterval = 0.01; }