~andrikos/acetoneiso/trunk

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
//This file is part of AcetoneISO. Copyright 2006,2007,2008,2009,2010 Marco Di Antonio and Fabrizio Di Marco (acetoneiso@gmail.com)
//
//    AcetoneISO is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    AcetoneISO is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with AcetoneISO.  If not, see <http://www.gnu.org/licenses/>. 


void acetoneiso::foldertoiso() {
  QFile mkisofs;
  mkisofs.setFileName("/usr/bin/xorrisofs");
  QDir Home = QDir::home();
  QFile file(Home.path() + "/.acetoneiso/acetoneiso.conf");
  file.open(QIODevice::ReadOnly);//lo apro in sola lettura
  QString str1 = (leggiRigo( 1, &file ));
  file.close();
  
  if (!mkisofs.exists()) {
    QMessageBox::warning(this, "AcetoneISO::Warning!",tr("no xorrisofs found in /usr/bin"));
    return;
  }

  QString folder = QFileDialog::getExistingDirectory(this, tr("AcetoneISO::Select Folder to be Converted"), Home.path());
  if (folder.isEmpty() ) {
    return;
  }

  QDir fol (folder);
  QString iso;
  iso = fol.dirName();

  QString fileName = QFileDialog::getSaveFileName(this, tr("AcetoneISO::Save ISO"), Home.path() , tr("Images(*.iso)"));

  if ( fileName.isNull() ) {
    return;
  }

  if (str1.contains("standard", Qt::CaseInsensitive)) {
		  
    showProgressDisplay();
    MKisofs = new QProcess();
    MKisofs->setReadChannel(QProcess::StandardOutput);
    MKisofs->setProcessChannelMode(QProcess::MergedChannels);
    connect(MKisofs, SIGNAL(readyReadStandardOutput()), SLOT(updateProgressDisplay_MKisofs() )); 
    connect(MKisofs, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(printOut(int, QProcess::ExitStatus)));
    MKisofs->start("xorrisofs",QStringList() << "-R" << "-J" << "-o" << fileName << folder  );
  }
  else {	
    bool ok;
    QString text = QInputDialog::getText(this, tr("ISO ID"), tr("Please insert an ID for the ISO"), QLineEdit::Normal, tr(""), &ok);

    if (!ok){
      return;
    }
  
    showProgressDisplay();
    MKisofs = new QProcess();
    MKisofs->setReadChannel(QProcess::StandardOutput);
    MKisofs->setProcessChannelMode(QProcess::MergedChannels);
    connect(MKisofs, SIGNAL(readyReadStandardOutput()), SLOT(updateProgressDisplay_MKisofs() )); 
    connect(MKisofs, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(printOut(int, QProcess::ExitStatus)));
    MKisofs->start("xorrisofs",QStringList()  << "-R" << "-J" << "-V" << text << "-o" << fileName << folder  );

  }

  file.close();
  
}