xref: /haiku/src/add-ons/translators/raw/ConfigView.cpp (revision 02354704729d38c3b078c696adc1bbbd33cbcf72)
1 /*
2  * Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Copyright 2009, Maxime Simon, maxime.simon@gmail.com. All rights reserved.
4  * Distributed under the terms of the MIT License.
5  */
6 
7 
8 #include "ConfigView.h"
9 #include "RAWTranslator.h"
10 
11 #include <Catalog.h>
12 #include <CheckBox.h>
13 #include <LayoutBuilder.h>
14 #include <StringView.h>
15 
16 #include <stdio.h>
17 #include <string.h>
18 
19 #ifdef USES_LIBRAW
20 #include <libraw/libraw.h>
21 #endif
22 
23 #undef B_TRANSLATION_CONTEXT
24 #define B_TRANSLATION_CONTEXT "ConfigView"
25 
26 const char* kShortName2 = B_TRANSLATE_MARK("RAWTranslator Settings");
27 
28 
29 ConfigView::ConfigView(uint32 flags)
30 	: BView(kShortName2, flags)
31 {
32 	SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
33 
34 	BStringView *fTitle = new BStringView("title", B_TRANSLATE("RAW image translator"));
35 	fTitle->SetFont(be_bold_font);
36 
37 	char version[256];
38 	sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
39 		int(B_TRANSLATION_MAJOR_VERSION(RAW_TRANSLATOR_VERSION)),
40 		int(B_TRANSLATION_MINOR_VERSION(RAW_TRANSLATOR_VERSION)),
41 		int(B_TRANSLATION_REVISION_VERSION(RAW_TRANSLATOR_VERSION)),
42 		__DATE__);
43 	BStringView *fVersion = new BStringView("version", version);
44 
45 	BStringView *fCopyright = new BStringView("copyright",
46 		B_UTF8_COPYRIGHT "2007-2021 Haiku Inc.");
47 
48 #ifdef USES_LIBRAW
49 	BString librawInfo = B_TRANSLATE(
50 		"Based on libraw %version%");
51 	librawInfo.ReplaceAll("%version%", LibRaw::version());
52 	BStringView *fCopyright2 = new BStringView("Copyright2",
53 		librawInfo.String());
54 	BStringView *fCopyright3 = new BStringView("Copyright3",
55 		B_TRANSLATE(B_UTF8_COPYRIGHT "Copyright (C) 2008-2021 LibRaw LLC"));
56 #else
57 	BStringView *fCopyright2 = new BStringView("copyright2",
58 		B_TRANSLATE("Based on Dave Coffin's dcraw 8.63"));
59 
60 	BStringView *fCopyright3 = new BStringView("copyright3",
61 		B_UTF8_COPYRIGHT "1997-2007 Dave Coffin");
62 #endif
63 
64 	// Build the layout
65 	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
66 		.SetInsets(B_USE_DEFAULT_SPACING)
67 		.Add(fTitle)
68 		.Add(fVersion)
69 		.Add(fCopyright)
70 		.AddGlue()
71 		.Add(fCopyright2)
72 		.Add(fCopyright3);
73 
74 	BFont font;
75 	GetFont(&font);
76 	SetExplicitPreferredSize(BSize((font.Size() * 233)/12, (font.Size() * 200)/12));
77 }
78 
79 
80 ConfigView::~ConfigView()
81 {
82 }
83 
84