Skip to content

Commit 53ec49c

Browse files
committed
added icon (and missing property dialog source)
1 parent 232f4af commit 53ec49c

File tree

5 files changed

+105
-1
lines changed

5 files changed

+105
-1
lines changed

MainWindow.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ MainWindow::MainWindow(){
1111
ModuleManager* moduleManager = new ModuleManager;
1212

1313

14+
set_icon_from_file("res/icons/ie-512x512.png");
15+
1416
accelGroup = Gtk::AccelGroup::create();
1517
add_accel_group(accelGroup);
1618

PropertiesDialog.cpp

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#include "PropertiesDialog.h"
2+
3+
#include "ModuleManager.h"
4+
#include <string>
5+
6+
PropertiesDialog::PropertiesDialog(void* node, void* manager){
7+
ModuleNode* nodeRef = (ModuleNode*) node;
8+
ModuleManager* mgr = (ModuleManager*) manager;
9+
10+
// get the sizes
11+
auto sizes = mgr->getSizes(nodeRef);
12+
Glib::ustring decompSize = Glib::format_size(sizes.first);
13+
Glib::ustring compSize = Glib::format_size(sizes.second);
14+
15+
set_title("Properties of " + nodeRef->name);
16+
set_size_request(400, 250);
17+
18+
int r = 0;
19+
20+
// fill the contents
21+
22+
Gtk::Grid* mainGrid = Gtk::make_managed<Gtk::Grid>();
23+
mainGrid->set_halign(Gtk::ALIGN_CENTER);
24+
mainGrid->set_margin_top(20);
25+
mainGrid->set_row_spacing(10);
26+
mainGrid->set_column_spacing(10);
27+
mainGrid->set_baseline_row(0);
28+
29+
// Item name
30+
Gtk::Label* nameLabel = Gtk::make_managed<Gtk::Label>("Name: ");
31+
Gtk::Label* nameValueLabel = Gtk::make_managed<Gtk::Label>(nodeRef->name);
32+
mainGrid->attach(*nameLabel, 0, r);
33+
mainGrid->attach(*nameValueLabel, 1, r);
34+
nameLabel->set_halign(Gtk::ALIGN_START);
35+
nameValueLabel->set_halign(Gtk::ALIGN_START);
36+
nameLabel->show();
37+
nameValueLabel->show();
38+
r++;
39+
40+
// Item name
41+
Gtk::Label* pathLabel = Gtk::make_managed<Gtk::Label>("Full Path: ");
42+
Gtk::Label* pathValueLabel = Gtk::make_managed<Gtk::Label>(nodeRef->path);
43+
mainGrid->attach(*pathLabel, 0, r);
44+
mainGrid->attach(*pathValueLabel, 1, r);
45+
pathLabel->set_halign(Gtk::ALIGN_START);
46+
pathValueLabel->set_halign(Gtk::ALIGN_START);
47+
pathLabel->show();
48+
pathValueLabel->show();
49+
r++;
50+
51+
// using if since a folder may be in multiple modules and I'm too lazy to check that, so I'm just not displaying it for now
52+
if(nodeRef->type != NODE_TYPE_DIRECTORY){
53+
// Module path
54+
Gtk::Label* moduleLabel = Gtk::make_managed<Gtk::Label>("Module: ");
55+
Gtk::Label* moduleValueLabel = Gtk::make_managed<Gtk::Label>(nodeRef->item->module->name);
56+
mainGrid->attach(*moduleLabel, 0, r);
57+
mainGrid->attach(*moduleValueLabel, 1, r);
58+
moduleLabel->set_halign(Gtk::ALIGN_START);
59+
moduleValueLabel->set_halign(Gtk::ALIGN_START);
60+
moduleLabel->show();
61+
moduleValueLabel->show();
62+
r++;
63+
}
64+
65+
66+
// Decompressed size
67+
Gtk::Label* decompLabel = Gtk::make_managed<Gtk::Label>("Decompressed Size: ");
68+
Gtk::Label* decompValueLabel = Gtk::make_managed<Gtk::Label>(decompSize + " (" + std::to_string(sizes.first) + " Bytes)");
69+
mainGrid->attach(*decompLabel, 0, r);
70+
mainGrid->attach(*decompValueLabel, 1, r);
71+
decompLabel->set_halign(Gtk::ALIGN_START);
72+
decompValueLabel->set_halign(Gtk::ALIGN_START);
73+
decompLabel->show();
74+
decompValueLabel->show();
75+
r++;
76+
77+
// Compressed size
78+
Gtk::Label* compLabel = Gtk::make_managed<Gtk::Label>("Compressed Size: ");
79+
Gtk::Label* compValueLabel = Gtk::make_managed<Gtk::Label>(compSize + " (" + std::to_string(sizes.second) + " Bytes)");
80+
mainGrid->attach(*compLabel, 0, r);
81+
mainGrid->attach(*compValueLabel, 1, r);
82+
compLabel->set_halign(Gtk::ALIGN_START);
83+
compValueLabel->set_halign(Gtk::ALIGN_START);
84+
compLabel->show();
85+
compValueLabel->show();
86+
r++;
87+
88+
((Gtk::Box*)get_child())->add(*mainGrid);
89+
90+
mainGrid->show();
91+
show();
92+
}

PropertiesDialog.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#pragma once
2+
#include <gtkmm.h>
3+
#include "ModuleNode.h"
4+
5+
6+
class PropertiesDialog : public Gtk::Dialog{
7+
public:
8+
PropertiesDialog(void* node, void* manager);
9+
};

res/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

22
#copy main.xml
33
configure_file(res/main.xml res/main.xml COPYONLY)
4-
configure_file(res/fileExplorer.css res/fileExplorer.css COPYONLY)
4+
configure_file(res/fileExplorer.css res/fileExplorer.css COPYONLY)
5+
configure_file(res/icons/ie-512x512.png res/icons/ie-512x512.png COPYONLY)

res/icons/ie-512x512.png

42.5 KB
Loading

0 commit comments

Comments
 (0)