summaryrefslogtreecommitdiffstats
path: root/src/qphotorec.cpp
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-07-31 09:33:13 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2009-07-31 09:33:13 +0200
commit79594ca992831ad19a3648af48d86d61dc14596e (patch)
tree9e06636683276743e33f61896d53062579001906 /src/qphotorec.cpp
parent93fc52322be3a9e172b217622022c9e586823012 (diff)
qphotorec: fix the device list
Diffstat (limited to 'src/qphotorec.cpp')
-rw-r--r--src/qphotorec.cpp66
1 files changed, 31 insertions, 35 deletions
diff --git a/src/qphotorec.cpp b/src/qphotorec.cpp
index 9e52391..ef1a658 100644
--- a/src/qphotorec.cpp
+++ b/src/qphotorec.cpp
@@ -36,6 +36,7 @@
#endif
#include <QtGui>
#include "qphotorec.h"
+#include "types.h"
#include "common.h"
#include "hdcache.h"
#include "hdaccess.h"
@@ -43,46 +44,41 @@
extern const arch_fnct_t arch_i386;
-QPhotorec::QPhotorec()
+QPhotorec::QPhotorec(QWidget *parent)
{
- editor = new QListWidget();
- btn = new QPushButton();
- QVBoxLayout *mainLayout = new QVBoxLayout();
- mainLayout->addWidget(editor);
- mainLayout->addWidget(btn);
- setLayout(mainLayout);
- setWindowTitle(tr("QPhotorec"));
- show();
-
+ setupUi(this);
}
-void QPhotorec::show()
+void QPhotorec::setupUi(QWidget *MainWindow)
{
- 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;
+ MainWindow->setWindowTitle(tr("QPhotorec"));
+ HDDlistWidget = new QListWidget();
+ btn = new QPushButton();
+ QVBoxLayout *mainLayout = new QVBoxLayout();
+ mainLayout->addWidget(HDDlistWidget);
+ mainLayout->addWidget(btn);
+ MainWindow->setLayout(mainLayout);
+ ashow();
+}
- if(list_disk==NULL)
- list_disk=hd_parse(list_disk,verbose,arch,testdisk_mode);
+void QPhotorec::ashow()
+{
+ 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;
+ list_disk_t *element_disk;
- 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++;
- }
+ 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 */
+ for(element_disk=list_disk;element_disk!=NULL;element_disk=element_disk->next)
+ {
+ disk_t *disk=element_disk->disk;
+ HDDlistWidget->addItem(disk->description_short(disk));
+ }
}