digiKam
parsesettings.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-12
7  * Description : parse settings class
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_PARSE_SETTINGS_H
25 #define DIGIKAM_PARSE_SETTINGS_H
26 
27 // Qt includes
28 
29 #include <QDateTime>
30 #include <QFileInfo>
31 #include <QString>
32 
33 // Local includes
34 
35 #include "iteminfo.h"
36 #include "parseresults.h"
37 #include "advancedrenamemanager.h"
38 
39 namespace Digikam
40 {
41 
43 {
44 public:
45 
48  {
49  init();
50  };
51 
52  explicit ParseSettings(const QString& _parseString)
53  : parseString(_parseString)
54  {
55  init();
56  };
57 
59  explicit ParseSettings(const ItemInfo& info)
60  {
61  init(info);
62  };
63 
64  ParseSettings(const QString& _parseString, const ItemInfo& info)
65  : parseString(_parseString)
66  {
67  init(info);
68  };
69 
70  // --------------------------------------------------------
71 
72  bool isValid() const
73  {
74  QFileInfo fi(fileUrl.toLocalFile());
75  return fi.isReadable();
76  };
77 
78 public:
79 
80  QUrl fileUrl;
81  QString parseString;
82  QString str2Modify;
83  QDateTime creationTime;
87 
91 
92 private:
93 
94  void init()
95  {
96  startIndex = 1;
98  manager = nullptr;
99  str2Modify.clear();
100  }
101 
102  void init(const ItemInfo& info)
103  {
104  init();
105  fileUrl = info.fileUrl();
106  }
107 };
108 
109 } // namespace Digikam
110 
111 #endif // DIGIKAM_PARSE_SETTINGS_H
Definition: advancedrenamemanager.h:46
Definition: iteminfo.h:78
QUrl fileUrl() const
Definition: iteminfo_properties.cpp:299
Definition: parseresults.h:37
QPair< int, int > ResultsKey
Definition: parseresults.h:40
Definition: parsesettings.h:43
ParseSettings(const ItemInfo &info)
ItemInfo constructor.
Definition: parsesettings.h:59
ParseResults invalidModifiers
Definition: parsesettings.h:85
bool useOriginalFileExtension
Definition: parsesettings.h:89
ParseSettings()
default constructor
Definition: parsesettings.h:47
ParseSettings(const QString &_parseString)
Definition: parsesettings.h:52
ParseResults results
Definition: parsesettings.h:84
QString parseString
Definition: parsesettings.h:81
QString str2Modify
Definition: parsesettings.h:82
ParseSettings(const QString &_parseString, const ItemInfo &info)
Definition: parsesettings.h:64
ParseResults::ResultsKey currentResultsKey
Definition: parsesettings.h:86
QDateTime creationTime
Definition: parsesettings.h:83
QUrl fileUrl
Definition: parsesettings.h:76
int startIndex
Definition: parsesettings.h:88
AdvancedRenameManager * manager
Definition: parsesettings.h:90
bool isValid() const
Definition: parsesettings.h:72
Definition: datefolderview.cpp:43