Commit f832c443 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Move all KDE::icon calls behind a gitIcon function

parent 879cdff8
......@@ -14,7 +14,6 @@
#include <KActionCollection>
#include <KConfigGroup>
#include <KIconLoader>
#include <KLocalizedString>
#include <KPluginFactory>
#include <KSharedConfig>
......@@ -309,7 +308,7 @@ void KateGitBlamePluginView::sendMessage(const QString &text, bool error)
QVariantMap genericMessage;
genericMessage.insert(QStringLiteral("type"), error ? QStringLiteral("Error") : QStringLiteral("Info"));
genericMessage.insert(QStringLiteral("category"), i18n("Git"));
genericMessage.insert(QStringLiteral("categoryIcon"), KDE::icon(QStringLiteral(":/icons/icons/sc-apps-git.svg")));
genericMessage.insert(QStringLiteral("categoryIcon"), gitIcon());
genericMessage.insert(QStringLiteral("text"), text);
Q_EMIT message(genericMessage);
}
......@@ -566,11 +565,7 @@ void KateGitBlamePluginView::createToolView()
}
auto plugin = static_cast<KTextEditor::Plugin *>(parent());
m_toolView.reset(m_mainWindow->createToolView(plugin,
QStringLiteral("commitfilesview"),
KTextEditor::MainWindow::Left,
KDE::icon(QStringLiteral(":/icons/icons/sc-apps-git.svg")),
i18n("Commit")));
m_toolView.reset(m_mainWindow->createToolView(plugin, QStringLiteral("commitfilesview"), KTextEditor::MainWindow::Left, gitIcon(), i18n("Commit")));
m_commitFilesView = new CommitDiffTreeView(m_toolView.get());
m_toolView->layout()->addWidget(m_commitFilesView);
......
......@@ -5,6 +5,7 @@
*/
#include "branchesdialog.h"
#include "branchesdialogmodel.h"
#include "gitprocess.h"
#include "kateprojectpluginview.h"
#include <QCoreApplication>
......@@ -23,7 +24,6 @@
#include <KTextEditor/Message>
#include <KTextEditor/View>
#include <KIconLoader>
#include <KLocalizedString>
#include <drawing_utils.h>
......@@ -135,7 +135,7 @@ void BranchesDialog::sendMessage(const QString &plainText, bool warn)
QVariantMap genericMessage;
genericMessage.insert(QStringLiteral("type"), warn ? QStringLiteral("Error") : QStringLiteral("Info"));
genericMessage.insert(QStringLiteral("category"), i18n("Git"));
genericMessage.insert(QStringLiteral("categoryIcon"), KDE::icon(QStringLiteral(":/icons/icons/sc-apps-git.svg")));
genericMessage.insert(QStringLiteral("categoryIcon"), gitIcon());
genericMessage.insert(QStringLiteral("text"), plainText);
Q_EMIT m_pluginView->message(genericMessage);
}
......@@ -43,7 +43,6 @@
#include <QtConcurrentRun>
#include <KActionCollection>
#include <KIconLoader>
#include <KLocalizedString>
#include <KMessageBox>
......@@ -458,7 +457,7 @@ void GitWidget::sendMessage(const QString &plainText, bool warn)
QVariantMap genericMessage;
genericMessage.insert(QStringLiteral("type"), warn ? QStringLiteral("Error") : QStringLiteral("Info"));
genericMessage.insert(QStringLiteral("category"), i18n("Git"));
genericMessage.insert(QStringLiteral("categoryIcon"), KDE::icon(QStringLiteral(":/icons/icons/sc-apps-git.svg")));
genericMessage.insert(QStringLiteral("categoryIcon"), gitIcon());
genericMessage.insert(QStringLiteral("text"), plainText);
Q_EMIT m_pluginView->message(genericMessage);
}
......
......@@ -7,6 +7,7 @@
#include "kateprojectpluginview.h"
#include "fileutil.h"
#include "gitprocess.h"
#include "gitwidget.h"
#include "kateproject.h"
#include "kateprojectinfoview.h"
......@@ -24,7 +25,6 @@
#include <KAboutData>
#include <KActionCollection>
#include <KActionMenu>
#include <KIconLoader>
#include <KLocalizedString>
#include <KPluginFactory>
#include <KStringHandler>
......@@ -63,11 +63,7 @@ KateProjectPluginView::KateProjectPluginView(KateProjectPlugin *plugin, KTextEdi
KTextEditor::MainWindow::Left,
QIcon::fromTheme(QStringLiteral("project-open")),
i18n("Projects"));
m_gitToolView.reset(m_mainWindow->createToolView(m_plugin,
QStringLiteral("kateprojectgit"),
KTextEditor::MainWindow::Left,
KDE::icon(QStringLiteral(":/icons/icons/sc-apps-git.svg")),
i18n("Git")));
m_gitToolView.reset(m_mainWindow->createToolView(m_plugin, QStringLiteral("kateprojectgit"), KTextEditor::MainWindow::Left, gitIcon(), i18n("Git")));
m_toolInfoView = m_mainWindow->createToolView(m_plugin,
QStringLiteral("kateprojectinfo"),
KTextEditor::MainWindow::Bottom,
......
......@@ -19,7 +19,6 @@
#include <KAcceleratorManager>
#include <KActionCollection>
#include <KIconLoader>
#include <KLineEdit>
#include <KLocalizedString>
......@@ -75,7 +74,7 @@ KateProjectView::KateProjectView(KateProjectPluginView *pluginView, KateProject
BranchCheckoutDialog bd(mainWindow->window(), m_pluginView, m_project->baseDir());
bd.openDialog();
});
currBranchAct->setIcon(KDE::icon(QStringLiteral(":/icons/icons/sc-apps-git.svg")));
currBranchAct->setIcon(gitIcon());
currBranchAct->setToolTip(i18n("Checkout branch"));
m_branchBtn->setDefaultAction(currBranchAct);
......
......@@ -21,7 +21,6 @@
#include <QVBoxLayout>
#include <QWidget>
#include <KIconLoader>
#include <KLocalizedString>
#include <KTextEditor/Application>
#include <KTextEditor/Editor>
......@@ -352,8 +351,7 @@ void FileHistory::showFileHistory(const QString &file, KTextEditor::MainWindow *
mainWindow = KTextEditor::Editor::instance()->application()->activeMainWindow();
}
const auto gitIcon = KDE::icon(QStringLiteral(":/icons/icons/sc-apps-git.svg"));
auto toolView = mainWindow->createToolView(nullptr, QStringLiteral("git_file_history"), KTextEditor::MainWindow::Left, gitIcon, i18n("File History"));
auto toolView = mainWindow->createToolView(nullptr, QStringLiteral("git_file_history"), KTextEditor::MainWindow::Left, gitIcon(), i18n("File History"));
new FileHistoryWidget(repoBase.value(), file, mainWindow, toolView);
mainWindow->showToolView(toolView);
}
......
......@@ -6,6 +6,14 @@
#include "gitprocess.h"
#include <QProcess>
#include <QRegularExpression>
#include <QStandardPaths>
#include <QIcon>
#include <KIconLoader>
bool setupGitProcess(QProcess &process, const QString &workingDirectory, const QStringList &arguments)
{
// only use git from PATH
......@@ -96,3 +104,9 @@ std::optional<QString> getRepoBasePath(const QString &repo)
}
return std::nullopt;
}
QIcon gitIcon()
{
static const auto icon = KDE::icon(QStringLiteral(":/icons/icons/sc-apps-git.svg"));
return icon;
}
......@@ -6,14 +6,13 @@
#pragma once
#include <QProcess>
#include <QRegularExpression>
#include <QStandardPaths>
#include "hostprocess.h"
#include "kateprivate_export.h"
#include <optional>
#include <utility>
class QIcon;
/**
* small helper function to setup a QProcess based "git" command.
......@@ -41,3 +40,8 @@ KATE_PRIVATE_EXPORT std::pair<int, int> getGitVersion(const QString &workingDir)
* @param workingDir the dir where
*/
KATE_PRIVATE_EXPORT std::optional<QString> getRepoBasePath(const QString &workingDir);
/**
* @brief returns the git icon for use in UI
*/
KATE_PRIVATE_EXPORT QIcon gitIcon();
Supports Markdown
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