Changeset View
Changeset View
Standalone View
Standalone View
addons/katebuild-plugin/plugin_katebuild.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 98 | { | |||
---|---|---|---|---|---|
147 | m_buildUi.buildStatusLabel->setVisible(true); | 147 | m_buildUi.buildStatusLabel->setVisible(true); | ||
148 | m_buildUi.buildAgainButton2->setVisible(false); | 148 | m_buildUi.buildAgainButton2->setVisible(false); | ||
149 | m_buildUi.cancelBuildButton2->setVisible(false); | 149 | m_buildUi.cancelBuildButton2->setVisible(false); | ||
150 | m_buildUi.buildStatusLabel2->setVisible(false); | 150 | m_buildUi.buildStatusLabel2->setVisible(false); | ||
151 | m_buildUi.extraLineLayout->setAlignment(Qt::AlignRight); | 151 | m_buildUi.extraLineLayout->setAlignment(Qt::AlignRight); | ||
152 | m_buildUi.cancelBuildButton->setEnabled(false); | 152 | m_buildUi.cancelBuildButton->setEnabled(false); | ||
153 | m_buildUi.cancelBuildButton2->setEnabled(false); | 153 | m_buildUi.cancelBuildButton2->setEnabled(false); | ||
154 | 154 | | |||
155 | connect(m_buildUi.errTreeWidget, &QTreeWidget::itemClicked, | 155 | connect(m_buildUi.errTreeWidget, &QTreeWidget::itemClicked, this, &KateBuildView::slotErrorSelected); | ||
156 | this, &KateBuildView::slotErrorSelected); | | |||
157 | 156 | | |||
158 | m_buildUi.plainTextEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); | 157 | m_buildUi.plainTextEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); | ||
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, &QSlider::valueChanged, this, &KateBuildView::slotDisplayMode); | 161 | connect(m_buildUi.displayModeSlider, &QSlider::valueChanged, this, &KateBuildView::slotDisplayMode); | ||
163 | 162 | | |||
164 | connect(m_buildUi.buildAgainButton, &QPushButton::clicked, this, &KateBuildView::slotBuildPreviousTarget); | 163 | connect(m_buildUi.buildAgainButton, &QPushButton::clicked, this, &KateBuildView::slotBuildPreviousTarget); | ||
Show All 16 Lines | |||||
181 | 180 | | |||
182 | connect(m_win, &KTextEditor::MainWindow::unhandledShortcutOverride, this, &KateBuildView::handleEsc); | 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, &KTextEditor::MainWindow::pluginViewCreated, | 188 | connect(m_win, &KTextEditor::MainWindow::pluginViewCreated, this, &KateBuildView::slotPluginViewCreated); | ||
190 | this, &KateBuildView::slotPluginViewCreated); | 189 | connect(m_win, &KTextEditor::MainWindow::pluginViewDeleted, this, &KateBuildView::slotPluginViewDeleted); | ||
191 | 190 | | |||
192 | connect(m_win, &KTextEditor::MainWindow::pluginViewDeleted, | 191 | // Connect signals from project plugin to our slots | ||
193 | this, &KateBuildView::slotPluginViewDeleted); | 192 | m_projectPluginView = m_win->pluginView(QStringLiteral("kateprojectplugin")); | ||
194 | // update once project plugin state manually | 193 | slotPluginViewCreated(QStringLiteral("kateprojectplugin"), m_projectPluginView); | ||
195 | m_projectPluginView = m_win->pluginView (QStringLiteral("kateprojectplugin")); | | |||
196 | slotProjectMapChanged (); | | |||
197 | } | 194 | } | ||
198 | 195 | | |||
199 | 196 | | |||
200 | /******************************************************************/ | 197 | /******************************************************************/ | ||
201 | KateBuildView::~KateBuildView() | 198 | KateBuildView::~KateBuildView() | ||
202 | { | 199 | { | ||
203 | m_win->guiFactory()->removeClient( this ); | 200 | m_win->guiFactory()->removeClient( this ); | ||
204 | delete m_toolView; | 201 | delete m_toolView; | ||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 206 | { | |||
259 | 256 | | |||
260 | m_targetsUi->targetsView->expandAll(); | 257 | m_targetsUi->targetsView->expandAll(); | ||
261 | m_targetsUi->targetsView->resizeColumnToContents(0); | 258 | m_targetsUi->targetsView->resizeColumnToContents(0); | ||
262 | m_targetsUi->targetsView->collapseAll(); | 259 | m_targetsUi->targetsView->collapseAll(); | ||
263 | 260 | | |||
264 | QModelIndex root = m_targetsUi->targetsModel.index(tmpIndex); | 261 | QModelIndex root = m_targetsUi->targetsModel.index(tmpIndex); | ||
265 | QModelIndex cmdIndex = m_targetsUi->targetsModel.index(tmpCmd, 0, root); | 262 | QModelIndex cmdIndex = m_targetsUi->targetsModel.index(tmpCmd, 0, root); | ||
266 | m_targetsUi->targetsView->setCurrentIndex(cmdIndex); | 263 | m_targetsUi->targetsView->setCurrentIndex(cmdIndex); | ||
264 | | ||||
265 | // Add project targets, if any | ||||
266 | slotAddProjectTarget(); | ||||
267 | } | 267 | } | ||
268 | 268 | | |||
269 | /******************************************************************/ | 269 | /******************************************************************/ | ||
270 | void KateBuildView::writeSessionConfig(KConfigGroup& cg) | 270 | void KateBuildView::writeSessionConfig(KConfigGroup& cg) | ||
271 | { | 271 | { | ||
272 | // Don't save project targets, is not our area of accountability | ||||
272 | m_targetsUi->targetsModel.deleteTargetSet(i18n("Project Plugin Targets")); | 273 | m_targetsUi->targetsModel.deleteTargetSet(i18n("Project Plugin Targets")); | ||
274 | | ||||
273 | QList<TargetModel::TargetSet> targets = m_targetsUi->targetsModel.targetSets(); | 275 | QList<TargetModel::TargetSet> targets = m_targetsUi->targetsModel.targetSets(); | ||
274 | 276 | | |||
275 | cg.writeEntry("NumTargets", targets.size()); | 277 | cg.writeEntry("NumTargets", targets.size()); | ||
276 | 278 | | |||
277 | for (int i=0; i<targets.size(); i++) { | 279 | for (int i=0; i<targets.size(); i++) { | ||
278 | cg.writeEntry(QStringLiteral("%1 Target").arg(i), targets[i].name); | 280 | cg.writeEntry(QStringLiteral("%1 Target").arg(i), targets[i].name); | ||
279 | cg.writeEntry(QStringLiteral("%1 BuildPath").arg(i), targets[i].workDir); | 281 | cg.writeEntry(QStringLiteral("%1 BuildPath").arg(i), targets[i].workDir); | ||
280 | QStringList cmdNames; | 282 | QStringList cmdNames; | ||
Show All 16 Lines | |||||
297 | else { | 299 | else { | ||
298 | set = ind.internalId(); | 300 | set = ind.internalId(); | ||
299 | setRow = ind.row(); | 301 | setRow = ind.row(); | ||
300 | } | 302 | } | ||
301 | if (setRow < 0) setRow = 0; | 303 | if (setRow < 0) setRow = 0; | ||
302 | 304 | | |||
303 | cg.writeEntry(QStringLiteral("Active Target Index"), set); | 305 | cg.writeEntry(QStringLiteral("Active Target Index"), set); | ||
304 | cg.writeEntry(QStringLiteral("Active Target Command"), setRow); | 306 | cg.writeEntry(QStringLiteral("Active Target Command"), setRow); | ||
307 | | ||||
308 | // Restore project targets, if any | ||||
305 | slotAddProjectTarget(); | 309 | slotAddProjectTarget(); | ||
306 | } | 310 | } | ||
307 | 311 | | |||
308 | 312 | | |||
309 | /******************************************************************/ | 313 | /******************************************************************/ | ||
310 | void KateBuildView::slotNext() | 314 | void KateBuildView::slotNext() | ||
311 | { | 315 | { | ||
312 | const int itemCount = m_buildUi.errTreeWidget->topLevelItemCount(); | 316 | const int itemCount = m_buildUi.errTreeWidget->topLevelItemCount(); | ||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Line(s) | 895 | for (int i=0;i<itemCount;i++) { | |||
904 | case CategoryError: | 908 | case CategoryError: | ||
905 | item->setHidden(false); | 909 | item->setHidden(false); | ||
906 | break; | 910 | break; | ||
907 | } | 911 | } | ||
908 | } | 912 | } | ||
909 | } | 913 | } | ||
910 | 914 | | |||
911 | /******************************************************************/ | 915 | /******************************************************************/ | ||
912 | void KateBuildView::slotPluginViewCreated (const QString &name, QObject *pluginView) | 916 | void KateBuildView::slotPluginViewCreated(const QString &name, QObject *pluginView) | ||
913 | { | 917 | { | ||
914 | // add view | 918 | // add view | ||
915 | if (name == QLatin1String("kateprojectplugin")) { | 919 | if (pluginView && name == QLatin1String("kateprojectplugin")) { | ||
916 | m_projectPluginView = pluginView; | 920 | m_projectPluginView = pluginView; | ||
917 | slotProjectMapChanged (); | 921 | slotAddProjectTarget(); | ||
918 | connect(pluginView, SIGNAL(projectMapChanged()), this, SLOT(slotProjectMapChanged())); | 922 | connect(pluginView, SIGNAL(projectMapChanged()), this, SLOT(slotProjectMapChanged()), Qt::UniqueConnection); | ||
919 | } | 923 | } | ||
920 | } | 924 | } | ||
921 | 925 | | |||
922 | /******************************************************************/ | 926 | /******************************************************************/ | ||
923 | void KateBuildView::slotPluginViewDeleted (const QString &name, QObject *) | 927 | void KateBuildView::slotPluginViewDeleted(const QString &name, QObject *) | ||
924 | { | 928 | { | ||
925 | // remove view | 929 | // remove view | ||
926 | if (name == QLatin1String("kateprojectplugin")) { | 930 | if (name == QLatin1String("kateprojectplugin")) { | ||
927 | m_projectPluginView = nullptr; | 931 | m_projectPluginView = nullptr; | ||
928 | m_targetsUi->targetsModel.deleteTargetSet(i18n("Project Plugin Targets")); | 932 | m_targetsUi->targetsModel.deleteTargetSet(i18n("Project Plugin Targets")); | ||
929 | } | 933 | } | ||
930 | } | 934 | } | ||
931 | 935 | | |||
932 | /******************************************************************/ | 936 | /******************************************************************/ | ||
933 | void KateBuildView::slotProjectMapChanged () | 937 | void KateBuildView::slotProjectMapChanged() | ||
934 | { | 938 | { | ||
935 | // only do stuff with valid project | 939 | // only do stuff with valid project | ||
936 | if (!m_projectPluginView) { | 940 | if (!m_projectPluginView) { | ||
937 | return; | 941 | return; | ||
938 | } | 942 | } | ||
939 | m_targetsUi->targetsModel.deleteTargetSet(i18n("Project Plugin Targets")); | 943 | m_targetsUi->targetsModel.deleteTargetSet(i18n("Project Plugin Targets")); | ||
940 | slotAddProjectTarget(); | 944 | slotAddProjectTarget(); | ||
941 | } | 945 | } | ||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |