vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / translators / exr / ConfigView.cpp
blob50a5ad846ad1485a7648e4852d93338a594eb0de
1 /*
2 * Copyright 2008, Jérôme Duval. All rights reserved.
3 * Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
4 * Copyright 2009, Maxime Simon, maxime.simon@gmail.com. All rights reserved.
5 * Distributed under the terms of the MIT License.
6 */
9 #include "ConfigView.h"
10 #include "EXRTranslator.h"
12 #include <Catalog.h>
13 #include <CheckBox.h>
14 #include <LayoutBuilder.h>
15 #include <StringView.h>
17 #include <OpenEXRConfig.h>
19 #include <stdio.h>
20 #include <string.h>
22 #undef B_TRANSLATION_CONTEXT
23 #define B_TRANSLATION_CONTEXT "ConfigView"
26 ConfigView::ConfigView(uint32 flags)
27 : BView("EXRTranslator Settings", flags)
29 SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
31 BStringView *titleView = new BStringView("title",
32 B_TRANSLATE("EXR image translator"));
33 titleView->SetFont(be_bold_font);
35 char version[256];
36 sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
37 int(B_TRANSLATION_MAJOR_VERSION(EXR_TRANSLATOR_VERSION)),
38 int(B_TRANSLATION_MINOR_VERSION(EXR_TRANSLATOR_VERSION)),
39 int(B_TRANSLATION_REVISION_VERSION(EXR_TRANSLATOR_VERSION)),
40 __DATE__);
41 BStringView *versionView = new BStringView("version", version);
43 BStringView *copyrightView = new BStringView("copyright",
44 B_UTF8_COPYRIGHT "2008 Haiku Inc.");
46 BString openExrInfo = B_TRANSLATE("Based on OpenEXR %version%");
47 openExrInfo.ReplaceAll("%version%", OPENEXR_VERSION_STRING);
48 BStringView *copyrightView2 = new BStringView("copyright2",
49 openExrInfo.String());
51 BStringView *copyrightView3 = new BStringView("copyright3",
52 B_UTF8_COPYRIGHT "2002-2014 Industrial Light & Magic,");
54 BStringView *copyrightView4 = new BStringView("copyright4",
55 B_TRANSLATE("a division of Lucasfilm Entertainment Company Ltd"));
57 // Build the layout
58 BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
59 .SetInsets(B_USE_DEFAULT_SPACING)
60 .Add(titleView)
61 .Add(versionView)
62 .Add(copyrightView)
63 .AddGlue()
64 .Add(copyrightView2)
65 .Add(copyrightView3)
66 .Add(copyrightView4);
68 BFont font;
69 GetFont(&font);
70 SetExplicitPreferredSize(BSize(font.Size() * 400 / 12,
71 font.Size() * 200 / 12));
75 ConfigView::~ConfigView()