OSDN Git Service

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