digiKam
advancedrenamewidget.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-05-22
7  * Description : a control widget for the AdvancedRename utility
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_WIDGET_H
25 #define DIGIKAM_ADVANCED_RENAME_WIDGET_H
26 
27 // Qt includes
28 
29 #include <QString>
30 #include <QWidget>
31 
32 // Local includes
33 
34 #include "rule.h"
35 #include "digikam_export.h"
36 
37 class QMenu;
38 
39 namespace Digikam
40 {
41 
42 class ParseSettings;
43 class Parser;
44 
45 class DIGIKAM_GUI_EXPORT AdvancedRenameWidget : public QWidget
46 {
47  Q_OBJECT
48 
49 public:
50 
52  {
54  LayoutCompact
55  };
56 
58  {
59  None = 0x0,
60  ToolTipButton = 0x1,
61  TokenButtons = 0x2,
62  ModifierToolButton = 0x4,
63  DefaultControls = TokenButtons | ToolTipButton | ModifierToolButton
64  };
65  Q_DECLARE_FLAGS(ControlWidgets, ControlWidget)
66 
67 public:
68 
69  explicit AdvancedRenameWidget(QWidget* const parent = nullptr);
70  ~AdvancedRenameWidget() override;
71 
75  QString parseString() const;
76 
82  void setParseString(const QString& text);
83 
84  void setParseTimerDuration(int milliseconds);
85 
89  void clearParseString();
90 
94  void clear();
95 
101  void setParser(Parser* parser);
102 
106  Parser* parser() const;
107 
113  QString parse(ParseSettings& settings) const;
114 
120  void setControlWidgets(ControlWidgets mask);
121 
127  void setLayoutStyle(LayoutStyle style);
128 
132  void focusLineEdit();
133 
137  void highlightLineEdit();
138 
142  void highlightLineEdit(const QString& word);
143 
144 Q_SIGNALS:
145 
146  void signalTextChanged(const QString&);
148 
149 private Q_SLOTS:
150 
151  void slotToolTipButtonToggled(bool);
152  void slotTokenMarked(bool);
153 
154 private:
155 
156  void createToolTip();
157 
158  void registerParserControls();
159  QMenu* createControlsMenu(QWidget* const parent, const RulesList& rules);
160 
161  void calculateLayout();
162 
163  void setupWidgets();
164 
165  void readSettings();
166  void writeSettings();
167 
168 private:
169 
170  // Disable
172  AdvancedRenameWidget& operator=(const AdvancedRenameWidget&) = delete;
173 
174 private:
175 
176  class Private;
177  Private* const d;
178 };
179 
180 } // namespace Digikam
181 
182 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::AdvancedRenameWidget::ControlWidgets)
183 
184 #endif // DIGIKAM_ADVANCED_RENAME_WIDGET_H
Definition: advancedrenamewidget.h:46
ControlWidget
Definition: advancedrenamewidget.h:58
void signalTextChanged(const QString &)
LayoutStyle
Definition: advancedrenamewidget.h:52
@ LayoutNormal
Definition: advancedrenamewidget.h:53
Definition: parsesettings.h:43
Definition: parser.h:45
Definition: datefolderview.cpp:43