开发者

Meego 1.2 Harmattan and QCamera application

开发者 https://www.devze.com 2023-04-02 03:38 出处:网络
Is there any way to work with camera with QCamera class in Nokia N9 (Meego 1.2 Harmattan) or I should use another one?

Is there any way to work with camera with QCamera class in Nokia N9 (Meego 1.2 Harmattan) or I should use another one?

Here's my problem: simple application that works fine on Nokia C6-01 (Symbian Anna) doesn't do anything useful on N9.

Here're code snipets:

testmobile.pro

<...>
CONFIG += mobility
MOBILITY += multimedia
LIBS += -lQtMultimediaKit
<...>

mainwindow.h

class MainWindow : public QWidget
{
    Q_OBJECT
    <...>
    private:
        QCamera* camera_;
        QGraphicsView *view;
        QGraphicsVideoItem *videoItem;
        QGraphicsScene *scene;
    <...>
}

mainwindow.cpp

MainWindow::MainWindow(QWidget *parent)
: QWidget(parent)
{
<...>
    camera_ = new QCamera;
    view = new QGraphicsView(this);
    scene = new QGraphicsScene(view);
    videoItem = new QGraphicsVideoItem;
    view->setSce开发者_运维技巧ne(scene);
    scene->addItem(videoItem);

    QVBoxLayout *lay = new QVBoxLayout(this);
    lay->addWidget(view);
    this->setLayout(lay);
    view->show();
    camera_->setViewfinder(videoItem);

    camera_->start();
}

<...>

So after MainWindow object is constructed and shown we'll se a simple viewfinder on Nokia C6-01 and black screen on Nokia N9.

Any ideas?


I found solution! It was security problem. As I found - Meego has analogue of "capabilities" of Symbian. It's called AEGIS security tokens. So, to request a permission to work with camera (or any other) you should add your_application_name.agis file into the "qtc_packaging/debian_harmattan" folder of your project. In my case this file consisted of:

<aegis>
    <request>
        <credential name="GRP::video"/>
        <credential name="GRP::pulse-access"/>
        <for path="/opt/testmobile/bin/testmobile"/>
   </request>
</aegis>

So permissons are defined in the "name" property of "credential" tag and "for path" tag defines package to perform these permissions with.

More information can be found here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号