コード例 #1
0
SeExprEdStringControl::SeExprEdStringControl(int id,SeExprEdStringEditable* editable)
    :SeExprEdControl(id,editable,false),_stringEditable(editable)
{
    // make line edit
    _edit=new QLineEdit();
    _edit->setFixedHeight(20);
    connect(_edit,SIGNAL(textChanged(const QString&)),SLOT(textChanged(const QString&)));
    // make a button if we are a file or directory
    if(_stringEditable->type=="file" || _stringEditable->type=="directory"){
        QPushButton* button=new QPushButton();
        button->setFixedSize(20,20);

        hbox->addWidget(_edit,3);
        hbox->addWidget(button,1);
        if(_stringEditable->type=="directory"){
            connect(button,SIGNAL(clicked()),SLOT(directoryBrowse()));
            button->setIcon(QIcon(QPixmap(directoryXPM)));
        } else if(_stringEditable->type=="file"){
            connect(button,SIGNAL(clicked()),SLOT(fileBrowse()));
            button->setIcon(QIcon(QPixmap(fileXPM)));
        }
        
    }else{
        hbox->addWidget(_edit,3);
    }
    // update controls
    updateControl();
}
コード例 #2
0
ファイル: sout_widgets.cpp プロジェクト: AsamQi/vlc
/* FileDest Box */
FileDestBox::FileDestBox( QWidget *_parent, intf_thread_t * _p_intf ) : VirtualDestBox( _parent )
{
    p_intf = _p_intf;

    QPushButton *fileSelectButton;
    QGridLayout *layout = new QGridLayout( this );

    QLabel *fileOutput = new QLabel(
         qtr( "This module writes the transcoded stream to a file."), this );
    layout->addWidget(fileOutput, 0, 0, 1, -1);

    QLabel *fileLabel = new QLabel( qtr( "Filename"), this );
    layout->addWidget(fileLabel, 1, 0, 1, 1);

    fileEdit = new QLineEdit(this);
    layout->addWidget(fileEdit, 1, 4, 1, 1);

    fileSelectButton = new QPushButton( qtr( "Browse..." ), this );
    QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
    fileSelectButton->setSizePolicy(sizePolicy);

    layout->addWidget(fileSelectButton, 1, 5, 1, 1);
    CT( fileEdit );
    BUTTONACT( fileSelectButton, fileBrowse() );
}
コード例 #3
0
ファイル: replay.c プロジェクト: doolin/ntdda
int
handleResultsViewReplay(HWND hwMain, LPARAM lParam, GRAPHICS * g)
{
   OPENFILENAME ofn;

   LPCSTR szFilter[] = {"Replay files (*.replay)\0*.replay\0All files (*.*)\0*.*\0\0"};

   dda_display_info(filepath.vfile);

   fileBrowse(hwMain, &ofn, szFilter, filepath.vpath, filepath.vfile, "replay");
                   
                    
         
                   
                        
       if( !GetOpenFileName(&ofn) ) 
       {
          strcpy(filepath.vpath, filepath.oldpath);
          return 0;  // user pressed cancel.
       }    
       else // Replay something.
       {
         /* Set up to call the replay function with an arbitrary
          * replay file.  It is not currently known whether 
          * the replay file has enough information to do the 
          * replay without first invoking the appropriate file 
          * containing the geometry information.  Eliminate all
          * this if possible.
          */
          strcpy(filepath.replayfile, ofn.lpstrFileTitle);
          strcpy(filepath.rootname, strtok(ofn.lpstrFileTitle, "."));
          strcpy(filepath.gfile, filepath.rootname);
          strcat(filepath.gfile, ".geo");

          dda_display_info(filepath.gfile);

          SendMessage(hwMain, WM_COMMAND, GEOM_APPLY, lParam);

          replay_analysis(hwMain, g, filepath.replayfile);

       }  /* Close if-else  */

  /* FIXME: Check the return value */
   return 0;

}  /*  close handleResultsViewReplay() */
コード例 #4
0
ファイル: convert.cpp プロジェクト: BtbN/vlc
ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf,
                              const QString& inputMRL )
              : QVLCDialog( parent, _p_intf )
{
    setWindowTitle( qtr( "Convert" ) );
    setWindowRole( "vlc-convert" );

    QGridLayout *mainLayout = new QGridLayout( this );
    SoutInputBox *inputBox = new SoutInputBox( this );
    inputBox->setMRL( inputMRL );
    mainLayout->addWidget( inputBox, 0, 0, 1, -1  );

    /**
     * Destination
     **/
    QGroupBox *destBox = new QGroupBox( qtr( "Destination" ) );
    QGridLayout *destLayout = new QGridLayout( destBox );

    QLabel *destLabel = new QLabel( qtr( "Destination file:" ) );
    destLayout->addWidget( destLabel, 0, 0);

    fileLine = new QLineEdit;
    fileLine->setMinimumWidth( 300 );
    fileLine->setFocus( Qt::ActiveWindowFocusReason );
    destLabel->setBuddy( fileLine );

    QPushButton *fileSelectButton = new QPushButton( qtr( "Browse" ) );
    destLayout->addWidget( fileLine, 0, 1 );
    destLayout->addWidget( fileSelectButton, 0, 2);
    BUTTONACT( fileSelectButton, fileBrowse() );

    mainLayout->addWidget( destBox, 3, 0, 1, -1  );


    /* Profile Editor */
    QGroupBox *settingBox = new QGroupBox( qtr( "Settings" ) );
    QGridLayout *settingLayout = new QGridLayout( settingBox );

    QRadioButton *convertRadio = new QRadioButton( qtr( "Convert" ) );
    dumpRadio = new QRadioButton( qtr( "Dump raw input" ) );
    QButtonGroup *buttonGroup = new QButtonGroup(this);
    buttonGroup->addButton( convertRadio );
    buttonGroup->addButton( dumpRadio );
    convertRadio->setChecked( true );

    settingLayout->addWidget( convertRadio, 1, 0 );

    QWidget *convertPanel = new QWidget( this );
    QVBoxLayout *convertLayout = new QVBoxLayout( convertPanel );

    displayBox = new QCheckBox( qtr( "Display the output" ) );
    displayBox->setToolTip( qtr( "This display the resulting media, but can "
                               "slow things down." ) );
    convertLayout->addWidget( displayBox );

    deinterBox = new QCheckBox( qtr( "Deinterlace" ) );
    convertLayout->addWidget( deinterBox );

    profile = new VLCProfileSelector( this );
    convertLayout->addWidget( profile );

    settingLayout->addWidget( convertPanel, 2, 0 );

    settingLayout->addWidget( dumpRadio, 5, 0 );

    mainLayout->addWidget( settingBox, 1, 0, 1, -1  );

    /* Buttons */
    QPushButton *okButton = new QPushButton( qtr( "&Start" ) );
    QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ) );
    QDialogButtonBox *buttonBox = new QDialogButtonBox;

    okButton->setDefault( true );
    buttonBox->addButton( okButton, QDialogButtonBox::AcceptRole );
    buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );

    mainLayout->addWidget( buttonBox, 5, 3 );

    BUTTONACT(okButton,close());
    BUTTONACT(cancelButton,cancel());

    CONNECT( convertRadio, toggled(bool), convertPanel, setEnabled(bool) );
    CONNECT(profile, optionsChanged(), this, setDestinationFileExtension());
    CONNECT(fileLine, editingFinished(), this, setDestinationFileExtension());
}
コード例 #5
0
ファイル: main.cpp プロジェクト: jinghuaguo/Logger1
MainWindow::MainWindow(Logger * logger)
 : logger(logger),
   depthImage(640, 480, QImage::Format_RGB888),
   rgbImage(640, 480, QImage::Format_RGB888),
   recording(false),
   lastDrawn(-1)
{
    this->setMaximumSize(1280, 600);
    this->setMinimumSize(1280, 600);

    QVBoxLayout * wrapperLayout = new QVBoxLayout;

    QHBoxLayout * mainLayout = new QHBoxLayout;
    QHBoxLayout * fileLayout = new QHBoxLayout;
    QHBoxLayout * buttonLayout = new QHBoxLayout;

    wrapperLayout->addLayout(mainLayout);

    depthLabel = new QLabel(this);
    depthLabel->setPixmap(QPixmap::fromImage(depthImage));
    mainLayout->addWidget(depthLabel);

    imageLabel = new QLabel(this);
    imageLabel->setPixmap(QPixmap::fromImage(rgbImage));
    mainLayout->addWidget(imageLabel);

    wrapperLayout->addLayout(fileLayout);

    QLabel * logLabel = new QLabel("Log file: ", this);
    logLabel->setMaximumWidth(logLabel->fontMetrics().boundingRect(logLabel->text()).width());
    fileLayout->addWidget(logLabel);

    logFile = new QLabel(this);
    logFile->setTextInteractionFlags(Qt::TextSelectableByMouse);
    logFile->setStyleSheet("border: 1px solid grey");
    fileLayout->addWidget(logFile);

    browseButton = new QPushButton("Browse", this);
    browseButton->setMaximumWidth(browseButton->fontMetrics().boundingRect(browseButton->text()).width() + 10);
    connect(browseButton, SIGNAL(clicked()), this, SLOT(fileBrowse()));
    fileLayout->addWidget(browseButton);

    dateNameButton = new QPushButton("Date filename", this);
    dateNameButton->setMaximumWidth(dateNameButton->fontMetrics().boundingRect(dateNameButton->text()).width() + 10);
    connect(dateNameButton, SIGNAL(clicked()), this, SLOT(dateFilename()));
    fileLayout->addWidget(dateNameButton);

    wrapperLayout->addLayout(buttonLayout);

    startStop = new QPushButton("Record", this);
    connect(startStop, SIGNAL(clicked()), this, SLOT(recordToggle()));
    buttonLayout->addWidget(startStop);

    QPushButton * quitButton = new QPushButton("Quit", this);
    connect(quitButton, SIGNAL(clicked()), this, SLOT(quit()));
    buttonLayout->addWidget(quitButton);

    setLayout(wrapperLayout);

    startStop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    quitButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QFont currentFont = startStop->font();
    currentFont.setPointSize(currentFont.pointSize() + 8);

    startStop->setFont(currentFont);
    quitButton->setFont(currentFont);

    painter = new QPainter(&depthImage);

    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(timerCallback()));
    timer->start(15);

#ifdef unix
    char * homeDir = getenv("HOME");
    logFolder.append(homeDir);
    logFolder.append("/");
#else
    char * homeDrive = getenv("HOMEDRIVE");
    char * homeDir = getenv("HOMEPATH");
    logFolder.append(homeDrive);
    logFolder.append("\\");
    logFolder.append(homeDir);
    logFolder.append("\\");
#endif

    logFolder.append("Kinect_Logs");

    boost::filesystem::path p(logFolder.c_str());
    boost::filesystem::create_directory(p);

    logFile->setText(QString::fromStdString(getNextFilename()));
}
コード例 #6
0
ファイル: main.cpp プロジェクト: caomw/Logger2
MainWindow::MainWindow(int width, int height, int fps, bool tcp)
 : logger(0),
   depthImage(width, height, QImage::Format_RGB888),
   rgbImage(width, height, QImage::Format_RGB888),
   recording(false),
   lastDrawn(-1),
   width(width),
   height(height),
   fps(fps),
   tcp(tcp), 
   comms(tcp ? new Communicator : 0)
{
    this->setMaximumSize(width * 2, height + 160);
    this->setMinimumSize(width * 2, height + 160);

    QVBoxLayout * wrapperLayout = new QVBoxLayout;

    QHBoxLayout * mainLayout = new QHBoxLayout;
    QHBoxLayout * fileLayout = new QHBoxLayout;
    QHBoxLayout * optionLayout = new QHBoxLayout;
    QHBoxLayout * buttonLayout = new QHBoxLayout;

    wrapperLayout->addLayout(mainLayout);

    depthLabel = new QLabel(this);
    depthLabel->setPixmap(QPixmap::fromImage(depthImage));
    mainLayout->addWidget(depthLabel);

    imageLabel = new QLabel(this);
    imageLabel->setPixmap(QPixmap::fromImage(rgbImage));
    mainLayout->addWidget(imageLabel);

    wrapperLayout->addLayout(fileLayout);
    wrapperLayout->addLayout(optionLayout);

    QLabel * logLabel = new QLabel("Log file: ", this);
    logLabel->setMaximumWidth(logLabel->fontMetrics().boundingRect(logLabel->text()).width());
    fileLayout->addWidget(logLabel);

    logFile = new QLabel(this);
    logFile->setTextInteractionFlags(Qt::TextSelectableByMouse);
    logFile->setStyleSheet("border: 1px solid grey");
    fileLayout->addWidget(logFile);

#ifdef __APPLE__
    int cushion = 25;
#else
    int cushion = 10;
#endif

    browseButton = new QPushButton("Browse", this);
    browseButton->setMaximumWidth(browseButton->fontMetrics().boundingRect(browseButton->text()).width() + cushion);
    connect(browseButton, SIGNAL(clicked()), this, SLOT(fileBrowse()));
    fileLayout->addWidget(browseButton);

    dateNameButton = new QPushButton("Date filename", this);
    dateNameButton->setMaximumWidth(dateNameButton->fontMetrics().boundingRect(dateNameButton->text()).width() + cushion);
    connect(dateNameButton, SIGNAL(clicked()), this, SLOT(dateFilename()));
    fileLayout->addWidget(dateNameButton);

    autoExposure = new QCheckBox("Auto Exposure");
    autoExposure->setChecked(false);

    autoWhiteBalance = new QCheckBox("Auto White Balance");
    autoWhiteBalance->setChecked(false);

    compressed = new QCheckBox("Compressed");
    compressed->setChecked(true);

    memoryRecord = new QCheckBox("Record to RAM");
    memoryRecord->setChecked(false);

    memoryStatus = new QLabel("");

    connect(autoExposure, SIGNAL(stateChanged(int)), this, SLOT(setExposure()));
    connect(autoWhiteBalance, SIGNAL(stateChanged(int)), this, SLOT(setWhiteBalance()));
    connect(compressed, SIGNAL(released()), this, SLOT(setCompressed()));
    connect(memoryRecord, SIGNAL(stateChanged(int)), this, SLOT(setMemoryRecord()));

    optionLayout->addWidget(autoExposure);
    optionLayout->addWidget(autoWhiteBalance);
    optionLayout->addWidget(compressed);
    optionLayout->addWidget(memoryRecord);
    optionLayout->addWidget(memoryStatus);

    wrapperLayout->addLayout(buttonLayout);

    startStop = new QPushButton(tcp ? "Stream && Record" : "Record", this);
    connect(startStop, SIGNAL(clicked()), this, SLOT(recordToggle()));
    buttonLayout->addWidget(startStop);

    QPushButton * quitButton = new QPushButton("Quit", this);
    connect(quitButton, SIGNAL(clicked()), this, SLOT(quit()));
    buttonLayout->addWidget(quitButton);

    setLayout(wrapperLayout);

    startStop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    quitButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QFont currentFont = startStop->font();
    currentFont.setPointSize(currentFont.pointSize() + 8);

    startStop->setFont(currentFont);
    quitButton->setFont(currentFont);

    painter = new QPainter(&depthImage);

    painter->setPen(Qt::green);
    painter->setFont(QFont("Arial", 30));
    painter->drawText(10, 50, "Attempting to start OpenNI2...");
    depthLabel->setPixmap(QPixmap::fromImage(depthImage));

#ifndef OS_WINDOWS
    char * homeDir = getenv("HOME");
    logFolder.append(homeDir);
    logFolder.append("/");
#else
    char * homeDrive = getenv("HOMEDRIVE");
    char * homeDir = getenv("HOMEPATH");
    logFolder.append(homeDrive);
    logFolder.append("\\");
    logFolder.append(homeDir);
    logFolder.append("\\");
#endif

    logFolder.append("Kinect_Logs");

    boost::filesystem::path p(logFolder.c_str());
    boost::filesystem::create_directory(p);

    logFile->setText(QString::fromStdString(getNextFilename()));

    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(timerCallback()));
    timer->start(15);
}