QTfrontend/ui/widget/drawmapwidget.cpp
changeset 7794 ab7b94c03bc9
parent 6952 7f70f37bbf08
child 9080 9b42757d7e71
equal deleted inserted replaced
7793:3c21da93db9f 7794:ab7b94c03bc9
    93     if(m_scene)
    93     if(m_scene)
    94     {
    94     {
    95         QFile file(fileName);
    95         QFile file(fileName);
    96 
    96 
    97         if(!file.open(QIODevice::WriteOnly))
    97         if(!file.open(QIODevice::WriteOnly))
    98             QMessageBox::warning(this, tr("File error"), tr("Cannot open file '%1' for writing").arg(fileName));
    98         {
       
    99             QMessageBox errorMsg(this);
       
   100             errorMsg.setIcon(QMessageBox::Warning);
       
   101             errorMsg.setWindowTitle(QMessageBox::tr("File error"));
       
   102             errorMsg.setText(QMessageBox::tr("Cannot open '%1' for writing").arg(fileName));
       
   103             errorMsg.setWindowModality(Qt::WindowModal);
       
   104             errorMsg.exec();
       
   105         }
    99         else
   106         else
   100             file.write(qCompress(m_scene->encode()).toBase64());
   107             file.write(qCompress(m_scene->encode()).toBase64());
   101     }
   108     }
   102 }
   109 }
   103 
   110 
   106     if(m_scene)
   113     if(m_scene)
   107     {
   114     {
   108         QFile f(fileName);
   115         QFile f(fileName);
   109 
   116 
   110         if(!f.open(QIODevice::ReadOnly))
   117         if(!f.open(QIODevice::ReadOnly))
   111             QMessageBox::warning(this, tr("File error"), tr("Cannot read file '%1'").arg(fileName));
   118         {
       
   119             QMessageBox errorMsg(this);
       
   120             errorMsg.setIcon(QMessageBox::Warning);
       
   121             errorMsg.setWindowTitle(QMessageBox::tr("File error"));
       
   122             errorMsg.setText(QMessageBox::tr("Cannot open '%1' for reading").arg(fileName));
       
   123             errorMsg.setWindowModality(Qt::WindowModal);
       
   124             errorMsg.exec();
       
   125         }
   112         else
   126         else
   113             m_scene->decode(qUncompress(QByteArray::fromBase64(f.readAll())));
   127             m_scene->decode(qUncompress(QByteArray::fromBase64(f.readAll())));
   114     }
   128     }
   115 }
   129 }
   116 
   130