Changeset View
Changeset View
Standalone View
Standalone View
addons/kate-ctags/kate_ctags_view.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 42 | { | |||
---|---|---|---|---|---|
46 | m_toolView = mainWin->createToolView(plugin, QLatin1String("kate_plugin_katectagsplugin"), | 46 | m_toolView = mainWin->createToolView(plugin, QLatin1String("kate_plugin_katectagsplugin"), | ||
47 | KTextEditor::MainWindow::Bottom, | 47 | KTextEditor::MainWindow::Bottom, | ||
48 | QIcon::fromTheme(QStringLiteral("application-x-ms-dos-executable")), | 48 | QIcon::fromTheme(QStringLiteral("application-x-ms-dos-executable")), | ||
49 | i18n("CTags")); | 49 | i18n("CTags")); | ||
50 | m_mWin = mainWin; | 50 | m_mWin = mainWin; | ||
51 | 51 | | |||
52 | QAction *back = actionCollection()->addAction(QLatin1String("ctags_return_step")); | 52 | QAction *back = actionCollection()->addAction(QLatin1String("ctags_return_step")); | ||
53 | back->setText(i18n("Jump back one step")); | 53 | back->setText(i18n("Jump back one step")); | ||
54 | connect(back, SIGNAL(triggered(bool)), this, SLOT(stepBack())); | 54 | connect(back, &QAction::triggered, this, &KateCTagsView::stepBack); | ||
55 | 55 | | |||
56 | QAction *decl = actionCollection()->addAction(QLatin1String("ctags_lookup_current_as_declaration")); | 56 | QAction *decl = actionCollection()->addAction(QLatin1String("ctags_lookup_current_as_declaration")); | ||
57 | decl->setText(i18n("Go to Declaration")); | 57 | decl->setText(i18n("Go to Declaration")); | ||
58 | connect(decl, SIGNAL(triggered(bool)), this, SLOT(gotoDeclaration())); | 58 | connect(decl, &QAction::triggered, this, &KateCTagsView::gotoDeclaration); | ||
59 | 59 | | |||
60 | QAction *defin = actionCollection()->addAction(QLatin1String("ctags_lookup_current_as_definition")); | 60 | QAction *defin = actionCollection()->addAction(QLatin1String("ctags_lookup_current_as_definition")); | ||
61 | defin->setText(i18n("Go to Definition")); | 61 | defin->setText(i18n("Go to Definition")); | ||
62 | connect(defin, SIGNAL(triggered(bool)), this, SLOT(gotoDefinition())); | 62 | connect(defin, &QAction::triggered, this, &KateCTagsView::gotoDefinition); | ||
63 | 63 | | |||
64 | QAction *lookup = actionCollection()->addAction(QLatin1String("ctags_lookup_current")); | 64 | QAction *lookup = actionCollection()->addAction(QLatin1String("ctags_lookup_current")); | ||
65 | lookup->setText(i18n("Lookup Current Text")); | 65 | lookup->setText(i18n("Lookup Current Text")); | ||
66 | connect(lookup, SIGNAL(triggered(bool)), this, SLOT(lookupTag())); | 66 | connect(lookup, &QAction::triggered, this, &KateCTagsView::lookupTag); | ||
67 | 67 | | |||
68 | // popup menu | 68 | // popup menu | ||
69 | m_menu = new KActionMenu(i18n("CTags"), this); | 69 | m_menu = new KActionMenu(i18n("CTags"), this); | ||
70 | actionCollection()->addAction(QLatin1String("popup_ctags"), m_menu); | 70 | actionCollection()->addAction(QLatin1String("popup_ctags"), m_menu); | ||
71 | 71 | | |||
72 | m_gotoDec=m_menu->menu()->addAction(i18n("Go to Declaration: %1",QString()), this, SLOT(gotoDeclaration())); | 72 | m_gotoDec=m_menu->menu()->addAction(i18n("Go to Declaration: %1",QString()), this, SLOT(gotoDeclaration())); | ||
73 | m_gotoDef=m_menu->menu()->addAction(i18n("Go to Definition: %1",QString()), this, SLOT(gotoDefinition())); | 73 | m_gotoDef=m_menu->menu()->addAction(i18n("Go to Definition: %1",QString()), this, SLOT(gotoDefinition())); | ||
74 | m_lookup=m_menu->menu()->addAction(i18n("Lookup: %1",QString()), this, SLOT(lookupTag())); | 74 | m_lookup=m_menu->menu()->addAction(i18n("Lookup: %1",QString()), this, SLOT(lookupTag())); | ||
75 | 75 | | |||
76 | connect(m_menu->menu(), SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); | 76 | connect(m_menu->menu(), &QMenu::aboutToShow, this, &KateCTagsView::aboutToShow); | ||
77 | 77 | | |||
78 | QWidget *ctagsWidget = new QWidget(m_toolView); | 78 | QWidget *ctagsWidget = new QWidget(m_toolView); | ||
79 | m_ctagsUi.setupUi(ctagsWidget); | 79 | m_ctagsUi.setupUi(ctagsWidget); | ||
80 | m_ctagsUi.cmdEdit->setText(DEFAULT_CTAGS_CMD); | 80 | m_ctagsUi.cmdEdit->setText(DEFAULT_CTAGS_CMD); | ||
81 | 81 | | |||
82 | m_ctagsUi.addButton->setToolTip(i18n("Add a directory to index.")); | 82 | m_ctagsUi.addButton->setToolTip(i18n("Add a directory to index.")); | ||
83 | m_ctagsUi.addButton->setIcon(QIcon::fromTheme(QStringLiteral("list-add"))); | 83 | m_ctagsUi.addButton->setIcon(QIcon::fromTheme(QStringLiteral("list-add"))); | ||
84 | 84 | | |||
85 | m_ctagsUi.delButton->setToolTip(i18n("Remove a directory.")); | 85 | m_ctagsUi.delButton->setToolTip(i18n("Remove a directory.")); | ||
86 | m_ctagsUi.delButton->setIcon(QIcon::fromTheme(QStringLiteral("list-remove"))); | 86 | m_ctagsUi.delButton->setIcon(QIcon::fromTheme(QStringLiteral("list-remove"))); | ||
87 | 87 | | |||
88 | m_ctagsUi.updateButton->setToolTip(i18n("(Re-)generate the session specific CTags database.")); | 88 | m_ctagsUi.updateButton->setToolTip(i18n("(Re-)generate the session specific CTags database.")); | ||
89 | m_ctagsUi.updateButton->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); | 89 | m_ctagsUi.updateButton->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); | ||
90 | 90 | | |||
91 | m_ctagsUi.updateButton2->setToolTip(i18n("(Re-)generate the session specific CTags database.")); | 91 | m_ctagsUi.updateButton2->setToolTip(i18n("(Re-)generate the session specific CTags database.")); | ||
92 | m_ctagsUi.updateButton2->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); | 92 | m_ctagsUi.updateButton2->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); | ||
93 | 93 | | |||
94 | m_ctagsUi.resetCMD->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); | 94 | m_ctagsUi.resetCMD->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); | ||
95 | 95 | | |||
96 | m_ctagsUi.tagsFile->setToolTip(i18n("Select new or existing database file.")); | 96 | m_ctagsUi.tagsFile->setToolTip(i18n("Select new or existing database file.")); | ||
97 | m_ctagsUi.tagsFile->setMode(KFile::File); | 97 | m_ctagsUi.tagsFile->setMode(KFile::File); | ||
98 | 98 | | |||
99 | connect(m_ctagsUi.resetCMD, SIGNAL(clicked()), this, SLOT(resetCMD())); | 99 | connect(m_ctagsUi.resetCMD, &QToolButton::clicked, this, &KateCTagsView::resetCMD); | ||
100 | connect(m_ctagsUi.addButton, SIGNAL(clicked()), this, SLOT(addTagTarget())); | 100 | connect(m_ctagsUi.addButton, &QPushButton::clicked, this, &KateCTagsView::addTagTarget); | ||
101 | connect(m_ctagsUi.delButton, SIGNAL(clicked()), this, SLOT(delTagTarget())); | 101 | connect(m_ctagsUi.delButton, &QPushButton::clicked, this, &KateCTagsView::delTagTarget); | ||
102 | connect(m_ctagsUi.updateButton, SIGNAL(clicked()), this, SLOT(updateSessionDB())); | 102 | connect(m_ctagsUi.updateButton, &QPushButton::clicked, this, &KateCTagsView::updateSessionDB); | ||
103 | connect(m_ctagsUi.updateButton2, SIGNAL(clicked()), this, SLOT(updateSessionDB())); | 103 | connect(m_ctagsUi.updateButton2, &QPushButton::clicked, this, &KateCTagsView::updateSessionDB); | ||
104 | connect(&m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), | 104 | connect(&m_proc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), | ||
105 | this, SLOT(updateDone(int,QProcess::ExitStatus))); | 105 | this, &KateCTagsView::updateDone); | ||
106 | 106 | | |||
107 | connect(m_ctagsUi.inputEdit, SIGNAL(textChanged(QString)), this, SLOT(startEditTmr())); | 107 | connect(m_ctagsUi.inputEdit, &QLineEdit::textChanged, this, &KateCTagsView::startEditTmr); | ||
108 | 108 | | |||
109 | m_editTimer.setSingleShot(true); | 109 | m_editTimer.setSingleShot(true); | ||
110 | connect(&m_editTimer, SIGNAL(timeout()), this, SLOT(editLookUp())); | 110 | connect(&m_editTimer, &QTimer::timeout, this, &KateCTagsView::editLookUp); | ||
111 | 111 | | |||
112 | connect(m_ctagsUi.tagTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), | 112 | connect(m_ctagsUi.tagTreeWidget, &QTreeWidget::itemActivated, this, &KateCTagsView::tagHitClicked); | ||
113 | SLOT(tagHitClicked(QTreeWidgetItem*))); | | |||
114 | 113 | | |||
115 | connect(m_mWin, SIGNAL(unhandledShortcutOverride(QEvent*)), | 114 | connect(m_mWin, &KTextEditor::MainWindow::unhandledShortcutOverride, this, &KateCTagsView::handleEsc); | ||
116 | this, SLOT(handleEsc(QEvent*))); | | |||
117 | 115 | | |||
118 | m_toolView->installEventFilter(this); | 116 | m_toolView->installEventFilter(this); | ||
119 | 117 | | |||
120 | m_mWin->guiFactory()->addClient(this); | 118 | m_mWin->guiFactory()->addClient(this); | ||
121 | 119 | | |||
122 | m_commonDB = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/katectags/common_db"); | 120 | m_commonDB = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/katectags/common_db"); | ||
123 | } | 121 | } | ||
124 | 122 | | |||
▲ Show 20 Lines • Show All 491 Lines • Show Last 20 Lines |