@@ -8,21 +8,40 @@ class QLabel;
88class QCheckBox ;
99class QSettings ;
1010
11+ // Dialog that lets the user define the path/name format used to organize comic
12+ // files on disk. The format is a path template where each path segment becomes a
13+ // directory, except the last one which becomes the file name (the original
14+ // extension is kept).
15+ //
16+ // Supported tokens: {publisher} {series} {number} {title} {volume} {year}
17+ // {title} falls back to {series} when the comic has no title.
1118class OrganizeFilesDialog : public QDialog
1219{
1320 Q_OBJECT
1421public:
22+ // libraryRoot and selectedFolderPath are absolute paths used to render a
23+ // realistic preview and to reflect the "relative to library root" toggle.
24+ // settings persists that toggle across runs (may be null).
1525 explicit OrganizeFilesDialog (const QString &libraryRoot,
1626 const QString &selectedFolderPath,
1727 QSettings *settings = nullptr ,
1828 QWidget *parent = nullptr );
1929
30+ // Returns the format pattern entered by the user.
2031 QString formatPattern () const ;
2132
33+ // Whether the destination should be rooted at the library root (true) or at
34+ // the currently selected folder (false).
2235 bool relativeToRoot () const ;
2336
37+ // Default format used when none has been configured yet.
2438 static QString defaultPattern ();
2539
40+ // Builds the relative destination path (directories + file name, including
41+ // the given extension) for a comic, applying token substitution and
42+ // sanitizing every path segment. The extension should include the leading
43+ // dot (e.g. ".cbz"); pass an empty string for none. When numberPadding is
44+ // greater than zero the {number} token is zero-padded to that width.
2645 static QString buildRelativePath (const QString &pattern,
2746 const QString &publisher,
2847 const QString &series,
@@ -33,8 +52,11 @@ class OrganizeFilesDialog : public QDialog
3352 const QString &extension,
3453 int numberPadding = 0 );
3554
55+ // Replaces characters that are invalid in a path segment and trims it.
3656 static QString sanitizeSegment (QString segment);
3757
58+ // Zero-pads the leading digits of an issue number to at least "width"
59+ // characters (e.g. "1" -> "01"). Non-numeric prefixes are left untouched.
3860 static QString padNumber (const QString &number, int width);
3961
4062private slots:
0 commit comments