forked from xiaozai511/LuaMemorySnapShot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
83 lines (67 loc) · 3.03 KB
/
mainwindow.cpp
File metadata and controls
83 lines (67 loc) · 3.03 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "common.h"
#include "treeDock.h"
#include "comparedock.h"
#include "refrencetreedock.h"
#include <QDir>
#include <QFileDialog>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//treedoc
QString initPath = globalSetting()->value(INIT_PATH_STR_KEY, "memory").toString();
m_treeDock = new TreeDock(this, initPath, "Memory");
m_compareDock = new CompareDock(this);
m_refrenceDock = new RefrenceTreeDock(this);
addDockWidget(Qt::LeftDockWidgetArea, m_treeDock);
addDockWidget(Qt::LeftDockWidgetArea, m_compareDock);
// addDockWidget(Qt::RightDockWidgetArea, m_refrenceDock);
this->setCentralWidget(m_refrenceDock);
//connect
connect(ui->actionRootDir, SIGNAL(triggered(bool)), SLOT(onSelectPath()));
connect(m_treeDock, SIGNAL(addCompare(QString)), m_compareDock, SLOT(addCompareFile(QString)));
connect(m_treeDock, SIGNAL(fileTriggerd(QString)), m_refrenceDock, SLOT(fileReceived(QString)));
connect(m_compareDock, SIGNAL(compareTriggerd(QString,QString)), m_refrenceDock, SLOT(compareFileReceived(QString,QString)));
ui->actionCompareView->setChecked(true);
ui->actionDirView->setChecked(true);
ui->actionTreeView->setChecked(true);
connect(ui->actionCompareView, SIGNAL(toggled(bool)), SLOT(onShowDocks()));
connect(ui->actionDirView, SIGNAL(toggled(bool)), SLOT(onShowDocks()));
// connect(ui->actionTreeView, SIGNAL(toggled(bool)), SLOT(onShowDocks()));
connect(ui->actionExpandAll, SIGNAL(triggered(bool)), m_refrenceDock, SLOT(expandAll()));
connect(ui->actionCollapseAll, SIGNAL(triggered(bool)), m_refrenceDock, SLOT(collapseAll()));
ui->actionColName->setChecked(true);
ui->actionColType->setChecked(true);
ui->actionColValue->setChecked(true);
ui->actionColRefCount->setChecked(true);
connect(ui->actionColName, SIGNAL(triggered(bool)), m_refrenceDock, SLOT(showColName(bool)));
connect(ui->actionColType, SIGNAL(triggered(bool)), m_refrenceDock, SLOT(showColType(bool)));
connect(ui->actionColRefCount, SIGNAL(triggered(bool)), m_refrenceDock, SLOT(showColRefCount(bool)));
connect(ui->actionColValue, SIGNAL(triggered(bool)), m_refrenceDock, SLOT(showColValue(bool)));
connect(ui->actionCopyName, SIGNAL(triggered(bool)), m_refrenceDock, SLOT(copyName()));
connect(ui->actionCopyValue, SIGNAL(triggered(bool)), m_refrenceDock, SLOT(copyValue()));
}
MainWindow::~MainWindow()
{
delete ui;
SAFE_DELETE(m_treeDock);
SAFE_DELETE(m_compareDock);
SAFE_DELETE(m_refrenceDock);
}
void MainWindow::onSelectPath()
{
QString dir = QFileDialog::getExistingDirectory(this, "select path", QDir::currentPath());
if(!dir.isEmpty()) {
globalSetting()->setValue(INIT_PATH_STR_KEY, QVariant(dir));
m_treeDock->setRootPath(dir);
}
}
void MainWindow::onShowDocks()
{
m_treeDock->setVisible(ui->actionDirView->isChecked());
m_compareDock->setVisible(ui->actionCompareView->isChecked());
// m_refrenceDock->setVisible(ui->actionTreeView->isChecked());
}