Subversion Repositories OpenInventory

Rev

Rev 202 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 202 Rev 203
Line 29... Line 29...
29
29
30
30
31
31
32
void FileForm::on_pushButton_clicked(){          // îáðàáîò÷èê íàæàòèÿ êíîïêè "Îòêðûòü ôàéë"
32
void FileForm::on_pushButton_clicked(){          // îáðàáîò÷èê íàæàòèÿ êíîïêè "Îòêðûòü ôàéë"
33
    QString  fileName;
33
    QString  fileName;
-
 
34
    QStringList fileName_list;
-
 
35
    int list_size;
34
    QFile file;
36
    QFile file;
35
    QByteArray data_tmp;
37
    QByteArray data_tmp;
36
38
37
        fileName = QFileDialog::getOpenFileName(this,
39
        fileName = QFileDialog::getOpenFileName(this,
38
         tr("Open Image"), "", tr("All Files (*.*);;Image Files (*.png *.jpg *.bmp);;Text files (*.txt);;XML files (*.xml)")); //Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)
40
         tr("Open Image"), "", tr("All Files (*.*);;Image Files (*.png *.jpg *.bmp);;Text files (*.txt);;XML files (*.xml)")); //Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)
Line 41... Line 43...
41
    file.setFileName(fileName);
43
    file.setFileName(fileName);
42
    if (!file.open(QIODevice::ReadOnly)) return;
44
    if (!file.open(QIODevice::ReadOnly)) return;
43
    Data.clear();
45
    Data.clear();
44
    // Data = file.readAll();
46
    // Data = file.readAll();
45
    QDataStream out(&Data,QIODevice::ReadWrite);
47
    QDataStream out(&Data,QIODevice::ReadWrite);
-
 
48
    fileName_list = fileName.split(QRegExp("[/\]"), QString::SkipEmptyParts);
-
 
49
-
 
50
    list_size = fileName_list.size();
-
 
51
-
 
52
    fileName = fileName_list.last();
-
 
53
46
    out << fileName;
54
    out << fileName;
47
    data_tmp = file.readAll();
55
    data_tmp = file.readAll();
48
    out << data_tmp;
56
    out << data_tmp;
49
    file.close();
57
    file.close();
50
    FileForm::fdataIsChanged = true;
58
    FileForm::fdataIsChanged = true;
Line 62... Line 70...
62
70
63
    QByteArray data_tmp;
71
    QByteArray data_tmp;
64
    QFile file;
72
    QFile file;
65
    QDataStream out(&Data,QIODevice::ReadOnly);
73
    QDataStream out(&Data,QIODevice::ReadOnly);
66
    QString fileName;
74
    QString fileName;
67
   // QString fileName_tmp;
75
    QStringList fileName_list;
68
    if (Data.isEmpty()) return;
76
    if (Data.isEmpty()) return;
69
    out.device()->reset();
77
    out.device()->reset();
70
    out >> fileName;
78
    out >> fileName;
-
 
79
    fileName_list = fileName.split(QRegExp("[/\]"), QString::SkipEmptyParts);
-
 
80
-
 
81
-
 
82
71
    fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
83
    fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
72
                                                     fileName,
84
                                                     fileName,
73
                                                     tr("All Files (*.*);;Image Files (*.png *.jpg *.bmp);;Text files (*.txt);;XML files (*.xml)"));
85
                                                     tr("All Files (*.*);;Image Files (*.png *.jpg *.bmp);;Text files (*.txt);;XML files (*.xml)"));
74
86
75
87