Subversion Repositories OpenInventory

Rev

Rev 191 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 191 Rev 194
1
#include "iconform.h"
1
#include "iconform.h"
2
#include "ui_iconform.h"
2
#include "ui_iconform.h"
3
#include "mainwindow.h"
3
#include "mainwindow.h"
4
4
5
5
6
IconForm::IconForm(QWidget *parent) :
6
IconForm::IconForm(QWidget *parent) :
7
    QWidget(parent),
7
    QWidget(parent),
8
    ui(new Ui::IconForm)
8
    ui(new Ui::IconForm)
9
{
9
{
10
    ui->setupUi(this);
10
    ui->setupUi(this);
11
    IconForm::fdataIsChanged = false;
11
    IconForm::fdataIsChanged = false;
12
}
12
}
13
13
14
IconForm::~IconForm()
14
IconForm::~IconForm()
15
{
15
{
16
    delete ui;
16
    delete ui;
17
}
17
}
18
18
19
void IconForm::changeEvent(QEvent *e)
19
void IconForm::changeEvent(QEvent *e)
20
{
20
{
21
    QWidget::changeEvent(e);
21
    QWidget::changeEvent(e);
22
    switch (e->type()) {
22
    switch (e->type()) {
23
    case QEvent::LanguageChange:
23
    case QEvent::LanguageChange:
24
        ui->retranslateUi(this);
24
        ui->retranslateUi(this);
25
        break;
25
        break;
26
    default:
26
    default:
27
        break;
27
        break;
28
    }
28
    }
29
}
29
}
30
30
31
31
32
void IconForm::on_pushButton_clicked(){          // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ïîìåíÿòü èêîíêó"
32
void IconForm::on_pushButton_clicked(){          // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ïîìåíÿòü èêîíêó"
33
33
34
    QString  fileName;
34
    QString  fileName;
35
        fileName = QFileDialog::getOpenFileName(this,
35
        fileName = QFileDialog::getOpenFileName(this,
36
         tr("Open Image"), "", tr("Image Files (*.png *.jpg *.bmp)"));
36
         tr("Open Image"), "", tr("Image Files (*.png *.jpg *.bmp)"));
37
37
38
    if (fileName.isEmpty()) return;
38
    if (fileName.isEmpty()) return;
39
    Pixmap.load(fileName);
39
    Pixmap.load(fileName);
-
 
40
    if (Pixmap.height() > 128) Pixmap = Pixmap.scaledToHeight(128);
40
41
41
    ui->label->setPixmap(Pixmap);
42
    ui->label->setPixmap(Pixmap);
42
    IconForm::fdataIsChanged = true;
43
    IconForm::fdataIsChanged = true;
43
//    IconForm::close();
44
//    IconForm::close();
44
}
45
}
45
46
46
void IconForm::on_pushButton_2_clicked(){          // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü èêîíêó"
47
void IconForm::on_pushButton_2_clicked(){          // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü èêîíêó"
47
48
48
    QPixmap pix_tmp;
49
    QPixmap pix_tmp;
49
    Pixmap = pix_tmp;
50
    Pixmap = pix_tmp;
50
    ui->label->setPixmap(Pixmap);
51
    ui->label->setPixmap(Pixmap);
51
    IconForm::fdataIsChanged = true;
52
    IconForm::fdataIsChanged = true;
52
53
53
   }
54
   }
54
55
55
56
56
57
57
58
58
void IconForm::setPixmap (QPixmap newPixmap){
59
void IconForm::setPixmap (QPixmap newPixmap){
59
Pixmap = newPixmap;
60
Pixmap = newPixmap;
60
  ui->label->setPixmap(Pixmap);
61
  ui->label->setPixmap(Pixmap);
61
62
62
}
63
}
63
64
64
65
65
QPixmap IconForm::pixmap (){
66
QPixmap IconForm::pixmap (){
66
    return Pixmap;
67
    return Pixmap;
67
}
68
}
68
69
69
70
70
bool IconForm::dataIsChanged(){
71
bool IconForm::dataIsChanged(){
71
    return IconForm::fdataIsChanged;
72
    return IconForm::fdataIsChanged;
72
}
73
}
73
 
74