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 <StringView.h> 10 #include <SpaceLayoutItem.h> 11 #include <ControlLook.h> 12 13 #include <stdio.h> 14 15 extern "C" { 16 #include <openjpeg.h> 17 }; 18 19 20 ConfigView::ConfigView(TranslatorSettings *settings) 21 : BGroupView("ICNSTranslator Settings", B_VERTICAL, 0) 22 { 23 fSettings = settings; 24 BAlignment leftAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET); 25 26 BStringView *stringView = new BStringView("title", "Apple icon translator"); 27 stringView->SetFont(be_bold_font); 28 stringView->SetExplicitAlignment(leftAlignment); 29 AddChild(stringView); 30 31 float spacing = be_control_look->DefaultItemSpacing(); 32 AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing)); 33 34 char version[256]; 35 sprintf(version, "Version %d.%d.%d, %s", 36 int(B_TRANSLATION_MAJOR_VERSION(ICNS_TRANSLATOR_VERSION)), 37 int(B_TRANSLATION_MINOR_VERSION(ICNS_TRANSLATOR_VERSION)), 38 int(B_TRANSLATION_REVISION_VERSION(ICNS_TRANSLATOR_VERSION)), 39 __DATE__); 40 stringView = new BStringView("version", version); 41 stringView->SetExplicitAlignment(leftAlignment); 42 AddChild(stringView); 43 44 stringView = new BStringView("copyright", 45 B_UTF8_COPYRIGHT "2005-2006 Haiku Inc."); 46 stringView->SetExplicitAlignment(leftAlignment); 47 AddChild(stringView); 48 49 stringView = new BStringView("my_copyright", 50 B_UTF8_COPYRIGHT "2012 Gerasim Troeglazov <3dEyes@gmail.com>."); 51 stringView->SetExplicitAlignment(leftAlignment); 52 AddChild(stringView); 53 54 AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing)); 55 56 stringView = new BStringView("support_sizes", 57 "Valid sizes: 16, 32, 48, 128, 256, 512, 1024"); 58 stringView->SetExplicitAlignment(leftAlignment); 59 AddChild(stringView); 60 61 stringView = new BStringView("support_colors", 62 "Valid colors: RGB32, RGBA32"); 63 stringView->SetExplicitAlignment(leftAlignment); 64 AddChild(stringView); 65 66 AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing)); 67 68 BString copyrightText; 69 copyrightText << "libicns v0.8.1\n" 70 << B_UTF8_COPYRIGHT "2001-2012 Mathew Eis <mathew@eisbox.net>\n\n" 71 << "OpenJPEG " << opj_version() << "\n" 72 << B_UTF8_COPYRIGHT "2002-2012, Communications and Remote Sensing " 73 << "Laboratory, Universite catholique de Louvain (UCL), Belgium"; 74 75 fCopyrightView = new BTextView("CopyrightLibs"); 76 fCopyrightView->SetExplicitAlignment(leftAlignment); 77 fCopyrightView->MakeEditable(false); 78 fCopyrightView->MakeResizable(true); 79 fCopyrightView->SetWordWrap(true); 80 fCopyrightView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 81 fCopyrightView->SetText(copyrightText.String()); 82 fCopyrightView->SetExplicitMinSize(BSize(300,200)); 83 84 BFont font; 85 font.SetSize(font.Size() * 0.9); 86 fCopyrightView->SetFontAndColor(&font, B_FONT_SIZE, NULL); 87 AddChild(fCopyrightView); 88 89 fCopyrightView->SetExplicitAlignment(leftAlignment); 90 91 AddChild(BSpaceLayoutItem::CreateGlue()); 92 GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, 93 B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING); 94 95 SetExplicitPreferredSize(GroupLayout()->MinSize()); 96 } 97 98 99 ConfigView::~ConfigView() 100 { 101 fSettings->Release(); 102 } 103 104