QPhotoRec: add raw files as source

This commit is contained in:
Christophe Grenier 2013-06-06 19:26:41 +02:00
parent ff449ff6f2
commit 63729d0662
5 changed files with 38 additions and 6 deletions

View file

@ -16,6 +16,7 @@ EXTRA_DIST = AUTHORS COPYING ChangeLog INFO INSTALL NEWS README THANKS compile.s
src/gnome/folder.png \
src/gnome/go-next.png \
src/gnome/go-previous.png \
src/gnome/application-x-cd-image.png \
win/readme.txt win/photorec_win.exe.manifest win/qphotorec_win.exe.manifest \
win/testdisk_win.exe.manifest \
Android.mk jni/Android.mk

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -137,6 +137,21 @@ void QPhotorec::setExistingDirectory()
}
}
void QPhotorec::newSourceFile()
{
const int testdisk_mode=TESTDISK_O_RDONLY|TESTDISK_O_READAHEAD_32K;
QString filename = QFileDialog::getOpenFileName(this,
"Please select a raw file",
"",
"Raw Files (*.dd *.raw *.img)");
if(!filename.isEmpty())
{
QByteArray filenameArray= (filename).toUtf8();
list_disk=insert_new_disk(list_disk, file_test_availability(filenameArray.constData(), options->verbose, testdisk_mode));
HDDlistWidget_updateUI();
}
}
void QPhotorec::partition_selected()
{
if(PartListWidget->selectedItems().count()<=0)
@ -266,6 +281,10 @@ void QPhotorec::disk_changed(int index)
return;
}
}
if(i==index)
{
newSourceFile();
}
}
QWidget *QPhotorec::copyright(QWidget * qwparent)
@ -353,14 +372,10 @@ void QPhotorec::buttons_updateUI()
button_search->setEnabled(!directoryLabel->text().isEmpty());
}
void QPhotorec::setupUI()
void QPhotorec::HDDlistWidget_updateUI()
{
list_disk_t *element_disk;
QWidget *t_copy = copyright(this);
QLabel *t_free_soft = new QLabel("PhotoRec is free software, and\ncomes with ABSOLUTELY NO WARRANTY.");
QLabel *t_select = new QLabel("Please select a media to recover from");
HDDlistWidget = new QComboBox();
HDDlistWidget->clear();
for(element_disk=list_disk;element_disk!=NULL;element_disk=element_disk->next)
{
disk_t *disk=element_disk->disk;
@ -368,6 +383,18 @@ void QPhotorec::setupUI()
QIcon::fromTheme("drive-harddisk", QIcon(":res/gnome/drive-harddisk.png")),
disk->description_short(disk));
}
HDDlistWidget->addItem(
QIcon::fromTheme("application-x-cd-image", QIcon(":res/gnome/application-x-cd-image.png")),
"Add a raw disk image...");
}
void QPhotorec::setupUI()
{
QWidget *t_copy = copyright(this);
QLabel *t_free_soft = new QLabel("PhotoRec is free software, and\ncomes with ABSOLUTELY NO WARRANTY.");
QLabel *t_select = new QLabel("Please select a media to recover from");
HDDlistWidget = new QComboBox();
HDDlistWidget->setToolTip("Disk capacity must be correctly detected for a successful recovery.\n"
"If a disk listed above has incorrect size, check HD jumper settings, BIOS\n"
"detection, and install the latest OS patches and disk drivers."
@ -468,6 +495,7 @@ void QPhotorec::setupUI()
mainLayout->addWidget(B_widget);
this->setLayout(mainLayout);
HDDlistWidget_updateUI();
buttons_updateUI();
connect(button_search, SIGNAL(clicked()), this, SLOT(qphotorec_search()) );

View file

@ -41,6 +41,7 @@ class QPhotorec: public QWidget
void disk_changed(int index);
void partition_selected();
void setExistingDirectory();
void newSourceFile();
void qphotorec_search();
void buttons_updateUI();
/* Recovery UI */
@ -53,6 +54,7 @@ class QPhotorec: public QWidget
QWidget *copyright(QWidget * qwparent = 0);
QTableWidgetItem *offset_to_item(const disk_t *disk, const uint64_t offset);
void PartListWidget_updateUI();
void HDDlistWidget_updateUI();
int photorec(alloc_data_t *list_search_space);
pstatus_t photorec_find_blocksize(alloc_data_t *list_search_space);
pstatus_t photorec_aux(alloc_data_t *list_search_space);

View file

@ -6,5 +6,6 @@
<file>gnome/folder.png</file>
<file>gnome/go-next.png</file>
<file>gnome/go-previous.png</file>
<file>gnome/application-x-cd-image.png</file>
</qresource>
</RCC>