Skip to content

Preferences: add a GUI control for the sparse part-file setting (/eMule/CreateSparseFiles) #653

Description

@ngosang

/eMule/CreateSparseFiles is a functional, EC-wired preference that has no control in either amule or amuleGUI. Users can only change it by hand-editing amule.conf. The amuleapi Web UI already exposes it as files.create_normal; the desktop should offer the same checkbox.

Current state

  • The pref is registered as INI-only: Preferences.cpp:1674 pushes it onto s_MiscList instead of binding it to a widget with NewCfgItem(<IDC_*>, …) the way AllocateFullFile does at Preferences.cpp:1378.
  • No IDC_* id exists, no checkbox in muuli_wdr.{h,cpp}, no handling in PrefsUnifiedDlg.cpp, and no translatable _() string — so it is absent from the message catalogs too.
  • amuleGUI shares PrefsUnifiedDlg, so it is missing in remote mode as well.

Why it matters

The setting has a real effect on how part files are created (PartFile.cpp:360-378) and it is not covered by the existing "Preallocate disk space for new files" checkbox. The three combinations behave differently:

CreateSparseFiles AllocateFullFile Behaviour
true (default) false sparse file of the full size, no real blocks committed
false false plain empty file that grows as data arrives
true plain file plus a full CAllocateFileTask preallocation

Turning sparse files off matters on filesystems where sparse allocation is unsupported, slow, or interacts badly with backup/dedup tooling, and it makes free-space accounting honest while a download is in progress.

Proposed change

Add a checkbox on the Files preferences page, next to "Preallocate disk space for new files" (muuli_wdr.cpp:1593), bound the same way:

  • new id in muuli_wdr.h (e.g. IDC_CREATEFILESSPARSE)
  • wxCheckBox in the Files page in muuli_wdr.cpp, with a tooltip
  • move the pref in Preferences.cpp:1674 from s_MiscList.push_back(...) to NewCfgItem(IDC_CREATEFILESSPARSE, new Cfg_Bool("/eMule/CreateSparseFiles", s_createFilesSparse, true))

No EC work is required: the tag is already serialized (ECSpecialMuleTags.cpp:352), applied (:766), and EC_PREFS_FILES is already in amuleGUI's exchange mask (amule-remote-gui.cpp:1152), so the control round-trips in remote mode for free.

Note the sense: the stored key is sparse (true by default), while the accessor used by EC is the inverted CreateFilesNormal() (Preferences.h:636). Whichever polarity the label uses, it must match the widget binding.

Prior art — the Web UI already ships this

The amuleapi Web UI exposes the same pref as files.create_normal on the Files tab, in the Downloads group, immediately after alloc_full_size (src/webapi/static/js/views/preferences.js:129):

{ key: "endgame", type: "bool" },
{ key: "alloc_full_size", type: "bool" },
{ key: "create_normal", type: "bool" },        // <-- here
{ key: "check_free_space", type: "bool" },

with the labels (src/webapi/static/i18n/en.json:662, es.json:662):

"prefs_field_files_create_normal": "Create new files non-sparse (allocate real disk blocks)"
"prefs_field_files_create_normal": "Crear los archivos nuevos sin huecos (reservar bloques reales en disco)"

The Web UI uses the positive create_normal sense (true = non-sparse) because that is what the API and the EC tag carry.

Acceptance criteria

  • The checkbox appears on the Files preferences page in both amule and amuleGUI.
  • Toggling it and pressing OK persists /eMule/CreateSparseFiles in amule.conf with the inverted value.
  • In amuleGUI remote mode the checkbox reflects and updates the daemon's value.
  • The new label and tooltip are wrapped in _() and appear in po/amule.pot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions