File: mainwindow.h

package info (click to toggle)
gpar2 0.3-2.3
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 1,144 kB
  • ctags: 91
  • sloc: sh: 9,399; cpp: 616; makefile: 70; sed: 16; xml: 3
file content (118 lines) | stat: -rw-r--r-- 2,439 bytes parent folder | download | duplicates (2)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <gtkmm/button.h>
#include <gtkmm/window.h>
#include <gtkmm/entry.h>
#include <gtkmm.h>
#include "gpar2.h"
#include <libpar2/libpar2.h>
#include <pthread.h>
#include <string.h>
#include<iostream>
#include<sstream>


class MainWindow : public Gtk::Window
{

public:
  MainWindow(char* text);
  virtual ~MainWindow();
  Gtk::ProgressBar progressBar;

protected:
  // Current operation
  typedef enum {
    none,
    repairing,
    verifying,
    scanning
  } Operation;
  Operation operation;

  typedef enum {
    notloaded_repair,
    notloaded_verify,
    notnecessary_repair,
    notpossible_repair,
    already_verified
  } Error;

  typedef enum {
    complete,
    repairable,
    unrepairable,
    undef
  } Status;
  Status status;

  //Signal handlers:
  virtual void verify();
  virtual void repair();
  virtual void open();
  virtual void quit();
  virtual void about();

  void preprocess();
  void update_status(Result result);
  void signal_filename(std::string filename);
  void signal_progress(double progress);
  void signal_headers(ParHeaders* headers);
  void signal_done(std::string filename, int blocks_available, 
		   int blocks_total);
  void errors(Error error);

  LibPar2* repairer;

  // menus
  Glib::RefPtr<Gtk::UIManager> m_refUIManager;
  Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;

  //Member widgets:
  Gtk::VBox main_VBox;
  Gtk::HBox main_HBox;
  Gtk::Button repair_button;
  Gtk::Button verify_button;
  Gtk::Button open_button;
  //Gtk::Entry filename_entry;
  Gtk::Frame status_frame;
  Gtk::Frame done_frame;
  Gtk::Frame headers_frame;
  Gtk::Label status_label;

  // Headers label
  Gtk::HBox headers_hbox;
  Gtk::VBox headers_col1;
  Gtk::VBox headers_col2;
  Gtk::Label header_setid;
  Gtk::Label header_blocksize;
  Gtk::Label header_chunksize;
  Gtk::Label header_sourceblockcount;
  Gtk::Label header_totalsize;
  Gtk::Label header_recoverablefiles;
  Gtk::Label header_otherfiles;
  Gtk::Label header_blocks;

  // Filename
  Gtk::HBox filename_hbox;
  Gtk::Label filename_title;
  Gtk::Label filename_entry;

  Gtk::ProgressBar globalProgress;

  // Files done
  Gtk::ScrolledWindow done_window;
  Gtk::TextView done_files;

  double nbdone;
  double nbfiles;
  bool file_loaded;
  int avail_blocks;
};

// Tools
string itos(int i);	// convert int to string
string dtos(double d);	// convert double to string

#endif // MAINWINDOW_H