vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / translators / icns / ConfigView.cpp
blobc93dcd5233e8436122efb239e8aeea4db3a5289b
1 /*
2 * Copyright 2012, Gerasim Troeglazov, 3dEyes@gmail.com. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "ConfigView.h"
7 #include "ICNSTranslator.h"
9 #include <Catalog.h>
10 #include <LayoutBuilder.h>
11 #include <StringView.h>
12 #include <ControlLook.h>
14 #include <stdio.h>
16 #undef B_TRANSLATION_CONTEXT
17 #define B_TRANSLATION_CONTEXT "ICNSConfig"
20 ConfigView::ConfigView(TranslatorSettings *settings)
21 : BGroupView("ICNSTranslator Settings", B_VERTICAL, 0)
23 fSettings = settings;
25 BStringView *titleView = new BStringView("title", B_TRANSLATE("Apple icon translator"));
26 titleView->SetFont(be_bold_font);
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__);
35 BStringView *versionView = new BStringView("version", version);
38 BStringView *copyrightView = new BStringView("copyright",
39 B_UTF8_COPYRIGHT "2005-2006 Haiku Inc.");
41 BStringView *copyright2View = new BStringView("my_copyright",
42 B_UTF8_COPYRIGHT "2012 Gerasim Troeglazov <3dEyes@gmail.com>.");
44 BStringView *infoView = new BStringView("support_sizes",
45 B_TRANSLATE("Valid sizes: 16, 32, 48, 128, 256, 512, 1024"));
47 BStringView *info2View = new BStringView("support_colors",
48 B_TRANSLATE("Valid colors: RGB32, RGBA32"));
50 BStringView *copyright3View = new BStringView("copyright3",
51 "libicns v0.8.1\n");
53 BStringView *copyright4View = new BStringView("copyright4",
54 "2001-2012 Mathew Eis <mathew@eisbox.net>");
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);
69 SetExplicitPreferredSize(GroupLayout()->MinSize());
73 ConfigView::~ConfigView()
75 fSettings->Release();