// Apply changes to prefs. Auto connected. void ScripterPrefsGui::apply() { scripterCore->setExtensionsEnabled(extensionScriptsChk->isChecked()); scripterCore->setStartupScript(startupScriptEdit->text()); syntaxColors->saveToPrefs(); // Necessary to update console syntax highlighter emit prefsChanged(); }
SqlEditorWidget::SqlEditorWidget(QWidget * parent) : QsciScintilla(parent), m_searchText(""), m_searchIndicator(9) // see QsciScintilla docs { m_prefs = Preferences::instance(); setMarginLineNumbers(0, true); setBraceMatching(SloppyBraceMatch); setAutoIndent(true); QsciLexerSQL * lexer = new QsciLexerSQL(this); QsciAPIs * api = new QsciAPIs(lexer); if (!api->load(":/api/sqlite.api")) qDebug("api is not loaded"); else { api->prepare(); lexer->setAPIs(api); } setAutoCompletionSource(QsciScintilla::AcsAll); setAutoCompletionCaseSensitivity(false); setAutoCompletionReplaceWord(true); setCaretLineVisible(m_prefs->activeHighlighting()); setCaretLineBackgroundColor(m_prefs->activeHighlightColor()); setUtf8(true); setFolding(QsciScintilla::BoxedFoldStyle); lexer->setFoldComments(true); lexer->setFoldCompact(false); setLexer(lexer); // search all occurrences // allow indicator painting *under* the text (but it makes editor slower a bit...) // It paints a colored box under the text for all occurrences of m_searchText. SendScintilla(QsciScintilla::SCI_SETTWOPHASEDRAW, 1); SendScintilla(QsciScintilla::SCI_INDICSETSTYLE, m_searchIndicator, QsciScintilla::INDIC_ROUNDBOX); // TODO/FIXME: make it configurable SendScintilla(QsciScintilla::SCI_INDICSETFORE, m_searchIndicator, QColor(255, 230, 90, 100)); SendScintilla(QsciScintilla::SCI_INDICSETUNDER, m_searchIndicator, 1); // end of search all occurrences connect(this, SIGNAL(linesChanged()), this, SLOT(linesChanged())); connect(this, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(cursorPositionChanged(int, int))); setCursorPosition(0, 0); linesChanged(); prefsChanged(); }
NS_IMETHODIMP nsIDNService::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) { if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsCOMPtr<nsIPrefBranch> prefBranch( do_QueryInterface(aSubject) ); if (prefBranch) prefsChanged(prefBranch, aData); } return NS_OK; }
nsresult nsIDNService::Init() { nsCOMPtr<nsIPrefBranch2> prefInternal(do_GetService(NS_PREFSERVICE_CONTRACTID)); if (prefInternal) { prefInternal->AddObserver(NS_NET_PREF_IDNTESTBED, this, PR_TRUE); prefInternal->AddObserver(NS_NET_PREF_IDNPREFIX, this, PR_TRUE); prefInternal->AddObserver(NS_NET_PREF_IDNBLACKLIST, this, PR_TRUE); prefsChanged(prefInternal, nsnull); } return NS_OK; }
UndoPalette::UndoPalette(QWidget* parent, const char* name) : UndoGui(parent, name) { currentSelection = 0; redoItems = 0; QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(5); layout->setSpacing(5); objectBox = new QCheckBox(this); layout->addWidget(objectBox); // objectBox->setEnabled(false); undoList = new QListWidget(this); // undoList->setMultiSelection(false); // undoList->setSelectionMode(QListWidget::Single); undoList->setSelectionMode(QAbstractItemView::SingleSelection); undoList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); layout->addWidget(undoList); QHBoxLayout* buttonLayout = new QHBoxLayout; buttonLayout->setMargin(0); buttonLayout->setSpacing(5); undoButton = new QPushButton(loadIcon("16/edit-undo.png"), "", this); buttonLayout->addWidget(undoButton); redoButton = new QPushButton(loadIcon("16/edit-redo.png"), "", this); buttonLayout->addWidget(redoButton); //Save the translated key sequence - hopefully we get the translated one here! initialUndoKS = undoButton->shortcut(); initialRedoKS = redoButton->shortcut(); layout->addLayout(buttonLayout); updateFromPrefs(); languageChange(); connect(PrefsManager::instance(), SIGNAL(prefsChanged()), this, SLOT(updateFromPrefs())); connect(undoButton, SIGNAL(clicked()), this, SLOT(undoClicked())); connect(redoButton, SIGNAL(clicked()), this, SLOT(redoClicked())); // connect(undoList, SIGNAL(highlighted(int)), this, SLOT(undoListClicked(int))); connect(undoList, SIGNAL(currentRowChanged(int)), this, SLOT(undoListClicked(int))); // connect(undoList, SIGNAL(onItem(Q3ListBoxItem*)), this, SLOT(showToolTip(Q3ListBoxItem*))); connect(undoList, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(showToolTip(QListWidgetItem*))); // connect(undoList, SIGNAL(onViewport()), this, SLOT(removeToolTip())); connect(undoList, SIGNAL(viewportEntered()), this, SLOT(removeToolTip())); connect(objectBox, SIGNAL(toggled(bool)), this, SLOT(objectCheckBoxClicked(bool))); connect(ScCore->primaryMainWindow()->scrActions["editActionMode"], SIGNAL(toggled(bool)), objectBox, SLOT(setChecked(bool))); connect(objectBox, SIGNAL(toggled(bool)), ScCore->primaryMainWindow()->scrActions["editActionMode"], SLOT(setChecked(bool))); }
nsresult nsIDNService::Init() { nsCOMPtr<nsIPrefService> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); if (prefs) prefs->GetBranch(NS_NET_PREF_IDNWHITELIST, getter_AddRefs(mIDNWhitelistPrefBranch)); nsCOMPtr<nsIPrefBranch2> prefInternal(do_QueryInterface(prefs)); if (prefInternal) { prefInternal->AddObserver(NS_NET_PREF_IDNTESTBED, this, PR_TRUE); prefInternal->AddObserver(NS_NET_PREF_IDNPREFIX, this, PR_TRUE); prefInternal->AddObserver(NS_NET_PREF_IDNBLACKLIST, this, PR_TRUE); prefInternal->AddObserver(NS_NET_PREF_SHOWPUNYCODE, this, PR_TRUE); prefsChanged(prefInternal, nsnull); } return NS_OK; }
SqlEditor::SqlEditor(LiteManWindow * parent) : QMainWindow(parent), m_fileWatcher(0) { creator = parent; ui.setupUi(this); #ifdef Q_WS_MAC ui.toolBar->setIconSize(QSize(16, 16)); #endif m_fileName = QString(); //m_fileWatcher = new QFileSystemWatcher(this); ui.sqlTextEdit->prefsChanged(); // addon run sql shortcut changedLabel = new QLabel(this); cursorTemplate = tr("Col: %1 Line: %2/%3"); cursorLabel = new QLabel(this); statusBar()->addPermanentWidget(changedLabel); statusBar()->addPermanentWidget(cursorLabel); sqlTextEdit_cursorPositionChanged(1, 1); toSQLParse::settings cur; cur.ExpandSpaces = false; cur.CommaBefore = false; cur.BlockOpenLine = false; cur.OperatorSpace = false; cur.KeywordUpper = false; cur.RightSeparator = false; cur.EndBlockNewline = false; cur.IndentLevel = true; cur.CommentColumn = false; toSQLParse::setSetting(cur); ui.searchFrame->hide(); ui.previousToolButton->setIcon(Utils::getIcon("go-previous.png")); ui.nextToolButton->setIcon(Utils::getIcon("go-next.png")); ui.action_Run_SQL->setIcon(Utils::getIcon("runsql.png")); ui.actionRun_Explain->setIcon(Utils::getIcon("runexplain.png")); ui.actionRun_as_Script->setIcon(Utils::getIcon("runscript.png")); ui.action_Open->setIcon(Utils::getIcon("document-open.png")); ui.action_Save->setIcon(Utils::getIcon("document-save.png")); ui.action_New->setIcon(Utils::getIcon("document-new.png")); ui.actionSave_As->setIcon(Utils::getIcon("document-save-as.png")); ui.actionCreateView->setIcon(Utils::getIcon("view.png")); ui.actionSearch->setIcon(Utils::getIcon("system-search.png")); QShortcut * alternativeSQLRun = new QShortcut(this); alternativeSQLRun->setKey(Qt::CTRL + Qt::Key_Return); QSettings settings("yarpen.cz", "sqliteman"); restoreState(settings.value("sqleditor/state").toByteArray()); connect(ui.actionShow_History, SIGNAL(triggered()), this, SLOT(actionShow_History_triggered())); actionShow_History_triggered(); connect(ui.action_Run_SQL, SIGNAL(triggered()), this, SLOT(action_Run_SQL_triggered())); // alternative run action for Ctrl+Enter connect(alternativeSQLRun, SIGNAL(activated()), this, SLOT(action_Run_SQL_triggered())); connect(ui.actionRun_Explain, SIGNAL(triggered()), this, SLOT(actionRun_Explain_triggered())); connect(ui.actionRun_as_Script, SIGNAL(triggered()), this, SLOT(actionRun_as_Script_triggered())); connect(ui.action_Open, SIGNAL(triggered()), this, SLOT(action_Open_triggered())); connect(ui.action_Save, SIGNAL(triggered()), this, SLOT(action_Save_triggered())); connect(ui.action_New, SIGNAL(triggered()), this, SLOT(action_New_triggered())); connect(ui.actionSave_As, SIGNAL(triggered()), this, SLOT(actionSave_As_triggered())); connect(ui.actionCreateView, SIGNAL(triggered()), this, SLOT(actionCreateView_triggered())); connect(ui.sqlTextEdit, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(sqlTextEdit_cursorPositionChanged(int,int))); connect(ui.sqlTextEdit, SIGNAL(modificationChanged(bool)), this, SLOT(documentChanged(bool))); connect(parent, SIGNAL(prefsChanged()), ui.sqlTextEdit, SLOT(prefsChanged())); // search connect(ui.actionSearch, SIGNAL(triggered()), this, SLOT(actionSearch_triggered())); connect(ui.searchEdit, SIGNAL(textChanged(const QString &)), this, SLOT(searchEdit_textChanged(const QString &))); connect(ui.previousToolButton, SIGNAL(clicked()), this, SLOT(findPrevious())); connect(ui.nextToolButton, SIGNAL(clicked()), this, SLOT(findNext())); connect(ui.searchEdit, SIGNAL(returnPressed()), this, SLOT(findNext())); }