Index: sources/device/DeviceController.cpp =================================================================== diff -u -r3caffb866d4c84ac6282dcd36fc2d8f7cad9584d -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 3caffb866d4c84ac6282dcd36fc2d8f7cad9584d) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -85,19 +85,9 @@ */ void DeviceController::quit() { - // disabled coco begin validated: Application termination is not correctly done in coco!!! - // it has been tested and works perfectly fine in normal run. - quitThread(); // validated + quitThread(); } -// disabled coco end -void DeviceController::onRemoveLogs(bool vInProgress) -{ - // disabled coco begin validated: The log in progress requires user interaction - // it has been tested and works fine in normal run. - _pauseSpaceCheck = vInProgress; -} -// disabled coco end /*! * \brief DeviceController::initConnections @@ -108,8 +98,6 @@ { connect(&_ApplicationController , SIGNAL(didUSBDriveUmount()), this , SLOT( onUSBDriveUmount())); - connect(&_Logger , SIGNAL(didRemoveLogs(bool)), - this , SLOT( onRemoveLogs(bool))); connect(this , SIGNAL(didScreenshot(const QImage &, const QString &)), this , SLOT( onScreenshot(const QImage &, const QString &))); @@ -199,13 +187,13 @@ */ bool DeviceController::driveSpaceCheck(const QString &vPath, qint64 &vTotalBytes, qint64 &vAvailableBytes, bool *vIsReadOnly) { - // disabled coco begin validated: Needed User Interaction to make the device not ready so tested manually - bool isReadOnly = true; - bool isMounted = FileHandler::isMounted(vPath, &isReadOnly); + QStorageInfo storage(vPath); + bool isReady = storage.isReady (); + bool isReadOnly = storage.isReadOnly(); + bool isMounted = FileHandler::isMounted(vPath); + if ( vIsReadOnly ) *vIsReadOnly = isReadOnly; - QStorageInfo storage(vPath); - bool isReady = storage.isReady(); if ( isReady ) { vTotalBytes = storage.bytesTotal(); vAvailableBytes = storage.bytesAvailable(); @@ -218,7 +206,6 @@ } return isReady; } -// disabled coco end /*! * \brief DeviceController::timerEvent @@ -264,11 +251,11 @@ void DeviceController::sdcardSpaceCheck() { static bool mInitialized = false; - // Old Info ; // Current info - static bool mOIsReady ; bool mCIsReady ; - static bool mOIsReadOnly; bool mCIsReadOnly ; - static qint64 mOTotal ; qint64 mCTotal ; - static qint64 mOAvailable ; qint64 mCAvailable ; + // Old Info ; // Current info + static bool mOIsReady = false; bool mCIsReady = false; + static bool mOIsReadOnly = false; bool mCIsReadOnly = false; + static qint64 mOTotal = 0; qint64 mCTotal = 0; + static qint64 mOAvailable = 0; qint64 mCAvailable = 0; quint8 mPercent = 0; @@ -277,15 +264,15 @@ mOIsReadOnly = mCIsReadOnly; mOIsReady = mCIsReady; mInitialized = true; + //DEBUG:0: qDebug() << " ~~~~~~~~~~ " << __FUNCTION__ << mInitialized << mCIsReady << mOIsReady << mCIsReadOnly << mOIsReadOnly; emit didSDCardStateChange(mCIsReady, mCIsReadOnly); - } - if (! mCIsReady ) { - mOIsReady = mCIsReady; - mOTotal = 0; - mOAvailable = 0; - emit didSDCardSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); - return; + if (! mCIsReady ) { + mOTotal = 0; + mOAvailable = 0; + emit didSDCardSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); + return; + } } mPercent = mCTotal ? ((100 * mCAvailable) / mCTotal) : 0; @@ -296,17 +283,13 @@ } /// DEBUG: qDebug() << Storage::SDCard_Base_Path_Name << mCIsReady << mOTotal << mCTotal << (mOTotal == mCTotal) << mOAvailable << mCAvailable << (mOAvailable == mCAvailable) << mPercent << mCIsReadOnly; - if (mOTotal == mCTotal && - mOAvailable == mCAvailable) { - return; + if (mOTotal != mCTotal && mOAvailable != mCAvailable ) { + mOTotal = mCTotal ; + mOAvailable = mCAvailable ; + emit didSDCardSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); + /// DEBUG: qDebug() << Storage::SDCard_Base_Path_Name << mCIsReady << mCTotal << mCAvailable << mPercent ; } - mOIsReady = mCIsReady ; - mOTotal = mCTotal ; - mOAvailable = mCAvailable ; - if (_pauseSpaceCheck) return; //TODO: may not be required, but needs a lot of time consuming testing. - emit didSDCardSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); - /// DEBUG: qDebug() << Storage::SDCard_Base_Path_Name << mCIsReady << mCTotal << mCAvailable << mPercent ; } /*! @@ -316,11 +299,11 @@ void DeviceController::usbSpaceCheck() { static bool mInitialized = false; - // Old Info ; // Current info - static bool mOIsReady ; bool mCIsReady ; - static bool mOIsReadOnly; bool mCIsReadOnly ; - static qint64 mOTotal ; qint64 mCTotal ; - static qint64 mOAvailable ; qint64 mCAvailable ; + // Old Info ; // Current info + static bool mOIsReady = false; bool mCIsReady = false; + static bool mOIsReadOnly = false; bool mCIsReadOnly = false; + static qint64 mOTotal = 0; qint64 mCTotal = 0; + static qint64 mOAvailable = 0; qint64 mCAvailable = 0; quint8 mPercent = 0; @@ -333,26 +316,27 @@ mOIsReady = mCIsReady; mInitialized = true; emit didUSBStateChange(mCIsReady, mCIsReadOnly); - } - if (! mCIsReady ) { - mOIsReady = mCIsReady; - mOTotal = 0; - mOAvailable = 0; - emit didUSBSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); - return; + if (! mCIsReady ) { + mOTotal = 0; + mOAvailable = 0; + emit didUSBSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); + return; + } } mPercent = mCTotal ? ((100 * mCAvailable) / mCTotal) : 0; - if (mOTotal == mCTotal && - mOAvailable == mCAvailable) { - return; + if (mOTotal != mCTotal || mOAvailable != mCAvailable) { + mOTotal = mCTotal ; + mOAvailable = mCAvailable ; + emit didUSBSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); } - mOIsReady = mCIsReady ; - mOTotal = mCTotal ; - mOAvailable = mCAvailable ; - emit didUSBSpaceChange(mCIsReady, mCTotal, mCAvailable, mPercent); + // DEBUG: qDebug() << "DeviceController::usbSpaceCheck" + // << mCIsReady + // << mCIsReadOnly + // << mCTotal + // << mCAvailable ; } @@ -374,11 +358,11 @@ case EBUSY: error = tr("%1 - Device or resource busy (%2)").arg(errno).arg(vDevice); _mounted = true; - break; + break; default: error = tr("%1 - %2 (%3 , %4)").arg(errno).arg(strerror(errno)).arg(vDevice).arg(USB_Mount_Point); - break; + break; } if (error != lastError) {