Example #1
0
void CameraWidget::createActions() {

    //--- On menu selection, window will show with preferred size
    _windowSelectAction = new QAction(windowTitle(), this);
    connect(_windowSelectAction, SIGNAL(triggered()), this, SLOT(showNormal()));
    connect(_windowSelectAction, SIGNAL(triggered()), this, SLOT(setFocus()));

    //--- Video Actions
    if(!_videoController->getCamera()->getCameraType())
    {
        _loadVideoAction = new QAction(QIcon("Resources/imageGUI/icons/configure64.png"), "Load video", this);
        connect(_loadVideoAction, SIGNAL(triggered()), this, SLOT(loadVideo()));
    }

    _saveFrameAction = new QAction(QIcon("Resources/imageGUI/icons/configure64.png"), "Save frame as...", this);
    connect(_saveFrameAction, SIGNAL(triggered()), this, SLOT(saveCurrentFrame()));

    _recordVideoAction = new QAction(QIcon("Resources/imageGUI/icons/configure64.png"), "Record video... (Click inside image to stop!)", this);
    connect(_recordVideoAction, SIGNAL(triggered()), this, SLOT(recordVideo()));

    //--- Settings
    _cameraInfoAction = new QAction(QIcon("Resources/imageGUI/icons/configure64.png"),
                                    "Camera...", this);
    connect(_cameraInfoAction, SIGNAL(triggered()), this, SLOT(openCameraInformationDialog()));

    _POISettingsAction = new QAction(QIcon("Resources/imageGUI/icons/configure64.png"), "POI Algorithm...",
                                     this);

    _trackingSettingsAction = new QAction(QIcon("Resources/imageGUI/icons/configure64.png"),
                                          "Tracking Algorithm...", this);

    _clearPOIsAction = new QAction(QIcon("Resources/imageGUI/icons/configure64.png"), "Clear initialized POIs", this);
    connect(_clearPOIsAction, SIGNAL(triggered()), this, SLOT(clearInitializedPOIs()));

}
PhotoVideoWidget::PhotoVideoWidget( QWidget *parent /* = NULL */ )
    : QWidget( parent )
{
    g_photoImage    = NULL;

    photoPushButton = new QPushButton( tr( "拍照" ), this );
    videoPushButton = new QPushButton( tr( "录像" ), this );
    photoToolBar    = new QToolBar;
    photoToolBar->setStyleSheet(
       "border: 4px solid blue; border-radius: 5px"
       );

    for ( int i = 0; i < PHOTO_NUM; i++ )
    {
        photoLabel[i] = new QLabel;
        photoLabel[i]->setFixedSize( 163, 140 );
        photoLabel[i]->setStyleSheet( "border: 2px solid green; border-radius: 5px" );
        photoToolBar->addSeparator();
        photoToolBar->addWidget( photoLabel[i] );
    }
    photoToolBar->addSeparator();

    connect( photoPushButton, SIGNAL( clicked() ), this, SLOT( takePhoto() ) );
    connect( videoPushButton, SIGNAL( clicked() ), this, SLOT( recordVideo() ) );

    QHBoxLayout *topLayout = new QHBoxLayout;

    topLayout->addWidget( photoPushButton );
    topLayout->addWidget( videoPushButton );

    QVBoxLayout *mainLayout = new QVBoxLayout;

    mainLayout->addLayout( topLayout );
    mainLayout->addWidget( photoToolBar );

    setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
    setLayout( mainLayout );
}