26 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
31 QGridLayout*
layout =
new QGridLayout(
this);
34 layout->addWidget(
new QLabel(tr(
"Face to use:"),
this),
line, 0);
38 layout->addWidget(
new QLabel(tr(
"Path of the picture to create:"),
this),
line, 0);
43 QPushButton*
browse =
new QPushButton(tr(
"Browse"),
this);
47 QDialogButtonBox*
box =
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Close, Qt::Horizontal,
this);
49 connect(
box, SIGNAL(rejected()),
this, SLOT(reject()));
52 setWindowTitle(tr(
"Smooth face base generator"));
54 QApplication::restoreOverrideCursor();
80 QMessageBox::warning(
this, tr(
"Oops"), tr(
"You must select a destination!"));
86 if (QMessageBox::question(
this, tr(
"Confirm file overwrite"), tr(
"File %1 already exists. Overwrite it?").arg(
destination()), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
90 QPixmap pic(32 * 16, 32 * 2);
91 pic.fill(QColor(0, 0, 0, 0));
93 QPainter device(&pic);
94 device.setBackground(QColor(0, 0, 0, 0));
132 int sx, sy, sw, sh, dx, dy, spot;
133 for (
int x = 0;
x < 16;
x++) {
134 for (
int y = 0;
y < 2;
y++) {
137 for (
int bit = 0; bit < 9; bit++) {
138 if ((spots[spot] & (1 << bit)) == 0)
182 device.drawImage(dx, dy, icon, sx, sy, sw, sh);
190 QMessageBox::critical(
this, tr(
"Error"), tr(
"Error while saving the picture as %1!").arg(
destination()));
194 QMessageBox::information(
this, tr(
"Smooth base saved"), tr(
"The smooth base was correctly saved as %1").arg(
destination()));
204 QString
dest = QFileDialog::getSaveFileName(
this, tr(
"Select destination file"),
"", tr(
"PNG file (*.png);;All files (*.*)"));