@@ -52,8 +52,11 @@ const char* MythMediaDevice::MediaErrorStrings[] =
5252 " MEDIAERR_UNSUPPORTED"
5353};
5454
55- MythMediaDevice::MythMediaDevice (QObject* par, const char * DevicePath,
56- bool SuperMount, bool AllowEject)
55+ QEvent::Type MediaEvent::kEventType =
56+ (QEvent::Type) QEvent::registerEventType();
57+
58+ MythMediaDevice::MythMediaDevice (QObject* par, const char * DevicePath,
59+ bool SuperMount, bool AllowEject)
5760 : QObject(par)
5861{
5962 m_DevicePath = DevicePath;
@@ -71,10 +74,10 @@ bool MythMediaDevice::openDevice()
7174 // Sanity check
7275 if (isDeviceOpen ())
7376 return true ;
74-
77+
7578 QByteArray dev = m_DevicePath.toLocal8Bit ();
7679 m_DeviceHandle = open (dev.constData (), O_RDONLY | O_NONBLOCK);
77-
80+
7881 return isDeviceOpen ();
7982}
8083
@@ -86,13 +89,13 @@ bool MythMediaDevice::closeDevice()
8689
8790 int ret = close (m_DeviceHandle);
8891 m_DeviceHandle = -1 ;
89-
92+
9093 return (ret != -1 ) ? true : false ;
9194}
9295
93- bool MythMediaDevice::isDeviceOpen () const
94- {
95- return (m_DeviceHandle >= 0 ) ? true : false ;
96+ bool MythMediaDevice::isDeviceOpen () const
97+ {
98+ return (m_DeviceHandle >= 0 ) ? true : false ;
9699}
97100
98101bool MythMediaDevice::performMountCmd (bool DoMount)
@@ -107,7 +110,7 @@ bool MythMediaDevice::performMountCmd(bool DoMount)
107110 if (isDeviceOpen ())
108111 closeDevice ();
109112
110- if (!m_SuperMount)
113+ if (!m_SuperMount)
111114 {
112115 QString MountCommand;
113116
@@ -121,7 +124,7 @@ bool MythMediaDevice::performMountCmd(bool DoMount)
121124 MountCommand = QString (" %1 %2" )
122125 .arg ((DoMount) ? PATHTO_MOUNT : PATHTO_UNMOUNT)
123126 .arg (m_DevicePath);
124-
127+
125128 VERBOSE (VB_MEDIA, QString (" Executing '%1'" ).arg (MountCommand));
126129 if (myth_system (MountCommand, kMSDontBlockInputDevs ) != GENERIC_EXIT_OK)
127130 {
@@ -148,12 +151,12 @@ bool MythMediaDevice::performMountCmd(bool DoMount)
148151 else
149152 VERBOSE (VB_GENERAL, QString (" Failed to mount %1." )
150153 .arg (m_DevicePath));
151- }
152- else
154+ }
155+ else
153156 {
154157 VERBOSE (VB_MEDIA, " Disk inserted on a supermount device" );
155158 // If it's a super mount then the OS will handle mounting / unmounting.
156- // We just need to give derived classes a chance to perform their
159+ // We just need to give derived classes a chance to perform their
157160 // mount / unmount logic.
158161 if (DoMount)
159162 {
@@ -307,11 +310,11 @@ void MythMediaDevice::setSpeed(int speed)
307310 .arg (speed).arg (m_DevicePath));
308311}
309312
310- MediaError MythMediaDevice::lock ()
311- {
313+ MediaError MythMediaDevice::lock ()
314+ {
312315 // We just open the device here, which may or may not do the trick,
313316 // derived classes can do more...
314- if (openDevice ())
317+ if (openDevice ())
315318 {
316319 m_Locked = true ;
317320 return MEDIAERR_OK;
@@ -321,9 +324,9 @@ MediaError MythMediaDevice::lock()
321324}
322325
323326MediaError MythMediaDevice::unlock ()
324- {
327+ {
325328 m_Locked = false ;
326-
329+
327330 return MEDIAERR_OK;
328331}
329332
@@ -419,9 +422,9 @@ MediaStatus MythMediaDevice::setStatus( MediaStatus NewStatus, bool CloseIt )
419422
420423 // If the status is changed we need to take some actions
421424 // depending on the old and new status.
422- if (NewStatus != OldStatus)
425+ if (NewStatus != OldStatus)
423426 {
424- switch (NewStatus)
427+ switch (NewStatus)
425428 {
426429 // the disk is not / should not be mounted.
427430 case MEDIASTAT_ERROR:
@@ -438,7 +441,7 @@ MediaStatus MythMediaDevice::setStatus( MediaStatus NewStatus, bool CloseIt )
438441 // get rid of the compiler warning...
439442 break ;
440443 }
441-
444+
442445 // Don't fire off transitions to / from unknown states
443446 if (m_Status != MEDIASTAT_UNKNOWN && OldStatus != MEDIASTAT_UNKNOWN)
444447 emit statusChanged (OldStatus, this );
0 commit comments