summaryrefslogtreecommitdiffstats
path: root/src/qphotorec.cpp
blob: d6d18ee2bd2e37b128a778a1dd0f8062e388fc36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#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 "types.h"
#include "common.h"
#include "hdcache.h"
#include "hdaccess.h"
#include "fnctdsk.h"

extern const arch_fnct_t arch_i386;

QPhotorec::QPhotorec(QWidget *parent)
{
  setupUi(this);
}

void QPhotorec::setupUi(QWidget *MainWindow)
{
  MainWindow->setWindowTitle(tr("QPhotorec"));
  HDDlistWidget = new QListWidget();
  QVBoxLayout *mainLayout = new QVBoxLayout();
  mainLayout->addWidget(HDDlistWidget);
  QPushButton *button_next = new QPushButton("&Proceed");
  mainLayout->addWidget(button_next);
  QPushButton *button_quit= new QPushButton("&Quit");
  mainLayout->addWidget(button_quit);
  MainWindow->setLayout(mainLayout);
  ashow();
}

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;

  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));
  }
}