-
Notifications
You must be signed in to change notification settings - Fork 22
/
iconinfo.cpp
46 lines (36 loc) · 1.12 KB
/
iconinfo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <QVector>
#include <QColor>
#include <QPixmap>
#include <QPainter>
#include <iconinfo.h>
IconInfo::IconInfo(QObject* parent) : QObject(parent) {}
IconInfo::~IconInfo(){}
const QString IconInfo::m_onedriveIconPathName = QString(":/images/OneDrive.svg");
const QString IconInfo::m_syncingOnedriveIconPathName = QString(":/images/OneDrive-sync.svg");
QStringList IconInfo::defaultColorsText()
{
static const QStringList result = {tr("Blue"), tr("White"), tr("Red"), tr("Green"), tr("Black")};
return result;
}
QVector<QColor> IconInfo::defaultColors()
{
QVector<QColor> result {Qt::blue, Qt::white, Qt::red, Qt::green, Qt::black};
return result;
}
QString IconInfo::onedriveIconPathName()
{
return m_onedriveIconPathName;
}
QString IconInfo::syncingOnedriveIconPathName()
{
return m_syncingOnedriveIconPathName;
}
QPixmap IconInfo::changeColorIcon(const QString &imageName, const QColor &color)
{
QPixmap pixmap(imageName);
QPainter painter(&pixmap);
painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
painter.fillRect(pixmap.rect(), color);
painter.end();
return pixmap;
}