Having no artistic talent or help, I created the icons I used in sipwitchqt and other things pragmatically instead.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1271 lines
33 KiB

/**
** Copyright (C) 2017-2019 David Sugar <tychosoft@gmail.com>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "icons.hpp"
#include "ui_icons.h"
#include <QImage>
#include <QPainter>
#include <QColor>
#include <QPen>
#include <QBrush>
#include <QRect>
#include <QRectF>
#include <QIcon>
#include <QDebug>
#include <QPainterPath>
#include <QGuiApplication>
#include <QFont>
#define ICON_COLOR 0xff000000
static Ui::MainWindow ui;
static QString name;
static QImage iconImage(96, 96, QImage::Format_ARGB32);
static QImage iconImage2x(192, 192, QImage::Format_ARGB32);
static QImage *images[2] = {&iconImage, &iconImage2x};
static QPen pen;
static QImage *image;
static void clear(int scale)
{
QImage *image = images[scale - 1];
image->fill(0);
}
static void clear()
{
for(int scale = 1; scale < 3; ++scale)
clear(scale);
}
static void update()
{
QPixmap pm = QPixmap::fromImage(iconImage);
QPixmap pm2x = QPixmap::fromImage(iconImage2x);
QIcon icon(pm);
QIcon icon2x(pm2x);
ui.icon->setIcon(icon);
ui.icon2x->setIcon(icon2x);
ui.scale32->setIcon(icon);
ui.scale24->setIcon(icon);
ui.scale16->setIcon(icon);
qDebug() << "updated images with" << name;
}
static void saveImages()
{
qDebug() << "saving" << name;
iconImage.save(name + ".png", "PNG");
iconImage2x.save(name + "@2x.png", "PNG");
}
static void iconSetup(QString id, int scale, double width = 6.0)
{
name = id;
image = images[scale - 1];
pen.setColor(ICON_COLOR);
pen.setWidthF(width * scale);
}
static void drawOn(int scale)
{
iconSetup("on", scale);
QPainter p(image);
pen.setWidth(8 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QPainterPath center;
QRectF right(56 * scale, 28 * scale, 40 * scale, 40 * scale);
QRectF left(0 * scale, 28 * scale, 40 * scale, 40 * scale);
center.moveTo(20 * scale, 28 * scale);
center.lineTo(76 * scale, 28 * scale);
center.arcTo(right, 270, 180);
center.lineTo(76 * scale, 68 * scale);
center.lineTo(20 * scale, 68 * scale);
center.arcTo(left, 90, 180);
center.closeSubpath();
p.fillPath(center, QBrush(QColor("gray")));
QRectF circle(0 * scale, 16 * scale, 64 * scale, 64 * scale);
QPainterPath path;
path.addEllipse(circle);
p.fillPath(path, QBrush(QColor("black")));
}
static void drawOff(int scale)
{
iconSetup("off", scale);
QPainter p(image);
pen.setWidth(8 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QPainterPath center;
QRectF right(56 * scale, 28 * scale, 40 * scale, 40 * scale);
QRectF left(0 * scale, 28 * scale, 40 * scale, 40 * scale);
center.moveTo(20 * scale, 28 * scale);
center.lineTo(76 * scale, 28 * scale);
center.arcTo(right, 270, 180);
center.lineTo(76 * scale, 68 * scale);
center.lineTo(20 * scale, 68 * scale);
center.arcTo(left, 90, 180);
center.closeSubpath();
p.fillPath(center, QBrush(QColor("light gray")));
QRectF circle(32 * scale, 16 * scale, 64 * scale, 64 * scale);
QPainterPath path;
path.addEllipse(circle);
p.fillPath(path, QBrush(QColor("gray")));
}
static void drawLocked(int scale)
{
iconSetup("locked", scale);
QPainter p(image);
pen.setWidth(8 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF handle(28 * scale, 8 * scale, 44 * scale, 80 * scale);
p.drawArc(handle, 35 * 16, 110 * 16);
p.drawLine(32 * scale, 60 * scale, 32 * scale, 88 * scale);
p.drawLine(68 * scale, 60 * scale, 68 * scale, 88 * scale);
QPainterPath path;
//path.moveTo(16 * scale, 74 * scale);
path.addRect(18 * scale, 36 * scale, 64 * scale, 48 * scale);
p.fillPath(path, QBrush(QColor("black")));
}
static void drawUnlocked(int scale)
{
iconSetup("unlocked", scale);
QPainter p(image);
pen.setWidth(8 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF handle(32 * scale, 8 * scale, 44 * scale, 80 * scale);
p.drawArc(handle, 70 * 16, 110 * 16);
p.drawLine(32 * scale, 60 * scale, 32 * scale, 88 * scale);
QPainterPath path;
path.addRect(18 * scale, 36 * scale, 64 * scale, 48 * scale);
p.fillPath(path, QBrush(QColor("black")));
}
static void drawPhonebook(int scale)
{
iconSetup("phonebook", scale);
QPainter p(image);
pen.setWidth(8 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF headset(24 * scale, 32 * scale, 64 * scale, 64 * scale);
QRectF phone(16 * scale, 48 * scale, 80 * scale, 160 * scale);
p.drawArc(headset, 35 * 16, 110 * 16);
QPainterPath path;
path.moveTo(24 * scale, 82 * scale);
path.arcTo(phone, 35, 110);
path.closeSubpath();
p.fillPath(path, QBrush(QColor("black")));
pen.setWidth(8 * scale);
pen.setBrush(QColor("black"));
p.setPen(pen);
p.drawLine(8 * scale, 20 * scale, 8 * scale, 90 * scale);
p.drawLine(10 * scale, 20 * scale, 86 * scale, 8 * scale);
}
static void drawDownScroll(int scale)
{
iconSetup("downscroll", scale);
QPainter p(image);
pen.setWidth(12 * scale);
pen.setBrush(QColor("#008000"));
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
p.drawLine(48 * scale, 12 * scale, 48 * scale, 76 * scale);
p.drawLine(20 * scale, 60 * scale, 47 * scale, 80 * scale);
p.drawLine(74 * scale, 60 * scale, 49 * scale, 80 * scale);
}
static void drawColorIdle(int scale)
{
iconSetup("color_idle", scale);
QPainter p(image);
pen.setWidth(8 * scale);
pen.setBrush(QColor("#008000"));
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF headset(8 * scale, 20 * scale, 80 * scale, 80 * scale);
QRectF phone(8 * scale, 40 * scale, 80 * scale, 160 * scale);
p.drawArc(headset, 35 * 16, 110 * 16);
QPainterPath path;
path.moveTo(16 * scale, 74 * scale);
path.arcTo(phone, 35, 110);
path.closeSubpath();
p.fillPath(path, QBrush(QColor("#008000")));
}
static void drawColorOffline(int scale)
{
iconSetup("color_offline", scale);
QPainter p(image);
pen.setWidth(8 * scale);
pen.setBrush(QColor("#800080"));
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF headset(8 * scale, 20 * scale, 80 * scale, 80 * scale);
QRectF phone(8 * scale, 40 * scale, 80 * scale, 160 * scale);
p.drawArc(headset, 35 * 16, 110 * 16);
QPainterPath path;
path.moveTo(16 * scale, 74 * scale);
path.arcTo(phone, 35, 110);
path.closeSubpath();
p.fillPath(path, QBrush(QColor("#800080")));
}
static void drawColorActivate(int scale)
{
iconSetup("color_activate", scale);
QPainter p(image);
pen.setWidth(8 * scale);
pen.setBrush(QColor("#708010"));
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF headset(8 * scale, 20 * scale, 80 * scale, 80 * scale);
QRectF phone(8 * scale, 40 * scale, 80 * scale, 160 * scale);
p.drawArc(headset, 35 * 16, 110 * 16);
QPainterPath path;
path.moveTo(16 * scale, 74 * scale);
path.arcTo(phone, 35, 110);
path.closeSubpath();
p.fillPath(path, QBrush(QColor("#708010")));
}
static void drawPhoneIdle(int scale)
{
iconSetup("phone_idle", scale);
QPainter p(image);
pen.setWidth(8 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF headset(8 * scale, 20 * scale, 80 * scale, 80 * scale);
QRectF phone(8 * scale, 40 * scale, 80 * scale, 160 * scale);
p.drawArc(headset, 35 * 16, 110 * 16);
QPainterPath path;
path.moveTo(16 * scale, 74 * scale);
path.arcTo(phone, 35, 110);
path.closeSubpath();
p.fillPath(path, QBrush(QColor("black")));
}
static void drawPhoneActivate(int scale)
{
iconSetup("phone_activate", scale);
QPainter p(image);
pen.setWidth(8 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF headset(8 * scale, 20 * scale, 80 * scale, 80 * scale);
QRectF phone(8 * scale, 40 * scale, 80 * scale, 160 * scale);
p.drawArc(headset, 35 * 16, 110 * 16);
QPainterPath path;
path.moveTo(16 * scale, 74 * scale);
path.arcTo(phone, 35, 110);
path.closeSubpath();
p.fillPath(path, QBrush(QColor("black")));
pen.setWidth(8 * scale);
pen.setBrush(QColor("blue"));
pen.setStyle(Qt::DotLine);
p.setPen(pen);
p.drawLine(80 * scale, 8 * scale, 24 * scale, 88 * scale);
pen.setStyle(Qt::SolidLine);
p.setPen(pen);
}
static void drawPhoneOffline(int scale)
{
iconSetup("phone_offline", scale);
QPainter p(image);
pen.setWidth(8 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF headset(8 * scale, 20 * scale, 80 * scale, 80 * scale);
QRectF phone(8 * scale, 40 * scale, 80 * scale, 160 * scale);
p.drawArc(headset, 35 * 16, 110 * 16);
QPainterPath path;
path.moveTo(16 * scale, 74 * scale);
path.arcTo(phone, 35, 110);
path.closeSubpath();
p.fillPath(path, QBrush(QColor("black")));
pen.setWidth(8 * scale);
pen.setBrush(QColor("red"));
p.setPen(pen);
p.drawLine(80 * scale, 8 * scale, 24 * scale, 88 * scale);
}
static void drawKill(int scale)
{
iconSetup("kill", scale);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
QRectF circle(12 * scale, 12 * scale, 72 * scale, 72 * scale);
pen.setColor(QColor("red"));
pen.setWidth(8 * scale);
auto brush = pen.brush();
brush.setColor(QColor("red"));
brush.setStyle(Qt::SolidPattern);
p.setPen(pen);
p.setBrush(brush);
p.drawEllipse(circle);
pen.setColor(QColor("light gray"));
pen.setWidth(8 * scale);
p.setPen(pen);
p.drawLine(32 * scale, 32 * scale, 64 * scale, 64 * scale);
p.drawLine(64 * scale, 32 * scale, 32 * scale, 64 * scale);
}
static void drawSession(int scale)
{
iconSetup("session", scale);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
pen.setWidth(7 * scale);
p.setPen(pen);
p.drawLine(12 * scale, 12 * scale, 84 * scale, 12 * scale);
p.drawLine(12 * scale, 12 * scale, 12 * scale, 68 * scale);
p.drawLine(84 * scale, 12 * scale, 84 * scale, 68 * scale);
p.drawLine(12 * scale, 68 * scale, 28 * scale, 68 * scale);
p.drawLine(54 * scale, 68 * scale, 84 * scale, 68 * scale);
p.drawLine(28 * scale, 68 * scale, 28 * scale, 92 * scale);
p.drawLine(30 * scale, 91 * scale, 52 * scale, 69 * scale);
}
static void drawClose(int scale)
{
iconSetup("close", scale);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
pen.setColor(QColor("black"));
pen.setWidth(8 * scale);
p.setPen(pen);
p.drawLine(32 * scale, 32 * scale, 64 * scale, 64 * scale);
p.drawLine(64 * scale, 32 * scale, 32 * scale, 64 * scale);
}
static void nightClose(int scale)
{
iconSetup("night-close", scale);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
pen.setColor(QColor("white"));
pen.setWidth(8 * scale);
p.setPen(pen);
p.drawLine(32 * scale, 32 * scale, 64 * scale, 64 * scale);
p.drawLine(64 * scale, 32 * scale, 32 * scale, 64 * scale);
}
static void drawCancel(int scale)
{
iconSetup("cancel", scale);
QPainter p(image);
pen.setWidth(12 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
p.drawLine(16 * scale, 16 * scale, 80 * scale, 80 * scale);
p.drawLine(80 * scale, 16 * scale, 16 * scale, 80 * scale);
}
static void drawOk(int scale)
{
iconSetup("ok", scale);
QPainter p(image);
pen.setWidth(8 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
p.drawLine(16 * scale, 48 * scale, 24 * scale, 80 * scale);
p.drawLine(28 * scale, 77 * scale, 80 * scale, 16 * scale);
p.drawLine(16 * scale, 48 * scale, 10 * scale, 50 * scale);
}
static void nightCheck(int scale)
{
iconSetup("night-check", scale);
QPainter p(image);
pen.setWidth(8 * scale);
pen.setColor(QColor("lightgreen"));
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
p.drawLine(24 * scale, 40 * scale, 32 * scale, 72 * scale);
p.drawLine(36 * scale, 68 * scale, 68 * scale, 24 * scale);
}
static void drawPerson(int scale)
{
iconSetup("person", scale);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF head(30 * scale, 8 * scale, 40 * scale, 40 * scale);
QRectF body(16 * scale, 64 * scale, 68 * scale, 68 * scale);
p.drawArc(head, 0, 360 * 16);
p.drawArc(body, 35 * 16, 110 * 16);
}
static void drawAdd(int scale)
{
iconSetup("add", scale);
QPainter p(image);
pen.setWidth(8 * scale);
pen.setColor(QColor("green"));
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
p.drawLine(12 * scale, 48 * scale, 84 * scale, 48 * scale);
p.drawLine(48 * scale, 12 * scale, 48 * scale, 84 * scale);
}
static void drawDel(int scale)
{
iconSetup("del", scale);
QPainter p(image);
pen.setWidth(8 * scale);
pen.setColor(QColor("red"));
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
p.drawLine(12 * scale, 48 * scale, 84 * scale, 48 * scale);
}
static void drawBurger(int scale)
{
iconSetup("burger", scale);
QPainter p(image);
pen.setWidth(12 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
p.drawLine(12 * scale, 20 * scale, 84 * scale, 20 * scale);
p.drawLine(12 * scale, 48 * scale, 84 * scale, 48 * scale);
p.drawLine(12 * scale, 76 * scale, 84 * scale, 76 * scale);
}
static void drawGroup(int scale)
{
iconSetup("group", scale);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF head1(38 * scale, 4 * scale, 20 * scale, 20 * scale);
QRectF body1(28 * scale, 34 * scale, 40 * scale, 32 * scale);
QRectF head2(14 * scale, 52 * scale, 20 * scale, 20 * scale);
QRectF body2(4 * scale, 82 * scale, 40 * scale, 32 * scale);
QRectF head3(64 * scale, 52 * scale, 20 * scale, 20 * scale);
QRectF body3(54 * scale, 82 * scale, 40 * scale, 32 * scale);
p.drawArc(head1, 0, 360 * 16);
p.drawArc(body1, 35 * 16, 110 * 16);
p.drawArc(head2, 0, 360 * 16);
p.drawArc(body2, 35 * 16, 110 * 16);
p.drawArc(head3, 0, 360 * 16);
p.drawArc(body3, 35 * 16, 110 * 16);
}
static void drawNewGroup(int scale)
{
iconSetup("newgroup", scale);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
pen.setColor(QColor("green"));
p.setPen(pen);
QRectF head1(38 * scale, 4 * scale, 20 * scale, 20 * scale);
QRectF body1(28 * scale, 34 * scale, 40 * scale, 32 * scale);
QRectF head2(14 * scale, 52 * scale, 20 * scale, 20 * scale);
QRectF body2(4 * scale, 82 * scale, 40 * scale, 32 * scale);
QRectF head3(64 * scale, 52 * scale, 20 * scale, 20 * scale);
QRectF body3(54 * scale, 82 * scale, 40 * scale, 32 * scale);
p.drawArc(head1, 0, 360 * 16);
p.drawArc(body1, 35 * 16, 110 * 16);
p.drawArc(head2, 0, 360 * 16);
p.drawArc(body2, 35 * 16, 110 * 16);
p.drawArc(head3, 0, 360 * 16);
p.drawArc(body3, 35 * 16, 110 * 16);
}
static void drawTopic(int scale)
{
iconSetup("topic", scale);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
auto font = QGuiApplication::font();
font.setPixelSize(112 * scale);
font.setBold(true);
p.setFont(font);
p.drawText(QPoint(32 * scale, 88 * scale), "!");
}
static void drawPeople(int scale)
{
iconSetup("people", scale);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF head1(64 * scale, 4 * scale, 20 * scale, 20 * scale);
QRectF body1(54 * scale, 36 * scale, 40 * scale, 32 * scale);
QRectF head2(14 * scale, 50 * scale, 20 * scale, 20 * scale);
QRectF body2(4 * scale, 82 * scale, 40 * scale, 32 * scale);
p.drawArc(head1, 0, 360 * 16);
p.drawArc(body1, 35 * 16, 110 * 16);
p.drawArc(head2, 0, 360 * 16);
p.drawArc(body2, 35 * 16, 110 * 16);
}
static void drawDialpad(int scale)
{
iconSetup("dialpad", scale);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
// p.drawLine(4 * scale, 4 * scale, 92 * scale, 4 * scale);
p.drawLine(4 * scale, 26 * scale, 92 * scale, 26 * scale);
p.drawLine(4 * scale, 48 * scale, 92 * scale, 48 * scale);
p.drawLine(4 * scale, 70 * scale, 92 * scale, 70 * scale);
// p.drawLine(4 * scale, 92 * scale, 92 * scale, 92 * scale);
// p.drawLine(4 * scale, 4 * scale, 4 * scale, 92 * scale);
p.drawLine(32 * scale, 4 * scale, 32 * scale, 92 * scale);
p.drawLine(64 * scale, 4 * scale, 64 * scale, 92 * scale);
// p.drawLine(92 * scale, 4 * scale, 92 * scale, 92 * scale);
}
static void drawSettings(int scale)
{
iconSetup("settings", scale);
QPainter p(image);
pen.setWidth(15 * scale);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF area1(21.0 * scale, 21.0 * scale, 54.0 * scale, 54.0 * scale);
p.drawEllipse(area1);
QBrush brush(ICON_COLOR);
pen.setWidth(1);
p.setPen(pen);
p.setBrush(brush);
QPointF gear1[] = {{36.0 * scale, 6.0 * scale}, {60.0 * scale, 6.0 * scale}, {60.0 * scale, 18.0 * scale}, {36.0 * scale, 18.0 * scale}};
QPointF gear2[] = {{36.0 * scale, 90.0 * scale}, {60.0 * scale, 90.0 * scale}, {60.0 * scale, 78.0 * scale}, {36.0 * scale, 78.0 * scale}};
QPointF gear3[] = {{18.0 * scale, 15.0 * scale}, {6.0 * scale, 36.0 * scale}, {21.0 * scale, 45.0 * scale}, {27.0 * scale, 21.0 * scale}};
QPointF gear4[] = {{78.0 * scale, 15.0 * scale}, {90.0 * scale, 36.0 * scale}, {75.0 * scale, 45.0 * scale}, {69.0 * scale, 21.0 * scale}};
QPointF gear5[] = {{18.0 * scale, 81.0 * scale}, {6.0 * scale, 60.0 * scale}, {21.0 * scale, 51.0 * scale}, {27.0 * scale, 75.0 * scale}};
QPointF gear6[] = {{78.0 * scale, 81.0 * scale}, {90.0 * scale, 60.0 * scale}, {75.0 * scale, 51.0 * scale}, {69.0 * scale, 75.0 * scale}};
p.drawPolygon(gear1, 4);
p.drawPolygon(gear2, 4);
p.drawPolygon(gear3, 4);
p.drawPolygon(gear4, 4);
p.drawPolygon(gear5, 4);
p.drawPolygon(gear6, 4);
}
static void drawInfo(int scale)
{
iconSetup("info", scale, 9);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF area1(6.0 * scale, 6.0 * scale, 84.0 * scale, 84.0 * scale);
p.drawEllipse(area1);
pen.setWidth(12 * scale);
p.setPen(pen);
p.drawPoint(48 * scale, 30 * scale);
p.drawLine(48 * scale, 48 * scale, 48 * scale, 66 * scale);
}
static void nightInfo(int scale)
{
QRectF area1(3.0 * scale, 3.0 * scale, 90.0 * scale, 90.0 * scale);
iconSetup("night-info", scale, 9);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
QBrush brush(QColor("#4080FF"));
QBrush old = p.brush();
p.setBrush(brush);
p.drawEllipse(area1);
p.setBrush(old);
pen.setWidth(12 * scale);
pen.setColor(QColor("white"));
p.setPen(pen);
p.drawPoint(48 * scale, 30 * scale);
p.drawLine(48 * scale, 48 * scale, 48 * scale, 66 * scale);
}
static void drawSearch(int scale)
{
iconSetup("search", scale, 9);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF area1(9.0 * scale, 9.0 * scale, 57.0 * scale, 57.0 * scale);
p.drawEllipse(area1);
p.drawLine(60 * scale, 60 * scale, 84 * scale, 84 * scale);
}
static void nightSearch(int scale)
{
QRectF area1(9.0 * scale, 9.0 * scale, 57.0 * scale, 57.0 * scale);
iconSetup("night-search", scale, 9);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
QBrush brush(QColor("darkcyan"));
QBrush old = p.brush();
p.setBrush(brush);
p.drawEllipse(area1);
p.setBrush(old);
pen.setColor(QColor("white"));
p.setPen(pen);
p.drawEllipse(area1);
p.drawLine(60 * scale, 60 * scale, 84 * scale, 84 * scale);
}
static void drawReload(int scale)
{
iconSetup("reload", scale, 9);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
QRectF area1(9.0 * scale, 9.0 * scale, 78.0 * scale, 78.0 * scale);
p.drawArc(area1, 40 * 16, 280 * 16);
QBrush brush(ICON_COLOR);
pen.setWidth(1);
p.setPen(pen);
p.setBrush(brush);
QPointF arrow1[] = {{87.0 * scale, 15.0 * scale}, {66.0 * scale, 33.0 * scale}, {90.0 * scale, 36.0 * scale}};
//QPointF arrow2[] = {{66.0 * scale, 60.0 * scale}, {87.0 * scale, 78.0 * scale}, {90.0 * scale, 57.0 * scale}};
p.drawPolygon(arrow1, 3);
//p.drawPolygon(arrow2, 3);
}
static void nightReload(int scale)
{
iconSetup("night-refresh", scale, 9);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
QBrush old = p.brush();
QBrush fill(QColor("darkgreen"));
p.setBrush(fill);
p.drawEllipse({48.0 * scale, 48.0 * scale}, 40.0 * scale, 40.0 * scale);
p.setBrush(old);
pen.setColor(QColor("#60A0FF"));
pen.setWidth(12 * scale);
p.setPen(pen);
QRectF area1(9.0 * scale, 9.0 * scale, 78.0 * scale, 78.0 * scale);
p.drawArc(area1, 40 * 16, 280 * 16);
QBrush brush(QColor("#60A0FF"));
pen.setWidth(1);
p.setPen(pen);
p.setBrush(brush);
QPointF arrow1[] = {{92.0 * scale, 15.0 * scale}, {60.0 * scale, 33.0 * scale}, {88.0 * scale, 36.0 * scale}};
//QPointF arrow2[] = {{66.0 * scale, 60.0 * scale}, {87.0 * scale, 78.0 * scale}, {90.0 * scale, 57.0 * scale}};
p.drawPolygon(arrow1, 3);
//p.drawPolygon(arrow2, 3);
}
static void nightSettings(int scale)
{
iconSetup("night-settings", scale);
QPainter p(image);
pen.setWidth(15 * scale);
pen.setColor("#60A0FF");
p.setRenderHint(QPainter::Antialiasing);
QBrush old = p.brush();
QBrush fill(QColor("darkcyan"));
p.setBrush(fill);
p.drawEllipse({48.0 * scale, 48.0 * scale}, 32.0 * scale, 32.0 * scale);
p.setBrush(old);
p.setPen(pen);
QRectF area1(21.0 * scale, 21.0 * scale, 54.0 * scale, 54.0 * scale);
p.drawEllipse(area1);
QBrush brush(QColor("#60A0FF"));
pen.setWidth(1);
p.setPen(pen);
p.setBrush(brush);
QPointF gear1[] = {{36.0 * scale, 4.0 * scale}, {60.0 * scale, 4.0 * scale}, {60.0 * scale, 18.0 * scale}, {36.0 * scale, 18.0 * scale}};
QPointF gear2[] = {{36.0 * scale, 92.0 * scale}, {60.0 * scale, 92.0 * scale}, {60.0 * scale, 78.0 * scale}, {36.0 * scale, 78.0 * scale}};
QPointF gear3[] = {{15.0 * scale, 12.0 * scale}, {3.0 * scale, 34.0 * scale}, {21.0 * scale, 45.0 * scale}, {27.0 * scale, 21.0 * scale}};
QPointF gear4[] = {{80.0 * scale, 12.0 * scale}, {93.0 * scale, 33.0 * scale}, {75.0 * scale, 45.0 * scale}, {69.0 * scale, 21.0 * scale}};
QPointF gear5[] = {{15.0 * scale, 84.0 * scale}, {3.0 * scale, 62.0 * scale}, {21.0 * scale, 51.0 * scale}, {27.0 * scale, 75.0 * scale}};
QPointF gear6[] = {{80.0 * scale, 82.0 * scale}, {93.0 * scale, 63.0 * scale}, {75.0 * scale, 51.0 * scale}, {69.0 * scale, 75.0 * scale}};
p.drawPolygon(gear1, 4);
p.drawPolygon(gear2, 4);
p.drawPolygon(gear3, 4);
p.drawPolygon(gear4, 4);
p.drawPolygon(gear5, 4);
p.drawPolygon(gear6, 4);
}
static void drawClear(int scale)
{
iconSetup("clear", scale, 10);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
p.drawLine(48 * scale, 9 * scale, 48 * scale, 39 * scale);
p.drawLine(30 * scale, 60 * scale, 21 * scale, 90 * scale);
p.drawLine(48 * scale, 60 * scale, 48 * scale, 90 * scale);
p.drawLine(66 * scale, 60 * scale, 75 * scale, 90 * scale);
}
static void nightClear(int scale)
{
iconSetup("night-clear", scale, 10);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
pen.setColor(QColor("orange"));
p.setPen(pen);
p.drawLine(48 * scale, 9 * scale, 48 * scale, 39 * scale);
pen.setColor(QColor("yellow"));
p.setPen(pen);
p.drawLine(30 * scale, 60 * scale, 21 * scale, 90 * scale);
p.drawLine(48 * scale, 60 * scale, 48 * scale, 90 * scale);
p.drawLine(66 * scale, 60 * scale, 75 * scale, 90 * scale);
}
static void drawExit(int scale)
{
iconSetup("exit", scale, 9);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pen);
p.drawLine(24 * scale, 6 * scale, 72 * scale, 6 * scale);
p.drawLine(24 * scale, 6 * scale, 24 * scale, 90 * scale);
p.drawLine(24 * scale, 90 * scale, 72 * scale, 90 * scale);
p.drawLine(72 * scale, 6 * scale, 72 * scale, 18 * scale);
p.drawLine(72 * scale, 90 * scale, 72 * scale, 78 * scale);
p.drawLine(51 * scale, 48 * scale, 84 * scale, 48 * scale);
p.drawLine(75 * scale, 36 * scale, 87 * scale, 48 * scale);
p.drawLine(75 * scale, 60 * scale, 87 * scale, 48 * scale);
}
static void nightExit(int scale)
{
iconSetup("night-exit", scale, 9);
QPainter p(image);
p.setRenderHint(QPainter::Antialiasing);
p.fillRect(24 * scale, 6 * scale, 48 * scale, 84 * scale, QColor("darkcyan"));
pen.setColor(QColor("white"));
p.setPen(pen);
p.drawLine(24 * scale, 6 * scale, 72 * scale, 6 * scale);
p.drawLine(24 * scale, 6 * scale, 24 * scale, 90 * scale);
p.drawLine(24 * scale, 90 * scale, 72 * scale, 90 * scale);
p.drawLine(72 * scale, 6 * scale, 72 * scale, 16 * scale);
p.drawLine(72 * scale, 90 * scale, 72 * scale, 80 * scale);
p.drawLine(47 * scale, 48 * scale, 76 * scale, 48 * scale);
p.drawLine(60 * scale, 28 * scale, 82 * scale, 48 * scale);
p.drawLine(60 * scale, 68 * scale, 82 * scale, 48 * scale);
}
Main::Main(QWidget *parent) :
QMainWindow(parent)
{
ui.setupUi(static_cast<QMainWindow *>(this));
drawTopic();
#ifdef Q_OS_MAC
glyphs.mkdir("../../../../Glyphs");
glyphs.setCurrent("../../../../Glyphs");
#else
glyphs.mkdir("../Glyphs");
glyphs.setCurrent("../Glyphs");
#endif
connect(ui.actionReload, &QAction::triggered, this, &Main::drawReload);
connect(ui.actionClear, &QAction::triggered, this, &Main::drawClear);
connect(ui.actionExit, &QAction::triggered, this, &Main::drawExit);
connect(ui.actionInfo, &QAction::triggered, this, &Main::drawInfo);
connect(ui.actionSettings, &QAction::triggered, this, &Main::drawSettings);
connect(ui.actionSearch, &QAction::triggered, this, &Main::drawSearch);
connect(ui.actionDialpad, &QAction::triggered, this, &Main::drawDialpad);
connect(ui.actionPeople, &QAction::triggered, this, &Main::drawPeople);
connect(ui.actionOk, &QAction::triggered, this, &Main::drawOk);
connect(ui.actionCancel, &QAction::triggered, this, &Main::drawCancel);
connect(ui.actionClose, &QAction::triggered, this, &Main::drawClose);
connect(ui.actionFileSave, &QAction::triggered, this, &Main::saveIcons);
connect(ui.actionQuit, &QAction::triggered, qApp, QCoreApplication::quit);
connect(ui.actionPhoneIdle, &QAction::triggered, this, &Main::drawPhoneIdle);
connect(ui.actionPhoneOffline, &QAction::triggered, this, &Main::drawPhoneOffline);
connect(ui.actionPhoneActivate, &QAction::triggered, this, &Main::drawPhoneActivate);
connect(ui.actionLocked, &QAction::triggered, this, &Main::drawLocked);
connect(ui.actionUnlocked, &QAction::triggered, this, &Main::drawUnlocked);
connect(ui.actionPhonebook, &QAction::triggered, this, &Main::drawPhonebook);
connect(ui.actionPerson, &QAction::triggered, this, &Main::drawPerson);
connect(ui.actionOn, &QAction::triggered, this, &Main::drawOn);
connect(ui.actionOff, &QAction::triggered, this, &Main::drawOff);
}
Main::~Main()
{
}
void Main::saveIcons()
{
drawReload();
::saveImages();
drawSettings();
::saveImages();
drawExit();
::saveImages();
drawInfo();
::saveImages();
drawClear();
::saveImages();
drawSearch();
::saveImages();
drawDialpad();
::saveImages();
drawPeople();
::saveImages();
drawTopic();
::saveImages();
drawGroup();
::saveImages();
drawNewGroup();
::saveImages();
drawAdd();
::saveImages();
drawDel();
::saveImages();
drawBurger();
::saveImages();
drawOk();
::saveImages();
drawCancel();
::saveImages();
drawColorOffline();
::saveImages();
drawColorIdle();
::saveImages();
drawColorActivate();
::saveImages();
drawDownScroll();
::saveImages();
drawSession();
::saveImages();
drawKill();
::saveImages();
drawClose();
::saveImages();
drawPhoneIdle();
::saveImages();
drawPhoneOffline();
::saveImages();
drawPhoneActivate();
::saveImages();
drawLocked();
::saveImages();
drawUnlocked();
::saveImages();
drawPhonebook();
::saveImages();
drawPerson();
::saveImages();
drawOn();
::saveImages();
drawOff();
::saveImages();
nightClose();
::saveImages();
nightExit();
::saveImages();
nightReload();
::saveImages();
nightSettings();
::saveImages();
nightInfo();
::saveImages();
nightClear();
::saveImages();
nightSearch();
::saveImages();
nightCheck();
::saveImages();
}
void Main::drawOn()
{
::clear();
::drawOn(1);
::drawOn(2);
::update();
}
void Main::drawOff()
{
::clear();
::drawOff(1);
::drawOff(2);
::update();
}
void Main::drawPerson()
{
::clear();
::drawPerson(1);
::drawPerson(2);
::update();
}
void Main::drawPhonebook()
{
::clear();
::drawPhonebook(1);
::drawPhonebook(2);
::update();
}
void Main::drawLocked()
{
::clear();
::drawLocked(1);
::drawLocked(2);
::update();
}
void Main::drawUnlocked()
{
::clear();
::drawUnlocked(1);
::drawUnlocked(2);
::update();
}
void Main::drawPhoneActivate()
{
::clear();
::drawPhoneActivate(1);
::drawPhoneActivate(2);
::update();
}
void Main::drawPhoneOffline()
{
::clear();
::drawPhoneOffline(1);
::drawPhoneOffline(2);
::update();
}
void Main::drawPhoneIdle()
{
::clear();
::drawPhoneIdle(1);
::drawPhoneIdle(2);
::update();
}
void Main::drawDownScroll()
{
::clear();
::drawDownScroll(1);
::drawDownScroll(2);
::update();
}
void Main::drawColorIdle()
{
::clear();
::drawColorIdle(1);
::drawColorIdle(2);
::update();
}
void Main::drawColorOffline()
{
::clear();
::drawColorOffline(1);
::drawColorOffline(2);
::update();
}
void Main::drawColorActivate()
{
::clear();
::drawColorActivate(1);
::drawColorActivate(2);
::update();
}
void Main::drawOk()
{
::clear();
::drawOk(1);
::drawOk(2);
::update();
}
void Main::nightCheck()
{
::clear();
::nightCheck(1);
::nightCheck(2);
::update();
}
void Main::drawCancel()
{
::clear();
::drawCancel(1);
::drawCancel(2);
::update();
}
void Main::drawClose()
{
::clear();
::drawClose(1);
::drawClose(2);
::update();
}
void Main::nightClose()
{
::clear();
::nightClose(1);
::nightClose(2);
::update();
}
void Main::nightExit()
{
::clear();
::nightExit(1);
::nightExit(2);
::update();
}
void Main::drawSession()
{
::clear();
::drawSession(1);
::drawSession(2);
::update();
}
void Main::drawKill()
{
::clear();
::drawKill(1);
::drawKill(2);
::update();
}
void Main::drawDel()
{
::clear();
::drawDel(1);
::drawDel(2);
::update();
}
void Main::drawBurger()
{
::clear();
::drawBurger(1);
::drawBurger(2);
::update();
}
void Main::drawAdd()
{
::clear();
::drawAdd(1);
::drawAdd(2);
::update();
}
void Main::drawGroup()
{
::clear();
::drawGroup(1);
::drawGroup(2);
::update();
}
void Main::drawTopic()
{
::clear();
::drawTopic(1);
::drawTopic(2);
::update();
}
void Main::drawNewGroup()
{
::clear();
::drawNewGroup(1);
::drawNewGroup(2);
::update();
}
void Main::drawPeople()
{
::clear();
::drawPeople(1);
::drawPeople(2);
::update();
}
void Main::drawDialpad()
{
::clear();
::drawDialpad(1);
::drawDialpad(2);
::update();
}
void Main::drawSearch()
{
::clear();
::drawSearch(1);
::drawSearch(2);
::update();
}
void Main::nightSearch()
{
::clear();
::nightSearch(1);
::nightSearch(2);
::update();
}
void Main::drawReload()
{
::clear();
::drawReload(1);
::drawReload(2);
::update();
}
void Main::nightReload()
{
::clear();
::nightReload(1);
::nightReload(2);
::update();
}
void Main::drawClear()
{
::clear();
::drawClear(1);
::drawClear(2);
::update();
}
void Main::nightClear()
{
::clear();
::nightClear(1);
::nightClear(2);
::update();
}
void Main::drawExit()
{
::clear();
::drawExit(1);
::drawExit(2);
::update();
}
void Main::drawInfo()
{
::clear();
::drawInfo(1);
::drawInfo(2);
::update();
}
void Main::nightInfo()
{
::clear();
::nightInfo(1);
::nightInfo(2);
::update();
}
void Main::drawSettings()
{
::clear();
::drawSettings(1);
::drawSettings(2);
::update();
}
void Main::nightSettings()
{
::clear();
::nightSettings(1);
::nightSettings(2);
::update();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Main w;
w.show();
return app.exec();
}