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