xref: /haiku/src/add-ons/translators/icns/ConfigView.cpp (revision 5f4f984a94d150153bcb00a2ed780d0437859543)
1 /*
2  * Copyright 2012, Gerasim Troeglazov, 3dEyes@gmail.com. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include "ConfigView.h"
7 #include "ICNSTranslator.h"
8 
9 #include <Catalog.h>
10 #include <LayoutBuilder.h>
11 #include <StringView.h>
12 #include <ControlLook.h>
13 
14 #include <stdio.h>
15 
16 #undef B_TRANSLATION_CONTEXT
17 #define B_TRANSLATION_CONTEXT "ICNSConfig"
18 
19 
20 ConfigView::ConfigView(TranslatorSettings *settings)
21 	: BGroupView("ICNSTranslator Settings", B_VERTICAL, 0)
22 {
23 	fSettings = settings;
24 
25 	BStringView *titleView = new BStringView("title", B_TRANSLATE("Apple icon translator"));
26 	titleView->SetFont(be_bold_font);
27 
28 	char version[256];
29 	sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
30 		int(B_TRANSLATION_MAJOR_VERSION(ICNS_TRANSLATOR_VERSION)),
31 		int(B_TRANSLATION_MINOR_VERSION(ICNS_TRANSLATOR_VERSION)),
32 		int(B_TRANSLATION_REVISION_VERSION(ICNS_TRANSLATOR_VERSION)),
33 		__DATE__);
34 
35 	BStringView *versionView = new BStringView("version", version);
36 
37 
38 	BStringView *copyrightView = new BStringView("copyright",
39 		B_UTF8_COPYRIGHT "2005-2006 Haiku Inc.");
40 
41 	BStringView *copyright2View = new BStringView("my_copyright",
42 		B_UTF8_COPYRIGHT "2012 Gerasim Troeglazov <3dEyes@gmail.com>.");
43 
44 	BStringView *infoView = new BStringView("support_sizes",
45 		B_TRANSLATE("Valid sizes: 16, 32, 48, 128, 256, 512, 1024"));
46 
47 	BStringView *info2View  = new BStringView("support_colors",
48 		B_TRANSLATE("Valid colors: RGB32, RGBA32"));
49 
50 	BStringView *copyright3View  = new BStringView("copyright3",
51 		"libicns v0.8.1\n");
52 
53 	BStringView *copyright4View  = new BStringView("copyright4",
54 		"2001-2012 Mathew Eis <mathew@eisbox.net>");
55 
56 	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
57 		.SetInsets(B_USE_DEFAULT_SPACING)
58 		.Add(titleView)
59 		.Add(versionView)
60 		.Add(copyrightView)
61 		.Add(copyright2View)
62 		.AddGlue()
63 		.Add(infoView)
64 		.Add(info2View)
65 		.AddGlue()
66 		.Add(copyright3View)
67 		.Add(copyright4View);
68 
69 	SetExplicitPreferredSize(GroupLayout()->MinSize());
70 }
71 
72 
73 ConfigView::~ConfigView()
74 {
75 	fSettings->Release();
76 }
77 
78