Esempio n. 1
0
QWidget* CGrabControls::createControls()
{
	grabButton = new QToolButton;
	grabButton->setText(tr("Grab"));
	grabButton->setIcon(QIcon(":UiFrame/images/grabbutton.png"));
	grabButton->setIconSize(QSize(50, 50));
	grabButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
	
	connect(grabButton, SIGNAL(clicked()),this, SLOT(grabFb()));

	directoryLabel = new QLineEdit;
	directoryLabel->setReadOnly(true);
#ifdef WIN32
	directoryLabel->setText(QString("C:/GrabPic"));
#else
	directoryLabel->setText(QString("/opt/GrabPic"));
#endif
	directoryLabel->setMinimumWidth(150);
	QPushButton *directoryButton = new QPushButton(tr("Grab &Save as.."));
	connect(directoryButton, SIGNAL(clicked()),this, SLOT(setExistingDirectory()));

	QGridLayout *grabLayout = new QGridLayout;
	grabLayout->addWidget(directoryButton,0,0);
	grabLayout->addWidget(directoryLabel,0,1);
	grabLayout->addWidget(grabButton, 1, 0);
	grabLayout->setRowStretch(2, 10);
	grabLayout->setColumnStretch(2, 10);

	QWidget *grabrWidget = new QWidget;
	grabrWidget->setLayout(grabLayout);

	return grabrWidget;
}
Esempio n. 2
0
int Dialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setInteger(); break;
        case 1: setDouble(); break;
        case 2: setItem(); break;
        case 3: setText(); break;
        case 4: setColor(); break;
        case 5: setFont(); break;
        case 6: setExistingDirectory(); break;
        case 7: setOpenFileName(); break;
        case 8: setOpenFileNames(); break;
        case 9: setSaveFileName(); break;
        case 10: criticalMessage(); break;
        case 11: informationMessage(); break;
        case 12: questionMessage(); break;
        case 13: warningMessage(); break;
        case 14: errorMessage(); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
