OSDN Git Service

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