summaryrefslogtreecommitdiffstats
path: root/src/qphotorec.cpp
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-01-14 22:19:06 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2009-01-14 22:19:06 +0100
commit9c2152f130fdad796792e75f9369b3bd2fc64b61 (patch)
treea2c7f8829121ad840d46680317ae9b773ce022e9 /src/qphotorec.cpp
parent1650fe5b8b6cea638c280df13605aea816718a00 (diff)
qphotorec: non-fonctionnal QT prototype of PhotoRec
Diffstat (limited to 'src/qphotorec.cpp')
-rw-r--r--src/qphotorec.cpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/qphotorec.cpp b/src/qphotorec.cpp
new file mode 100644
index 0000000..9e52391
--- /dev/null
+++ b/src/qphotorec.cpp
@@ -0,0 +1,88 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdarg.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h> /* unlink, ftruncate */
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#include <ctype.h> /* tolower */
+#ifdef HAVE_LOCALE_H
+#include <locale.h> /* setlocale */
+#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#include <errno.h>
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#include <QtGui>
+#include "qphotorec.h"
+#include "common.h"
+#include "hdcache.h"
+#include "hdaccess.h"
+#include "fnctdsk.h"
+
+extern const arch_fnct_t arch_i386;
+
+QPhotorec::QPhotorec()
+{
+ editor = new QListWidget();
+ btn = new QPushButton();
+ QVBoxLayout *mainLayout = new QVBoxLayout();
+ mainLayout->addWidget(editor);
+ mainLayout->addWidget(btn);
+ setLayout(mainLayout);
+ setWindowTitle(tr("QPhotorec"));
+ show();
+
+}
+
+void QPhotorec::show()
+{
+ int verbose=1;
+ const arch_fnct_t *arch=&arch_i386;
+ int testdisk_mode=TESTDISK_O_RDONLY|TESTDISK_O_READAHEAD_32K;
+ list_disk_t *list_disk=NULL;
+ list_disk_t *element_disk;
+
+ if(list_disk==NULL)
+ list_disk=hd_parse(list_disk,verbose,arch,testdisk_mode);
+
+ hd_update_all_geometry(list_disk,0,verbose);
+ /* Activate the cache, even if photorec has its own */
+ for(element_disk=list_disk;element_disk!=NULL;element_disk=element_disk->next)
+ element_disk->disk=new_diskcache(element_disk->disk,testdisk_mode);
+ /* save disk parameters to rapport */
+ int i = 0;
+ for(element_disk=list_disk;element_disk!=NULL;element_disk=element_disk->next)
+ {
+ disk_t *disk=element_disk->disk;
+ if(disk->model==NULL)
+ //log_info("%s, sector size=%u\n", disk->description(disk), disk->sector_size);
+ editor->insertItem(i, QString("%s, sector size=%u").arg(disk->description(disk)).arg(disk->sector_size));
+ else
+ //log_info("%s, sector size=%u - %s\n", disk->description(disk), disk->sector_size, disk->model);
+ editor->insertItem(i, QString("%s, sector size=%u - %s").arg(disk->description(disk)).arg(disk->sector_size).arg(disk->model));
+ i++;
+ }
+
+}