xref: /haiku/src/add-ons/translators/icns/ConfigView.cpp (revision f4a1f9c06a3fab1abf98d1419fba56b3534b71fd)
1122e78a5Sthreedeyes /*
2122e78a5Sthreedeyes  * Copyright 2012, Gerasim Troeglazov, 3dEyes@gmail.com. All rights reserved.
3122e78a5Sthreedeyes  * Distributed under the terms of the MIT License.
4122e78a5Sthreedeyes  */
5122e78a5Sthreedeyes 
6122e78a5Sthreedeyes #include "ConfigView.h"
7122e78a5Sthreedeyes #include "ICNSTranslator.h"
8122e78a5Sthreedeyes 
9a52b9419Sthreedeyes #include <Catalog.h>
10b5118c36SJanus #include <LayoutBuilder.h>
11122e78a5Sthreedeyes #include <StringView.h>
12122e78a5Sthreedeyes #include <ControlLook.h>
13122e78a5Sthreedeyes 
14122e78a5Sthreedeyes #include <stdio.h>
15122e78a5Sthreedeyes 
16a52b9419Sthreedeyes #undef B_TRANSLATION_CONTEXT
17a52b9419Sthreedeyes #define B_TRANSLATION_CONTEXT "ICNSConfig"
18a52b9419Sthreedeyes 
19122e78a5Sthreedeyes 
20122e78a5Sthreedeyes ConfigView::ConfigView(TranslatorSettings *settings)
21122e78a5Sthreedeyes 	: BGroupView("ICNSTranslator Settings", B_VERTICAL, 0)
22122e78a5Sthreedeyes {
23122e78a5Sthreedeyes 	fSettings = settings;
24122e78a5Sthreedeyes 
25b5118c36SJanus 	BStringView *titleView = new BStringView("title", B_TRANSLATE("Apple icon translator"));
26b5118c36SJanus 	titleView->SetFont(be_bold_font);
27122e78a5Sthreedeyes 
28122e78a5Sthreedeyes 	char version[256];
29a52b9419Sthreedeyes 	sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
30122e78a5Sthreedeyes 		int(B_TRANSLATION_MAJOR_VERSION(ICNS_TRANSLATOR_VERSION)),
31122e78a5Sthreedeyes 		int(B_TRANSLATION_MINOR_VERSION(ICNS_TRANSLATOR_VERSION)),
32122e78a5Sthreedeyes 		int(B_TRANSLATION_REVISION_VERSION(ICNS_TRANSLATOR_VERSION)),
33122e78a5Sthreedeyes 		__DATE__);
34122e78a5Sthreedeyes 
35b5118c36SJanus 	BStringView *versionView = new BStringView("version", version);
36b5118c36SJanus 
37b5118c36SJanus 
38b5118c36SJanus 	BStringView *copyrightView = new BStringView("copyright",
39122e78a5Sthreedeyes 		B_UTF8_COPYRIGHT "2005-2006 Haiku Inc.");
40122e78a5Sthreedeyes 
41b5118c36SJanus 	BStringView *copyright2View = new BStringView("my_copyright",
42122e78a5Sthreedeyes 		B_UTF8_COPYRIGHT "2012 Gerasim Troeglazov <3dEyes@gmail.com>.");
43122e78a5Sthreedeyes 
44b5118c36SJanus 	BStringView *infoView = new BStringView("support_sizes",
45*f4a1f9c0SKacper Kasper 		B_TRANSLATE("Valid sizes: 16, 32, 48, 128, 256, 512, 1024"));
46122e78a5Sthreedeyes 
47b5118c36SJanus 	BStringView *info2View  = new BStringView("support_colors",
48*f4a1f9c0SKacper Kasper 		B_TRANSLATE("Valid colors: RGB32, RGBA32"));
49122e78a5Sthreedeyes 
50b5118c36SJanus 	BStringView *copyright3View  = new BStringView("copyright3",
51b5118c36SJanus 		"libicns v0.8.1\n");
52122e78a5Sthreedeyes 
53b5118c36SJanus 	BStringView *copyright4View  = new BStringView("copyright4",
54b5118c36SJanus 		"2001-2012 Mathew Eis <mathew@eisbox.net>");
55122e78a5Sthreedeyes 
56b5118c36SJanus 	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
57b5118c36SJanus 		.SetInsets(B_USE_DEFAULT_SPACING)
58b5118c36SJanus 		.Add(titleView)
59b5118c36SJanus 		.Add(versionView)
60b5118c36SJanus 		.Add(copyrightView)
61b5118c36SJanus 		.Add(copyright2View)
62b5118c36SJanus 		.AddGlue()
63b5118c36SJanus 		.Add(infoView)
64b5118c36SJanus 		.Add(info2View)
65b5118c36SJanus 		.AddGlue()
66b5118c36SJanus 		.Add(copyright3View)
67b5118c36SJanus 		.Add(copyright4View);
68122e78a5Sthreedeyes 
69122e78a5Sthreedeyes 	SetExplicitPreferredSize(GroupLayout()->MinSize());
70122e78a5Sthreedeyes }
71122e78a5Sthreedeyes 
72122e78a5Sthreedeyes 
73122e78a5Sthreedeyes ConfigView::~ConfigView()
74122e78a5Sthreedeyes {
75122e78a5Sthreedeyes 	fSettings->Release();
76122e78a5Sthreedeyes }
77122e78a5Sthreedeyes 
78