-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.cpp
93 lines (75 loc) · 3.43 KB
/
generator.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
#include "generator.h"
#include "ui_generator.h"
generator::generator(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::generator)
{
ui->setupUi(this);
setFixedSize(652, 433);
}
generator::~generator()
{
delete ui;
}
void generator::on_gen_css_btn_clicked()
{
css_code = ".btn\n{\n background-color: " + ui->bkc_input->text() + ";\n width: 80px;\n height: 28px;\n" + " border: " + ui->bw_input->text() + " " + ui->bs_input->currentText() + " " + ui->bc_input->text() + ";\n " + "-webkit-border-radius: " + ui->br_input->text() + ";\n " + "-moz-border-radius: " + ui->br_input->text() + ";\n " + "border-radius: " + ui->br_input->text() + ";\n " + "font-family: \'" + ui->ff_input->currentText() + "\';\n " + "color: " + ui->fc_input->text() + ";\n " + "font-size: " + ui->fs_input->currentText() + "px;\n " + "padding: " + ui->pt_input->text() + " " + ui->pr_input->text() + " " + ui->pb_input->text() + " " + ui->pl_input->text() + ";\n " + "text-decoration: " + "none" + ";\n}\n.btn:hover\n{\n background-color: " + ui->bkch_input->text() + ";\n " + "text-decoration: none;\n}";
preview_code = "QPushButton\n{\n background-color: " + ui->bkc_input->text() + ";\n width: 80px;\n height: 28px;\n" + " border: " + ui->bw_input->text() + " " + ui->bs_input->currentText() + " " + ui->bc_input->text() + ";\n " + "-webkit-border-radius: " + ui->br_input->text() + ";\n " + "-moz-border-radius: " + ui->br_input->text() + ";\n " + "border-radius: " + ui->br_input->text() + ";\n " + "font-family: \'" + ui->ff_input->currentText() + "\';\n " + "color: " + ui->fc_input->text() + ";\n " + "font-size: " + ui->fs_input->currentText() + "px;\n " + "padding: " + ui->pt_input->text() + " " + ui->pr_input->text() + " " + ui->pb_input->text() + " " + ui->pl_input->text() + ";\n " + "text-decoration: " + "none" + ";\n}\nQPushButton:hover\n{\n background-color: " + ui->bkch_input->text() + ";\n " + "text-decoration: none;\n}";
result = new CssDisplayer(this);
result->setCSS(css_code, preview_code);
result->show();
}
void generator::on_fc_label_linkActivated(const QString &link)
{
if(!link.isEmpty())
{
QColor color = QColorDialog::getColor();
if (color.isValid())
{
ui->fc_input->setText(color.name());
}
}
}
void generator::on_bc_label_linkActivated(const QString &link)
{
if(!link.isEmpty())
{
QColor color = QColorDialog::getColor();
if (color.isValid())
{
ui->bc_input->setText(color.name());
}
}
}
void generator::on_bkc_label_linkActivated(const QString &link)
{
if(!link.isEmpty())
{
QColor color = QColorDialog::getColor();
if (color.isValid())
{
ui->bkc_input->setText(color.name());
}
}
}
void generator::on_bkch_label_linkActivated(const QString &link)
{
if(!link.isEmpty())
{
QColor color = QColorDialog::getColor();
if (color.isValid())
{
ui->bkch_input->setText(color.name());
}
}
}
void generator::on_actionAbout_Qt_triggered()
{
QMessageBox::aboutQt(this);
}
void generator::on_actionJoin_us_on_twitter_triggered()
{
QUrl url;
url.setUrl("https://twitter.com/prog_naveed");
QDesktopServices::openUrl(url);
}