forked from KengoSawa2/RapidCopy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainsettingdialog.cpp
265 lines (229 loc) · 9.02 KB
/
mainsettingdialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
/* ========================================================================
Project Name : Fast/Force copy file and directory
Create : 2016-02-28
Copyright : Kengo Sawatsu
Summary : 「Preference(一般設定)」 のダイアログ
Reference :
======================================================================== */
#include "mainsettingdialog.h"
#include "ui_mainsettingdialog.h"
#include "mainwindow.h"
struct VerifyInfo VERIFYINFO_LIST [] = {
{IDS_SHA1,TDigest::SHA1},
{IDS_MD5,TDigest::MD5},
{IDS_XX,TDigest::XX},
{IDS_SHA2_256,TDigest::SHA2_256},
{IDS_SHA2_512,TDigest::SHA2_512},
{IDS_SHA3_256,TDigest::SHA3_256},
{IDS_SHA3_512,TDigest::SHA3_512},
};
mainsettingDialog::mainsettingDialog(QWidget *parent,Cfg *cfg_pt) :
QDialog(parent),
ui(new Ui::mainsettingDialog)
{
ui->setupUi(this);
this->cfg = cfg_pt;
//一般タブに初期設定
//ベリファイモードリスト作成
for (int i=0; VERIFYINFO_LIST[i].resId; i++) {
ui->comboBox_VerifyMode->addItem((char*)GetLoadStrV(VERIFYINFO_LIST[i].resId));
}
ui->checkBox_rwstat->setEnabled(false);
ui->checkBox_rwstat->setVisible(false);
GetData();
ui->general_optionlist->setCurrentRow(0);
ui->checkBox_Rdahead->setVisible(false);
}
mainsettingDialog::~mainsettingDialog()
{
delete ui;
}
//EvCreate代わりのカレントコンフィグ取得->GUI設定ウインドウ
BOOL mainsettingDialog::GetData()
{
//Defaults
ui->lineEdit_Buffer->setText(QString::number(cfg->bufSize));
ui->checkBox_NonStop->setChecked(cfg->ignoreErr ? true:false);
ui->checkBox_Estimate->setChecked(cfg->estimateMode ? true:false);
ui->checkBox_ACL->setChecked(cfg->enableAcl);
ui->checkBox_Xattr->setChecked(cfg->enableXattr);
ui->checkBox_Dotignore->setChecked(cfg->Dotignore_mode);
ui->checkBox_Verify->setChecked(cfg->enableVerify);
//ui->checkBox_F_NOCACHE->setChecked(cfg->enableF_NOCACHE);
ui->checkBox_LTFS->setChecked(cfg->enableLTFS);
ui->checkBox_Owdel->setChecked(cfg->enableOwdel);
ui->checkBox_ShowExtend->setChecked(cfg->isExtendFilter);
ui->checkBox_JobList->setChecked(cfg->isJobListMode);
SetSpeedLevelLabel(cfg->speedLevel);
//I/O settings
ui->lineEdit_Iomax->setText(QString::number(cfg->maxTransSize));
ui->lineEdit_aionum->setText(QString::number(cfg->maxAionum));
ui->checkBox_O_DIRECT->setChecked(cfg->enableOdirect);
//Copy/Move Options
ui->checkBox_Samedir->setChecked(cfg->isSameDirRename);
ui->checkBox_Nocreate->setChecked(cfg->skipEmptyDir);
ui->checkBox_Symlink->setChecked(cfg->isReparse);
ui->checkBox_Movemode->setChecked(cfg->enableMoveAttr);
ui->checkBox_Moveone->setChecked(cfg->serialMove);
ui->checkBox_Moveone_verify->setChecked(cfg->serialVerifyMove);
ui->checkBox_Noutime->setChecked(cfg->isDisableutime);
ui->checkBox_Dumpdel->setChecked(cfg->enableVerifyErrDel);
//Delete Options
ui->checkBox_NSA->setChecked(cfg->enableNSA);
ui->checkBox_Delfilter->setChecked(cfg->delDirWithFilter);
//Log Settings
ui->lineEdit_Srcdstnum->setText(QString::number(cfg->maxHistoryNext));
ui->checkBox_Errlog->setChecked(cfg->isErrLog);
ui->checkBox_Filelog->setChecked(cfg->fileLogMode);
if(cfg->fileLogMode & Cfg::AUTO_FILELOG){
ui->checkBox_FilelogCSV->setChecked(cfg->fileLogMode & Cfg::ADD_CSVFILELOG ? true : false);
}
ui->checkBox_Aclerr->setChecked(cfg->aclErrLog);
ui->checkBox_Xattrerr->setChecked(cfg->streamErrLog);
//Misc
ui->checkBox_Dontwait->setChecked(cfg->forceStart ? true : false);
ui->checkBox_Confirm_exe->setChecked(cfg->execConfirm);
ui->checkBox_Taskminimize->setChecked(cfg->taskbarMode);
switch(cfg->infoSpan){
case 0:
ui->radioButton_250ms->setChecked(true);
break;
case 1:
ui->radioButton_500ms->setChecked(true);
break;
case 2:
ui->radioButton_1000ms->setChecked(true);
break;
default:
ui->radioButton_500ms->setChecked(true);
break;
}
ui->checkBox_EnglishUI->setChecked(cfg->lcid == QLocale::Japanese ? false : true);
ui->comboBox_VerifyMode->setCurrentIndex(cfg->usingMD5);
ui->checkBox_rwstat->setChecked(cfg->rwstat);
return TRUE;
}
int mainsettingDialog::SetSpeedLevelLabel(int level)
{
if (level == -1){
level = ui->slider_Speed->value();
}
else{
ui->slider_Speed->setValue(level);
}
char buf[64];
sprintf(buf,
level == SPEED_FULL ? (char*)GetLoadStrV(IDS_FULLSPEED_DISP) :
level == SPEED_AUTO ? (char*)GetLoadStrV(IDS_AUTOSLOW_DISP) :
level == SPEED_SUSPEND ? (char*)GetLoadStrV(IDS_SUSPEND_DISP) :
(char*)GetLoadStrV(IDS_RATE_DISP),
level);
ui->label_Realspeed->setText(buf);
return level;
}
BOOL mainsettingDialog::SetData()
{
//Defaults
cfg->bufSize = ui->lineEdit_Buffer->text().toInt();
cfg->ignoreErr = ui->checkBox_NonStop->checkState() ? 1 : 0;
cfg->estimateMode = ui->checkBox_Estimate->checkState() ? 1 : 0;
cfg->enableAcl = ui->checkBox_ACL->checkState();
cfg->enableXattr = ui->checkBox_Xattr->checkState();
cfg->enableVerify = ui->checkBox_Verify->checkState();
//cfg->enableF_NOCACHE = ui->checkBox_F_NOCACHE->checkState();
cfg->enableOwdel = ui->checkBox_Owdel->checkState();
cfg->isExtendFilter = ui->checkBox_ShowExtend->checkState();
cfg->isJobListMode = ui->checkBox_JobList->checkState();
cfg->speedLevel = SetSpeedLevelLabel();
//I/O settings
cfg->maxTransSize = ui->lineEdit_Iomax->text().toInt();
cfg->maxAionum = ui->lineEdit_aionum->text().toInt();
cfg->enableOdirect = ui->checkBox_O_DIRECT->checkState();
//Copy/Move Options
cfg->isSameDirRename = ui->checkBox_Samedir->checkState();
cfg->skipEmptyDir = ui->checkBox_Nocreate->checkState() ? 1 : 0;
cfg->isReparse = ui->checkBox_Symlink->checkState();
cfg->enableMoveAttr = ui->checkBox_Movemode->checkState();
cfg->serialMove = ui->checkBox_Moveone->checkState();
cfg->serialVerifyMove = ui->checkBox_Moveone_verify->checkState();
cfg->enableLTFS = ui->checkBox_LTFS->checkState();
cfg->Dotignore_mode = ui->checkBox_Dotignore->checkState();
cfg->isDisableutime = ui->checkBox_Noutime->checkState();
cfg->enableVerifyErrDel = ui->checkBox_Dumpdel->checkState();
//Delete Options
cfg->enableNSA = ui->checkBox_NSA->checkState();
cfg->delDirWithFilter = ui->checkBox_Delfilter->checkState();
//Log Settings
cfg->maxHistoryNext = ui->lineEdit_Srcdstnum->text().toInt();
cfg->isErrLog = ui->checkBox_Errlog->checkState();
//廃止
cfg->fileLogMode = ui->checkBox_Filelog->checkState() ? Cfg::AUTO_FILELOG : Cfg::NO_FILELOG;
if(cfg->fileLogMode & Cfg::AUTO_FILELOG){
cfg->fileLogMode |= ui->checkBox_FilelogCSV->isChecked() ? Cfg::ADD_CSVFILELOG : 0;
}
cfg->aclErrLog = ui->checkBox_Aclerr->checkState();
cfg->streamErrLog = ui->checkBox_Xattrerr->checkState();
//Misc
cfg->forceStart = ui->checkBox_Dontwait->checkState() ? 1 : 0;
cfg->execConfirm = ui->checkBox_Confirm_exe->checkState();
cfg->taskbarMode = ui->checkBox_Taskminimize->checkState();
if(ui->radioButton_250ms->isChecked()){
cfg->infoSpan = 0;
}
else if(ui->radioButton_500ms->isChecked()){
cfg->infoSpan = 1;
}
else{
cfg->infoSpan = 2;
}
cfg->lcid = ui->checkBox_EnglishUI->checkState() ? QLocale::English : QLocale::Japanese;
cfg->usingMD5 = ui->comboBox_VerifyMode->currentIndex();
cfg->rwstat = ui->checkBox_rwstat->checkState();
return TRUE;
}
void mainsettingDialog::on_buttonBox_accepted()
{
//現在設定をcfgクラスに反映
SetData();
//定義ファイルに書き込む
cfg->WriteIni();
}
void mainsettingDialog::on_buttonBox_rejected()
{
//何もしない
}
void mainsettingDialog::on_general_optionlist_currentRowChanged(int changedrowindex)
{
// qDebug("changed %d",changedrowindex);
}
void mainsettingDialog::on_slider_Speed_valueChanged(int value)
{
SetSpeedLevelLabel(value);
}
void mainsettingDialog::on_checkBox_Filelog_stateChanged(int arg1)
{
switch(arg1){
case Qt::Unchecked:
ui->checkBox_FilelogCSV->setChecked(false);
ui->checkBox_FilelogCSV->setEnabled(false);
break;
case Qt::Checked:
case Qt::PartiallyChecked:
ui->checkBox_FilelogCSV->setEnabled(true);
break;
default:
break;
}
}
void mainsettingDialog::on_lineEdit_Iomax_textChanged(const QString &arg1)
{
int iosize = arg1.toInt();
int olap = ui->lineEdit_aionum->text().toInt();
ui->lineEdit_totaliosize->setText(QString::number(iosize*olap));
}
void mainsettingDialog::on_lineEdit_aionum_textChanged(const QString &arg1)
{
int olap = arg1.toInt();
int iosize = ui->lineEdit_Iomax->text().toInt();
ui->lineEdit_totaliosize->setText(QString::number(iosize*olap));
}