chooseUserStatsLocation

utils.dlgs.chooseUserStatsLocation(ParentFigure, currentFolder, options)

CHOOSEUSERSTATSLOCATION - Ask where MIB should keep the user statistics.

Syntax:

chosenFolder = chooseUserStatsLocation(ParentFigure, currentFolder)
chosenFolder = chooseUserStatsLocation(ParentFigure, currentFolder, options)

Presents the locations found by utils.getUserStatsCandidates() and lets the user pick one, or browse for any other folder. The selected folder is created before the function returns, so the caller can write a shard into it straight away with utils.saveUserStats().

The dialog is used from two places: the one-time prompt shown on the first start of MIB on a workstation (controllers.MibController.initialize) and the Set stats file… button of utils.dlgs.showMilestoneDialog(). The firstRun option only changes the wording.

Selecting a folder does not move any existing statistics. Because each workstation writes its own shard file, pointing several machines at the same shared folder is all that is needed for their statistics to add up; the dialog previews the total already stored in the highlighted folder so that the user can see this happening.

Input Arguments:
  • ParentFigure - handle to the parent window (AppContainer, uifigure or []), used to center the dialog

  • currentFolder - [char] folder currently in use, preselected in the list. Pass '' when there is none

  • options (optional) - struct with fields:

    • .mibPath - [char] MIB installation directory, used to find the window icon. Default: resolved from which('mib3')

    • .tierPointsCoef - [numeric] passed to utils.loadUserStats() for the preview. Default: 500

    • .firstRun - [logical] when true the dialog is worded as the one-time question asked on a new workstation. Default: false

Output Arguments:
  • chosenFolder - [char] full path of the selected folder, or '' when the user cancelled

Usage:

Example 1 - ask once on a new workstation

statsFolder = fileparts(obj.mibModel.preferences.System.UserStatsProfile);
chosenFolder = utils.dlgs.chooseUserStatsLocation(obj.view.gui, statsFolder, ...
    struct('mibPath', obj.mibModel.mibPath, 'firstRun', true));

See also: utils.getUserStatsCandidates, utils.loadUserStats, utils.saveUserStats, utils.dlgs.showMilestoneDialog