1
//This file is part of AcetoneISO. Copyright 2006,2007,2008,2009 Marco Di Antonio and Fabrizio Di Marco (acetoneiso@gmail.com)
3
// AcetoneISO is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, either version 3 of the License, or
6
// (at your option) any later version.
8
// AcetoneISO is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License
14
// along with AcetoneISO. If not, see <http://www.gnu.org/licenses/>.
15
void acetoneiso::play()
17
QFile Mtab("/etc/mtab");//dichiaro un file Mtab che sarebbe /etc/mtab
18
Mtab.open(QIODevice::ReadOnly);//lo apro in sola lettura
19
QString str1 = (Mtab.readAll());//leggo il contenuto del file mtab
21
QDir Home = QDir::home();
22
QFile file(Home.path() + "/.acetoneiso/acetoneiso.conf");
23
file.open(QIODevice::ReadOnly);//lo apro in sola lettura
24
QString strb = (leggiRigo( 2, &file ));
26
QDir Temp = QDir::temp();
27
Temp.cd("acetoneiso");
28
//QDir Home = QDir::home();
29
QDir virtual_dvd_drive( Home.path() + "/virtual-drives" + "/dvd" );
31
if(str1.contains( virtual_dvd_drive.path() ) )//Caso che il dvd è già montato.
34
QMessageBox::information(this, "AcetoneISO",tr("Please Unmount the movie first"));
37
else{ //Caso che il dvd non è montato.
38
QString isodamontare = QFileDialog::getOpenFileName(this,tr("Select DVD-Movie to Play"), Home.path() , tr("DVD-Movie Image (*.iso *.bin *.img *.mdf *.nrg)"));
39
if ( !isodamontare.isNull() )
41
QFileInfo fi( isodamontare );
42
QString onlyfile = fi.fileName();
44
QString percorsovirtuale = virtual_dvd_drive.path();
45
Monta( isodamontare, percorsovirtuale ); //function defined in a_mount.h
47
// chiamo subito lo scaricamento della copertina, speriamo bene!
48
//dvdGui( label_dvd2, onlyfile);
49
// decidi se usare metodo 1 o 2
52
msgBox.setText(tr("Choose a method to play the movie.\nMethod 1 generally works, if it doesn't try Method 2."));
53
QPushButton *connectButton = msgBox.addButton(tr("Method 1"), QMessageBox::ActionRole);
54
QPushButton *connectButton2 = msgBox.addButton(tr("Method 2"), QMessageBox::ActionRole);
56
if (msgBox.clickedButton() == connectButton) {
59
if(strb.contains("kaffeine", Qt::CaseInsensitive)) { //Se nel radio button è selezionato kaffeine.
60
QString kaf_input(virtual_dvd_drive.path());
61
kaf_input.prepend("dvd:/");
62
KAffeine.start("kaffeine", QStringList() << kaf_input );
65
if(strb.contains("vlc", Qt::CaseInsensitive)) { //Se nel radio button è selezionato vlc.
66
VLc.start("vlc", QStringList() << virtual_dvd_drive.path() );
69
SMplayer.start("smplayer", QStringList() << virtual_dvd_drive.path() );
74
else if (msgBox.clickedButton() == connectButton2)
76
isodamontare.prepend("dvd:/");
78
if(strb.contains("kaffeine", Qt::CaseInsensitive)) { //Se nel radio button è selezionato kaffeine.
80
KAffeine.start("kaffeine", QStringList() << isodamontare );
83
if(strb.contains("vlc", Qt::CaseInsensitive)) { //Se nel radio button è selezionato vlc.
84
VLc.start("vlc", QStringList() << isodamontare );
87
SMplayer.start("smplayer", QStringList() << isodamontare );
98
/*void acetoneiso::dvdGui( QLabel *label, QString &string ) //questa funzione pulisce la label e ci riscrive il titolo del dvd.Infine richiama get_cover
100
QDir Temp = QDir::temp();
101
Temp.cd("acetoneiso");
103
label->setText("DVD-Movie " + string + + " " + tr(" mounted"));
104
QFile f1(Temp.path() + "/dvd");
105
f1.open(QIODevice::WriteOnly | QIODevice::Text);
106
QTextStream out(&f1);
108
QTimer::singleShot(2000, this, SLOT(get_cover())); //QUI DEVO ASPETTARE CHE CREA IL FILE /TMP/ACETONEISO/DVD E POI FA COVER
111
void acetoneiso::unplay()
113
QDir Home = QDir::home();
114
QDir Temp = QDir::temp();
115
Temp.cd("acetoneiso");
116
QFile dvd_temp( Temp.path() + "/dvd" );
117
QFile cover( Temp.path() + "/cov.jpg" );
118
QDir virtual_dvd_drive( Home.path() + "/virtual-drives" + "/dvd" );
119
FUsermount.start("fusermount", QStringList() << "-u" << "-z" << virtual_dvd_drive.path() );
120
//label_dvd2->clear();
123
//label_cover->setPixmap(QPixmap(":/images/default.png"));
124
//button_saveCover->setVisible(false);
125
QFile file_xml( Temp.path() + "/xml.xml" );