File indexing completed on 2025-03-09 03:57:05
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-09-12 0007 * Description : parse settings class 0008 * 0009 * SPDX-FileCopyrightText: 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_PARSE_SETTINGS_H 0016 #define DIGIKAM_PARSE_SETTINGS_H 0017 0018 // Qt includes 0019 0020 #include <QDateTime> 0021 #include <QFileInfo> 0022 #include <QString> 0023 0024 // Local includes 0025 0026 #include "iteminfo.h" 0027 #include "parseresults.h" 0028 #include "advancedrenamemanager.h" 0029 0030 namespace Digikam 0031 { 0032 0033 class ParseSettings 0034 { 0035 public: 0036 0037 /// default constructor 0038 ParseSettings() 0039 { 0040 init(); 0041 }; 0042 0043 explicit ParseSettings(const QString& _parseString) 0044 : parseString(_parseString) 0045 { 0046 init(); 0047 }; 0048 0049 /// ItemInfo constructor 0050 explicit ParseSettings(const ItemInfo& info) 0051 { 0052 init(info); 0053 }; 0054 0055 ParseSettings(const QString& _parseString, const ItemInfo& info) 0056 : parseString(_parseString) 0057 { 0058 init(info); 0059 }; 0060 0061 // -------------------------------------------------------- 0062 0063 bool isValid() const 0064 { 0065 QFileInfo fi(fileUrl.toLocalFile()); 0066 return fi.isReadable(); 0067 }; 0068 0069 public: 0070 0071 QUrl fileUrl; 0072 QString parseString; 0073 QString str2Modify; 0074 QDateTime creationTime; 0075 ParseResults results; 0076 ParseResults invalidModifiers; 0077 ParseResults::ResultsKey currentResultsKey; 0078 0079 int startIndex; 0080 int cutFileName; 0081 bool useOriginalFileExtension; 0082 AdvancedRenameManager* manager; 0083 0084 private: 0085 0086 void init() 0087 { 0088 startIndex = 1; 0089 cutFileName = 0; 0090 useOriginalFileExtension = true; 0091 manager = nullptr; 0092 str2Modify.clear(); 0093 } 0094 0095 void init(const ItemInfo& info) 0096 { 0097 init(); 0098 fileUrl = info.fileUrl(); 0099 } 0100 }; 0101 0102 } // namespace Digikam 0103 0104 #endif // DIGIKAM_PARSE_SETTINGS_H