OSDN Git Service

Ver0.19
[gefu/Gefu.git] / preferencedialog.cpp
1 #include "colorsamplemodel.h"
2 #include"common.h"
3 #include "preferencedialog.h"
4 #include "ui_preferencedialog.h"
5
6 #include <QAbstractTableModel>
7 #include <QColorDialog>
8 #include <QSettings>
9 #include <QDebug>
10 #include <QDir>
11 #include <QFileDialog>
12 #include <QStandardPaths>
13 #include <QFontDialog>
14
15 PreferenceDialog::PreferenceDialog(QWidget *parent) :
16     QDialog(parent),
17     ui(new Ui::PreferenceDialog),
18     m_model(),
19     m_colorMap()
20 {
21     m_model.setColorMap(&m_colorMap);
22
23     ui->setupUi(this);
24     ui->tabWidget->setCurrentIndex(0);
25     // アドレスボックスの外観サンプル
26     ui->sampleEdit->setText(QDir::homePath());
27     // ファイルビューの外観サンプル
28     ui->sampleTable->setModel(&m_model);
29
30     QHeaderView *header;
31     header = ui->sampleTable->horizontalHeader();
32     header->setSectionResizeMode(0, QHeaderView::Stretch);
33     header->setSectionResizeMode(1, QHeaderView::ResizeToContents);
34     header->setSectionResizeMode(2, QHeaderView::ResizeToContents);
35     header = ui->sampleTable->verticalHeader();
36     header->setDefaultSectionSize(header->defaultSectionSize() * 0.75);
37
38     // シグナル&スロット
39     connect(ui->bootSize, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
40     connect(ui->sizeAbsolute, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
41     connect(ui->sizeRelative, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
42     connect(ui->bootPos, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
43     connect(ui->posAbsolute, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
44     connect(ui->posRelative, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
45
46     connect(ui->boxClrBg, SIGNAL(clicked()), this, SLOT(selectBoxColor()));
47     connect(ui->boxClrFg, SIGNAL(clicked()), this, SLOT(selectBoxColor()));
48     connect(ui->chooseBoxFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
49
50     connect(ui->clrBgMark, SIGNAL(clicked()), this, SLOT(selectViewColor()));
51     connect(ui->clrBgNormal, SIGNAL(clicked()), this, SLOT(selectViewColor()));
52     connect(ui->clrFgHidden, SIGNAL(clicked()), this, SLOT(selectViewColor()));
53     connect(ui->clrFgMark, SIGNAL(clicked()), this, SLOT(selectViewColor()));
54     connect(ui->clrFgNormal, SIGNAL(clicked()), this, SLOT(selectViewColor()));
55     connect(ui->clrFgReadonly, SIGNAL(clicked()), this, SLOT(selectViewColor()));
56     connect(ui->clrFgSystem, SIGNAL(clicked()), this, SLOT(selectViewColor()));
57     connect(ui->chooseViewFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
58
59     connect(ui->importAppearance, SIGNAL(clicked()), this, SLOT(importAppearance()));
60     connect(ui->exportAppearance, SIGNAL(clicked()), this, SLOT(exportAppearance()));
61
62     connect(ui->termBrowse, SIGNAL(clicked()), this, SLOT(browseApp()));
63     connect(ui->editorBrowse, SIGNAL(clicked()), this, SLOT(browseApp()));
64
65     connect(ui->chooseViewerFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
66     connect(ui->viewerClrBg, SIGNAL(clicked()), this, SLOT(selectViewerColor()));
67     connect(ui->viewerClrFg, SIGNAL(clicked()), this, SLOT(selectViewerColor()));
68     connect(ui->viewerInherit, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
69     connect(ui->enableViewerIgnoreExt, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
70     connect(ui->defaultIgnoreExt, SIGNAL(clicked()), this, SLOT(setIgnoreExtDefault()));
71
72     // 現在の設定で各コントロールを初期化する
73     QSettings settings;
74     QString strValue;
75     QSize size;
76     QPoint point;
77     QRadioButton *radioBtn;
78
79     //>>>>> 起動と終了
80     // 起動時のサイズ
81     ui->bootSize->setChecked(true);
82     strValue = settings.value(IniKey_BootSizeSpec).toString();
83     radioBtn = findChild<QRadioButton*>(strValue);
84     if (radioBtn == NULL) {
85         radioBtn = ui->sizeRelative;
86     }
87     radioBtn->setChecked(true);
88     if (strValue.isEmpty()) {
89         ui->bootSize->setChecked(false);
90     }
91     size = settings.value(IniKey_BootSizeAbs).toSize();
92     ui->absoluteWidth->setValue(size.width());
93     ui->absoluteHeight->setValue(size.height());
94     size = settings.value(IniKey_BootSizeRel).toSize();
95     ui->relativeWidth->setValue(size.width());
96     ui->relativeHeight->setValue(size.height());
97     // 起動時の位置
98     ui->bootPos->setChecked(true);
99     strValue = settings.value(IniKey_BootPosSpec).toString();
100     radioBtn = findChild<QRadioButton*>(strValue);
101     if (radioBtn == NULL) {
102         radioBtn = ui->posCenter;
103     }
104     radioBtn->setChecked(true);
105     if (strValue.isEmpty()) {
106         ui->bootPos->setChecked(false);
107     }
108     point = settings.value(IniKey_BootPosAbs).toPoint();
109     ui->absoluteLeft->setValue(point.x());
110     ui->absoluteTop->setValue(point.y());
111     point = settings.value(IniKey_BootPosRel).toPoint();
112     ui->relativeLeft->setValue(point.x());
113     ui->relativeTop->setValue(point.y());
114     // 起動時の設定削除
115     ui->resetOnBoot->setChecked(settings.value(IniKey_ResetOnBoot).toBool());
116     // アップデートの確認
117     ui->checkUpdates->setChecked(settings.value(IniKey_CheckUpdates).toBool());
118     // 終了時の確認ダイアログ
119     ui->confirmExit->setChecked(settings.value(IniKey_ConfirmExit).toBool());
120
121     //>>>>> 色とフォント、テキストビューア
122     loadAppearance(settings, false);
123     ui->dark->setValue(settings.value(IniKey_Darkness).toInt());
124
125     //>>>>> ファイル操作
126     // 確認ダイアログの表示
127     ui->confirmCopy->setChecked(settings.value(IniKey_ConfirmCopy).toBool());
128     ui->confirmDelete->setChecked(settings.value(IniKey_ConfirmDelete).toBool());
129     ui->confirmMove->setChecked(settings.value(IniKey_ConfirmMove).toBool());
130     ui->confirmRename->setChecked(settings.value(IniKey_ConfirmRename).toBool());
131     // 完了ダイアログの自動クローズ
132     ui->autoCloseCopy->setChecked(settings.value(IniKey_AutoCloseCopy).toBool());
133     ui->autoCloseDelete->setChecked(settings.value(IniKey_AutoCloseDelete).toBool());
134     ui->autoCloseMove->setChecked(settings.value(IniKey_AutoCloseMove).toBool());
135     ui->autoCloseRename->setChecked(settings.value(IniKey_AutoCloseRename).toBool());
136     // 上書き時の既定動作
137     strValue = settings.value(IniKey_DefaultOnCopy).toString();
138     if (strValue.isEmpty()) {
139         strValue = "owDefIfNew";
140     }
141     radioBtn = findChild<QRadioButton*>(strValue);
142     if (radioBtn == NULL) {
143         radioBtn = ui->rbOverWriteIfNew;
144     }
145     radioBtn->setChecked(true);
146     ui->moveAfterCreate->setChecked(settings.value(IniKey_MoveAfterCreateFolder).toBool());
147     ui->openAfterCreate->setChecked(settings.value(IniKey_OpenAfterCreateFile).toBool());
148
149     //>>>>> パス設定
150     // エディタ
151     ui->editorOpt->setText(settings.value(IniKey_EditorOption).toString());
152     ui->editorPath->setText(settings.value(IniKey_EditorPath).toString());
153     // ターミナル
154     ui->termOpt->setText(settings.value(IniKey_TerminalOption).toString());
155     ui->termPath->setText(settings.value(IniKey_TerminalPath).toString());
156
157     //>>>>> テキストビューア
158     ui->enableViewerIgnoreExt->setChecked(true);
159     ui->enableViewerIgnoreExt->setChecked(!settings.value(IniKey_ViewerForceOpen).toBool());
160     ui->viewerIgnoreExt->setPlainText(settings.value(IniKey_ViewerIgnoreExt).toString());
161 }
162
163 PreferenceDialog::~PreferenceDialog()
164 {
165     delete ui;
166 }
167
168 void PreferenceDialog::saveAppearance(QSettings &settings)
169 {
170     QFont font = ui->sampleEdit->font();
171     QPalette palette = ui->sampleEdit->palette();
172     settings.setValue(IniKey_BoxColorBg, palette.base().color());
173     settings.setValue(IniKey_BoxColorFg, palette.text().color());
174     settings.setValue(IniKey_BoxFont, font);
175
176     settings.setValue(IniKey_ViewColorBgMark, m_colorMap["clrBgMark"]);
177     settings.setValue(IniKey_ViewColorBgNormal, m_colorMap["clrBgNormal"]);
178     settings.setValue(IniKey_ViewColorFgHidden, m_colorMap["clrFgHidden"]);
179     settings.setValue(IniKey_ViewColorFgMark, m_colorMap["clrFgMark"]);
180     settings.setValue(IniKey_ViewColorFgNormal, m_colorMap["clrFgNormal"]);
181     settings.setValue(IniKey_ViewColorFgReadonly, m_colorMap["clrFgReadonly"]);
182     settings.setValue(IniKey_ViewColorFgSystem, m_colorMap["clrFgSystem"]);
183     settings.setValue(IniKey_ViewFont, m_model.font());
184 }
185
186 void PreferenceDialog::loadAppearance(QSettings &settings, bool import)
187 {
188     QPalette palette;
189     QColor color;
190     QFont font;
191
192     //>>>> アドレスボックス
193     palette = QPalette();
194     // 背景色
195     color = settings.value(IniKey_BoxColorBg).value<QColor>();
196     palette.setColor(QPalette::Base, color);
197     // 文字色
198     color = settings.value(IniKey_BoxColorFg).value<QColor>();
199     palette.setColor(QPalette::Text, color);
200     // フォント
201     font = settings.value(IniKey_BoxFont).value<QFont>();
202     ui->boxFont->setText(tr("%1, %2pt").arg(font.family()).arg(font.pointSize()));
203     // サンプル表示
204     ui->sampleEdit->setPalette(palette);
205     ui->sampleEdit->setFont(font);
206
207     //>>>> ファイルビュー
208     // 背景色
209     color = settings.value(IniKey_ViewColorBgMark).value<QColor>();
210     m_colorMap["clrBgMark"] = color;
211     color = settings.value(IniKey_ViewColorBgNormal).value<QColor>();
212     m_colorMap["clrBgNormal"] = color;
213     // 文字色
214     color = settings.value(IniKey_ViewColorFgHidden).value<QColor>();
215     m_colorMap["clrFgHidden"] = color;
216     color = settings.value(IniKey_ViewColorFgMark).value<QColor>();
217     m_colorMap["clrFgMark"] = color;
218     color = settings.value(IniKey_ViewColorFgNormal).value<QColor>();
219     m_colorMap["clrFgNormal"] = color;
220     color = settings.value(IniKey_ViewColorFgReadonly).value<QColor>();
221     m_colorMap["clrFgReadonly"] = color;
222     color = settings.value(IniKey_ViewColorFgSystem).value<QColor>();
223     m_colorMap["clrFgSystem"] = color;
224     // フォント
225     font = settings.value(IniKey_ViewFont).value<QFont>();
226     ui->viewFont->setText(tr("%1, %2pt").arg(font.family()).arg(font.pointSize()));
227     // サンプル表示
228     QHeaderView *header = ui->sampleTable->verticalHeader();
229     header->setDefaultSectionSize(QFontMetrics(font).height() * 1.5);
230     ui->sampleTable->setMinimumHeight(header->sectionSize(0) * 5);
231     ui->sampleTable->setMaximumHeight(ui->sampleTable->minimumHeight() + 2);
232     m_model.setFont(font);
233     m_model.update();
234
235     //>>>> テキストビューア
236     // 文字色と背景色
237     if (settings.value(IniKey_ViewerInherit).toBool()) {
238         ui->viewerInherit->setChecked(true);
239         color = settings.value(IniKey_ViewColorBgNormal).value<QColor>();
240         palette.setColor(QPalette::Base, color);
241         color = settings.value(IniKey_ViewColorFgNormal).value<QColor>();
242         palette.setColor(QPalette::Text, color);
243     }
244     else if (!import){
245         ui->viewerInherit->setChecked(false);
246         color = settings.value(IniKey_ViewerColorBg).value<QColor>();
247         palette.setColor(QPalette::Base, color);
248         color = settings.value(IniKey_ViewerColorFg).value<QColor>();
249         palette.setColor(QPalette::Text, color);
250     }
251     ui->viewerSample->setPalette(palette);
252     // フォント
253     if (!import) {
254         font = settings.value(IniKey_ViewerFont).value<QFont>();
255         ui->viewerFont->setText(tr("%1, %2pt").arg(font.family()).arg(font.pointSize()));
256         ui->viewerSample->setFont(font);
257     }
258 }
259
260 void PreferenceDialog::chooseFont()
261 {
262     bool ok;
263     QFont font;
264     QLabel *label = NULL;
265
266     if (sender() == ui->chooseViewerFont) {
267         font = ui->viewerSample->font();
268     }
269     else if (sender() == ui->chooseBoxFont) {
270         font = ui->sampleEdit->font();
271     }
272     else if (sender() == ui->chooseViewFont) {
273         font = m_model.font();
274     }
275
276     font = QFontDialog::getFont(&ok, font, this);
277
278     if (sender() == ui->chooseViewerFont) {
279         ui->viewerSample->setFont(font);
280         label = ui->viewerFont;
281     }
282     else if (sender() == ui->chooseBoxFont) {
283         ui->sampleEdit->setFont(font);
284         label = ui->boxFont;
285     }
286     else if (sender() == ui->chooseViewFont) {
287         QHeaderView *header = ui->sampleTable->verticalHeader();
288         header->setDefaultSectionSize(QFontMetrics(font).height() * 1.5);
289         ui->sampleTable->setMinimumHeight(header->sectionSize(0) * 5);
290         ui->sampleTable->setMaximumHeight(ui->sampleTable->minimumHeight() + 2);
291         m_model.setFont(font);
292         m_model.update();
293         label = ui->viewFont;
294     }
295     label->setText(tr("%1, %2pt").arg(font.family()).arg(font.pointSize()));
296
297 }
298
299 void PreferenceDialog::setControlsEnabled(bool enabled)
300 {
301     if (sender() == ui->bootSize) {
302         ui->sizeAbsolute->setEnabled(enabled);
303         ui->sizeLast->setEnabled(enabled);
304         ui->sizeRelative->setEnabled(enabled);
305         if (enabled) {
306             emit ui->sizeAbsolute->toggled(ui->sizeAbsolute->isChecked());
307             emit ui->sizeRelative->toggled(ui->sizeRelative->isChecked());
308         }
309         else {
310             emit ui->sizeAbsolute->toggled(false);
311             emit ui->sizeRelative->toggled(false);
312         }
313     }
314     else if (sender() == ui->sizeAbsolute) {
315         ui->absoluteHeight->setEnabled(enabled);
316         ui->absoluteWidth->setEnabled(enabled);
317     }
318     else if (sender() == ui->sizeRelative) {
319         ui->relativeHeight->setEnabled(enabled);
320         ui->relativeWidth->setEnabled(enabled);
321     }
322     else if (sender() == ui->bootPos) {
323         ui->posAbsolute->setEnabled(enabled);
324         ui->posCenter->setEnabled(enabled);
325         ui->posLast->setEnabled(enabled);
326         ui->posRelative->setEnabled(enabled);
327         if (enabled) {
328             emit ui->posAbsolute->toggled(ui->posAbsolute->isChecked());
329             emit ui->posRelative->toggled(ui->posRelative->isChecked());
330         }
331         else {
332             emit ui->posAbsolute->toggled(false);
333             emit ui->posRelative->toggled(false);
334         }
335     }
336     else if (sender() == ui->posAbsolute) {
337         ui->absoluteLeft->setEnabled(enabled);
338         ui->absoluteTop->setEnabled(enabled);
339     }
340     else if (sender() == ui->posRelative) {
341         ui->relativeLeft->setEnabled(enabled);
342         ui->relativeTop->setEnabled(enabled);
343     }
344     else if (sender() == ui->viewerInherit) {
345         ui->viewerClrBg->setEnabled(!enabled);
346         ui->viewerClrFg->setEnabled(!enabled);
347         // サンプル表示も更新
348         QPalette pal = ui->viewerSample->palette();
349         if (enabled) {
350             pal.setColor(QPalette::Base, m_colorMap["clrBgNormal"]);
351             pal.setColor(QPalette::Text, m_colorMap["clrFgNormal"]);
352         }
353         else {
354             QSettings settings;
355             pal.setColor(QPalette::Base, settings.value(IniKey_ViewerColorBg).value<QColor>());
356             pal.setColor(QPalette::Text, settings.value(IniKey_ViewerColorFg).value<QColor>());
357         }
358         ui->viewerSample->setPalette(pal);
359     }
360     else if (sender() == ui->enableViewerIgnoreExt) {
361         ui->viewerIgnoreExt->setEnabled(enabled);
362     }
363 }
364
365 void PreferenceDialog::setIgnoreExtDefault()
366 {
367     ui->viewerIgnoreExt->setPlainText(ViewerIgnoreExt());
368 }
369
370 void PreferenceDialog::selectBoxColor()
371 {
372     QColor color;
373     QPalette palette = ui->sampleEdit->palette();
374     if (sender() == ui->boxClrBg) {
375         color = palette.background().color();
376     }
377     else if (sender() == ui->boxClrFg) {
378         color = palette.text().color();
379     }
380
381     color = QColorDialog::getColor(color, this, tr("色選択"));
382     if (!color.isValid()) {
383         return;
384     }
385
386     if (sender() == ui->boxClrBg) {
387         palette.setColor(QPalette::Base, color);
388     }
389     else if (sender() == ui->boxClrFg) {
390         palette.setColor(QPalette::Text, color);
391     }
392     ui->sampleEdit->setPalette(palette);
393 }
394
395 void PreferenceDialog::selectViewColor()
396 {
397     const QString objName = sender()->objectName();
398     QColor color = m_colorMap[objName];
399
400     color = QColorDialog::getColor(color, this, tr("色選択"));
401     if (!color.isValid()) {
402         return;
403     }
404
405     m_colorMap[objName] = color;
406     m_model.update();
407 }
408
409 void PreferenceDialog::selectViewerColor()
410 {
411     QColor color;
412     QPalette palette = ui->viewerSample->palette();
413     if (sender() == ui->viewerClrBg) {
414         color = palette.background().color();
415     }
416     else if (sender() == ui->viewerClrFg) {
417         color = palette.text().color();
418     }
419
420     color = QColorDialog::getColor(color, this, tr("色選択"));
421     if (!color.isValid()) {
422         return;
423     }
424
425     if (sender() == ui->viewerClrBg) {
426         palette.setColor(QPalette::Base, color);
427     }
428     else if (sender() == ui->viewerClrFg) {
429         palette.setColor(QPalette::Text, color);
430     }
431     ui->viewerSample->setPalette(palette);
432 }
433
434 void PreferenceDialog::browseApp()
435 {
436     QStringList list = QStandardPaths::standardLocations(
437                 QStandardPaths::ApplicationsLocation);
438 #ifdef Q_OS_WIN
439     QString path = QFileDialog::getOpenFileName(
440                 this, tr("アプリケーションを選択"), list.at(0),
441                 tr("実行ファイル (*.exe *.com *.bat *.pif);;すべてのファイル (*)"));
442 #elif defined(Q_OS_MAC)
443     QString path = QFileDialog::getOpenFileName(
444                 this, tr("アプリケーションを選択"), list.at(0),
445                 tr("実行ファイル (*.app);;すべてのファイル (*)"));
446 #else
447     QString path = QFileDialog::getOpenFileName(
448                 this, tr("アプリケーションを選択"), list.at(0),
449                 tr("すべてのファイル (*)"));
450 #endif
451     if (!path.isEmpty()) {
452         if (sender() == ui->editorBrowse) {
453             ui->editorPath->setText(path);
454         }
455         else if (sender() == ui->termBrowse) {
456             ui->termPath->setText(path);
457         }
458     }
459 }
460
461 void PreferenceDialog::importAppearance()
462 {
463     QStringList list = QStandardPaths::standardLocations(
464                 QStandardPaths::DocumentsLocation);
465     QString path = QFileDialog::getOpenFileName(
466                 this, tr("ファイルを選択"), list.at(0),
467                 tr("設定ファイル (*.ini);;すべてのファイル (*)"));
468     if (path.isEmpty()) {
469         return;
470     }
471
472     QSettings settings(path, QSettings::IniFormat);
473     loadAppearance(settings, true);
474 }
475
476 void PreferenceDialog::exportAppearance()
477 {
478     QStringList list = QStandardPaths::standardLocations(
479                 QStandardPaths::DocumentsLocation);
480     QString path = QFileDialog::getSaveFileName(
481                 this, tr("ファイルを選択"), list.at(0) + "/gefu_appearance.ini",
482                 tr("設定ファイル (*.ini);;すべてのファイル (*)"));
483     if (path.isEmpty()) {
484         return;
485     }
486
487     QSettings settings(path, QSettings::IniFormat);
488     saveAppearance(settings);
489 }
490
491 void PreferenceDialog::accept()
492 {
493     QSettings settings;
494     QAbstractButton *selected;
495
496     //>>>>> 起動と終了
497     // 起動時のサイズ
498     if (!ui->bootSize->isChecked()) {
499         settings.setValue(IniKey_BootSizeSpec, "");
500     }
501     else {
502         selected = ui->sizeOptions->checkedButton();
503         settings.setValue(IniKey_BootSizeSpec, selected->objectName());
504         QSize size;
505         // 絶対指定
506         size = QSize(ui->absoluteWidth->value(), ui->absoluteHeight->value());
507         settings.setValue(IniKey_BootSizeAbs, size);
508         // 相対指定
509         size = QSize(ui->relativeWidth->value(), ui->relativeHeight->value());
510         settings.setValue(IniKey_BootSizeRel, size);
511     }
512     // 起動時の位置
513     if (!ui->bootPos->isChecked()) {
514         settings.setValue(IniKey_BootPosSpec, "");
515     }
516     else {
517         selected = ui->posOptions->checkedButton();
518         settings.setValue(IniKey_BootPosSpec, selected->objectName());
519         // 絶対指定
520         QPoint pos;
521         pos = QPoint(ui->absoluteLeft->value(), ui->absoluteTop->value());
522         settings.setValue(IniKey_BootPosAbs, pos);
523         // 相対指定
524         pos = QPoint(ui->relativeLeft->value(), ui->relativeTop->value());
525         settings.setValue(IniKey_BootPosRel, pos);
526     }
527     // 起動時の設定削除
528     settings.setValue(IniKey_ResetOnBoot, ui->resetOnBoot->isChecked());
529     // 終了時の確認ダイアログ
530     settings.setValue(IniKey_ConfirmExit, ui->confirmExit->isChecked());
531     // アップデートのチェック
532     settings.setValue(IniKey_CheckUpdates, ui->checkUpdates->isChecked());
533
534     //>>>>> 色とフォント
535     saveAppearance(settings);
536     settings.setValue(IniKey_Darkness, ui->dark->value());
537
538     //>>>>> ファイル操作
539     settings.setValue(IniKey_ConfirmCopy, ui->confirmCopy->isChecked());
540     settings.setValue(IniKey_ConfirmDelete, ui->confirmDelete->isChecked());
541     settings.setValue(IniKey_ConfirmMove, ui->confirmMove->isChecked());
542     settings.setValue(IniKey_ConfirmRename, ui->confirmRename->isChecked());
543
544     settings.setValue(IniKey_AutoCloseCopy, ui->autoCloseCopy->isChecked());
545     settings.setValue(IniKey_AutoCloseDelete, ui->autoCloseDelete->isChecked());
546     settings.setValue(IniKey_AutoCloseMove, ui->autoCloseMove->isChecked());
547     settings.setValue(IniKey_AutoCloseRename, ui->autoCloseRename->isChecked());
548
549     selected = ui->overwriteOptions->checkedButton();
550     settings.setValue(IniKey_DefaultOnCopy, selected->objectName());
551
552     settings.setValue(IniKey_MoveAfterCreateFolder, ui->moveAfterCreate->isChecked());
553     settings.setValue(IniKey_OpenAfterCreateFile, ui->openAfterCreate->isChecked());
554
555     //>>>>> パス設定
556     settings.setValue(IniKey_EditorOption, ui->editorOpt->text().trimmed());
557     settings.setValue(IniKey_EditorPath, ui->editorPath->text().trimmed());
558
559     settings.setValue(IniKey_TerminalOption, ui->termOpt->text().trimmed());
560     settings.setValue(IniKey_TerminalPath, ui->termPath->text().trimmed());
561
562     //>>>>> テキストビューア
563     settings.setValue(IniKey_ViewerFont, ui->viewerSample->font());
564     settings.setValue(IniKey_ViewerColorBg, ui->viewerSample->palette().base().color());
565     settings.setValue(IniKey_ViewerColorFg, ui->viewerSample->palette().text().color());
566     settings.setValue(IniKey_ViewerInherit, ui->viewerInherit->isChecked());
567     settings.setValue(IniKey_ViewerForceOpen, !ui->enableViewerIgnoreExt->isChecked());
568     QStringList list = ui->viewerIgnoreExt->toPlainText().split(",", QString::SkipEmptyParts);
569     QStringList::iterator it;
570     for (it = list.begin(); it != list.end(); it++) {
571         *it = it->trimmed();
572     }
573     settings.setValue(IniKey_ViewerIgnoreExt, list.join(","));
574
575     QDialog::accept();
576 }