mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
ref: segregate systems, codestyle, busy message
This commit is contained in:
87
UI/resourcemanager.cpp
Normal file
87
UI/resourcemanager.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
#include "resourcemanager.h"
|
||||
|
||||
#include <QFontDatabase>
|
||||
#include <QIcon>
|
||||
#include <QPainter>
|
||||
|
||||
ResourceManager::ResourceManager(QObject *parent) :
|
||||
QObject(parent),
|
||||
settingsIcon(new QIcon),
|
||||
unsavedIcon(new QIcon),
|
||||
closeIcon(new QIcon)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ResourceManager::painting()
|
||||
{
|
||||
QFontDatabase::addApplicationFont(":/resource/Fonts/Kanit Cyrillic.ttf");
|
||||
QFontDatabase::addApplicationFont(":/resource/Fonts/HelveticaNeue-Medium.ttf");
|
||||
|
||||
//settings
|
||||
QPixmap settingIcon(":resource/Icons/settingWhite.png");
|
||||
QPainter painter;
|
||||
QColor color(45,84,130);
|
||||
|
||||
painter.begin(&settingIcon);
|
||||
painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
painter.fillRect(settingIcon.rect(),color);
|
||||
painter.end();
|
||||
|
||||
settingsIcon->addPixmap(settingIcon,QIcon::Normal,QIcon::Off);
|
||||
|
||||
//caution
|
||||
QPixmap cautionIcon(":resource/Icons/caution.png");
|
||||
|
||||
painter.begin(&cautionIcon);
|
||||
painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
painter.fillRect(cautionIcon.rect(),color);
|
||||
painter.end();
|
||||
|
||||
unsavedIcon->addPixmap(cautionIcon,QIcon::Normal,QIcon::Off);
|
||||
|
||||
//exit
|
||||
QPixmap crossPixmap(":resource/Icons/crossInCircle.png");
|
||||
QPainter painterCross;
|
||||
|
||||
painter.begin(&crossPixmap);
|
||||
painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
painter.fillRect(crossPixmap.rect(),color);
|
||||
painter.end();
|
||||
|
||||
closeIcon->addPixmap(crossPixmap,QIcon::Normal,QIcon::Off);
|
||||
//loading
|
||||
|
||||
movie = new QMovie(":/resource/Icons/762.gif");
|
||||
startLoadingAnim();
|
||||
}
|
||||
|
||||
void ResourceManager::startLoadingAnim()
|
||||
{
|
||||
movie->start();
|
||||
}
|
||||
|
||||
void ResourceManager::stopLoadingMovie()
|
||||
{
|
||||
movie->stop();
|
||||
}
|
||||
|
||||
QMovie *ResourceManager::getMovie() const
|
||||
{
|
||||
return movie;
|
||||
}
|
||||
|
||||
QIcon *ResourceManager::getSettingsIcon() const
|
||||
{
|
||||
return settingsIcon;
|
||||
}
|
||||
|
||||
QIcon *ResourceManager::getUnsavedIcon() const
|
||||
{
|
||||
return unsavedIcon;
|
||||
}
|
||||
|
||||
QIcon *ResourceManager::getCloseIcon() const
|
||||
{
|
||||
return closeIcon;
|
||||
}
|
||||
32
UI/resourcemanager.h
Normal file
32
UI/resourcemanager.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef RESOURCEMANAGER_H
|
||||
#define RESOURCEMANAGER_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMovie>
|
||||
#include <QObject>
|
||||
|
||||
class ResourceManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ResourceManager(QObject *parent = nullptr);
|
||||
|
||||
void painting();
|
||||
void startLoadingAnim();
|
||||
void stopLoadingMovie();
|
||||
|
||||
QMovie *getMovie() const;
|
||||
QIcon *getSettingsIcon() const;
|
||||
QIcon *getUnsavedIcon() const;
|
||||
QIcon *getCloseIcon() const;
|
||||
|
||||
signals:
|
||||
|
||||
private:
|
||||
QMovie *movie;
|
||||
QIcon *settingsIcon;
|
||||
QIcon *unsavedIcon;
|
||||
QIcon *closeIcon;
|
||||
};
|
||||
|
||||
#endif // RESOURCEMANAGER_H
|
||||
Reference in New Issue
Block a user