summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/autodetection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/base/autodetection.cpp')
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp39
1 files changed, 36 insertions, 3 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index fa2fe63cb8..de3765ffb1 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -38,6 +38,7 @@ bool Autodetection::detect()
38 m_device = ""; 38 m_device = "";
39 m_mountpoint = ""; 39 m_mountpoint = "";
40 m_errdev = ""; 40 m_errdev = "";
41 m_usberr = "";
41 42
42 detectUsb(); 43 detectUsb();
43 44
@@ -146,7 +147,8 @@ bool Autodetection::detect()
146 // if the found ipod is a macpod also notice it as device with problem. 147 // if the found ipod is a macpod also notice it as device with problem.
147 if(ipod.macpod) 148 if(ipod.macpod)
148 m_errdev = ipod.targetname; 149 m_errdev = ipod.targetname;
149 m_device = ipod.targetname; 150 else
151 m_device = ipod.targetname;
150 // since resolveMountPoint is doing exact matches we need to select 152 // since resolveMountPoint is doing exact matches we need to select
151 // the correct partition. 153 // the correct partition.
152 QString mp(ipod.diskname); 154 QString mp(ipod.diskname);
@@ -218,8 +220,8 @@ bool Autodetection::detectUsb()
218 return true; 220 return true;
219 } 221 }
220 if(usberror.contains(attached.at(i))) { 222 if(usberror.contains(attached.at(i))) {
221 m_errdev = usberror.value(attached.at(i)).at(0); 223 m_usberr = usberror.value(attached.at(i)).at(0);
222 qDebug() << "[USB] detected problem with player" << m_errdev; 224 qDebug() << "[USB] detected problem with player" << m_usberr;
223 return true; 225 return true;
224 } 226 }
225 QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0')); 227 QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0'));
@@ -233,6 +235,37 @@ bool Autodetection::detectUsb()
233} 235}
234 236
235 237
238QList<struct Autodetection::Detected> Autodetection::detected(void)
239{
240 struct Detected d;
241
242 m_detected.clear();
243 if(!m_device.isEmpty()) {
244 d.device = m_device;
245 d.mountpoint = m_mountpoint;
246 d.status = PlayerOk;
247 m_detected.append(d);
248 }
249 else if(!m_errdev.isEmpty()) {
250 d.device = m_errdev;
251 d.status = PlayerWrongFilesystem;
252 m_detected.append(d);
253 }
254 else if(!m_usberr.isEmpty()) {
255 d.device = m_usberr;
256 d.status = PlayerMtpMode;
257 m_detected.append(d);
258 }
259 else if(!m_incompat.isEmpty()) {
260 d.device = m_incompat;
261 d.status = PlayerIncompatible;
262 m_detected.append(d);
263 }
264
265 return m_detected;
266}
267
268
236bool Autodetection::detectAjbrec(QString root) 269bool Autodetection::detectAjbrec(QString root)
237{ 270{
238 QFile f(root + "/ajbrec.ajz"); 271 QFile f(root + "/ajbrec.ajz");