digiKam
advancedrenamemanager.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2010-08-08
7  * Description : a class that manages the files to be renamed
8  *
9  * Copyright (C) 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_ADVANCED_RENAME_MANAGER_H
25 #define DIGIKAM_ADVANCED_RENAME_MANAGER_H
26 
27 // Qt includes
28 
29 #include <QUrl>
30 #include <QString>
31 #include <QStringList>
32 #include <QObject>
33 
34 // Local includes
35 
36 #include "digikam_export.h"
37 
38 namespace Digikam
39 {
40 
41 class AdvancedRenameWidget;
42 class Parser;
43 class ParseSettings;
44 
45 class DIGIKAM_GUI_EXPORT AdvancedRenameManager : public QObject
46 {
47  Q_OBJECT
48 
49 public:
50 
52  {
53  DefaultParser = 0,
54  ImportParser
55  };
56 
58  {
59  SortName = 0,
62  SortCustom
63  };
64 
66  {
67  SortAscending = 0,
68  SortDescending
69  };
70 
71 public:
72 
74  explicit AdvancedRenameManager(const QList<ParseSettings>& files);
75  ~AdvancedRenameManager() override;
76 
77  void addFiles(const QList<ParseSettings>& files);
78  void reset();
79 
80  void parseFiles();
81  void parseFiles(const ParseSettings& settings);
82  void parseFiles(const QString& parseString);
83  void parseFiles(const QString& parseString, const ParseSettings& settings);
84 
85  void setParserType(ParserType type);
86  Parser* getParser() const;
87 
88  void setSortAction(SortAction action);
89  SortAction sortAction() const;
90 
91  void setSortDirection(SortDirection direction);
92  SortDirection sortDirection() const;
93 
94  void setStartIndex(int index);
95 
96  void setWidget(AdvancedRenameWidget* widget);
97 
98  int indexOfFile(const QString& filename);
99  int indexOfFolder(const QString& filename);
100  int indexOfFileGroup(const QString& filename);
101  QString newName(const QString& filename) const;
102 
103  QStringList fileList() const;
104  QMap<QString, QString> newFileList(bool checkFileSystem = false) const;
105 
106 Q_SIGNALS:
107 
109 
110 private:
111 
112  void addFile(const QString& filename) const;
113  void addFile(const QString& filename, const QDateTime& datetime) const;
114  bool initialize();
115  void initializeFileList();
116  void resetState();
117 
118  QString fileGroupKey(const QString& filename) const;
119 
120  void clearMappings();
121  void clearAll();
122 
123 private:
124 
125  // Disable
126  AdvancedRenameManager(QObject*) = delete;
128  AdvancedRenameManager& operator=(const AdvancedRenameManager&) = delete;
129 
130 private:
131 
132  class Private;
133  Private* const d;
134 };
135 
136 } // namespace Digikam
137 
138 #endif // DIGIKAM_ADVANCED_RENAME_MANAGER_H
Definition: advancedrenamemanager.h:46
SortAction
Definition: advancedrenamemanager.h:58
@ SortDate
Definition: advancedrenamemanager.h:60
@ SortSize
Definition: advancedrenamemanager.h:61
SortDirection
Definition: advancedrenamemanager.h:66
ParserType
Definition: advancedrenamemanager.h:52
void signalSortingChanged(QList< QUrl >)
Definition: advancedrenamewidget.h:46
Definition: parsesettings.h:43
Definition: parser.h:45
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43
@ SortAction
Definition: itemdragdrop.cpp:65