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
|
#ifndef __FBEXPORTTREE_H__
#define __FBEXPORTTREE_H__
#include "controls/FbTreeModel.h"
#include <wx/filename.h>
#include <wx/wxsqlite3.h>
class FbConvertArray;
class FbExportTreeModel;
class FbExportParentData: public FbParentData
{
public:
FbExportParentData(FbModel & model, FbParentData * parent = NULL, const wxString &name = wxEmptyString)
: FbParentData(model, parent), m_name(name) {}
virtual wxString GetValue(FbModel & model, size_t col = 0) const
{ return col == 0 ? m_name : wxString(); }
void Sort(FbModel & model);
FbExportParentData * GetDir(FbModel & model, wxArrayString &dirs);
void Append(FbModel & model, int book, wxFileName &filename, int size);
int Compare(const FbExportParentData &data) const;
void GetFiles(FbModel & model, FbConvertArray & files) const;
private:
wxString m_name;
DECLARE_CLASS(FbExportParentData)
};
class FbExportChildData: public FbChildData
{
public:
FbExportChildData(FbModel & model, FbParentData * parent, int book, const wxFileName &filename, int size)
: FbChildData(model, parent), m_book(book), m_name(filename.GetName()), m_type(filename.GetExt()), m_size(size) {}
virtual wxString GetValue(FbModel & model, size_t col = 0) const;
int Compare(const FbExportChildData &data) const;
wxFileName GetPath(FbModel &model) const;
virtual int GetBook() const { return m_book; }
private:
int m_book;
wxString m_name;
wxString m_type;
int m_size;
DECLARE_CLASS(FbExportChildData)
};
class FbExportTreeContext
{
public:
FbExportTreeContext(FbExportTreeModel * model);
wxFileName GetFilename(wxSQLite3ResultSet &result);
private:
wxString Get(wxSQLite3ResultSet &result, const wxString &field);
wxString Normalize(const wxString &filename, bool translit = false);
private:
bool m_translit_folder;
bool m_translit_file;
bool m_underscores;
int m_digits_count;
wxString m_template;
};
class FbExportTreeModel: public FbTreeModel
{
public:
FbExportTreeModel(const wxString &books, const wxString &structure, int author = 0);
void GetFiles(FbConvertArray & files);
void SetFormat(const wxString & ext, const wxString & arc, int scale = 0)
{ m_ext = ext; m_arc = arc; m_scale = scale; }
void SetTransDir(bool transDir) { m_transDir = transDir; }
void SetTransFile(bool transFile) { m_transFile = transFile; }
bool GetTransDir() const { return m_transDir; }
bool GetTransFile() const { return m_transFile; }
const wxString & GetStructure() const { return m_structure; }
const wxString & GetExt() const { return m_ext; }
const wxString & GetArc() const { return m_arc; }
int GetScale() const { return m_scale; }
void Create();
private:
wxString m_structure;
bool m_transDir;
bool m_transFile;
wxString m_books;
wxString m_ext;
wxString m_arc;
int m_author;
int m_scale;
DECLARE_CLASS(FbExportTreeModel)
};
#endif // __FBEXPORTTREE_H__
|