-
Notifications
You must be signed in to change notification settings - Fork 0
/
messages.cpp
109 lines (85 loc) · 2.56 KB
/
messages.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "messages.h"
#include "ui_messages.h"
#include <QSettings>
#include <QDesktopServices>
#include <QPainter>
Messages::Messages(WidgetParent *parent) :
WidgetParent(parent),
ui(new Ui::Messages)
{
ui->setupUi(this);
this->setWindowFlags(Qt::WindowStaysOnTopHint);
this->DrawGUI();
this->setRoundedCorners(6,6,6,6);
this->setWindowOpacity(0);
QPropertyAnimation* animation = new QPropertyAnimation(this, "windowOpacity");
animation->setDuration(200);
animation->setStartValue(0);
animation->setEndValue(0.99);
animation->start();
}
Messages::~Messages()
{
delete ui;
}
void Messages::on_Ok_Button_clicked()
{
emit click_Ok();
this->close();
delete this;
}
void Messages::on_Download_Button_clicked()
{
QDesktopServices::openUrl(QUrl("http://slproweb.com/products/Win32OpenSSL.html"));
this->close();
delete this;
}
void Messages::on_CloseApp_clicked()
{
this->close();
delete this;
}
void Messages::set_Title_and_Text(QString title, QString Text, bool Show_DB, bool Show_ReWrite)
{
if(Show_DB){
ui->Download_Button->show();
}
else
ui->Download_Button->hide();
if(Show_ReWrite){
ui->Ok_Button->setText("Отмена");
ui->ReWrite->show();
}
else
ui->ReWrite->hide();
ui->Title->setText(title);
ui->Text->setText(Text);
ui->Text->setAlignment(Qt::AlignCenter);
}
void Messages::DrawGUI()
{
QSettings * settings = new QSettings("settings.conf",QSettings::IniFormat);
int r = settings->value("Color/R").toInt();
int g = settings->value("Color/G").toInt();
int b = settings->value("Color/B").toInt();
QString styleSheet = "Messages { background-color : rgb(%1, %2, %3)}";
this->setStyleSheet(styleSheet.arg(r).arg(g).arg(b));
ui->CloseApp->setStyleSheet("border-image: url(:/new/prefix1/icons/close.gif) stretch;");
QString stylesheet_path;
stylesheet_path = "://CSS/MessageText.txt";
ui->Text->setStyleSheet(this->Read_Stylesheet(stylesheet_path));
stylesheet_path = "://CSS/Button.txt";
ui->Ok_Button->setStyleSheet(this->Read_Stylesheet(stylesheet_path));
ui->ReWrite->setStyleSheet(this->Read_Stylesheet(stylesheet_path));
ui->Download_Button->setStyleSheet(this->Read_Stylesheet(stylesheet_path));
ui->Title->setStyleSheet(
"color:white;"
);
ui->Icon->setStyleSheet("border-image: url(:/new/prefix1/icons/vkp2.ico) stretch;");
}
void Messages::on_ReWrite_clicked()
{
emit click_ReWrite();
this->close();
delete this;
}