コード例 #1
0
ファイル: actionfoldermodel.cpp プロジェクト: Camelek/qtmoko
void ComposeActionMessageSet::init()
{
    QTimer::singleShot(0,this,SLOT(delayedInit()));
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: muromec/qtopia-ezx
CameraMainWindow::CameraMainWindow(QWidget *parent, Qt::WFlags f):
    QMainWindow(parent, f),
    settings( NULL ),
    settingsDialog( NULL ),
    psize( -1 ),
    vsize( -1 ),
    snapRequest( 0 ),
    videoOnSecondary(false),
    m_photoContentSet( QContentSet::Asynchronous ),
    m_photoModel( 0 ),
    m_contextMenuActive(false)
{
    setWindowTitle(tr("Camera"));

    QtopiaApplication::setPowerConstraint(QtopiaApplication::DisableLightOff);

    picfile = Qtopia::tempDir() + "image.jpg";
    QWidget *cameraWidget = new QWidget(this);
    camera = new Ui::CameraBase();
    camera->setupUi(cameraWidget);
    setCentralWidget(cameraWidget);

    camcat = QLatin1String("Camera");
    // Ensure the Camera system categoy exists
    QCategoryManager catman("Documents");
    // For new code a more unique id should be used instead of using the untranslated text
    // eg. ensureSystemCategory("com.mycompany.myapp.mycategory", "My Category");
    catman.ensureSystemCategory(camcat, camcat);

    new CameraService(this);

    camera->photo->setFocus();

    connect(camera->photo, SIGNAL(clicked()), this, SLOT(takePhoto()));
    connect(camera->video, SIGNAL(clicked()), this, SLOT(toggleVideo()));

    refocusTimer = new QTimer(this);
    refocusTimer->setSingleShot(true);
    connect(refocusTimer, SIGNAL(timeout()), this, SLOT(takePhotoNow()));

    thumb[0] = camera->thumb1;
    thumb[1] = camera->thumb2;
    thumb[2] = camera->thumb3;
    thumb[3] = camera->thumb4;
    thumb[4] = camera->thumb5;
    cur_thumb = -1;

    // Load the allowable sizes from the camera hardware.
    photo_size = camera->videocaptureview->photoSizes();
    video_size = camera->videocaptureview->videoSizes();

    namehint=0;
    recording = false;


    if ( !video_supported ) {
        // Room for longer text
        camera->photo->setText(tr("Take Photo"));
        camera->video->setEnabled(false);
        camera->video->hide();
    }

    if (QApplication::desktop()->numScreens() > 1) {
        // We have a secondary display - watch for the clamshell open/close
        clamshellVsi = new QValueSpaceItem("/Hardware/Devices/ClamshellOpen", this);
        connect(clamshellVsi, SIGNAL(contentsChanged()), this, SLOT(clamshellChanged()));
        if (!clamshellVsi->value().toBool()) {
            videoToScreen(1);
        }
    }

    m_photoContentSet.setCriteria( QContentFilter( QContent::Document )
            & QContentFilter::category( QLatin1String( "Camera" ) )
            & QContentFilter::mimeType( QLatin1String( "image/jpeg" ) ) );

    m_photoContentSet.setSortCriteria( QContentSortCriteria( QContentSortCriteria::LastUpdated, Qt::DescendingOrder ) );

    m_photoModel = new QContentSetModel( &m_photoContentSet, this );
    connect( m_photoModel, SIGNAL(updateFinished()), this, SLOT(loadThumbs()) );

    m_wait = new QWaitWidget(camera->videocaptureview);
    m_iswaiting = false;
    QTimer::singleShot(1, this, SLOT(delayedInit()));
    m_currzoom = 0;
    zoomActive = false;

    zoomTimer.setSingleShot(true);
    zoomTimer.setInterval(5000);
    connect(&zoomTimer, SIGNAL(timeout()), this, SLOT(hideZoom()));
}