-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.js
146 lines (119 loc) · 3.73 KB
/
index.js
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//===-- index.js ------------------------------------------------===//
//
// Memoro
//
// This file is distributed under the MIT License.
// See LICENSE for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of Memoro.
// Stuart Byma, EPFL.
//
//===----------------------------------------------------------------------===//
var remote = require("electron").remote;
const {ipcRenderer} = require('electron')
const settings = require('electron').remote.require('electron-settings');
//var Menu = remote.require('menu');
var chunk_graph = require("./js/chunkgraph");
function initApp() {
addAppEventListeners();
//chunk_graph.updateData("hplgst.json");
/* document.getElementById("filter-form")
.addEventListener("keyup", function(event) {
event.preventDefault();
if (event.keyCode === 13) {
document.querySelector("#filter-button").click();
}
});*/
// add div
var element = document.querySelector("#overlay");
element.style.visibility = "visible";
if (!settings.has('theme')) {
// a default
console.log("did not have a theme in settings");
settings.set('theme', 'light')
}
if (settings.get('theme') === 'light') {
$('head link#bootstrapSheet').attr('href', 'css/light.css');
$('head link#colorSheet').attr('href', 'css/chunk_graph_light.css');
} else {
$('head link#bootstrapSheet').attr('href', 'css/slate.css');
$('head link#colorSheet').attr('href', 'css/chunk_graph_dark.css');
}
}
function resetTimeClick() {
chunk_graph.resetTimeClick();
}
function chunkScroll() {
chunk_graph.chunkScroll();
}
function traceScroll() {
chunk_graph.traceScroll();
}
function stackFilterClick() {
chunk_graph.stackFilterClick();
}
function stackFilterResetClick() {
chunk_graph.stackFilterResetClick();
}
function typeFilterClick() {
chunk_graph.typeFilterClick();
}
function filterExecuteClick() {
chunk_graph.filterExecuteClick();
}
function typeFilterResetClick() {
chunk_graph.typeFilterResetClick();
}
function filterHelpClick() {
chunk_graph.showFilterHelp();
}
function fgAllocationsClick() {
console.log("allocations click")
chunk_graph.setFlameGraphNumAllocs();
}
function fgBytesTimeClick() {
console.log("bytes time click")
chunk_graph.setFlameGraphBytesTime();
}
function fgBytesTotalClick() {
console.log("bytes total click")
chunk_graph.setFlameGraphBytesTotal();
}
function fgMostActiveClick() {
console.log("most active click")
}
function fgHelpClick() {
console.log("fg help click")
chunk_graph.flameGraphHelp();
}
function globalInfoHelpClick() {
console.log("fg help click")
chunk_graph.globalInfoHelp();
}
function tabSwitchClick() {
console.log("tab switch click");
chunk_graph.tabSwitchClick();
}
function traceSort(pred) {
chunk_graph.traceSort(pred);
}
function addAppEventListeners() {
ipcRenderer.on('open_file', function(emitter, file_path) {
console.log(file_path[0]);
chunk_graph.updateData(file_path[0]);
});
ipcRenderer.on('theme_light', function(emitter) {
console.log("changing theme to light!!");
$('head link#bootstrapSheet').attr('href', 'css/light.css');
$('head link#colorSheet').attr('href', 'css/chunk_graph_light.css');
settings.set('theme', 'light')
});
ipcRenderer.on('theme_dark', function(emitter) {
console.log("changing theme to dark!!");
$('head link#bootstrapSheet').attr('href', 'css/slate.css');
$('head link#colorSheet').attr('href', 'css/chunk_graph_dark.css');
settings.set('theme', 'dark')
});
}