char *slot_buffer(int n) { if (n < 0 || n >= NUM_SLOTS) return NULL; // invalid slot slot_t *slot = slots[n]; if (slot == NULL) slot = slot_reload(n); return slot->buffer; }
SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog), stackedLayout(new QStackedLayout) { ui->setupUi(this); QT_TR_NOOP("environment"); QT_TR_NOOP("general"); QT_TR_NOOP("language"); QT_TR_NOOP("de_DE"); QT_TR_NOOP("en_US"); QT_TR_NOOP("Design"); QT_TR_NOOP("Colors"); QT_TR_NOOP("backgroundColor"); QT_TR_NOOP("Userinterface"); QT_TR_NOOP("Cursor"); QT_TR_NOOP("cursorSize"); QT_TR_NOOP("cursorLineWidth"); QT_TR_NOOP("cursorPickboxSize"); QT_TR_NOOP("Snap"); QT_TR_NOOP("snapIndicatorSize"); QT_TR_NOOP("pickbox"); QT_TR_NOOP("pickboxOutlineWidth"); QT_TR_NOOP("pickboxOutlineColorLeft"); QT_TR_NOOP("pickboxOutlineColorRight"); QT_TR_NOOP("pickboxFillColorLeft"); QT_TR_NOOP("pickboxFillColorRight"); QT_TR_NOOP("arcball"); QT_TR_NOOP("arcballRadius"); stackedLayout->setMargin(0); stackedLayout->addWidget(new QWidget(this)); ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); ((QGridLayout *)this->layout())->addLayout(stackedLayout, 1, 1, 1, 1); connect(this, SIGNAL(signal_settingsChanged()), this, SLOT(slot_reload())); this->loadCategorys(); foreach (Category *category, categories) { QListWidgetItem *item = new QListWidgetItem(category->icon, category->displayName); ui->listWidget->addItem(item); }
STSourceEditor::STSourceEditor(QWidget *parent) : QWidget(parent) { ui.setupUi(this); CppHighlighter *m_highlighter_header=new CppHighlighter; CppHighlighter *m_highlighter_source=new CppHighlighter; m_highlighter_header->setDocument(ui.header->editor()->document()); m_highlighter_source->setDocument(ui.source->editor()->document()); QMap<QString,QTextCharFormat> formats; QTextCharFormat format; format.setForeground(QBrush(Qt::darkGreen)); formats["comment"]=format; format.setForeground(QBrush(Qt::darkBlue)); formats["cpp_keyword"]=format; format.setForeground(QBrush(Qt::darkMagenta)); formats["qt_keyword"]=format; format.setForeground(QBrush(Qt::darkGray)); formats["operator"]=format; format.setForeground(QBrush(Qt::darkGray)); formats["number"]=format; format.setForeground(QBrush(Qt::red)); formats["escape_char"]=format; format.setForeground(QBrush(Qt::darkBlue)); formats["macro"]=format; format.setForeground(QBrush(Qt::darkRed)); formats["string"]=format; format.setForeground(QBrush(Qt::black)); formats["function_name"]=format; m_highlighter_header->set_text_formats(formats); m_highlighter_source->set_text_formats(formats); QStringList source_keywords; source_keywords << "ST_CLASS" << "ST_PARAMETER" << "ST_CHILD" << "ST_ALIGN" << "ST_DEFAULT"; foreach (QString source_keyword,source_keywords) m_highlighter_source->addUserKeyword(source_keyword); m_C=0; QAction *action_save_changes=new QAction("Save changes to code (Ctrl+U)",this); action_save_changes->setShortcut(tr("Ctrl+U")); ui.save_changes_button->setDefaultAction(action_save_changes); addAction(action_save_changes); QAction *action_find=new QAction(this); action_find->setShortcut(tr("Ctrl+F")); addAction(action_find); connect(action_find,SIGNAL(triggered()),this,SLOT(slot_find())); connect(ui.header->editor()->document(),SIGNAL(modificationChanged(bool)),this,SLOT(slot_modification_changed())); connect(ui.source->editor()->document(),SIGNAL(modificationChanged(bool)),this,SLOT(slot_modification_changed())); connect(ui.save_changes_button,SIGNAL(clicked()),this,SLOT(slotSaveChanges())); connect(ui.reload_button,SIGNAL(clicked()),this,SLOT(slot_reload())); connect(action_save_changes,SIGNAL(triggered()),this,SLOT(slotSaveChanges())); //connect(ui.actionCompile,SIGNAL(triggered()),this,SIGNAL(signalCompile())); connect(ui.class_box,SIGNAL(currentIndexChanged(QString)),this,SLOT(slot_class_box_changed(QString))); //ui.actionSaveChanges->setShortcut(tr("Ctrl+S")); //ui.actionCompile->setShortcut(tr("F9")); }