Changeset View
Changeset View
Standalone View
Standalone View
addons/katebuild-plugin/plugin_katebuild.cpp
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Line(s) | 98 | { | |||
---|---|---|---|---|---|
102 | m_toolView = mw->createToolView(plugin, QStringLiteral("kate_plugin_katebuildplugin"), | 102 | m_toolView = mw->createToolView(plugin, QStringLiteral("kate_plugin_katebuildplugin"), | ||
103 | KTextEditor::MainWindow::Bottom, | 103 | KTextEditor::MainWindow::Bottom, | ||
104 | QIcon::fromTheme(QStringLiteral("application-x-ms-dos-executable")), | 104 | QIcon::fromTheme(QStringLiteral("application-x-ms-dos-executable")), | ||
105 | i18n("Build Output")); | 105 | i18n("Build Output")); | ||
106 | 106 | | |||
107 | QAction *a = actionCollection()->addAction(QStringLiteral("select_target")); | 107 | QAction *a = actionCollection()->addAction(QStringLiteral("select_target")); | ||
108 | a->setText(i18n("Select Target...")); | 108 | a->setText(i18n("Select Target...")); | ||
109 | a->setIcon(QIcon::fromTheme(QStringLiteral("select"))); | 109 | a->setIcon(QIcon::fromTheme(QStringLiteral("select"))); | ||
110 | connect(a, SIGNAL(triggered(bool)), this, SLOT(slotSelectTarget())); | 110 | connect(a, &QAction::triggered, this, &KateBuildView::slotSelectTarget); | ||
111 | | ||||
112 | a = actionCollection()->addAction(QStringLiteral("build_default_target")); | 111 | a = actionCollection()->addAction(QStringLiteral("build_default_target")); | ||
113 | a->setText(i18n("Build Default Target")); | 112 | a->setText(i18n("Build Default Target")); | ||
114 | connect(a, SIGNAL(triggered(bool)), this, SLOT(slotBuildDefaultTarget())); | 113 | connect(a, &QAction::triggered, this, &KateBuildView::slotBuildDefaultTarget); | ||
115 | 114 | | |||
116 | a = actionCollection()->addAction(QStringLiteral("build_previous_target")); | 115 | a = actionCollection()->addAction(QStringLiteral("build_previous_target")); | ||
117 | a->setText(i18n("Build Previous Target")); | 116 | a->setText(i18n("Build Previous Target")); | ||
118 | connect(a, SIGNAL(triggered(bool)), this, SLOT(slotBuildPreviousTarget())); | 117 | connect(a, &QAction::triggered, this, &KateBuildView::slotBuildPreviousTarget); | ||
119 | 118 | | |||
120 | a = actionCollection()->addAction(QStringLiteral("stop")); | 119 | a = actionCollection()->addAction(QStringLiteral("stop")); | ||
121 | a->setText(i18n("Stop")); | 120 | a->setText(i18n("Stop")); | ||
122 | a->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); | 121 | a->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); | ||
123 | connect(a, SIGNAL(triggered(bool)), this, SLOT(slotStop())); | 122 | connect(a, &QAction::triggered, this, &KateBuildView::slotStop); | ||
124 | 123 | | |||
125 | a = actionCollection()->addAction(QStringLiteral("goto_next")); | 124 | a = actionCollection()->addAction(QStringLiteral("goto_next")); | ||
126 | a->setText(i18n("Next Error")); | 125 | a->setText(i18n("Next Error")); | ||
127 | a->setIcon(QIcon::fromTheme(QStringLiteral("go-next"))); | 126 | a->setIcon(QIcon::fromTheme(QStringLiteral("go-next"))); | ||
128 | actionCollection()->setDefaultShortcut(a, Qt::SHIFT+Qt::ALT+Qt::Key_Right); | 127 | actionCollection()->setDefaultShortcut(a, Qt::SHIFT+Qt::ALT+Qt::Key_Right); | ||
129 | connect(a, SIGNAL(triggered(bool)), this, SLOT(slotNext())); | 128 | connect(a, &QAction::triggered, this, &KateBuildView::slotNext); | ||
130 | 129 | | |||
131 | a = actionCollection()->addAction(QStringLiteral("goto_prev")); | 130 | a = actionCollection()->addAction(QStringLiteral("goto_prev")); | ||
132 | a->setText(i18n("Previous Error")); | 131 | a->setText(i18n("Previous Error")); | ||
133 | a->setIcon(QIcon::fromTheme(QStringLiteral("go-previous"))); | 132 | a->setIcon(QIcon::fromTheme(QStringLiteral("go-previous"))); | ||
134 | actionCollection()->setDefaultShortcut(a, Qt::SHIFT+Qt::ALT+Qt::Key_Left); | 133 | actionCollection()->setDefaultShortcut(a, Qt::SHIFT+Qt::ALT+Qt::Key_Left); | ||
135 | connect(a, SIGNAL(triggered(bool)), this, SLOT(slotPrev())); | 134 | connect(a, &QAction::triggered, this, &KateBuildView::slotPrev); | ||
136 | 135 | | |||
137 | 136 | | |||
138 | m_buildWidget = new QWidget(m_toolView); | 137 | m_buildWidget = new QWidget(m_toolView); | ||
139 | m_buildUi.setupUi(m_buildWidget); | 138 | m_buildUi.setupUi(m_buildWidget); | ||
140 | m_targetsUi = new TargetsUi(this, m_buildUi.u_tabWidget); | 139 | m_targetsUi = new TargetsUi(this, m_buildUi.u_tabWidget); | ||
141 | m_buildUi.u_tabWidget->insertTab(0, m_targetsUi, i18nc("Tab label", "Target Settings")); | 140 | m_buildUi.u_tabWidget->insertTab(0, m_targetsUi, i18nc("Tab label", "Target Settings")); | ||
142 | m_buildUi.u_tabWidget->setCurrentWidget(m_targetsUi); | 141 | m_buildUi.u_tabWidget->setCurrentWidget(m_targetsUi); | ||
143 | 142 | | |||
144 | m_buildWidget->installEventFilter(this); | 143 | m_buildWidget->installEventFilter(this); | ||
145 | 144 | | |||
146 | m_buildUi.buildAgainButton->setVisible(true); | 145 | m_buildUi.buildAgainButton->setVisible(true); | ||
147 | m_buildUi.cancelBuildButton->setVisible(true); | 146 | m_buildUi.cancelBuildButton->setVisible(true); | ||
148 | m_buildUi.buildStatusLabel->setVisible(true); | 147 | m_buildUi.buildStatusLabel->setVisible(true); | ||
149 | m_buildUi.buildAgainButton2->setVisible(false); | 148 | m_buildUi.buildAgainButton2->setVisible(false); | ||
150 | m_buildUi.cancelBuildButton2->setVisible(false); | 149 | m_buildUi.cancelBuildButton2->setVisible(false); | ||
151 | m_buildUi.buildStatusLabel2->setVisible(false); | 150 | m_buildUi.buildStatusLabel2->setVisible(false); | ||
152 | m_buildUi.extraLineLayout->setAlignment(Qt::AlignRight); | 151 | m_buildUi.extraLineLayout->setAlignment(Qt::AlignRight); | ||
153 | m_buildUi.cancelBuildButton->setEnabled(false); | 152 | m_buildUi.cancelBuildButton->setEnabled(false); | ||
154 | m_buildUi.cancelBuildButton2->setEnabled(false); | 153 | m_buildUi.cancelBuildButton2->setEnabled(false); | ||
155 | 154 | | |||
156 | connect(m_buildUi.errTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), | 155 | connect(m_buildUi.errTreeWidget, &QTreeWidget::itemClicked, | ||
157 | SLOT(slotErrorSelected(QTreeWidgetItem*))); | 156 | this, &KateBuildView::slotErrorSelected); | ||
158 | 157 | | |||
159 | m_buildUi.plainTextEdit->setReadOnly(true); | 158 | m_buildUi.plainTextEdit->setReadOnly(true); | ||
160 | slotDisplayMode(FullOutput); | 159 | slotDisplayMode(FullOutput); | ||
161 | 160 | | |||
162 | connect(m_buildUi.displayModeSlider, SIGNAL(valueChanged(int)), this, SLOT(slotDisplayMode(int))); | 161 | connect(m_buildUi.displayModeSlider, &QSlider::valueChanged, this, &KateBuildView::slotDisplayMode); | ||
163 | 162 | | |||
164 | connect(m_buildUi.buildAgainButton, SIGNAL(clicked()), this, SLOT(slotBuildPreviousTarget())); | 163 | connect(m_buildUi.buildAgainButton, &QPushButton::clicked, this, &KateBuildView::slotBuildPreviousTarget); | ||
165 | connect(m_buildUi.cancelBuildButton, SIGNAL(clicked()), this, SLOT(slotStop())); | 164 | connect(m_buildUi.cancelBuildButton, &QPushButton::clicked, this, &KateBuildView::slotStop); | ||
166 | connect(m_buildUi.buildAgainButton2, SIGNAL(clicked()), this, SLOT(slotBuildPreviousTarget())); | 165 | connect(m_buildUi.buildAgainButton2, &QPushButton::clicked, this, &KateBuildView::slotBuildPreviousTarget); | ||
167 | connect(m_buildUi.cancelBuildButton2, SIGNAL(clicked()), this, SLOT(slotStop())); | 166 | connect(m_buildUi.cancelBuildButton2, &QPushButton::clicked, this, &KateBuildView::slotStop); | ||
168 | 167 | | |||
169 | connect(m_targetsUi->newTarget, SIGNAL(clicked()), this, SLOT(targetSetNew())); | 168 | connect(m_targetsUi->newTarget, &QToolButton::clicked, this, &KateBuildView::targetSetNew); | ||
170 | connect(m_targetsUi->copyTarget, SIGNAL(clicked()), this, SLOT(targetOrSetCopy())); | 169 | connect(m_targetsUi->copyTarget, &QToolButton::clicked, this, &KateBuildView::targetOrSetCopy); | ||
171 | connect(m_targetsUi->deleteTarget, SIGNAL(clicked()), this, SLOT(targetDelete())); | 170 | connect(m_targetsUi->deleteTarget, &QToolButton::clicked, this, &KateBuildView::targetDelete); | ||
172 | 171 | | |||
173 | connect(m_targetsUi->addButton, SIGNAL(clicked()), this, SLOT(slotAddTargetClicked())); | 172 | connect(m_targetsUi->addButton, &QToolButton::clicked, this, &KateBuildView::slotAddTargetClicked); | ||
174 | connect(m_targetsUi->buildButton, SIGNAL(clicked()), this, SLOT(slotBuildActiveTarget())); | 173 | connect(m_targetsUi->buildButton, &QToolButton::clicked, this, &KateBuildView::slotBuildActiveTarget); | ||
175 | connect(m_targetsUi, SIGNAL(enterPressed()), this, SLOT(slotBuildActiveTarget())); | 174 | connect(m_targetsUi, &TargetsUi::enterPressed, this, &KateBuildView::slotBuildActiveTarget); | ||
176 | 175 | | |||
177 | m_proc.setOutputChannelMode(KProcess::SeparateChannels); | 176 | m_proc.setOutputChannelMode(KProcess::SeparateChannels); | ||
178 | connect(&m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotProcExited(int,QProcess::ExitStatus))); | 177 | connect(&m_proc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, &KateBuildView::slotProcExited); | ||
179 | connect(&m_proc, SIGNAL(readyReadStandardError()),this, SLOT(slotReadReadyStdErr())); | 178 | connect(&m_proc, &KProcess::readyReadStandardError, this, &KateBuildView::slotReadReadyStdErr); | ||
180 | connect(&m_proc, SIGNAL(readyReadStandardOutput()),this, SLOT(slotReadReadyStdOut())); | 179 | connect(&m_proc, &KProcess::readyReadStandardOutput, this, &KateBuildView::slotReadReadyStdOut); | ||
181 | 180 | | |||
182 | connect(m_win, SIGNAL(unhandledShortcutOverride(QEvent*)), this, SLOT(handleEsc(QEvent*))); | 181 | connect(m_win, &KTextEditor::MainWindow::unhandledShortcutOverride, this, &KateBuildView::handleEsc); | ||
183 | 182 | | |||
184 | m_toolView->installEventFilter(this); | 183 | m_toolView->installEventFilter(this); | ||
185 | 184 | | |||
186 | m_win->guiFactory()->addClient(this); | 185 | m_win->guiFactory()->addClient(this); | ||
187 | 186 | | |||
188 | // watch for project plugin view creation/deletion | 187 | // watch for project plugin view creation/deletion | ||
189 | connect(m_win, SIGNAL(pluginViewCreated (const QString &, QObject *)) | 188 | connect(m_win, &KTextEditor::MainWindow::pluginViewCreated, | ||
190 | , this, SLOT(slotPluginViewCreated (const QString &, QObject *))); | 189 | this, &KateBuildView::slotPluginViewCreated); | ||
191 | | ||||
192 | connect(m_win, SIGNAL(pluginViewDeleted (const QString &, QObject *)) | | |||
193 | , this, SLOT(slotPluginViewDeleted (const QString &, QObject *))); | | |||
194 | 190 | | |||
191 | connect(m_win, &KTextEditor::MainWindow::pluginViewDeleted, | ||||
192 | this, &KateBuildView::slotPluginViewDeleted); | ||||
195 | // update once project plugin state manually | 193 | // update once project plugin state manually | ||
196 | m_projectPluginView = m_win->pluginView (QStringLiteral("kateprojectplugin")); | 194 | m_projectPluginView = m_win->pluginView (QStringLiteral("kateprojectplugin")); | ||
197 | slotProjectMapChanged (); | 195 | slotProjectMapChanged (); | ||
198 | } | 196 | } | ||
199 | 197 | | |||
200 | 198 | | |||
201 | /******************************************************************/ | 199 | /******************************************************************/ | ||
202 | KateBuildView::~KateBuildView() | 200 | KateBuildView::~KateBuildView() | ||
▲ Show 20 Lines • Show All 708 Lines • ▼ Show 20 Line(s) | |||||
911 | 909 | | |||
912 | /******************************************************************/ | 910 | /******************************************************************/ | ||
913 | void KateBuildView::slotPluginViewCreated (const QString &name, QObject *pluginView) | 911 | void KateBuildView::slotPluginViewCreated (const QString &name, QObject *pluginView) | ||
914 | { | 912 | { | ||
915 | // add view | 913 | // add view | ||
916 | if (name == QLatin1String("kateprojectplugin")) { | 914 | if (name == QLatin1String("kateprojectplugin")) { | ||
917 | m_projectPluginView = pluginView; | 915 | m_projectPluginView = pluginView; | ||
918 | slotProjectMapChanged (); | 916 | slotProjectMapChanged (); | ||
919 | connect (pluginView, SIGNAL(projectMapChanged()), this, SLOT(slotProjectMapChanged())); | 917 | connect(pluginView, SIGNAL(projectMapChanged()), this, SLOT(slotProjectMapChanged())); | ||
920 | } | 918 | } | ||
dhaumann: delete? | |||||
921 | } | 919 | } | ||
922 | 920 | | |||
923 | /******************************************************************/ | 921 | /******************************************************************/ | ||
924 | void KateBuildView::slotPluginViewDeleted (const QString &name, QObject *) | 922 | void KateBuildView::slotPluginViewDeleted (const QString &name, QObject *) | ||
925 | { | 923 | { | ||
926 | // remove view | 924 | // remove view | ||
927 | if (name == QLatin1String("kateprojectplugin")) { | 925 | if (name == QLatin1String("kateprojectplugin")) { | ||
928 | m_projectPluginView = nullptr; | 926 | m_projectPluginView = nullptr; | ||
▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines |
delete?