digiKam
advancedrenamedialog.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 : 2009-09-14
7  * Description : a rename dialog for the AdvancedRename utility
8  *
9  * Copyright (C) 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com>
10  * Copyright (C) 2013-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_ADVANCED_RENAME_DIALOG_H
26 #define DIGIKAM_ADVANCED_RENAME_DIALOG_H
27 
28 // Qt includes
29 
30 #include <QList>
31 #include <QPair>
32 #include <QTreeWidgetItem>
33 #include <QUrl>
34 #include <QDialog>
35 
36 // Local includes
37 
38 #include "iteminfo.h"
39 #include "digikam_export.h"
40 
41 class QEvent;
42 class QMoveEvent;
43 class QString;
44 class QTreeWidget;
45 
46 namespace Digikam
47 {
48 
49 class Parser;
50 
51 class DIGIKAM_GUI_EXPORT AdvancedRenameListItem : public QTreeWidgetItem
52 {
53 public:
54 
55  enum Column
56  {
57  OldName = 0,
58  NewName
59  };
60 
61 public:
62 
63  explicit AdvancedRenameListItem(QTreeWidget* const view);
64  AdvancedRenameListItem(QTreeWidget* const view, const QUrl& info);
65  ~AdvancedRenameListItem() override;
66 
67  void setImageUrl(const QUrl& url);
68  QUrl imageUrl() const;
69 
70  void setName(const QString& name);
71  QString name() const;
72 
73  void setNewName(const QString& name);
74  QString newName() const;
75 
76  void markInvalid(bool invalid);
77  bool isNameEqual() const;
78 
79 private:
80 
81  // Disable
83  AdvancedRenameListItem& operator=(const AdvancedRenameListItem&) = delete;
84 
85 private:
86 
87  class Private;
88  Private* const d;
89 };
90 
91 // --------------------------------------------------------
92 
93 typedef QPair<QUrl, QString> NewNameInfo;
95 
96 class DIGIKAM_GUI_EXPORT AdvancedRenameDialog : public QDialog
97 {
98  Q_OBJECT
99 
100 public:
101 
102  explicit AdvancedRenameDialog(QWidget* const parent = nullptr);
103  ~AdvancedRenameDialog() override;
104 
105  NewNamesList newNames() const;
106 
107 public Q_SLOTS:
108 
109  void slotAddImages(const QList<QUrl>& urls);
110 
111 private Q_SLOTS:
112 
113  void slotParseStringChanged(const QString&);
114  void slotReturnPressed();
115 
116  void slotSortActionTriggered(QAction*);
117  void slotSortDirectionTriggered(QAction*);
118 
119  void slotShowContextMenu(const QPoint&);
120  void slotHelp();
121 
122 private:
123 
124  void setupWidgets();
125  void setupConnections();
126 
127  void initDialog();
128  void readSettings();
129  void writeSettings();
130  bool checkNewNames() const;
131 
132  NewNamesList filterNewNames() const;
133 
134 private:
135 
136  // Disable
138  AdvancedRenameDialog& operator=(const AdvancedRenameDialog&) = delete;
139 
140 private:
141 
142  class Private;
143  Private* const d;
144 };
145 
146 } // namespace Digikam
147 
148 #endif // DIGIKAM_ADVANCED_RENAME_DIALOG_H
Definition: advancedrenamedialog.h:97
Definition: advancedrenamedialog.h:52
Column
Definition: advancedrenamedialog.h:56
Definition: datefolderview.cpp:43
QPair< QUrl, QString > NewNameInfo
Definition: advancedrenamedialog.h:93
QList< NewNameInfo > NewNamesList
Definition: advancedrenamedialog.h:94