PCManFM-Qt
Toggle main menu visibility
Loading...
Searching...
No Matches
pcmanfm
bulkrename.h
1
/*
2
Copyright (C) 2017 Pedram Pourang (Tsu Jan) <tsujan2000@gmail.com>
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License along
15
with this program; if not, write to the Free Software Foundation, Inc.,
16
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
*/
18
19
#ifndef PCMANFM_BULKRENAME_H
20
#define PCMANFM_BULKRENAME_H
21
22
#include "ui_bulk-rename.h"
23
#include <QDialog>
24
25
#include <libfm-qt6/core/fileinfo.h>
26
27
namespace
PCManFM {
28
29
class
BulkRenameDialog :
public
QDialog {
30
Q_OBJECT
31
32
public
:
33
explicit
BulkRenameDialog(QWidget* parent =
nullptr
, Qt::WindowFlags flags = Qt::WindowFlags());
34
35
// renaming
36
QString getBaseName()
const
{
37
return
ui.lineEdit->text();
38
}
39
int
getStart()
const
{
40
return
ui.spinBox->value();
41
}
42
bool
getZeroPadding()
const
{
43
return
ui.zeroBox->isChecked();
44
}
45
bool
getRespectLocale()
const
{
46
return
ui.localeBox->isChecked();
47
}
48
49
// replacement
50
bool
getReplace()
const
{
51
return
ui.replaceGroupBox->isChecked();
52
}
53
QString getFindStr()
const
{
54
return
ui.findLineEdit->text();
55
}
56
QString getReplaceStr()
const
{
57
return
ui.replaceLineEdit->text();
58
}
59
Qt::CaseSensitivity getCase()
const
{
60
return
ui.caseBox->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive;
61
}
62
bool
getRegex()
const
{
63
return
ui.regexBox->isChecked();
64
}
65
66
// case change
67
bool
getCaseChange()
const
{
68
return
ui.caseGroupBox->isChecked();
69
}
70
bool
getUpperCase()
const
{
71
return
ui.upperCaseButton->isChecked();
72
}
73
74
void
setState(
const
QString& baseName,
75
const
QString& findStr,
const
QString& replaceStr,
76
bool
replacement,
bool
caseChange,
77
bool
zeroPadding,
bool
respectLocale,
bool
regex,
bool
toUpperCase,
78
int
start, Qt::CaseSensitivity cs);
79
80
protected
:
81
virtual
void
showEvent(QShowEvent* event)
override
;
82
83
private
:
84
Ui::BulkRenameDialog ui;
85
};
86
87
class
BulkRenamer {
88
public
:
89
BulkRenamer(
const
Fm::FileInfoList& files, QWidget* parent =
nullptr
);
90
~BulkRenamer();
91
92
private
:
93
bool
rename(
const
Fm::FileInfoList& files,
94
QString& baseName,
const
QLocale& locale,
95
int
start,
bool
zeroPadding,
bool
respectLocale,
96
QWidget* parent);
97
bool
renameByReplacing(
const
Fm::FileInfoList& files,
98
const
QString& findStr,
const
QString& replaceStr,
99
Qt::CaseSensitivity cs,
bool
regex,
100
QWidget* parent);
101
bool
renameByChangingCase(
const
Fm::FileInfoList& files,
const
QLocale& locale,
102
bool
toUpperCase, QWidget* parent);
103
};
104
105
}
106
107
#endif
// PCMANFM_BULKRENAME_H
Generated on
for PCManFM-Qt by
1.17.0