Commit b7f4b6dd authored by Petr Štětka's avatar Petr Štětka
Browse files

Change color to red when process have max usage.

parent 6c751f1d
No preview for this file type
......@@ -13,6 +13,16 @@ list separator {
background: #dadada;
}
list row.max {
background: #fabbbb;
border: 1px solid #faa5a2;
}
list row.max:hover {
background: #faa5a2;
border: 1px solid #faa5a2;
}
list row.opened {
background: #919191;
}
......@@ -27,10 +37,19 @@ subprocess-list row {
}
subprocess-list row:hover {
padding: 0;
background: #e2e2e2;
}
subprocess-list row.max {
background: #fabbbb;
border: 1px solid #faa5a2;
}
subprocess-list row.max:hover {
background: #faa5a2;
border: 1px solid #faa5a2;
}
graph-stack-switcher {
background: #fafafa;
}
......@@ -59,7 +78,7 @@ scrolledwindow {
background: #f1f2f1;
}
line-graph.big {
cpu-all-graph.big {
background-color: #ffffff;
background-size: 57px 57px;
background-image: repeating-linear-gradient(0deg, #e6e6e6, #e6e6e6 1px, transparent 1px, transparent 57px);
......
......@@ -9,27 +9,30 @@ namespace Usage
{
private static CpuGraphTableMostUsedCore rg_table;
private LineRenderer renderer;
private const string red_color = "#ee2222"; //TODO load from css
private const string blue_color = "#4a90d9";
private Gdk.RGBA color_max;
private Gdk.RGBA color_normal;
public CpuGraphMostUsed ()
{
color_max.parse("#ee2222");
color_normal.parse("#4a90d9");
if(rg_table == null)
rg_table = new CpuGraphTableMostUsedCore();
set_table(rg_table);
renderer = new LineRenderer();
renderer.stroke_color = blue_color;
renderer.stroke_color_rgba = color_normal;
renderer.line_width = 1.2;
add_renderer(renderer);
rg_table.big_process_usage.connect (() => {
renderer.stroke_color = red_color;
renderer.stroke_color_rgba = color_max;
});
rg_table.small_process_usage.connect (() => {
renderer.stroke_color = blue_color;
renderer.stroke_color_rgba = color_normal;
});
}
}
......@@ -41,17 +44,20 @@ namespace Usage
{
private static CpuGraphTableComplex table;
private LineRenderer[] renderers;
private const string red_color = "#ee2222";
private const string blue_color = "#a8c9ed";
private Gdk.RGBA color_max;
private Gdk.RGBA color_normal;
class construct
{
set_css_name("line-graph");
set_css_name("cpu-all-graph");
}
public CpuGraphAllCores ()
public CpuGraphAllCores()
{
color_max.parse("#ee2222");
color_normal.parse("#4a90d9");
get_style_context().add_class("big");
if(table == null)
table = new CpuGraphTableComplex();
......@@ -62,17 +68,17 @@ namespace Usage
{
renderers[i] = new LineRenderer();
renderers[i].column = i;
renderers[i].stroke_color = blue_color;
renderers[i].stroke_color_rgba = color_normal;
renderers[i].line_width = 2.5;
add_renderer(renderers[i]);
}
table.big_process_usage.connect ((column) => {
renderers[column].stroke_color = red_color;
renderers[column].stroke_color_rgba = color_max;
});
table.small_process_usage.connect ((column) => {
renderers[column].stroke_color = blue_color;
renderers[column].stroke_color_rgba = color_normal;
});
}
}
......
......@@ -41,7 +41,7 @@ namespace Usage
{
if((process.cmdline in rows) == false)
{
if(process.cpu_load >= 1)
if(process.cpu_load >= 1) //TODO To backend!
{
rows.add(process.cmdline);
model.append(process);
......
......@@ -15,8 +15,9 @@ namespace Usage
public bool showing_details { get; private set; }
public bool max_usage { get; private set; }
public ProcessRowNew(Process process, bool opened)
public ProcessRowNew(Process process, bool opened = false)
{
showing_details = opened;
if(apps_info == null)
apps_info = AppInfo.get_all(); //Because it takes too long
this.process = process;
......@@ -37,7 +38,11 @@ namespace Usage
row_box.pack_end(load_label, false, true, 10);
box.pack_start(row_box, false, true, 0);
notify["max-usage"].connect (() => {
set_styles();
});
update();
if(process.sub_processes != null)
{
sub_process_list_box = new SubProcessListBox(process);
......@@ -164,6 +169,8 @@ namespace Usage
hide_details();
else
show_details();
set_styles();
}
else
{
......@@ -171,5 +178,13 @@ namespace Usage
dialog.show_all ();
}
}
private void set_styles()
{
if(max_usage == true && showing_details == false)
get_style_context().add_class("max");
else
get_style_context().remove_class("max");
}
}
}
......@@ -29,6 +29,9 @@ namespace Usage
row_box.pack_end(load_label, false, true, 10);
this.add(row_box);
notify["max-usage"].connect (() => {
set_styles();
});
update();
show_all();
}
......@@ -43,6 +46,14 @@ namespace Usage
max_usage = false;
}
private void set_styles()
{
if(max_usage == true)
get_style_context().add_class("max");
else
get_style_context().remove_class("max");
}
public void activate()
{
var dialog = new ProcessDialog(process.pid, process.cmdline);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment