-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenedlisthandle.h
More file actions
107 lines (98 loc) · 3.2 KB
/
openedlisthandle.h
File metadata and controls
107 lines (98 loc) · 3.2 KB
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
#ifndef OPENEDLISTHANDLE_H
#define OPENEDLISTHANDLE_H
#include "mainhandler.h"
#include "osinterface.h"
#include "mylineedit.h"
#include "mytreeview.h"
#include "myiconview.h"
#include <dirent.h>
#include <QWidget>
#include <QString>
#include <QPushButton>
#include <QComboBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QLineEdit>
#include <QModelIndex>
#include <QTreeWidgetItem>
#include <QTableWidgetItem>
#include <QListView>
#include <QScrollBar>
#include <QToolBar>
#include <QLabel>
#include <QObject>
#include <QMainWindow>
#include <map>
#include <vector>
#include <string>
#include <iostream>
class MyTreeView;
class MyIconView;
class OpenedListHandle: public QWidget{
Q_OBJECT
public:
OSInterface *os;
std::map<Qt::Key, ButtonHandle<OpenedListHandle>> tool_btts;
std::vector<MyViewType *> to_del;
std::string last_dir;
QVBoxLayout *v_layout, *v_layout2;
QHBoxLayout *h_layout1, *h_layout2;
QGridLayout *g_layout;
MyLineEdit *le1;
ButtonHandle<OpenedListHandle> *up_btt;
QLineEdit *le2;
QLabel *lbl, *lbl2, *lbl3;
MyViewType *content;
QToolBar *tb, *tb2;
bool in_layout;
std::string path, pattern;
enum {TREE, LIST, ICON, VIEW, ARCHIVE};
int view_type, last_layout;
enum {B, KB, MB, GB};
OpenedListHandle() { initLayout(".");}
OpenedListHandle(std::string, QWidget *parent = 0);
void delGraphics();
void changeLayout(int);
void highlightBtt();
void getFullPath(QTreeWidgetItem *, std::string&);
void clean();
void updateLbl();
void processItem(std::string);
template <typename T>
void connectSignals(){
if(typeid(T) == typeid(MyTreeView)){
QObject::connect((T *)content, SIGNAL(itemExpanded(QTreeWidgetItem *)), this, SLOT(itemExpanded(QTreeWidgetItem *)));
QObject::connect((T *)content, SIGNAL(itemActivated(QTreeWidgetItem *, int)), this, SLOT(itemActivated(QTreeWidgetItem*,int)));
}else if(typeid(T) == typeid(MyIconView)){
QObject::connect((T *)content, SIGNAL(itemActivated(QTableWidgetItem *)), this, SLOT(itemActivated(QTableWidgetItem *)));
}
QObject::connect((T *)content, SIGNAL(rebuilded()), this, SLOT(rebuildContent()));
QObject::connect((T *)content, SIGNAL(chlayout()), this, SLOT(chlayout()));
QObject::connect((T *)content, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
QObject::connect((T *)content, &T::stepup, this, &OpenedListHandle::stepUp);
QObject::connect((T *)content, &T::refresh, this, &OpenedListHandle::refresh);
}
void initLayout(std::string);
virtual ~OpenedListHandle();
signals:
void updated();
void refreshed(OpenedListHandle *);
public slots:
void toTree();
void toList();
void toIcon();
void chlayout();
void stepUp();
void refresh();
void patternChanged();
void pathChanged();
void setSelection(bool);
void rebuildContent();
//void itemPressed(QTreeWidgetItem *item);
void itemExpanded(QTreeWidgetItem *item);
void selectionChanged();
void itemActivated(QTreeWidgetItem *item, int col );
void itemActivated(QTableWidgetItem *item);
};
#endif // OPENEDLISTHANDLE_H