Esempio n. 3
0
Dialogs::Dialogs(QWidget *parent)
   : QWidget(parent), ui(new Ui::Dialogs)
{
   ui->setupUi(this);
   setWindowTitle(tr("Standard Dialogs"));

   ui->native_checkBox->setChecked(true);

   // signals
   connect(ui->integer_pushButton,    SIGNAL(clicked()), this, SLOT(setInteger()));
   connect(ui->double_pushButton,     SIGNAL(clicked()), this, SLOT(setDouble()));
   connect(ui->getItem_pushButton,    SIGNAL(clicked()), this, SLOT(setItem()));
   connect(ui->getText_pushButton,    SIGNAL(clicked()), this, SLOT(setText()));

   connect(ui->dir_pushButton,        SIGNAL(clicked()), this, SLOT(setExistingDirectory()));
   connect(ui->openFile_pushButton,   SIGNAL(clicked()), this, SLOT(setOpenFileName()));
   connect(ui->openFiles_pushButton,  SIGNAL(clicked()), this, SLOT(setOpenFileNames()));

   connect(ui->critical_pushButton,   SIGNAL(clicked()), this, SLOT(criticalMessage()));
   connect(ui->info_pushButton,       SIGNAL(clicked()), this, SLOT(informationMessage()));
   connect(ui->quest_pushButton,      SIGNAL(clicked()), this, SLOT(questionMessage()));
   connect(ui->warn_pushButton,       SIGNAL(clicked()), this, SLOT(warningMessage()));
   connect(ui->error_pushButton,      SIGNAL(clicked()), this, SLOT(errorMessage()));
}
Esempio n. 4
0
void widget::setAddFileFolder()
{
    setExistingDirectory();

}
Esempio n. 5
0
Exporter::Exporter(QString mode, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Exporter)
{
    ui->setupUi(this);


    dialogMode = mode;


    if(dialogMode == "export"){
        setWindowTitle(tr("Export Dialog"));
    }
        if(dialogMode == "print"){
        setWindowTitle(tr("Print Dialog"));
ui->stackedWidget->setCurrentIndex(0);
}

    ui->fileNameLineEdit->setValidator(new QRegExpValidator(QRegExp("[^\x002F\\\\:\x002A\?\x0022<>|]+"), ui->fileNameLineEdit));

    //    directoryLabel = new QLabel(tr("Path : "));


    connect(ui->pathButton, SIGNAL(clicked()), this, SLOT(setExistingDirectory()));


    if(dialogMode == "print")
    {
        ui->fileNameLabel->hide();
        ui->fileNameLineEdit->hide();
        ui->pathButton->hide();
        ui->pathLineEdit->hide();
        ui->fileTypeLabel->hide();
        ui->fileTypeComboBox->hide();
    }





    if(dialogMode == "print")
    {
        QWidget *widget = new QWidget;
        QVBoxLayout *layout = new QVBoxLayout;
        layout->addWidget(ui->buttonBox);
        widget->setLayout(layout);
        delete widget;

        QDialogButtonBox *box = new QDialogButtonBox(this);
        QPushButton *cancelBut = box->addButton(QDialogButtonBox::Cancel);
        QPushButton *acceptBut = box->addButton(tr("Print"), QDialogButtonBox::AcceptRole);
    ui->verticalLayout->addWidget(box);


    connect(cancelBut, SIGNAL(clicked()), this, SLOT(close()));
    connect(acceptBut, SIGNAL(clicked()), this, SLOT(accept()));


    }

    connect(ui->previewPushButton, SIGNAL(clicked()), this, SLOT(seePreview()));



}
Esempio n. 6
0
Dialog::Dialog(QWidget *parent)
    : QWidget(parent)
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    QToolBox *toolbox = new QToolBox;
    mainLayout->addWidget(toolbox);

    errorMessageDialog = new QErrorMessage(this);

    int frameStyle = QFrame::Sunken | QFrame::Panel;

    integerLabel = new QLabel;
    integerLabel->setFrameStyle(frameStyle);
    QPushButton *integerButton =
            new QPushButton(tr("QInputDialog::get&Int()"));

    doubleLabel = new QLabel;
    doubleLabel->setFrameStyle(frameStyle);
    QPushButton *doubleButton =
            new QPushButton(tr("QInputDialog::get&Double()"));

    itemLabel = new QLabel;
    itemLabel->setFrameStyle(frameStyle);
    QPushButton *itemButton = new QPushButton(tr("QInputDialog::getIte&m()"));

    textLabel = new QLabel;
    textLabel->setFrameStyle(frameStyle);
    QPushButton *textButton = new QPushButton(tr("QInputDialog::get&Text()"));

    multiLineTextLabel = new QLabel;
    multiLineTextLabel->setFrameStyle(frameStyle);
    QPushButton *multiLineTextButton = new QPushButton(tr("QInputDialog::get&MultiLineText()"));

    colorLabel = new QLabel;
    colorLabel->setFrameStyle(frameStyle);
    QPushButton *colorButton = new QPushButton(tr("QColorDialog::get&Color()"));

    fontLabel = new QLabel;
    fontLabel->setFrameStyle(frameStyle);
    QPushButton *fontButton = new QPushButton(tr("QFontDialog::get&Font()"));

    directoryLabel = new QLabel;
    directoryLabel->setFrameStyle(frameStyle);
    QPushButton *directoryButton =
            new QPushButton(tr("QFileDialog::getE&xistingDirectory()"));

    openFileNameLabel = new QLabel;
    openFileNameLabel->setFrameStyle(frameStyle);
    QPushButton *openFileNameButton =
            new QPushButton(tr("QFileDialog::get&OpenFileName()"));

    openFileNamesLabel = new QLabel;
    openFileNamesLabel->setFrameStyle(frameStyle);
    QPushButton *openFileNamesButton =
            new QPushButton(tr("QFileDialog::&getOpenFileNames()"));

    saveFileNameLabel = new QLabel;
    saveFileNameLabel->setFrameStyle(frameStyle);
    QPushButton *saveFileNameButton =
            new QPushButton(tr("QFileDialog::get&SaveFileName()"));

    criticalLabel = new QLabel;
    criticalLabel->setFrameStyle(frameStyle);
    QPushButton *criticalButton =
            new QPushButton(tr("QMessageBox::critica&l()"));

    informationLabel = new QLabel;
    informationLabel->setFrameStyle(frameStyle);
    QPushButton *informationButton =
            new QPushButton(tr("QMessageBox::i&nformation()"));

    questionLabel = new QLabel;
    questionLabel->setFrameStyle(frameStyle);
    QPushButton *questionButton =
            new QPushButton(tr("QMessageBox::&question()"));

    warningLabel = new QLabel;
    warningLabel->setFrameStyle(frameStyle);
    QPushButton *warningButton = new QPushButton(tr("QMessageBox::&warning()"));

    errorLabel = new QLabel;
    errorLabel->setFrameStyle(frameStyle);
    QPushButton *errorButton =
            new QPushButton(tr("QErrorMessage::showM&essage()"));

    connect(integerButton, SIGNAL(clicked()), this, SLOT(setInteger()));
    connect(doubleButton, SIGNAL(clicked()), this, SLOT(setDouble()));
    connect(itemButton, SIGNAL(clicked()), this, SLOT(setItem()));
    connect(textButton, SIGNAL(clicked()), this, SLOT(setText()));
    connect(multiLineTextButton, SIGNAL(clicked()), this, SLOT(setMultiLineText()));
    connect(colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
    connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
    connect(directoryButton, SIGNAL(clicked()),
            this, SLOT(setExistingDirectory()));
    connect(openFileNameButton, SIGNAL(clicked()),
            this, SLOT(setOpenFileName()));
    connect(openFileNamesButton, SIGNAL(clicked()),
            this, SLOT(setOpenFileNames()));
    connect(saveFileNameButton, SIGNAL(clicked()),
            this, SLOT(setSaveFileName()));
    connect(criticalButton, SIGNAL(clicked()), this, SLOT(criticalMessage()));
    connect(informationButton, SIGNAL(clicked()),
            this, SLOT(informationMessage()));
    connect(questionButton, SIGNAL(clicked()), this, SLOT(questionMessage()));
    connect(warningButton, SIGNAL(clicked()), this, SLOT(warningMessage()));
    connect(errorButton, SIGNAL(clicked()), this, SLOT(errorMessage()));

    QWidget *page = new QWidget;
    QGridLayout *layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->setColumnMinimumWidth(1, 250);
    layout->addWidget(integerButton, 0, 0);
    layout->addWidget(integerLabel, 0, 1);
    layout->addWidget(doubleButton, 1, 0);
    layout->addWidget(doubleLabel, 1, 1);
    layout->addWidget(itemButton, 2, 0);
    layout->addWidget(itemLabel, 2, 1);
    layout->addWidget(textButton, 3, 0);
    layout->addWidget(textLabel, 3, 1);
    layout->addWidget(multiLineTextButton, 4, 0);
    layout->addWidget(multiLineTextLabel, 4, 1);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 5, 0);
    toolbox->addItem(page, tr("Input Dialogs"));

    const QString doNotUseNativeDialog = tr("Do not use native dialog");

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(colorButton, 0, 0);
    layout->addWidget(colorLabel, 0, 1);
    colorDialogOptionsWidget = new DialogOptionsWidget;
    colorDialogOptionsWidget->addCheckBox(doNotUseNativeDialog, QColorDialog::DontUseNativeDialog);
    colorDialogOptionsWidget->addCheckBox(tr("Show alpha channel") , QColorDialog::ShowAlphaChannel);
    colorDialogOptionsWidget->addCheckBox(tr("No buttons") , QColorDialog::NoButtons);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 1, 0);
    layout->addWidget(colorDialogOptionsWidget, 2, 0, 1 ,2);

    toolbox->addItem(page, tr("Color Dialog"));

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(fontButton, 0, 0);
    layout->addWidget(fontLabel, 0, 1);
    fontDialogOptionsWidget = new DialogOptionsWidget;
    fontDialogOptionsWidget->addCheckBox(doNotUseNativeDialog, QFontDialog::DontUseNativeDialog);
    fontDialogOptionsWidget->addCheckBox(tr("No buttons") , QFontDialog::NoButtons);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 1, 0);
    layout->addWidget(fontDialogOptionsWidget, 2, 0, 1 ,2);
    toolbox->addItem(page, tr("Font Dialog"));

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(directoryButton, 0, 0);
    layout->addWidget(directoryLabel, 0, 1);
    layout->addWidget(openFileNameButton, 1, 0);
    layout->addWidget(openFileNameLabel, 1, 1);
    layout->addWidget(openFileNamesButton, 2, 0);
    layout->addWidget(openFileNamesLabel, 2, 1);
    layout->addWidget(saveFileNameButton, 3, 0);
    layout->addWidget(saveFileNameLabel, 3, 1);
    fileDialogOptionsWidget = new DialogOptionsWidget;
    fileDialogOptionsWidget->addCheckBox(doNotUseNativeDialog, QFileDialog::DontUseNativeDialog);
    fileDialogOptionsWidget->addCheckBox(tr("Show directories only"), QFileDialog::ShowDirsOnly);
    fileDialogOptionsWidget->addCheckBox(tr("Do not resolve symlinks"), QFileDialog::DontResolveSymlinks);
    fileDialogOptionsWidget->addCheckBox(tr("Do not confirm overwrite"), QFileDialog::DontConfirmOverwrite);
    fileDialogOptionsWidget->addCheckBox(tr("Do not use sheet"), QFileDialog::DontUseSheet);
    fileDialogOptionsWidget->addCheckBox(tr("Readonly"), QFileDialog::ReadOnly);
    fileDialogOptionsWidget->addCheckBox(tr("Hide name filter details"), QFileDialog::HideNameFilterDetails);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 4, 0);
    layout->addWidget(fileDialogOptionsWidget, 5, 0, 1 ,2);
    toolbox->addItem(page, tr("File Dialogs"));

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(criticalButton, 0, 0);
    layout->addWidget(criticalLabel, 0, 1);
    layout->addWidget(informationButton, 1, 0);
    layout->addWidget(informationLabel, 1, 1);
    layout->addWidget(questionButton, 2, 0);
    layout->addWidget(questionLabel, 2, 1);
    layout->addWidget(warningButton, 3, 0);
    layout->addWidget(warningLabel, 3, 1);
    layout->addWidget(errorButton, 4, 0);
    layout->addWidget(errorLabel, 4, 1);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 5, 0);
    toolbox->addItem(page, tr("Message Boxes"));

    setWindowTitle(tr("Standard Dialogs"));
}
Esempio n. 7
0
Dialog::Dialog(QWidget *parent)
	: QDialog(parent)
{
	errorMessageDialog = new QErrorMessage(this);
	
	int frameStyle = QFrame::Sunken | QFrame::Panel;
	
	integerLabel = new QLabel;
	integerLabel->setFrameStyle(frameStyle);
	
	QPushButton *integerButton = new QPushButton(tr("QInputDialog::get&Integer()"));
	
	doubleLabel = new QLabel;
	doubleLabel->setFrameStyle(frameStyle);
	QPushButton *doubleButton = new QPushButton(tr("QInputDialog::get&Double()"));
	
	itemLabel = new QLabel;
	itemLabel->setFrameStyle(frameStyle);
	QPushButton *itemButton = new QPushButton(tr("QInputDialog::getIte&m()"));
	
	textLabel = new QLabel;
	textLabel->setFrameStyle(frameStyle);
	QPushButton *textButton = new QPushButton(tr("QInputDialog::get&Text()"));
	
	colorLabel= new QLabel;
	colorLabel->setFrameStyle(frameStyle);
	QPushButton *colorButton = new QPushButton(tr("QColorDialog::get&Color()"));
	
	fontLabel = new QLabel;
	fontLabel->setFrameStyle(frameStyle);
	QPushButton *fontButton = new QPushButton(tr("QFontDialog::get&Font()"));
	
	directoryLabel = new QLabel;
	directoryLabel->setFrameStyle(frameStyle);
	QPushButton *directoryButton = new QPushButton(tr("QFileDialog::getE&xistingDirectory()"));

	openFileNameLabel = new QLabel;
	openFileNameLabel->setFrameStyle(frameStyle);
	QPushButton *openFileNameButton = new QPushButton(tr("QFileDialog::get&OpenFileName()"));
	
	openFileNamesLabel = new QLabel;
	openFileNamesLabel->setFrameStyle(frameStyle);
	QPushButton *openFileNamesButton = new QPushButton(tr("QFileDialog::&getOpenFileNames()"));

	
	saveFileNameLabel = new QLabel;
	saveFileNameLabel->setFrameStyle(frameStyle);
	QPushButton *saveFileNameButton = new QPushButton(tr("QFileDialog::get&SaveFileName()"));

	criticalLabel = new QLabel;
	criticalLabel->setFrameStyle(frameStyle);
	QPushButton *criticalButton = new QPushButton(tr("QMessageBox::critica&l()"));

	informationLabel = new QLabel;
	informationLabel->setFrameStyle(frameStyle);
	QPushButton *informationButton = new QPushButton(tr("QMessageBox::i&nformation()"));

	questionLabel = new QLabel;
	questionLabel->setFrameStyle(frameStyle);
	QPushButton *questionButton = new QPushButton(tr("QMessageBox::&question()"));

	warningLabel = new QLabel;
	warningLabel->setFrameStyle(frameStyle);
	QPushButton *warningButton = new QPushButton(tr("QMessageBox::&warning()"));
	
	errorLabel = new QLabel;
	errorLabel->setFrameStyle(frameStyle);
	QPushButton *errorButton = new QPushButton(tr("QMessageBox::&error()"));
	
	connect(integerButton, SIGNAL(clicked()), this, SLOT(setInteger()));
	connect(doubleButton, SIGNAL(clicked()), this, SLOT(setDouble()));
	connect(itemButton, SIGNAL(clicked()), this, SLOT(setItem()));
	connect(textButton, SIGNAL(clicked()), this, SLOT(setText()));
	connect(colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
	connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
	connect(directoryButton, SIGNAL(clicked()), this, SLOT(setExistingDirectory()));
	connect(openFileNameButton, SIGNAL(clicked()), this, SLOT(setOpenFileName()));
	connect(openFileNamesButton, SIGNAL(clicked()), this, SLOT(setOpenFileNames()));
	connect(saveFileNameButton, SIGNAL(clicked()), this, SLOT(setSaveFileName()));
	connect(criticalButton, SIGNAL(clicked()), this, SLOT(criticalMessage()));
	connect(informationButton, SIGNAL(clicked()), this, SLOT(informationMessage()));
	connect(questionButton, SIGNAL(clicked()), this, SLOT(questionMessage()));
	connect(warningButton, SIGNAL(clicked()), this, SLOT(warningMessage()));
	connect(errorButton, SIGNAL(clicked()), this, SLOT(errorMessage()));

	native = new QCheckBox(this);
	native->setText("Use native file dialog");
	native->setChecked(true);

#ifndef Q_WS_WIN
#ifndef Q_OS_MAC

	native->hide();
#endif
#endif

	QGridLayout *layout = new QGridLayout;
	layout->setColumnStretch(1, 1);		
	layout->setColumnMinimumWidth(1, 250);
	layout->addWidget(integerButton, 0, 0);
	layout->addWidget(integerLabel, 0, 1);
	layout->addWidget(doubleButton, 1, 0);
	layout->addWidget(doubleLabel, 1, 1);
	layout->addWidget(itemButton, 2, 0);
	layout->addWidget(itemLabel, 2, 1);
	layout->addWidget(textButton, 3, 0);
	layout->addWidget(textLabel, 3, 1);
	layout->addWidget(colorButton, 4, 0);
	layout->addWidget(colorLabel, 4, 1);
	layout->addWidget(fontButton, 5, 0);
	layout->addWidget(fontLabel, 5, 1);
	layout->addWidget(directoryButton, 6, 0);
	layout->addWidget(directoryLabel, 6, 1);
	layout->addWidget(openFileNameButton, 7, 0);
	layout->addWidget(openFileNameLabel, 7, 1);
	layout->addWidget(openFileNamesButton, 8, 0);
	layout->addWidget(openFileNamesLabel, 8, 1);
	layout->addWidget(saveFileNameButton, 9, 0);
	layout->addWidget(saveFileNameLabel, 9, 1);
	layout->addWidget(criticalButton, 10, 0);
	layout->addWidget(criticalLabel, 10, 1);
	layout->addWidget(informationButton, 11, 0);
	layout->addWidget(informationLabel, 11, 1);
	layout->addWidget(questionButton, 12, 0);
	layout->addWidget(questionLabel, 12, 1);
	layout->addWidget(warningButton, 13, 0);
	layout->addWidget(warningLabel, 13, 1);
	layout->addWidget(errorButton, 14, 0);
	layout->addWidget(errorLabel, 14, 1);

	layout->addWidget(native, 15, 0);

	setLayout(layout);

	setWindowTitle("Standard Dialogs");
}
Esempio n. 8
0
int QPhotorec::photorec(alloc_data_t *list_search_space)
{
  pstatus_t ind_stop=PSTATUS_OK;
  const unsigned int blocksize_is_known=params->blocksize;
  params_reset(params, options);
  /* make the first recup_dir */
  params->dir_num=photorec_mkdir(params->recup_dir, params->dir_num);
  for(params->pass=0; params->status!=STATUS_QUIT; params->pass++)
  {
    timer->start();
    switch(params->status)
    {
      case STATUS_UNFORMAT:
	/* FIXME */
	break;
      case STATUS_FIND_OFFSET:
	{
	  uint64_t start_offset=0;
	  if(blocksize_is_known>0)
	  {
	    ind_stop=PSTATUS_OK;
	    if(!td_list_empty(&list_search_space->list))
	      start_offset=(td_list_entry(list_search_space->list.next, alloc_data_t, list))->start % params->blocksize;
	  }
	  else
	  {
	    ind_stop=photorec_find_blocksize(list_search_space);
	    params->blocksize=find_blocksize(list_search_space, params->disk->sector_size, &start_offset);
	  }
	  update_blocksize(params->blocksize, list_search_space, start_offset);
	}
	break;  
      case STATUS_EXT2_ON_BF:
      case STATUS_EXT2_OFF_BF:
	/* FIXME */
	break;
      default:
	ind_stop=photorec_aux(list_search_space);
	break;
    }
    timer->stop();
    qphotorec_search_updateUI();
    session_save(list_search_space, params, options);
    switch(ind_stop)
    {
      case PSTATUS_EACCES:
	{
	  int ret=QMessageBox::warning(this,
	      tr("QPhotoRec: Failed to create file!"),
	      tr("Failed to create file! Please choose another destination"),
	      QMessageBox::Ok| QMessageBox::Cancel, QMessageBox::Ok);
	  if(ret==QMessageBox::Cancel)
	  {
	    params->status=STATUS_QUIT;
	  }
	  else
	  {
	    setExistingDirectory();
	    free(params->recup_dir);
	    QByteArray byteArray = (directoryLabel->text() + "/" + DEFAULT_RECUP_DIR).toUtf8();
	    params->recup_dir=strdup(byteArray.constData());
	    params->dir_num=photorec_mkdir(params->recup_dir, params->dir_num);
	  }
	}
	break;
      case PSTATUS_ENOSPC:
	{
	  int ret=QMessageBox::warning(this,
	      tr("QPhotoRec: Not enough space!"),
	      tr("There is not enough space left! Please free disk space and/or choose another destination"),
	      QMessageBox::Ok| QMessageBox::Cancel, QMessageBox::Ok);
	  if(ret==QMessageBox::Cancel)
	  {
	    params->status=STATUS_QUIT;
	  }
	  else
	  {
	    setExistingDirectory();
	    free(params->recup_dir);
	    QByteArray byteArray = (directoryLabel->text() + "/" + DEFAULT_RECUP_DIR).toUtf8();
	    params->recup_dir=strdup(byteArray.constData());
	    params->dir_num=photorec_mkdir(params->recup_dir, params->dir_num);
	  }
	}
break;
      case PSTATUS_OK:
	status_inc(params, options);
	if(params->status==STATUS_QUIT)
	  unlink("photorec.ses");
	break;
      case PSTATUS_STOP:
	params->status=STATUS_QUIT;
	break;
    }
    update_stats(params->file_stats, list_search_space);
    qphotorec_search_updateUI();
  }
  free_search_space(list_search_space);
  free_header_check();
  free(params->file_stats);
  params->file_stats=NULL;
  return 0;
}
Esempio n. 9
0
void QPhotorec::setupUI()
{
  QWidget *t_copy = copyright(this);
  QLabel *t_free_soft = new QLabel(tr("PhotoRec is free software, and comes with ABSOLUTELY NO WARRANTY."));
  QLabel *t_select = new QLabel(tr("Please select a media to recover from"));

  HDDlistWidget = new QComboBox();
  HDDlistWidget->setToolTip(tr("Disk capacity must be correctly detected for a successful recovery.\n"
      "If a disk listed above has an incorrect size, check HD jumper settings and BIOS\n"
      "detection, and install the latest OS patches and disk drivers.")
  );

  QStringList oLabel;
  oLabel.append("");
  oLabel.append(tr("Flags"));
  oLabel.append(tr("Type"));
  oLabel.append(tr("File System"));
  oLabel.append(tr("Size"));
  oLabel.append(tr("Label"));

  PartListWidget= new QTableWidget();
  PartListWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
  PartListWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
  PartListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
  PartListWidget->verticalHeader()->hide();
  PartListWidget->setShowGrid(false);
  PartListWidget->setColumnCount( 6 );
  PartListWidget->setHorizontalHeaderLabels( oLabel );
  PartListWidget_updateUI();

  QGroupBox *groupBox1;
  QGroupBox *groupBox2;

  groupBox1 = new QGroupBox(tr("File System type"));
  qextRadioButton = new QRadioButton(tr("ext2/ext3/ext4 filesystem"));
  qfatRadioButton = new QRadioButton(tr("FAT/NTFS/HFS+/ReiserFS/..."));
  qfatRadioButton->setChecked(true);

  groupBox2 = new QGroupBox();
  qfreeRadioButton = new QRadioButton(tr("Free: Scan for file from unallocated space only"));
  qwholeRadioButton = new QRadioButton(tr("Whole: Extract files from whole partition"));
  qfreeRadioButton->setEnabled(false);
  qwholeRadioButton->setChecked(true);


  QVBoxLayout *groupBox1Layout = new QVBoxLayout;
  QVBoxLayout *groupBox2Layout = new QVBoxLayout;

  groupBox1Layout->addWidget(qextRadioButton);
  groupBox1Layout->addWidget(qfatRadioButton);
  groupBox1->setLayout(groupBox1Layout);

  groupBox2Layout->addWidget(qfreeRadioButton);
  groupBox2Layout->addWidget(qwholeRadioButton);
  groupBox2->setLayout(groupBox2Layout);

  QWidget *groupBox= new QWidget();
  QHBoxLayout *groupBoxLayout = new QHBoxLayout;
  groupBoxLayout->addWidget(groupBox1);
  groupBoxLayout->addWidget(groupBox2);
  groupBox->setLayout(groupBoxLayout);


  QLabel *dstWidget= new QLabel(tr("Please select a destination to save the recovered files to."));
  directoryLabel=new QLineEdit("");
  QPushButton *dst_button = new QPushButton(
      QIcon::fromTheme("folder", QIcon(":res/gnome/folder.png")),
      tr("&Browse"));

  QWidget *dst_widget= new QWidget(this);
  QWidget *dst_widget2= new QWidget(this);

  QHBoxLayout *dst_widgetLayout2 = new QHBoxLayout;
  dst_widgetLayout2->addWidget(directoryLabel);
  dst_widgetLayout2->addWidget(dst_button);
  dst_widget2->setLayout(dst_widgetLayout2);

  QVBoxLayout *dst_widgetLayout = new QVBoxLayout;
  dst_widgetLayout->addWidget(dstWidget);
  dst_widgetLayout->addWidget(dst_widget2);
  dst_widget->setLayout(dst_widgetLayout);
  

  button_search = new QPushButton(QIcon::fromTheme("go-next", QIcon(":res/gnome/go-next.png")), "&Search");
  button_search->setEnabled(false);
  QPushButton *button_quit= new QPushButton(QIcon::fromTheme("application-exit", QIcon(":res/gnome/application-exit.png")), "&Quit");
  QPushButton *button_about= new QPushButton(QIcon::fromTheme("help-about", QIcon(":res/gnome/help-about.png")), "&About");
  QPushButton *button_formats= new QPushButton(QIcon::fromTheme("image-x-generic.png", QIcon(":res/gnome/image-x-generic.png")),tr("&File Formats"));

  QWidget *B_widget = new QWidget(this);
  QHBoxLayout *B_layout = new QHBoxLayout(B_widget);
  B_layout->addWidget(button_about);
  B_layout->addWidget(button_formats);
  B_layout->addWidget(button_search);
  B_layout->addWidget(button_quit);
  B_widget->setLayout(B_layout);

  clearWidgets();
//  QLayout *mainLayout = this->layout();
  delete this->layout();
  QVBoxLayout *mainLayout = new QVBoxLayout();
  mainLayout->addWidget(t_copy);
  mainLayout->addWidget(t_free_soft);
  mainLayout->addWidget(t_select);
  mainLayout->addWidget(HDDlistWidget);
  mainLayout->addWidget(PartListWidget);
  mainLayout->addWidget(groupBox);
  mainLayout->addWidget(dst_widget);
  mainLayout->addWidget(B_widget);
  this->setLayout(mainLayout);

  HDDlistWidget_updateUI();
  buttons_updateUI();

  connect(button_about, SIGNAL(clicked()), this, SLOT(qphotorec_about()) );
  connect(button_formats, SIGNAL(clicked()), this, SLOT(qphotorec_formats()) );
  connect(button_search, SIGNAL(clicked()), this, SLOT(qphotorec_search()) );
  connect(button_quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
  connect(HDDlistWidget, SIGNAL(activated(int)),this,SLOT(disk_changed(int)));
  connect(PartListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(partition_selected()));
  connect(dst_button, SIGNAL(clicked()), this, SLOT(setExistingDirectory()));
  connect(directoryLabel, SIGNAL(editingFinished()), this, SLOT(buttons_updateUI()));
}