-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '385-fix-start-camera-in-qr-code-scanning-view-5-9-4' in…
…to 'development' Resolve "Fix start camera in QR-code scanning view 5.9.4" Closes #385 See merge request qt-team/graft-mobile-client!368
- Loading branch information
Showing
19 changed files
with
408 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "ioscamerapermission.h" | ||
#include "permissiondelegate.h" | ||
|
||
#include <QTimerEvent> | ||
|
||
IOSCameraPermission::IOSCameraPermission(QObject *parent) | ||
: QObject(parent) | ||
,mTimer(-1) | ||
{ | ||
} | ||
|
||
bool IOSCameraPermission::hasPermission() | ||
{ | ||
if (!PermissionDelegate::isCameraAuthorised()) | ||
{ | ||
mTimer = startTimer(50); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
void IOSCameraPermission::stopTimer() | ||
{ | ||
killTimer(mTimer); | ||
} | ||
|
||
void IOSCameraPermission::timerEvent(QTimerEvent *event) | ||
{ | ||
if ((event->timerId() == mTimer) && PermissionDelegate::isCameraAuthorised()) | ||
{ | ||
emit hasCameraPermission(true); | ||
stopTimer(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef IOSCAMERAPERMISSION_H | ||
#define IOSCAMERAPERMISSION_H | ||
|
||
#include <QObject> | ||
|
||
class IOSCameraPermission : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit IOSCameraPermission(QObject *parent = nullptr); | ||
|
||
Q_INVOKABLE bool hasPermission(); | ||
Q_INVOKABLE void stopTimer(); | ||
|
||
signals: | ||
void hasCameraPermission(bool result); | ||
|
||
protected: | ||
void timerEvent(QTimerEvent *event) override; | ||
|
||
private: | ||
int mTimer; | ||
}; | ||
|
||
#endif // IOSCAMERAPERMISSION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef PERMISSIONDELEGATE_H | ||
#define PERMISSIONDELEGATE_H | ||
|
||
class PermissionDelegate | ||
{ | ||
public: | ||
static bool isCameraAuthorised(); | ||
}; | ||
#endif // PERMISSIONDELEGATE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "permissiondelegate.h" | ||
|
||
#include <AVFoundation/AVFoundation.h> | ||
#include <UIKit/UIKit.h> | ||
|
||
bool PermissionDelegate::isCameraAuthorised() | ||
{ | ||
NSString *mediaType = AVMediaTypeVideo; | ||
return [AVCaptureDevice authorizationStatusForMediaType:mediaType] == AVAuthorizationStatusAuthorized; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,6 @@ BaseScreen { | |
"SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.") | ||
} | ||
} | ||
|
||
} | ||
|
||
WideActionButton { | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.