AS_NAMESPACE_START SettingsEditor::SettingsEditor(QWidget *p) : Dialog(Qrc::text("dialog.settings.title"), p) { setFixedSize(480, 192); setWindowIcon(Qrc::icon("toolbar_settings")); auto pr = Preferences::get(); // Form : Start QFormLayout *form = new QFormLayout; QPushButton *browse = new QPushButton(Qrc::text("dialog.settings.buttons.browse"), this); QLayout *row = new QHBoxLayout; row->addWidget(_binariesPath = new QLineEdit(pr->binariesPath(), this)); row->addWidget(browse); form->addRow(Qrc::text("dialog.settings.form.binaries_path"), row); _javaHeap = new QSpinBox(this); _javaHeap->setMinimum(16); _javaHeap->setMaximum(4096); _javaHeap->setSingleStep(4); _javaHeap->setValue(pr->javaHeap()); form->addRow(Qrc::text("dialog.settings.form.java_heap"), _javaHeap); form->addRow(Qrc::text("dialog.settings.form.show_whitespaces"), _showWhitespaces = new QCheckBox(this)); _tabStopWidth = new QSpinBox(this); _tabStopWidth->setMinimum(1); _tabStopWidth->setMaximum(99); _tabStopWidth->setSingleStep(1); _tabStopWidth->setValue(pr->tabStopWidth()); form->addRow(Qrc::text("dialog.settings.form.tab_stop_width"), _tabStopWidth); form->addRow(Qrc::text("dialog.settings.form.spaces_for_tabs"), _useSpacesForTabs = new QCheckBox(this)); _showWhitespaces->setChecked(pr->showWhitespaces()); _useSpacesForTabs->setChecked(pr->useSpacesForTabs()); // Form : End QVBoxLayout *layout = new QVBoxLayout(this); QDialogButtonBox *buttons = new QDialogButtonBox(this); buttons->addButton(new QPushButton(Qrc::text("dialog.settings.buttons.cancel"), buttons), QDialogButtonBox::RejectRole); buttons->addButton(new QPushButton(Qrc::text("dialog.settings.buttons.save"), buttons), QDialogButtonBox::AcceptRole); layout->addLayout(form); layout->addWidget(buttons); _connections << connect(browse, &QPushButton::clicked, [=] { QFileDialog d(this, Qrc::text("dialog.open.binaries.title"), pr->binariesPath()); d.setAcceptMode(QFileDialog::AcceptOpen); d.setFileMode(QFileDialog::Directory); d.setOptions(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (d.exec() == QFileDialog::Accepted) { QStringList files; if ((files = d.selectedFiles()).isEmpty() == false) { _binariesPath->setText(files.first()); } } }); _connections << connect(buttons, &QDialogButtonBox::accepted, this, &SettingsEditor::onSaveClicked); _connections << connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::close); }
int QPlainTextEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QAbstractScrollArea::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 25) qt_static_metacall(this, _c, _id, _a); _id -= 25; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = tabChangesFocus(); break; case 1: *reinterpret_cast< QString*>(_v) = documentTitle(); break; case 2: *reinterpret_cast< bool*>(_v) = isUndoRedoEnabled(); break; case 3: *reinterpret_cast< LineWrapMode*>(_v) = lineWrapMode(); break; case 4: *reinterpret_cast< bool*>(_v) = isReadOnly(); break; case 5: *reinterpret_cast< QString*>(_v) = toPlainText(); break; case 6: *reinterpret_cast< bool*>(_v) = overwriteMode(); break; case 7: *reinterpret_cast< int*>(_v) = tabStopWidth(); break; case 8: *reinterpret_cast< int*>(_v) = cursorWidth(); break; case 9: *reinterpret_cast< Qt::TextInteractionFlags*>(_v) = textInteractionFlags(); break; case 10: *reinterpret_cast< int*>(_v) = blockCount(); break; case 11: *reinterpret_cast< int*>(_v) = maximumBlockCount(); break; case 12: *reinterpret_cast< bool*>(_v) = backgroundVisible(); break; case 13: *reinterpret_cast< bool*>(_v) = centerOnScroll(); break; } _id -= 14; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setTabChangesFocus(*reinterpret_cast< bool*>(_v)); break; case 1: setDocumentTitle(*reinterpret_cast< QString*>(_v)); break; case 2: setUndoRedoEnabled(*reinterpret_cast< bool*>(_v)); break; case 3: setLineWrapMode(*reinterpret_cast< LineWrapMode*>(_v)); break; case 4: setReadOnly(*reinterpret_cast< bool*>(_v)); break; case 5: setPlainText(*reinterpret_cast< QString*>(_v)); break; case 6: setOverwriteMode(*reinterpret_cast< bool*>(_v)); break; case 7: setTabStopWidth(*reinterpret_cast< int*>(_v)); break; case 8: setCursorWidth(*reinterpret_cast< int*>(_v)); break; case 9: setTextInteractionFlags(*reinterpret_cast< Qt::TextInteractionFlags*>(_v)); break; case 11: setMaximumBlockCount(*reinterpret_cast< int*>(_v)); break; case 12: setBackgroundVisible(*reinterpret_cast< bool*>(_v)); break; case 13: setCenterOnScroll(*reinterpret_cast< bool*>(_v)); break; } _id -= 14; } else if (_c == QMetaObject::ResetProperty) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 14; } #endif // QT_NO_PROPERTIES return _id; }