[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src/traverso/dialogs CDWritingDialog.c...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src/traverso/dialogs CDWritingDialog.c... |
Date: |
Mon, 28 Jan 2008 15:55:27 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 08/01/28 15:55:27
Modified files:
src/traverso/dialogs: CDWritingDialog.cpp CDWritingDialog.h
Log message:
* use wodim for burn device detection, since it does a better job at
that then cdrdao. If wodim is not available, fall back to cdrdao
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/CDWritingDialog.cpp?cvsroot=traverso&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/CDWritingDialog.h?cvsroot=traverso&r1=1.4&r2=1.5
Patches:
Index: CDWritingDialog.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/dialogs/CDWritingDialog.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- CDWritingDialog.cpp 21 Jan 2008 16:25:16 -0000 1.6
+++ CDWritingDialog.cpp 28 Jan 2008 15:55:27 -0000 1.7
@@ -76,6 +76,14 @@
connect(refreshButton, SIGNAL(clicked()), this, SLOT(query_devices()));
connect(cdDiskExportOnlyCheckBox, SIGNAL(stateChanged(int)), this,
SLOT(export_only_changed(int)));
+
+ m_wodimAvailable = false;
+
+ // A bit lame way to 'detect' if wodim is installed
+ if (QProcess::execute("wodim") != QProcess::FailedToStart) {
+ m_wodimAvailable = true;
+ }
+
query_devices();
}
@@ -150,7 +158,13 @@
cdDeviceComboBox->addItem("IOCompactDiscServices");
cdDeviceComboBox->addItem("IOCompactDiscServices/2");
#else
+ // Detect the available devices with wodim if available,
+ // since it seems to work better then cdrdao
+ if (m_wodimAvailable) {
+ m_burnprocess->start("wodim", QStringList() << "--devices");
+ } else {
m_burnprocess->start(CDRDAO_BIN, QStringList() << "drive-info");
+ }
#endif
}
@@ -369,21 +383,45 @@
QString device = get_device(index);
QStringList arguments;
- arguments << "write" << "--device" << device << "-n" << "--eject" <<
"--driver" << "generic-mmc";
+ QString burnprogram;
+
+
+ // wodim vs cdrecord vs cdrdao?? a lot of fuzz about these,
+ // but so far cdrdao works for me just fine, so let's continue
+ // using it for the actual burning for now.
+/* if (m_wodimAvailable) {
+ burnprogram = "wodim";
+ arguments << "-vv";
+ if (simulateCheckBox->isChecked()) {
+ arguments << "-dummy";
+ }
+ arguments << QString("dev=").append(device);
+ arguments << "driveropts=burnfree";
+ arguments << "-dao";
+ arguments << "-eject";
+ if (speedComboBox->currentIndex() != 0) {
+ arguments << "speed=" <<
speedComboBox->currentText().remove("x");
+ }
+ } else {*/
+ burnprogram = CDRDAO_BIN;
+ arguments << "write" << "--device" << device << "-n" <<
"--eject" << "--driver" << "generic-mmc";
if (speedComboBox->currentIndex() != 0) {
arguments << "--speed" <<
speedComboBox->currentText().remove("x");
}
-
if (simulateCheckBox->isChecked()) {
arguments << "--simulate";
}
+// }
arguments << m_exportSpec->tocFileName;
+
+ printf("%s arguments: %s\n", QS_C(burnprogram), QS_C(arguments.join("
")));
+
#if defined (Q_WS_MAC)
m_burnprocess->start(qApp->applicationDirPath() + "/cdrdao", arguments);
#else
- m_burnprocess->start(CDRDAO_BIN, arguments);
+ m_burnprocess->start(burnprogram, arguments);
#endif
}
@@ -441,6 +479,11 @@
while(m_burnprocess->readLine(buf, sizeof(buf)) != -1) {
QString data = QString(buf);
+
+ if (data.isEmpty()) {
+ continue;
+ }
+
//printf("%s\n", QS_C(data));
if (data.contains("trying to open")) {
update_cdburn_status(tr("Trying to access CD
Writer ..."), NORMAL_MESSAGE);
@@ -453,32 +496,48 @@
#if defined (Q_WS_WIN)
if (data.contains(QRegExp("[0-9],[0-9],[0-9]"))) {
#else
- if (data.contains("/dev/")) {
+ if (data.contains("/dev/") || data.contains("dev=")) {
#endif
- QString deviceName;
QStringList strlist =
QString(data).split(QRegExp("\\s+"));
- for (int i=1; i<strlist.size(); ++i) {
- QString token = strlist.at(i);
- if (token.contains("Rev:")) {
- break;
- } else if (token != ":") {
- deviceName += token + " ";
+ QString deviceName = "No Device Available";
+ QString device = "/no/device/detected";
+
+ if (m_wodimAvailable) {
+ if (strlist.size() > 5) {
+ deviceName = strlist.at(5) + "
";
+ deviceName =
deviceName.remove("'");
}
+ if (strlist.size() > 7) {
+ deviceName += strlist.at(7) + "
";
+ deviceName =
deviceName.remove("'");
}
- QString device = strlist.at(0);
+ if (strlist.size() > 2) {
+ device = strlist.at(2);
+ device =
device.remove("dev=").remove("'");
+ deviceName += "(" + device +
")";
+ }
+ } else {
+ if (strlist.size() > 1) {
+ deviceName = strlist.at(1) + "
";
+ }
+ if (strlist.size() > 3) {
+ deviceName += strlist.at(3) + "
";
+ }
+ if (strlist.size() > 0) {
+ device = strlist.at(0);
device = device.remove(":");
deviceName += "(" + device + ")";
+ }
+ }
cdDeviceComboBox->addItem(deviceName, device);
}
}
QString cdrdaoDrive = config().get_property("Cdrdao", "drive",
"").toString();
- if (cdrdaoDrive != "") {
int index = cdDeviceComboBox->findData(cdrdaoDrive);
- if (index != -1) {
+ if (index >= 0) {
cdDeviceComboBox->setCurrentIndex(index);
}
- }
update_cdburn_status(tr("Information"), NORMAL_MESSAGE);
@@ -611,10 +670,10 @@
QString CDWritingDialog::get_device(int index)
{
- #if defined (Q_WS_MAC)
+#if defined (Q_WS_MAC)
return cdDeviceComboBox->currentText();
- #else
+#else
return cdDeviceComboBox->itemData(index).toString();
- #endif
+#endif
}
Index: CDWritingDialog.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/dialogs/CDWritingDialog.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- CDWritingDialog.h 21 Jan 2008 16:25:16 -0000 1.4
+++ CDWritingDialog.h 28 Jan 2008 15:55:27 -0000 1.5
@@ -76,6 +76,7 @@
int m_writingState;
int m_lastSheetExported;
bool m_wasClosed;
+ bool m_wodimAvailable;
int m_copyNumber;
QString get_device(int index);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src/traverso/dialogs CDWritingDialog.c...,
Remon Sijrier <=