| 1 | /* fre:ac - free audio converter |
| 2 | * Copyright (C) 2001-2018 Robert Kausch <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation, either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 10 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 11 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ |
| 12 | |
| 13 | #include <dialogs/config/config_verification.h> |
| 14 | |
| 15 | #include <config.h> |
| 16 | |
| 17 | using namespace BoCA::AS; |
| 18 | |
| 19 | using namespace smooth::GUI::Dialogs; |
| 20 | |
| 21 | freac::ConfigureVerification::ConfigureVerification() |
| 22 | { |
| 23 | BoCA::Config *config = BoCA::Config::Get(); |
| 24 | BoCA::I18n *i18n = BoCA::I18n::Get(); |
| 25 | |
| 26 | i18n->SetContext("Configuration::Verification"); |
| 27 | |
| 28 | verifyInput = config->GetIntValue(Config::CategoryVerificationID, Config::VerificationVerifyInputID, Config::VerificationVerifyInputDefault); |
| 29 | verifyOutput = config->GetIntValue(Config::CategoryVerificationID, Config::VerificationVerifyOutputID, Config::VerificationVerifyOutputDefault); |
| 30 | |
| 31 | group_verification = new GroupBox(i18n->TranslateString("Verification"), Point(7, 11), Size(350, 128)); |
| 32 | |
| 33 | check_input = new CheckBox(i18n->TranslateString("Enable input verification"), Point(10, 14), Size(330, 0), &verifyInput); |
| 34 | text_input = new Text(i18n->TranslateString("Verify that lossless inputs decode to exactly the data\nthey were originally created from."), Point(27, 34)); |
| 35 | |
| 36 | check_output = new CheckBox(i18n->TranslateString("Enable output verification"), Point(10, 70), Size(330, 0), &verifyOutput); |
| 37 | text_output = new Text(i18n->TranslateString("Verify that lossless outputs decode to exactly the data\nused when encoding them."), Point(27, 90)); |
| 38 | |
| 39 | Int maxTextSize = Math::Max(text_input->GetUnscaledTextWidth(), text_output->GetUnscaledTextWidth()); |
| 40 | |
| 41 | group_verification->SetWidth(Math::Max(maxTextSize + 36, 330)); |
| 42 | |
| 43 | check_input->SetWidth(group_verification->GetWidth() - 20); |
| 44 | check_output->SetWidth(group_verification->GetWidth() - 20); |
| 45 | |
| 46 | group_verification->Add(check_input); |
| 47 | group_verification->Add(text_input); |
| 48 | group_verification->Add(check_output); |
| 49 | group_verification->Add(text_output); |
| 50 | |
| 51 | Add(group_verification); |
| 52 | |
| 53 | SetSize(group_verification->GetSize() + Size(14, 16)); |
| 54 | } |
| 55 | |
| 56 | freac::ConfigureVerification::~ConfigureVerification() |
| 57 | { |
| 58 | DeleteObject(group_verification); |
| 59 | DeleteObject(check_input); |
| 60 | DeleteObject(text_input); |
| 61 | DeleteObject(check_output); |
| 62 | DeleteObject(text_output); |
| 63 | } |
| 64 | |
| 65 | Int freac::ConfigureVerification::SaveSettings() |
| 66 | { |
| 67 | BoCA::Config *config = BoCA::Config::Get(); |
| 68 | |
| 69 | config->SetIntValue(Config::CategoryVerificationID, Config::VerificationVerifyInputID, verifyInput); |
| 70 | config->SetIntValue(Config::CategoryVerificationID, Config::VerificationVerifyOutputID, verifyOutput); |
| 71 | |
| 72 | return Success(); |
| 73 | } |