void AccountsTreeView::slotModelReset() { hideColumns( m_leftview, QList<int>() << 3 << -1 ); QHeaderView *v = m_leftview->header(); kDebug(planDbg())<<v->sectionSize(2)<<v->sectionSizeHint(2)<<v->defaultSectionSize()<<v->minimumSectionSize(); hideColumns( m_rightview, QList<int>() << 0 << 1 << 2 ); }
PreferenceDialog::PreferenceDialog(QWidget *parent) : QDialog(parent), ui(new Ui::PreferenceDialog), m_model(), m_colorMap() { m_model.setColorMap(&m_colorMap); ui->setupUi(this); ui->tabWidget->setCurrentIndex(0); // アドレスボックスの外観サンプル ui->sampleEdit->setText(QDir::homePath()); // ファイルビューの外観サンプル ui->sampleTable->setModel(&m_model); QHeaderView *header; header = ui->sampleTable->horizontalHeader(); header->setSectionResizeMode(0, QHeaderView::Stretch); header->setSectionResizeMode(1, QHeaderView::ResizeToContents); header->setSectionResizeMode(2, QHeaderView::ResizeToContents); header = ui->sampleTable->verticalHeader(); header->setDefaultSectionSize(header->defaultSectionSize() * 0.75); // シグナル&スロット connect(ui->bootSize, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool))); connect(ui->sizeAbsolute, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool))); connect(ui->sizeRelative, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool))); connect(ui->bootPos, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool))); connect(ui->posAbsolute, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool))); connect(ui->posRelative, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool))); connect(ui->boxClrBg, SIGNAL(clicked()), this, SLOT(selectBoxColor())); connect(ui->boxClrFg, SIGNAL(clicked()), this, SLOT(selectBoxColor())); connect(ui->chooseBoxFont, SIGNAL(clicked()), this, SLOT(chooseFont())); connect(ui->clrBgMark, SIGNAL(clicked()), this, SLOT(selectViewColor())); connect(ui->clrBgNormal, SIGNAL(clicked()), this, SLOT(selectViewColor())); connect(ui->clrFgHidden, SIGNAL(clicked()), this, SLOT(selectViewColor())); connect(ui->clrFgMark, SIGNAL(clicked()), this, SLOT(selectViewColor())); connect(ui->clrFgNormal, SIGNAL(clicked()), this, SLOT(selectViewColor())); connect(ui->clrFgReadonly, SIGNAL(clicked()), this, SLOT(selectViewColor())); connect(ui->clrFgSystem, SIGNAL(clicked()), this, SLOT(selectViewColor())); connect(ui->chooseViewFont, SIGNAL(clicked()), this, SLOT(chooseFont())); connect(ui->importAppearance, SIGNAL(clicked()), this, SLOT(importAppearance())); connect(ui->exportAppearance, SIGNAL(clicked()), this, SLOT(exportAppearance())); connect(ui->browseArchiver, SIGNAL(clicked()), this, SLOT(browseApp())); connect(ui->browseEditor, SIGNAL(clicked()), this, SLOT(browseApp())); connect(ui->browseTerminal, SIGNAL(clicked()), this, SLOT(browseApp())); connect(ui->chooseViewerFont, SIGNAL(clicked()), this, SLOT(chooseFont())); connect(ui->viewerClrBg, SIGNAL(clicked()), this, SLOT(selectViewerColor())); connect(ui->viewerClrFg, SIGNAL(clicked()), this, SLOT(selectViewerColor())); connect(ui->viewerInherit, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool))); connect(ui->enableViewerIgnoreExt, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool))); connect(ui->defaultIgnoreExt, SIGNAL(clicked()), this, SLOT(setIgnoreExtDefault())); // 現在の設定で各コントロールを初期化する QSettings settings; QString strValue; QSize size; QPoint point; QRadioButton *radioBtn; //>>>>> 起動と終了 // 起動時のサイズ ui->bootSize->setChecked(true); strValue = settings.value(IniKey_BootSizeSpec).toString(); radioBtn = findChild<QRadioButton*>(strValue); if (radioBtn == NULL) { radioBtn = ui->sizeRelative; } radioBtn->setChecked(true); if (strValue.isEmpty()) { ui->bootSize->setChecked(false); } size = settings.value(IniKey_BootSizeAbs).toSize(); ui->absoluteWidth->setValue(size.width()); ui->absoluteHeight->setValue(size.height()); size = settings.value(IniKey_BootSizeRel).toSize(); ui->relativeWidth->setValue(size.width()); ui->relativeHeight->setValue(size.height()); // 起動時の位置 ui->bootPos->setChecked(true); strValue = settings.value(IniKey_BootPosSpec).toString(); radioBtn = findChild<QRadioButton*>(strValue); if (radioBtn == NULL) { radioBtn = ui->posCenter; } radioBtn->setChecked(true); if (strValue.isEmpty()) { ui->bootPos->setChecked(false); } point = settings.value(IniKey_BootPosAbs).toPoint(); ui->absoluteLeft->setValue(point.x()); ui->absoluteTop->setValue(point.y()); point = settings.value(IniKey_BootPosRel).toPoint(); ui->relativeLeft->setValue(point.x()); ui->relativeTop->setValue(point.y()); // 起動時の設定削除 ui->resetOnBoot->setChecked(settings.value(IniKey_ResetOnBoot).toBool()); // アップデートの確認 ui->checkUpdates->setChecked(settings.value(IniKey_CheckUpdates).toBool()); // 終了時の確認ダイアログ ui->confirmExit->setChecked(settings.value(IniKey_ConfirmExit).toBool()); //>>>>> 色とフォント、テキストビューア loadAppearance(settings, false); ui->dark->setValue(settings.value(IniKey_Darkness).toInt()); //>>>>> ファイル操作 // 確認ダイアログの表示 ui->confirmCopy->setChecked(settings.value(IniKey_ConfirmCopy).toBool()); ui->confirmDelete->setChecked(settings.value(IniKey_ConfirmDelete).toBool()); ui->confirmMove->setChecked(settings.value(IniKey_ConfirmMove).toBool()); ui->confirmRename->setChecked(settings.value(IniKey_ConfirmRename).toBool()); // 完了ダイアログの自動クローズ ui->autoCloseCopy->setChecked(settings.value(IniKey_AutoCloseCopy).toBool()); ui->autoCloseDelete->setChecked(settings.value(IniKey_AutoCloseDelete).toBool()); ui->autoCloseMove->setChecked(settings.value(IniKey_AutoCloseMove).toBool()); ui->autoCloseRename->setChecked(settings.value(IniKey_AutoCloseRename).toBool()); // 上書き時の既定動作 strValue = settings.value(IniKey_DefaultOnCopy).toString(); if (strValue.isEmpty()) { strValue = "owDefIfNew"; } radioBtn = findChild<QRadioButton*>(strValue); if (radioBtn == NULL) { radioBtn = ui->rbOverWriteIfNew; } radioBtn->setChecked(true); ui->moveAfterCreate->setChecked(settings.value(IniKey_MoveAfterCreateFolder).toBool()); ui->openAfterCreate->setChecked(settings.value(IniKey_OpenAfterCreateFile).toBool()); //>>>>> パス設定 // エディタ ui->editorPath->setText(settings.value(IniKey_PathEditor).toString()); // ターミナル ui->terminalPath->setText(settings.value(IniKey_PathTerminal).toString()); // アーカイバ ui->archiverPath->setText(settings.value(IniKey_PathArchiver).toString()); //>>>>> テキストビューア ui->enableViewerIgnoreExt->setChecked(true); ui->enableViewerIgnoreExt->setChecked(!settings.value(IniKey_ViewerForceOpen).toBool()); ui->viewerIgnoreExt->setPlainText(settings.value(IniKey_ViewerIgnoreExt).toString()); }