2021-06-24 16:05:19 +08:00
|
|
|
#include "iconsmanager.h"
|
|
|
|
|
2021-12-20 09:36:18 +08:00
|
|
|
#include <QPainter>
|
|
|
|
#include <QSvgRenderer>
|
|
|
|
|
2021-06-24 16:05:19 +08:00
|
|
|
IconsManager* pIconsManager;
|
|
|
|
|
|
|
|
IconsManager::IconsManager(QObject *parent) : QObject(parent)
|
|
|
|
{
|
2021-12-20 12:53:35 +08:00
|
|
|
updateEditorGuttorIcons(24);
|
|
|
|
mFolder = std::make_shared<QPixmap>(":/icons/images/newlook24/090-explorer.png");
|
2021-12-20 09:36:18 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-12-20 12:53:35 +08:00
|
|
|
void IconsManager::updateEditorGuttorIcons(int size)
|
2021-12-20 09:36:18 +08:00
|
|
|
{
|
2021-12-20 12:53:35 +08:00
|
|
|
mBreakpoint = createSVGIcon(":/icons/images/editor/breakpoint.svg",size,size);
|
|
|
|
mSyntaxError = createSVGIcon(":/icons/images/editor/syntaxerror.svg",size,size);
|
|
|
|
mSyntaxWarning = createSVGIcon(":/icons/images/editor/syntaxwarning.svg",size,size);
|
|
|
|
mActiveBreakpoint = createSVGIcon(":/icons/images/editor/currentline.svg",size,size);
|
|
|
|
mBookmark = createSVGIcon(":/icons/images/editor/bookmark.svg",size,size);
|
2021-06-24 16:05:19 +08:00
|
|
|
}
|
|
|
|
|
2021-10-23 23:10:34 +08:00
|
|
|
const PIcon &IconsManager::syntaxError() const
|
2021-06-24 16:05:19 +08:00
|
|
|
{
|
|
|
|
return mSyntaxError;
|
|
|
|
}
|
|
|
|
|
2021-10-23 23:10:34 +08:00
|
|
|
const PIcon &IconsManager::syntaxWarning() const
|
2021-06-24 16:05:19 +08:00
|
|
|
{
|
|
|
|
return mSyntaxWarning;
|
|
|
|
}
|
|
|
|
|
2021-10-23 23:10:34 +08:00
|
|
|
const PIcon &IconsManager::breakpoint() const
|
2021-06-24 16:05:19 +08:00
|
|
|
{
|
|
|
|
return mBreakpoint;
|
|
|
|
}
|
|
|
|
|
2021-10-23 23:10:34 +08:00
|
|
|
const PIcon &IconsManager::activeBreakpoint() const
|
2021-06-24 16:05:19 +08:00
|
|
|
{
|
2021-07-26 00:22:08 +08:00
|
|
|
return mActiveBreakpoint;
|
2021-06-24 16:05:19 +08:00
|
|
|
}
|
2021-10-21 17:31:25 +08:00
|
|
|
|
|
|
|
const PIcon &IconsManager::bookmark() const
|
|
|
|
{
|
|
|
|
return mBookmark;
|
|
|
|
}
|
2021-10-23 23:10:34 +08:00
|
|
|
|
|
|
|
const PIcon &IconsManager::folder() const
|
|
|
|
{
|
|
|
|
return mFolder;
|
|
|
|
}
|
2021-12-20 12:53:35 +08:00
|
|
|
|
|
|
|
PIcon IconsManager::createSVGIcon(const QString &filename, int width, int height)
|
|
|
|
{
|
|
|
|
QSvgRenderer renderer(filename);
|
|
|
|
PIcon icon = std::make_shared<QPixmap>(width,height);
|
|
|
|
icon->fill(Qt::transparent);
|
|
|
|
QPainter painter(icon.get());
|
|
|
|
renderer.render(&painter,icon->rect());
|
|
|
|
return icon;
|
|
|
|
}
|