digiKam
taggingactionfactory.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of Tumorprofil
4  *
5  * Date : 11.09.2015
6  *
7  * Copyright (C) 2012 by Marcel Wiesweg <marcel dot wiesweg at uk-essen dot de>
8  *
9  * This program is free software; you can redistribute it
10  * and/or modify it under the terms of the GNU General
11  * Public License as published by the Free Software Foundation;
12  * either version 2, or (at your option)
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * ============================================================ */
21 
22 #ifndef DIGIKAM_TAGGING_ACTION_FACTORY_H
23 #define DIGIKAM_TAGGING_ACTION_FACTORY_H
24 
25 // Qt includes
26 
27 #include <QList>
28 
29 // Local includes
30 
31 #include "taggingaction.h"
32 
33 namespace Digikam
34 {
35 
37 {
38 public:
39 
41  {
42  public:
43 
44  ConstraintInterface() = default;
45  virtual ~ConstraintInterface() = default;
46  virtual bool matches(int tagId) = 0;
47 
48  private:
49 
50  Q_DISABLE_COPY(ConstraintInterface)
51  };
52 
53 public:
54 
56  {
59 
62  };
63 
64 public:
65 
66  explicit TaggingActionFactory();
67  virtual ~TaggingActionFactory();
68 
70  void setFragment(const QString& fragment);
71  QString fragment() const;
72 
74  void setParentTag(int parentTagId);
75  int parentTagId() const;
76 
81  void setConstraintInterface(ConstraintInterface* const iface);
82  ConstraintInterface* constraintInterface() const;
83 
87 
89  void reset();
90 
93 
96 
98  int indexOfDefaultAction() const;
99 
101  int indexOfLastRecentAction() const;
102 
104  QString suggestedUIString(const TaggingAction& action) const;
105 
106  static TaggingAction defaultTaggingAction(const QString& tagName, int parentTagId = 0);
107 
108 private:
109 
110  // Disable
112  TaggingActionFactory& operator=(const TaggingActionFactory&) = delete;
113 
114  class Private;
115  Private* const d;
116 };
117 
118 } // namespace Digikam
119 
120 #endif // DIGIKAM_TAGGING_ACTION_FACTORY_H
Definition: taggingactionfactory.h:41
Definition: taggingactionfactory.h:37
void setParentTag(int parentTagId)
Set a tag which may by the user be intended to be the parent of a newly created tag.
Definition: taggingactionfactory.cpp:111
void reset()
reset all settings to the default (no fragment, no actions)
Definition: taggingactionfactory.cpp:154
int parentTagId() const
Definition: taggingactionfactory.cpp:106
NameMatchMode nameMatchMode() const
Definition: taggingactionfactory.cpp:149
TaggingActionFactory()
Definition: taggingactionfactory.cpp:80
QString fragment() const
Definition: taggingactionfactory.cpp:90
int indexOfDefaultAction() const
Returns the index of the default action in the list returned by generate()
Definition: taggingactionfactory.cpp:291
virtual ~TaggingActionFactory()
Definition: taggingactionfactory.cpp:85
NameMatchMode
Definition: taggingactionfactory.h:56
@ MatchContainingFragment
use the "contains" method
Definition: taggingactionfactory.h:61
@ MatchStartingWithFragment
Default: use the "startingWith" method.
Definition: taggingactionfactory.h:58
ConstraintInterface * constraintInterface() const
Definition: taggingactionfactory.cpp:133
int indexOfLastRecentAction() const
Returns the index of the last recent action in the list returned by actions()
Definition: taggingactionfactory.cpp:301
void setNameMatchMode(NameMatchMode mode)
Set the matching mode for the tag name.
Definition: taggingactionfactory.cpp:138
void setConstraintInterface(ConstraintInterface *const iface)
Definition: taggingactionfactory.cpp:122
QList< TaggingAction > actions() const
Returns the sorted list of suggested tagging actions, based on the above settings.
Definition: taggingactionfactory.cpp:164
QString suggestedUIString(const TaggingAction &action) const
Returns a string to be used in the UI for the given TaggingAction, interpreted in the context of the ...
Definition: taggingactionfactory.cpp:375
TaggingAction defaultTaggingAction() const
Returns one single action, which is decided to be the presumably best action based on the settings.
Definition: taggingactionfactory.cpp:413
void setFragment(const QString &fragment)
Set a fragment of a tag name to generate possible tags, as known from completers.
Definition: taggingactionfactory.cpp:95
Definition: taggingaction.h:36
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43