Changeset View
Changeset View
Standalone View
Standalone View
addons/symbolviewer/plugin_katesymbolviewer.cpp
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 75 | { | |||
---|---|---|---|---|---|
101 | m_struct->setChecked(true); | 101 | m_struct->setChecked(true); | ||
102 | m_func->setChecked(true); | 102 | m_func->setChecked(true); | ||
103 | m_sort->setChecked(m_plugin->sortOn); | 103 | m_sort->setChecked(m_plugin->sortOn); | ||
104 | macro_on = true; | 104 | macro_on = true; | ||
105 | struct_on = true; | 105 | struct_on = true; | ||
106 | func_on = true; | 106 | func_on = true; | ||
107 | 107 | | |||
108 | m_updateTimer.setSingleShot(true); | 108 | m_updateTimer.setSingleShot(true); | ||
109 | connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(slotRefreshSymbol())); | 109 | connect(&m_updateTimer, &QTimer::timerId, this, &KatePluginSymbolViewerView::slotRefreshSymbol); | ||
110 | 110 | | |||
111 | m_currItemTimer.setSingleShot(true); | 111 | m_currItemTimer.setSingleShot(true); | ||
112 | connect(&m_currItemTimer, SIGNAL(timeout()), this, SLOT(updateCurrTreeItem())); | 112 | connect(&m_currItemTimer, &QTimer::timeout, this, &KatePluginSymbolViewerView::updateCurrTreeItem); | ||
113 | 113 | | |||
114 | QPixmap cls( ( const char** ) class_xpm ); | 114 | QPixmap cls( ( const char** ) class_xpm ); | ||
115 | 115 | | |||
116 | m_toolview = m_mainWindow->createToolView(plugin, QLatin1String("kate_plugin_symbolviewer"), | 116 | m_toolview = m_mainWindow->createToolView(plugin, QLatin1String("kate_plugin_symbolviewer"), | ||
117 | KTextEditor::MainWindow::Left, | 117 | KTextEditor::MainWindow::Left, | ||
118 | cls, | 118 | cls, | ||
119 | i18n("Symbol List")); | 119 | i18n("Symbol List")); | ||
120 | 120 | | |||
121 | QWidget *container = new QWidget(m_toolview); | 121 | QWidget *container = new QWidget(m_toolview); | ||
122 | QHBoxLayout *layout = new QHBoxLayout(container); | 122 | QHBoxLayout *layout = new QHBoxLayout(container); | ||
123 | 123 | | |||
124 | m_symbols = new QTreeWidget(); | 124 | m_symbols = new QTreeWidget(); | ||
125 | m_symbols->setFocusPolicy(Qt::NoFocus); | 125 | m_symbols->setFocusPolicy(Qt::NoFocus); | ||
126 | m_symbols->setLayoutDirection( Qt::LeftToRight ); | 126 | m_symbols->setLayoutDirection( Qt::LeftToRight ); | ||
127 | layout->addWidget(m_symbols, 10); | 127 | layout->addWidget(m_symbols, 10); | ||
128 | layout->setContentsMargins(0,0,0,0); | 128 | layout->setContentsMargins(0,0,0,0); | ||
129 | 129 | | |||
130 | connect(m_symbols, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(goToSymbol(QTreeWidgetItem*))); | 130 | connect(m_symbols, &QTreeWidget::itemClicked, this, &KatePluginSymbolViewerView::goToSymbol); | ||
131 | connect(m_symbols, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotShowContextMenu(QPoint))); | 131 | connect(m_symbols, &QTreeWidget::customContextMenuRequested, this, &KatePluginSymbolViewerView::slotShowContextMenu); | ||
132 | 132 | | |||
133 | connect(m_mainWindow, SIGNAL(viewChanged(KTextEditor::View *)), this, SLOT(slotDocChanged())); | 133 | connect(m_mainWindow, &KTextEditor::MainWindow::viewChanged, this, &KatePluginSymbolViewerView::slotDocChanged); | ||
134 | 134 | | |||
135 | QStringList titles; | 135 | QStringList titles; | ||
136 | titles << i18nc("@title:column", "Symbols") << i18nc("@title:column", "Position"); | 136 | titles << i18nc("@title:column", "Symbols") << i18nc("@title:column", "Position"); | ||
137 | m_symbols->setColumnCount(2); | 137 | m_symbols->setColumnCount(2); | ||
138 | m_symbols->setHeaderLabels(titles); | 138 | m_symbols->setHeaderLabels(titles); | ||
139 | 139 | | |||
140 | m_symbols->setColumnHidden(1, true); | 140 | m_symbols->setColumnHidden(1, true); | ||
141 | m_symbols->setSortingEnabled(m_plugin->sortOn); | 141 | m_symbols->setSortingEnabled(m_plugin->sortOn); | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | |||||
220 | 220 | | |||
221 | void KatePluginSymbolViewerView::slotDocChanged() | 221 | void KatePluginSymbolViewerView::slotDocChanged() | ||
222 | { | 222 | { | ||
223 | slotRefreshSymbol(); | 223 | slotRefreshSymbol(); | ||
224 | 224 | | |||
225 | KTextEditor::View *view = m_mainWindow->activeView(); | 225 | KTextEditor::View *view = m_mainWindow->activeView(); | ||
226 | //qDebug()<<"Document changed !!!!" << view; | 226 | //qDebug()<<"Document changed !!!!" << view; | ||
227 | if (view) { | 227 | if (view) { | ||
228 | connect(view, SIGNAL(cursorPositionChanged(KTextEditor::View*,KTextEditor::Cursor)), | 228 | connect(view, &KTextEditor::View::cursorPositionChanged, this, &KatePluginSymbolViewerView::cursorPositionChanged); | ||
229 | this, SLOT(cursorPositionChanged()), Qt::UniqueConnection); | | |||
230 | 229 | | |||
231 | if (view->document()) { | 230 | if (view->document()) { | ||
232 | connect(view->document(), SIGNAL(textChanged(KTextEditor::Document*)), | 231 | connect(view->document(), &KTextEditor::Document::textChanged, this, &KatePluginSymbolViewerView::slotDocEdited); | ||
233 | this, SLOT(slotDocEdited()), Qt::UniqueConnection); | | |||
234 | } | 232 | } | ||
235 | } | 233 | } | ||
236 | } | 234 | } | ||
237 | 235 | | |||
238 | void KatePluginSymbolViewerView::slotDocEdited() | 236 | void KatePluginSymbolViewerView::slotDocEdited() | ||
239 | { | 237 | { | ||
240 | m_updateTimer.start(500); | 238 | m_updateTimer.start(500); | ||
241 | } | 239 | } | ||
▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Line(s) | |||||
387 | { | 385 | { | ||
388 | KatePluginSymbolViewerConfigPage* p = new KatePluginSymbolViewerConfigPage(this, parent); | 386 | KatePluginSymbolViewerConfigPage* p = new KatePluginSymbolViewerConfigPage(this, parent); | ||
389 | 387 | | |||
390 | KConfigGroup config(KSharedConfig::openConfig(), QStringLiteral("PluginSymbolViewer")); | 388 | KConfigGroup config(KSharedConfig::openConfig(), QStringLiteral("PluginSymbolViewer")); | ||
391 | p->viewReturns->setChecked(config.readEntry(QLatin1String("ViewTypes"), false)); | 389 | p->viewReturns->setChecked(config.readEntry(QLatin1String("ViewTypes"), false)); | ||
392 | p->expandTree->setChecked(config.readEntry(QLatin1String("ExpandTree"), false)); | 390 | p->expandTree->setChecked(config.readEntry(QLatin1String("ExpandTree"), false)); | ||
393 | p->treeView->setChecked(config.readEntry(QLatin1String("TreeView"), false)); | 391 | p->treeView->setChecked(config.readEntry(QLatin1String("TreeView"), false)); | ||
394 | p->sortSymbols->setChecked(config.readEntry(QLatin1String("SortSymbols"), false)); | 392 | p->sortSymbols->setChecked(config.readEntry(QLatin1String("SortSymbols"), false)); | ||
395 | connect( p, SIGNAL(configPageApplyRequest(KatePluginSymbolViewerConfigPage*)), | 393 | connect(p, &KatePluginSymbolViewerConfigPage::configPageApplyRequest, this, &KatePluginSymbolViewer::applyConfig); | ||
396 | SLOT(applyConfig(KatePluginSymbolViewerConfigPage*)) ); | | |||
397 | return (KTextEditor::ConfigPage*)p; | 394 | return (KTextEditor::ConfigPage*)p; | ||
398 | } | 395 | } | ||
399 | 396 | | |||
400 | void KatePluginSymbolViewer::applyConfig( KatePluginSymbolViewerConfigPage* p ) | 397 | void KatePluginSymbolViewer::applyConfig( KatePluginSymbolViewerConfigPage* p ) | ||
401 | { | 398 | { | ||
402 | KConfigGroup config(KSharedConfig::openConfig(), QStringLiteral("PluginSymbolViewer")); | 399 | KConfigGroup config(KSharedConfig::openConfig(), QStringLiteral("PluginSymbolViewer")); | ||
403 | config.writeEntry(QLatin1String("ViewTypes"), p->viewReturns->isChecked()); | 400 | config.writeEntry(QLatin1String("ViewTypes"), p->viewReturns->isChecked()); | ||
404 | config.writeEntry(QLatin1String("ExpandTree"), p->expandTree->isChecked()); | 401 | config.writeEntry(QLatin1String("ExpandTree"), p->expandTree->isChecked()); | ||
Show All 33 Lines | 415 | { | |||
438 | //genLay->addWidget( ); | 435 | //genLay->addWidget( ); | ||
439 | 436 | | |||
440 | lo->addWidget( parserGBox ); | 437 | lo->addWidget( parserGBox ); | ||
441 | //lo->addWidget( generalGBox ); | 438 | //lo->addWidget( generalGBox ); | ||
442 | lo->addStretch( 1 ); | 439 | lo->addStretch( 1 ); | ||
443 | 440 | | |||
444 | 441 | | |||
445 | // throw signal changed | 442 | // throw signal changed | ||
446 | connect(viewReturns, SIGNAL(toggled(bool)), this, SIGNAL(changed())); | 443 | connect(viewReturns, &QCheckBox::toggled, this, &KatePluginSymbolViewerConfigPage::changed); | ||
447 | connect(expandTree, SIGNAL(toggled(bool)), this, SIGNAL(changed())); | 444 | connect(expandTree, &QCheckBox::toggled, this, &KatePluginSymbolViewerConfigPage::changed); | ||
448 | connect(treeView, SIGNAL(toggled(bool)), this, SIGNAL(changed())); | 445 | connect(treeView, &QCheckBox::toggled, this, &KatePluginSymbolViewerConfigPage::changed); | ||
449 | connect(sortSymbols, SIGNAL(toggled(bool)), this, SIGNAL(changed())); | 446 | connect(sortSymbols, &QCheckBox::toggled, this, &KatePluginSymbolViewerConfigPage::changed); | ||
450 | } | 447 | } | ||
451 | 448 | | |||
452 | KatePluginSymbolViewerConfigPage::~KatePluginSymbolViewerConfigPage() {} | 449 | KatePluginSymbolViewerConfigPage::~KatePluginSymbolViewerConfigPage() {} | ||
453 | 450 | | |||
454 | QString KatePluginSymbolViewerConfigPage::name() const { return i18n("Symbol Viewer"); } | 451 | QString KatePluginSymbolViewerConfigPage::name() const { return i18n("Symbol Viewer"); } | ||
455 | QString KatePluginSymbolViewerConfigPage::fullName() const { return i18n("Symbol Viewer Configuration Page"); } | 452 | QString KatePluginSymbolViewerConfigPage::fullName() const { return i18n("Symbol Viewer Configuration Page"); } | ||
456 | QIcon KatePluginSymbolViewerConfigPage::icon() const { return QPixmap(( const char** ) class_xpm ); } | 453 | QIcon KatePluginSymbolViewerConfigPage::icon() const { return QPixmap(( const char** ) class_xpm ); } | ||
457 | 454 | | |||
Show All 11 Lines |