void PropertiesDialog::changeFontButton_clicked() { bool ok; QFont f = QFontDialog::getFont(&ok, fontSampleLabel->font(), this, tr("Select Terminal Font")); if (ok && QFontInfo(f).fixedPitch()) setFontSample(f); }
void PropertiesDialog::changeFontButton_clicked() { FontDialog dia(fontSampleLabel->font()); if (!dia.exec()) return; QFont f = dia.getFont(); if (QFontInfo(f).fixedPitch()) setFontSample(f); }
FontDialog::FontDialog(const QFont &f) : QDialog(0) { setupUi(this); fontComboBox->setFontFilters(QFontComboBox::MonospacedFonts | QFontComboBox::NonScalableFonts | QFontComboBox::ScalableFonts); fontComboBox->setCurrentFont(f); fontComboBox->setEditable(false); sizeSpinBox->setValue(f.pointSize()); setFontSample(); connect(fontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(setFontSample())); connect(sizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setFontSample())); }
PropertiesDialog::PropertiesDialog(QWidget *parent) : QDialog(parent) { setupUi(this); connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply())); connect(changeFontButton, SIGNAL(clicked()), this, SLOT(changeFontButton_clicked())); connect(chooseBackgroundImageButton, &QPushButton::clicked, this, &PropertiesDialog::chooseBackgroundImageButton_clicked); QStringList emulations = QTermWidget::availableKeyBindings(); QStringList colorSchemes = QTermWidget::availableColorSchemes(); listWidget->setCurrentRow(0); listWidget->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContentsOnFirstShow); colorSchemaCombo->addItems(colorSchemes); int csix = colorSchemaCombo->findText(Properties::Instance()->colorScheme); if (csix != -1) colorSchemaCombo->setCurrentIndex(csix); backgroundImageLineEdit->setText(Properties::Instance()->backgroundImage); emulationComboBox->addItems(emulations); int eix = emulationComboBox->findText(Properties::Instance()->emulation); emulationComboBox->setCurrentIndex(eix != -1 ? eix : 0 ); /* shortcuts */ setupShortcuts(); /* scrollbar position */ QStringList scrollBarPosList; scrollBarPosList << tr("No scrollbar") << tr("Left") << tr("Right"); scrollBarPos_comboBox->addItems(scrollBarPosList); scrollBarPos_comboBox->setCurrentIndex(Properties::Instance()->scrollBarPos); /* tabs position */ QStringList tabsPosList; tabsPosList << tr("Top") << tr("Bottom") << tr("Left") << tr("Right"); tabsPos_comboBox->addItems(tabsPosList); tabsPos_comboBox->setCurrentIndex(Properties::Instance()->tabsPos); /* keyboard cursor shape */ QStringList keyboardCursorShapeList; keyboardCursorShapeList << tr("BlockCursor") << tr("UnderlineCursor") << tr("IBeamCursor"); keybCursorShape_comboBox->addItems(keyboardCursorShapeList); keybCursorShape_comboBox->setCurrentIndex(Properties::Instance()->keyboardCursorShape); hideTabBarCheckBox->setChecked(Properties::Instance()->hideTabBarWithOneTab); // show main menu bar showMenuCheckBox->setChecked(Properties::Instance()->menuVisible); /* actions by motion after paste */ QStringList motionAfter; motionAfter << tr("No move") << tr("Move start") << tr("Move end"); motionAfterPasting_comboBox->addItems(motionAfter); motionAfterPasting_comboBox->setCurrentIndex(Properties::Instance()->m_motionAfterPaste); // Setting windows style actions styleComboBox->addItem(tr("System Default")); styleComboBox->addItems(QStyleFactory::keys()); int ix = styleComboBox->findText(Properties::Instance()->guiStyle); if (ix != -1) styleComboBox->setCurrentIndex(ix); setFontSample(Properties::Instance()->font); appTransparencyBox->setValue(Properties::Instance()->appTransparency); termTransparencyBox->setValue(Properties::Instance()->termTransparency); highlightCurrentCheckBox->setChecked(Properties::Instance()->highlightCurrentTerminal); askOnExitCheckBox->setChecked(Properties::Instance()->askOnExit); savePosOnExitCheckBox->setChecked(Properties::Instance()->savePosOnExit); saveSizeOnExitCheckBox->setChecked(Properties::Instance()->saveSizeOnExit); useCwdCheckBox->setChecked(Properties::Instance()->useCWD); historyLimited->setChecked(Properties::Instance()->historyLimited); historyUnlimited->setChecked(!Properties::Instance()->historyLimited); historyLimitedTo->setValue(Properties::Instance()->historyLimitedTo); dropShowOnStartCheckBox->setChecked(Properties::Instance()->dropShowOnStart); dropHeightSpinBox->setValue(Properties::Instance()->dropHeight); dropHeightSpinBox->setMaximum(100); dropWidthSpinBox->setValue(Properties::Instance()->dropWidht); dropWidthSpinBox->setMaximum(100); dropShortCutEdit->setText(Properties::Instance()->dropShortCut.toString()); useBookmarksCheckBox->setChecked(Properties::Instance()->useBookmarks); bookmarksLineEdit->setText(Properties::Instance()->bookmarksFile); openBookmarksFile(Properties::Instance()->bookmarksFile); connect(bookmarksButton, SIGNAL(clicked()), this, SLOT(bookmarksButton_clicked())); terminalPresetComboBox->setCurrentIndex(Properties::Instance()->terminalsPreset); changeWindowTitleCheckBox->setChecked(Properties::Instance()->changeWindowTitle); changeWindowIconCheckBox->setChecked(Properties::Instance()->changeWindowIcon); trimPastedTrailingNewlinesCheckBox->setChecked(Properties::Instance()->trimPastedTrailingNewlines); confirmMultilinePasteCheckBox->setChecked(Properties::Instance()->confirmMultilinePaste); }
PropertiesDialog::PropertiesDialog(QWidget *parent) : QDialog(parent) { setupUi(this); connect(buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, &PropertiesDialog::apply); connect(changeFontButton, &QPushButton::clicked, this, &PropertiesDialog::changeFontButton_clicked); connect(chooseBackgroundImageButton, &QPushButton::clicked, this, &PropertiesDialog::chooseBackgroundImageButton_clicked); QStringList emulations = QTermWidget::availableKeyBindings(); QStringList colorSchemes = QTermWidget::availableColorSchemes(); colorSchemes.sort(Qt::CaseInsensitive); listWidget->setCurrentRow(0); listWidget->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContentsOnFirstShow); colorSchemaCombo->addItems(colorSchemes); int csix = colorSchemaCombo->findText(Properties::Instance()->colorScheme); if (csix != -1) colorSchemaCombo->setCurrentIndex(csix); backgroundImageLineEdit->setText(Properties::Instance()->backgroundImage); emulationComboBox->addItems(emulations); int eix = emulationComboBox->findText(Properties::Instance()->emulation); emulationComboBox->setCurrentIndex(eix != -1 ? eix : 0 ); /* set the delegate of shortcut widget as well as its contents */ Delegate *del = new Delegate(shortcutsWidget); shortcutsWidget->setItemDelegate(del); shortcutsWidget->sortByColumn(0, Qt::AscendingOrder); setupShortcuts(); /* scrollbar position */ QStringList scrollBarPosList; scrollBarPosList << tr("No scrollbar") << tr("Left") << tr("Right"); scrollBarPos_comboBox->addItems(scrollBarPosList); scrollBarPos_comboBox->setCurrentIndex(Properties::Instance()->scrollBarPos); /* tabs position */ QStringList tabsPosList; tabsPosList << tr("Top") << tr("Bottom") << tr("Left") << tr("Right"); tabsPos_comboBox->addItems(tabsPosList); tabsPos_comboBox->setCurrentIndex(Properties::Instance()->tabsPos); /* tab width */ fixedTabWidthCheckBox->setChecked(Properties::Instance()->fixedTabWidth); fixedTabWidthSpinBox->setValue(Properties::Instance()->fixedTabWidthValue); closeTabButtonCheckBox->setChecked(Properties::Instance()->showCloseTabButton); /* keyboard cursor shape */ QStringList keyboardCursorShapeList; keyboardCursorShapeList << tr("BlockCursor") << tr("UnderlineCursor") << tr("IBeamCursor"); keybCursorShape_comboBox->addItems(keyboardCursorShapeList); keybCursorShape_comboBox->setCurrentIndex(Properties::Instance()->keyboardCursorShape); hideTabBarCheckBox->setChecked(Properties::Instance()->hideTabBarWithOneTab); // show main menu bar showMenuCheckBox->setChecked(Properties::Instance()->menuVisible); /* actions by motion after paste */ QStringList motionAfter; motionAfter << tr("No move") << tr("Move start") << tr("Move end"); motionAfterPasting_comboBox->addItems(motionAfter); motionAfterPasting_comboBox->setCurrentIndex(Properties::Instance()->m_motionAfterPaste); // Setting windows style actions styleComboBox->addItem(tr("System Default")); styleComboBox->addItems(QStyleFactory::keys()); int ix = styleComboBox->findText(Properties::Instance()->guiStyle); if (ix != -1) styleComboBox->setCurrentIndex(ix); setFontSample(Properties::Instance()->font); terminalMarginSpinBox->setValue(Properties::Instance()->terminalMargin); appTransparencyBox->setValue(Properties::Instance()->appTransparency); termTransparencyBox->setValue(Properties::Instance()->termTransparency); highlightCurrentCheckBox->setChecked(Properties::Instance()->highlightCurrentTerminal); showTerminalSizeHintCheckBox->setChecked(Properties::Instance()->showTerminalSizeHint); askOnExitCheckBox->setChecked(Properties::Instance()->askOnExit); savePosOnExitCheckBox->setChecked(Properties::Instance()->savePosOnExit); saveSizeOnExitCheckBox->setChecked(Properties::Instance()->saveSizeOnExit); useCwdCheckBox->setChecked(Properties::Instance()->useCWD); termComboBox->setCurrentText(Properties::Instance()->term); historyLimited->setChecked(Properties::Instance()->historyLimited); historyUnlimited->setChecked(!Properties::Instance()->historyLimited); historyLimitedTo->setValue(Properties::Instance()->historyLimitedTo); dropShowOnStartCheckBox->setChecked(Properties::Instance()->dropShowOnStart); dropHeightSpinBox->setValue(Properties::Instance()->dropHeight); dropHeightSpinBox->setMaximum(100); dropWidthSpinBox->setValue(Properties::Instance()->dropWidht); dropWidthSpinBox->setMaximum(100); dropShortCutEdit->setText(Properties::Instance()->dropShortCut.toString()); useBookmarksCheckBox->setChecked(Properties::Instance()->useBookmarks); bookmarksLineEdit->setText(Properties::Instance()->bookmarksFile); openBookmarksFile(Properties::Instance()->bookmarksFile); connect(bookmarksButton, &QPushButton::clicked, this, &PropertiesDialog::bookmarksButton_clicked); terminalPresetComboBox->setCurrentIndex(Properties::Instance()->terminalsPreset); changeWindowTitleCheckBox->setChecked(Properties::Instance()->changeWindowTitle); changeWindowIconCheckBox->setChecked(Properties::Instance()->changeWindowIcon); enabledBidiSupportCheckBox->setChecked(Properties::Instance()->enabledBidiSupport); trimPastedTrailingNewlinesCheckBox->setChecked(Properties::Instance()->trimPastedTrailingNewlines); confirmMultilinePasteCheckBox->setChecked(Properties::Instance()->confirmMultilinePaste); // show it compact inside available desktop geometry QSize ag; if (parent != nullptr) { if (QWindow *win = parent->windowHandle()) { if (QScreen *sc = win->screen()) ag = sc->availableVirtualGeometry().size(); } } resize(sizeHint().boundedTo(ag)); }
PropertiesDialog::PropertiesDialog(QWidget *parent) : QDialog(parent) { setupUi(this); connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply())); connect(changeFontButton, SIGNAL(clicked()), this, SLOT(changeFontButton_clicked())); QStringList emulations = QTermWidget::availableKeyBindings(); QStringList colorSchemes = QTermWidget::availableColorSchemes(); listWidget->setCurrentRow(0); colorSchemaCombo->addItems(colorSchemes); int csix = colorSchemaCombo->findText(Properties::Instance()->colorScheme); if (csix != -1) colorSchemaCombo->setCurrentIndex(csix); emulationComboBox->addItems(emulations); int eix = emulationComboBox->findText(Properties::Instance()->emulation); emulationComboBox->setCurrentIndex(eix != -1 ? eix : 0 ); /* shortcuts */ setupShortcuts(); /* scrollbar position */ QStringList scrollBarPosList; scrollBarPosList << "No scrollbar" << "Left" << "Right"; scrollBarPos_comboBox->addItems(scrollBarPosList); scrollBarPos_comboBox->setCurrentIndex(Properties::Instance()->scrollBarPos); /* tabs position */ QStringList tabsPosList; tabsPosList << "Top" << "Bottom" << "Left" << "Right"; tabsPos_comboBox->addItems(tabsPosList); tabsPos_comboBox->setCurrentIndex(Properties::Instance()->tabsPos); /* actions by motion after paste */ QStringList motionAfter; motionAfter << "No move" << "Move start" << "Move end"; motionAfterPasting_comboBox->addItems(motionAfter); motionAfterPasting_comboBox->setCurrentIndex(Properties::Instance()->m_motionAfterPaste); // Setting windows style actions styleComboBox->addItem(tr("System Default")); styleComboBox->addItems(QStyleFactory::keys()); int ix = styleComboBox->findText(Properties::Instance()->guiStyle); if (ix != -1) styleComboBox->setCurrentIndex(ix); setFontSample(Properties::Instance()->font); appOpacityBox->setValue(Properties::Instance()->appOpacity); //connect(appOpacityBox, SIGNAL(valueChanged(int)), this, SLOT(apply())); termOpacityBox->setValue(Properties::Instance()->termOpacity); //connect(termOpacityBox, SIGNAL(valueChanged(int)), this, SLOT(apply())); highlightCurrentCheckBox->setChecked(Properties::Instance()->highlightCurrentTerminal); historyLimited->setChecked(Properties::Instance()->historyLimited); historyUnlimited->setChecked(!Properties::Instance()->historyLimited); historyLimitedTo->setValue(Properties::Instance()->historyLimitedTo); dropShowOnStartCheckBox->setChecked(Properties::Instance()->dropShowOnStart); dropHeightSpinBox->setValue(Properties::Instance()->dropHeight); dropWidthSpinBox->setValue(Properties::Instance()->dropWidht); dropShortCutEdit->setText(Properties::Instance()->dropShortCut.toString()); }