Commit 1300078c authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use MarkInterfaceV2 to pass QIcons for the marker sidebar, not QPixmaps

parent b4e01110
......@@ -50,6 +50,7 @@
#include <ktexteditor/editor.h>
#include <ktexteditor/markinterface.h>
#include <ktexteditor/view.h>
#include <ktexteditor_version.h>
K_PLUGIN_FACTORY_WITH_JSON(KatePluginGDBFactory, "kategdbplugin.json", registerPlugin<KatePluginGDB>();)
......@@ -360,11 +361,19 @@ void KatePluginGDBView::slotToggleBreakpoint()
void KatePluginGDBView::slotBreakpointSet(const QUrl &file, int line)
{
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
KTextEditor::MarkInterfaceV2 *iface = qobject_cast<KTextEditor::MarkInterfaceV2 *>(m_kateApplication->findUrl(file));
#else
KTextEditor::MarkInterface *iface = qobject_cast<KTextEditor::MarkInterface *>(m_kateApplication->findUrl(file));
#endif
if (iface) {
iface->setMarkDescription(KTextEditor::MarkInterface::BreakpointActive, i18n("Breakpoint"));
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
iface->setMarkIcon(KTextEditor::MarkInterface::BreakpointActive, QIcon::fromTheme(QStringLiteral("media-playback-pause")));
#else
iface->setMarkPixmap(KTextEditor::MarkInterface::BreakpointActive, QIcon::fromTheme(QStringLiteral("media-playback-pause")).pixmap(10, 10));
#endif
iface->addMark(line, KTextEditor::MarkInterface::BreakpointActive);
}
}
......@@ -458,7 +467,11 @@ void KatePluginGDBView::enableDebugActions(bool enable)
if (iface) {
if (enable) {
iface->setMarkDescription(KTextEditor::MarkInterface::Execution, i18n("Execution point"));
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
iface->setMarkIcon(KTextEditor::MarkInterface::Execution, QIcon::fromTheme(QStringLiteral("arrow-right")));
#else
iface->setMarkPixmap(KTextEditor::MarkInterface::Execution, QIcon::fromTheme(QStringLiteral("arrow-right")).pixmap(10, 10));
#endif
iface->addMark(m_lastExecLine, KTextEditor::MarkInterface::Execution);
} else {
iface->removeMark(m_lastExecLine, KTextEditor::MarkInterface::Execution);
......
......@@ -55,6 +55,7 @@
#include <ktexteditor/markinterface.h>
#include <ktexteditor/movinginterface.h>
#include <ktexteditor_version.h>
#include "SelectTargetView.h"
......@@ -509,7 +510,11 @@ void KateBuildView::clearMarks()
void KateBuildView::addMarks(KTextEditor::Document *doc, bool mark)
{
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
KTextEditor::MarkInterfaceV2 *iface = qobject_cast<KTextEditor::MarkInterfaceV2 *>(doc);
#else
KTextEditor::MarkInterface *iface = qobject_cast<KTextEditor::MarkInterface *>(doc);
#endif
KTextEditor::MovingInterface *miface = qobject_cast<KTextEditor::MovingInterface *>(doc);
if (!iface || m_markedDocs.contains(doc))
return;
......@@ -545,8 +550,12 @@ void KateBuildView::addMarks(KTextEditor::Document *doc, bool mark)
}
if (markType) {
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
iface->setMarkIcon(markType, messageIcon(category));
#else
const int ps = 32;
iface->setMarkPixmap(markType, messageIcon(category).pixmap(ps, ps));
#endif
iface->addMark(line - 1, markType);
}
m_markedDocs.insert(doc, doc);
......
......@@ -50,6 +50,7 @@
#include <ktexteditor/markinterface.h>
#include <ktexteditor/movinginterface.h>
#include <ktexteditor/movingrange.h>
#include <ktexteditor_version.h>
#include <QAction>
#include <QApplication>
......@@ -554,7 +555,11 @@ public:
Q_ASSERT(item);
KTextEditor::MovingInterface *miface = qobject_cast<KTextEditor::MovingInterface *>(doc);
Q_ASSERT(miface);
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
KTextEditor::MarkInterfaceV2 *iface = qobject_cast<KTextEditor::MarkInterfaceV2 *>(doc);
#else
KTextEditor::MarkInterface *iface = qobject_cast<KTextEditor::MarkInterface *>(doc);
#endif
Q_ASSERT(iface);
KTextEditor::View *activeView = m_mainWindow->activeView();
KTextEditor::ConfigInterface *ciface = qobject_cast<KTextEditor::ConfigInterface *>(activeView);
......@@ -630,21 +635,37 @@ public:
switch (markType) {
case RangeData::markType:
iface->setMarkDescription(markType, i18n("RangeHighLight"));
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
iface->setMarkIcon(markType, QIcon());
#else
iface->setMarkPixmap(markType, QIcon().pixmap(0, 0));
#endif
handleClick = false;
enabled = true;
break;
case RangeData::markTypeDiagError:
iface->setMarkDescription(markType, i18n("Error"));
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
iface->setMarkIcon(markType, diagnosticsIcon(LSPDiagnosticSeverity::Error));
#else
iface->setMarkPixmap(markType, diagnosticsIcon(LSPDiagnosticSeverity::Error).pixmap(ps, ps));
#endif
break;
case RangeData::markTypeDiagWarning:
iface->setMarkDescription(markType, i18n("Warning"));
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
iface->setMarkIcon(markType, diagnosticsIcon(LSPDiagnosticSeverity::Warning));
#else
iface->setMarkPixmap(markType, diagnosticsIcon(LSPDiagnosticSeverity::Warning).pixmap(ps, ps));
#endif
break;
case RangeData::markTypeDiagOther:
iface->setMarkDescription(markType, i18n("Information"));
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
iface->setMarkIcon(markType, diagnosticsIcon(LSPDiagnosticSeverity::Information));
#else
iface->setMarkPixmap(markType, diagnosticsIcon(LSPDiagnosticSeverity::Information).pixmap(ps, ps));
#endif
break;
default:
Q_ASSERT(false);
......
......@@ -30,6 +30,7 @@
#include <ktexteditor/movinginterface.h>
#include <ktexteditor/movingrange.h>
#include <ktexteditor/view.h>
#include <ktexteditor_version.h>
#include "kacceleratormanager.h"
#include <kaboutdata.h>
......@@ -917,11 +918,19 @@ void KatePluginSearchView::addMatchMark(KTextEditor::Document *doc, QTreeWidgetI
m_matchRanges.append(mr);
// Add a match mark
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
KTextEditor::MarkInterfaceV2 *iface = qobject_cast<KTextEditor::MarkInterfaceV2 *>(doc);
#else
KTextEditor::MarkInterface *iface = qobject_cast<KTextEditor::MarkInterface *>(doc);
#endif
if (!iface)
return;
iface->setMarkDescription(KTextEditor::MarkInterface::markType32, i18n("SearchHighLight"));
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,69,0)
iface->setMarkIcon(KTextEditor::MarkInterface::markType32, QIcon());
#else
iface->setMarkPixmap(KTextEditor::MarkInterface::markType32, QIcon().pixmap(0, 0));
#endif
iface->addMark(line, KTextEditor::MarkInterface::markType32);
connect(doc, SIGNAL(aboutToInvalidateMovingInterfaceContent(KTextEditor::Document *)), this, SLOT(clearMarks()), Qt::UniqueConnection);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment