|
@@ -2,115 +2,63 @@
|
|
|
|
|
|
#include <qvariant.h>
|
|
|
#include <qpushbutton.h>
|
|
|
-#include <q3buttongroup.h>
|
|
|
#include <qradiobutton.h>
|
|
|
#include <qcheckbox.h>
|
|
|
#include <qlabel.h>
|
|
|
#include <qlineedit.h>
|
|
|
#include <qlayout.h>
|
|
|
#include <qtooltip.h>
|
|
|
-#include <q3whatsthis.h>
|
|
|
#include <qcombobox.h>
|
|
|
-//Added by qt3to4:
|
|
|
-#include <Q3HBoxLayout>
|
|
|
-#include <Q3VBoxLayout>
|
|
|
+#include <QHBoxLayout>
|
|
|
+#include <QVBoxLayout>
|
|
|
+#include <QFileDialog>
|
|
|
|
|
|
namespace NICE {
|
|
|
|
|
|
CaptureWidget::CaptureWidget(QWidget* parent, const char* name, Qt::WFlags fl)
|
|
|
- : QWidget(parent, name, fl) {
|
|
|
- if (name == NULL) {
|
|
|
- setName("CaptureWidget");
|
|
|
- }
|
|
|
- //setSizeGripEnabled( TRUE );
|
|
|
- CaptureWidgetLayout = new Q3VBoxLayout( this, 11, 6, "CaptureWidgetLayout");
|
|
|
+ : QWidget(parent, fl) {
|
|
|
+ CaptureWidgetLayout = new QVBoxLayout( this );
|
|
|
|
|
|
- layout15 = new Q3HBoxLayout( 0, 0, 6, "layout15");
|
|
|
+ layout15 = new QHBoxLayout( );
|
|
|
|
|
|
- textLabel1 = new QLabel( this, "textLabel1" );
|
|
|
+ textLabel1 = new QLabel( this );
|
|
|
layout15->addWidget( textLabel1 );
|
|
|
|
|
|
- editFormat = new QComboBox( true, this, "editFormat" );
|
|
|
- editFormat->insertItem("ppm");
|
|
|
- editFormat->insertItem("pgm");
|
|
|
- editFormat->insertItem("png");
|
|
|
- editFormat->insertItem("jpg");
|
|
|
- QToolTip::add(editFormat,
|
|
|
- "Format specified by filename extension (without dot)");
|
|
|
+ editFormat = new QComboBox( this );
|
|
|
+ editFormat->addItem("ppm");
|
|
|
+ editFormat->addItem("pgm");
|
|
|
+ editFormat->addItem("png");
|
|
|
+ editFormat->addItem("jpg");
|
|
|
+ editFormat->setToolTip("Format specified by filename extension (without dot)");
|
|
|
layout15->addWidget( editFormat );
|
|
|
|
|
|
- checkBuffered = new QCheckBox( this, "checkBuffered" );
|
|
|
- QToolTip::add(checkBuffered,
|
|
|
- "Buffer images in memory and write after capturing (stop)");
|
|
|
+ checkBuffered = new QCheckBox( this );
|
|
|
+ checkBuffered->setToolTip( "Buffer images in memory and write after capturing (stop)");
|
|
|
layout15->addWidget( checkBuffered );
|
|
|
|
|
|
- buttonStart = new QPushButton( this, "buttonStart" );
|
|
|
+ buttonStart = new QPushButton( this );
|
|
|
layout15->addWidget( buttonStart );
|
|
|
|
|
|
- buttonStop = new QPushButton( this, "buttonStop" );
|
|
|
+ buttonStop = new QPushButton( this );
|
|
|
buttonStop->setEnabled( FALSE );
|
|
|
layout15->addWidget( buttonStop );
|
|
|
|
|
|
- buttonCancel = new QPushButton( this, "buttonCancel" );
|
|
|
+ buttonCancel = new QPushButton( this );
|
|
|
buttonCancel->setAutoDefault( TRUE );
|
|
|
buttonCancel->hide();
|
|
|
layout15->addWidget( buttonCancel );
|
|
|
- //spacer5 = new QSpacerItem( 20, 44, QSizePolicy::Minimum, QSizePolicy::Expanding );
|
|
|
- //layout15->addItem( spacer5 );
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// layout15 = new QHBoxLayout( 0, 0, 6, "layout15");
|
|
|
-//
|
|
|
-// boxFormat = new QButtonGroup( this, "boxFormat" );
|
|
|
-// //boxFormat->setInsideMargin(0);
|
|
|
-// //boxFormat->setInsideSpacing(2);
|
|
|
-//
|
|
|
-// radioPPM = new QRadioButton( boxFormat, "radioPPM" );
|
|
|
-// radioPPM->setGeometry( QRect( 11, 26, 267, 25 ) );
|
|
|
-// radioPPM->setChecked( TRUE );
|
|
|
-//
|
|
|
-// radioJPG = new QRadioButton( boxFormat, "radioJPG" );
|
|
|
-// radioJPG->setGeometry( QRect( 11, 119, 267, 25 ) );
|
|
|
-//
|
|
|
-// radioPGM = new QRadioButton( boxFormat, "radioPGM" );
|
|
|
-// radioPGM->setGeometry( QRect( 11, 57, 267, 25 ) );
|
|
|
-//
|
|
|
-// radioPNG = new QRadioButton( boxFormat, "radioPNG" );
|
|
|
-// radioPNG->setGeometry( QRect( 11, 88, 267, 25 ) );
|
|
|
-// layout15->addWidget( boxFormat );
|
|
|
-//
|
|
|
-// layout14 = new QVBoxLayout( 0, 0, 6, "layout14");
|
|
|
-//
|
|
|
-// buttonStart = new QPushButton( this, "buttonStart" );
|
|
|
-// layout14->addWidget( buttonStart );
|
|
|
-//
|
|
|
-// buttonStop = new QPushButton( this, "buttonStop" );
|
|
|
-// buttonStop->setEnabled( FALSE );
|
|
|
-// layout14->addWidget( buttonStop );
|
|
|
-//
|
|
|
-// buttonCancel = new QPushButton( this, "buttonCancel" );
|
|
|
-// buttonCancel->setAutoDefault( TRUE );
|
|
|
-// buttonCancel->hide();
|
|
|
-// layout14->addWidget( buttonCancel );
|
|
|
-// spacer5 = new QSpacerItem( 20, 44, QSizePolicy::Minimum, QSizePolicy::Expanding );
|
|
|
-// layout14->addItem( spacer5 );
|
|
|
-//
|
|
|
-// checkBuffered = new QCheckBox( this, "checkBuffered" );
|
|
|
-// layout14->addWidget( checkBuffered );
|
|
|
-// layout15->addLayout( layout14 );
|
|
|
-
|
|
|
+
|
|
|
CaptureWidgetLayout->addLayout( layout15 );
|
|
|
|
|
|
- layout11 = new Q3HBoxLayout( 0, 0, 6, "layout11");
|
|
|
+ layout11 = new QHBoxLayout();
|
|
|
|
|
|
- textLabel2 = new QLabel( this, "textLabel2" );
|
|
|
+ textLabel2 = new QLabel( this );
|
|
|
layout11->addWidget( textLabel2 );
|
|
|
|
|
|
- editDirectory = new QLineEdit( this, "editDirectory" );
|
|
|
+ editDirectory = new QLineEdit( this );
|
|
|
layout11->addWidget( editDirectory );
|
|
|
|
|
|
- buttonBrowse = new QPushButton( this, "buttonBrowse" );
|
|
|
+ buttonBrowse = new QPushButton( this );
|
|
|
layout11->addWidget( buttonBrowse );
|
|
|
CaptureWidgetLayout->addLayout( layout11 );
|
|
|
|
|
@@ -124,11 +72,7 @@ CaptureWidget::CaptureWidget(QWidget* parent, const char* name, Qt::WFlags fl)
|
|
|
|
|
|
languageChange();
|
|
|
resize( QSize(542, 253).expandedTo(minimumSizeHint()) );
|
|
|
-// clearWState( WState_Polished ); // Qt4
|
|
|
|
|
|
- // signals and slots connections
|
|
|
-// connect(buttonCancel, SIGNAL(clicked()),
|
|
|
-// this, SLOT(buttonCancelClicked()));
|
|
|
connect(buttonCancel, SIGNAL(clicked()),
|
|
|
this, SIGNAL(cancelled()));
|
|
|
connect(buttonBrowse, SIGNAL(clicked()),
|
|
@@ -157,35 +101,31 @@ CaptureWidget::~CaptureWidget()
|
|
|
*/
|
|
|
void CaptureWidget::languageChange()
|
|
|
{
|
|
|
- setCaption( tr( "Capture Image Sequence" ) );
|
|
|
-// boxFormat->setTitle( tr( "Image file format" ) );
|
|
|
-// radioPPM->setText( tr( "PPM" ) );
|
|
|
-// radioJPG->setText( tr( "JPEG" ) );
|
|
|
-// radioPGM->setText( tr( "PGM (gray)" ) );
|
|
|
-// radioPNG->setText( tr( "PNG" ) );
|
|
|
+ setWindowTitle( tr( "Capture Image Sequence" ) );
|
|
|
buttonStart->setText( tr( "Start" ) );
|
|
|
buttonStop->setText( tr( "Stop" ) );
|
|
|
buttonCancel->setText( tr( "&Cancel" ) );
|
|
|
- buttonCancel->setAccel( QKeySequence( QString::null ) );
|
|
|
+ buttonCancel->setShortcut( QKeySequence( QString::null ) );
|
|
|
checkBuffered->setText( tr( "Buffer" ) );
|
|
|
textLabel1->setText( tr( "Format" ) );
|
|
|
textLabel2->setText( tr( "Directory" ) );
|
|
|
buttonBrowse->setText( tr( "..." ) );
|
|
|
}
|
|
|
|
|
|
-#include <q3filedialog.h>
|
|
|
-
|
|
|
void CaptureWidget::buttonBrowseClicked()
|
|
|
{
|
|
|
- Q3FileDialog dialog("",
|
|
|
- "",
|
|
|
- this,
|
|
|
- "Save to directory dialog");
|
|
|
- dialog.setCaption("Choose an output directory");
|
|
|
- dialog.setMode(Q3FileDialog::AnyFile); // QFileDialog::DirectoryOnly
|
|
|
+/*
|
|
|
+ QFileDialog dialog( this );
|
|
|
+ dialog.setWindowTitle("Choose an output directory");
|
|
|
+ dialog.setMode(QFileDialog::AnyFile);
|
|
|
if (dialog.exec() == QDialog::Accepted) {
|
|
|
editDirectory->setText(dialog.selectedFile());
|
|
|
}
|
|
|
+*/
|
|
|
+ QString directory = QFileDialog::getExistingDirectory(this);
|
|
|
+ if(!directory.isNull()) {
|
|
|
+ editDirectory->setText(directory);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void CaptureWidget::buttonStartClicked()
|
|
@@ -215,13 +155,12 @@ void CaptureWidget::enableGUI(bool enable)
|
|
|
editDirectory->setEnabled(value);
|
|
|
buttonBrowse->setEnabled(value);
|
|
|
checkBuffered->setEnabled(value);
|
|
|
-// boxFormat->setEnabled(value);
|
|
|
buttonStop->setEnabled(!value);
|
|
|
}
|
|
|
|
|
|
std::string CaptureWidget::directoryName()
|
|
|
{
|
|
|
- return std::string(editDirectory->text().local8Bit());
|
|
|
+ return std::string(editDirectory->text().toLocal8Bit());
|
|
|
}
|
|
|
|
|
|
bool CaptureWidget::isBuffered() {
|
|
@@ -231,18 +170,7 @@ bool CaptureWidget::isBuffered() {
|
|
|
|
|
|
std::string CaptureWidget::extensionName()
|
|
|
{
|
|
|
-// if (radioPPM->isChecked()) {
|
|
|
-// return ".ppm";
|
|
|
-// } else if (radioPGM->isChecked()) {
|
|
|
-// return ".pgm";
|
|
|
-// } else if (radioPNG->isChecked()) {
|
|
|
-// return ".png";
|
|
|
-// } else if (radioJPG->isChecked()) {
|
|
|
-// return ".jpg";
|
|
|
-// } else {
|
|
|
-// return ".ppm";
|
|
|
-// }
|
|
|
- return "." + std::string(editFormat->currentText().local8Bit());
|
|
|
+ return "." + std::string(editFormat->currentText().toLocal8Bit());
|
|
|
}
|
|
|
|
|
|
bool CaptureWidget::isCapturing() {
|
|
@@ -254,7 +182,13 @@ void CaptureWidget::setDirectoryName(const std::string& dir) {
|
|
|
}
|
|
|
|
|
|
void CaptureWidget::setExtensionName(const std::string& ext) {
|
|
|
- editFormat->setCurrentText(ext.c_str());
|
|
|
+ std::string extension_end = ext.substr(1);
|
|
|
+ int extension_index = editFormat->findText(extension_end.c_str());
|
|
|
+ if(extension_index > 0) {
|
|
|
+ editFormat->addItem(extension_end.c_str());
|
|
|
+ }
|
|
|
+
|
|
|
+ editFormat->setCurrentIndex(extension_index);
|
|
|
}
|
|
|
|
|
|
void CaptureWidget::setBuffered(bool buffer) {
|