Locale: move "translate application names" checkbox to formatting tab
Part of #15511
This commit is contained in:
@@ -59,6 +59,12 @@ FormatSettingsView::FormatSettingsView()
|
||||
B_TRANSLATE("Use month/day-names from preferred language"),
|
||||
new BMessage(kStringsLanguageChange));
|
||||
|
||||
fFilesystemTranslationCheckbox = new BCheckBox("filesystemTranslation",
|
||||
B_TRANSLATE("Translate application and folder names"),
|
||||
new BMessage(kMsgFilesystemTranslationChanged));
|
||||
fFilesystemTranslationCheckbox->SetValue(
|
||||
BLocaleRoster::Default()->IsFilesystemTranslationPreferred());
|
||||
|
||||
BStringView* fullDateLabel
|
||||
= new BStringView("", B_TRANSLATE("Full format:"));
|
||||
fullDateLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
|
||||
@@ -230,6 +236,7 @@ FormatSettingsView::FormatSettingsView()
|
||||
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||
.Add(fFilesystemTranslationCheckbox)
|
||||
.Add(fUseLanguageStringsCheckBox)
|
||||
.Add(fDateBox)
|
||||
.Add(fTimeBox)
|
||||
@@ -249,6 +256,7 @@ FormatSettingsView::~FormatSettingsView()
|
||||
void
|
||||
FormatSettingsView::AttachedToWindow()
|
||||
{
|
||||
fFilesystemTranslationCheckbox->SetTarget(Window());
|
||||
fUseLanguageStringsCheckBox->SetTarget(this);
|
||||
f24HourRadioButton->SetTarget(this);
|
||||
f12HourRadioButton->SetTarget(this);
|
||||
@@ -315,6 +323,8 @@ FormatSettingsView::Revert()
|
||||
MutableLocaleRoster::Default()->SetDefaultFormattingConventions(
|
||||
fInitialConventions);
|
||||
|
||||
fFilesystemTranslationCheckbox->SetValue(fInitialTranslateNames);
|
||||
|
||||
_UpdateExamples();
|
||||
}
|
||||
|
||||
@@ -324,8 +334,11 @@ FormatSettingsView::Refresh(bool setInitial)
|
||||
{
|
||||
BFormattingConventions conventions;
|
||||
BLocale::Default()->GetFormattingConventions(&conventions);
|
||||
if (setInitial)
|
||||
if (setInitial) {
|
||||
fInitialConventions = conventions;
|
||||
fInitialTranslateNames
|
||||
= BLocaleRoster::Default()->IsFilesystemTranslationPreferred();
|
||||
}
|
||||
|
||||
if (!conventions.Use24HourClock()) {
|
||||
f12HourRadioButton->SetValue(B_CONTROL_ON);
|
||||
@@ -351,7 +364,8 @@ FormatSettingsView::IsReversible() const
|
||||
BFormattingConventions conventions;
|
||||
BLocale::Default()->GetFormattingConventions(&conventions);
|
||||
|
||||
return conventions != fInitialConventions;
|
||||
return (conventions != fInitialConventions)
|
||||
|| (fFilesystemTranslationCheckbox->Value() != fInitialTranslateNames);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ class BTextControl;
|
||||
|
||||
static const uint32 kClockFormatChange = 'cfmc';
|
||||
static const uint32 kStringsLanguageChange = 'strc';
|
||||
static const uint32 kMsgFilesystemTranslationChanged = 'fsys';
|
||||
|
||||
|
||||
class FormatSettingsView : public BView {
|
||||
@@ -41,6 +42,7 @@ private:
|
||||
void _UpdateExamples();
|
||||
|
||||
private:
|
||||
BCheckBox* fFilesystemTranslationCheckbox;
|
||||
BCheckBox* fUseLanguageStringsCheckBox;
|
||||
|
||||
BRadioButton* f24HourRadioButton;
|
||||
@@ -64,6 +66,7 @@ private:
|
||||
bool fLocaleIs24Hour;
|
||||
|
||||
BFormattingConventions fInitialConventions;
|
||||
bool fInitialTranslateNames;
|
||||
|
||||
BBox* fDateBox;
|
||||
BBox* fTimeBox;
|
||||
|
||||
@@ -48,7 +48,6 @@ static const uint32 kMsgConventionsSelection = 'csel';
|
||||
static const uint32 kMsgDefaults = 'dflt';
|
||||
|
||||
static const uint32 kMsgPreferredLanguagesChanged = 'lang';
|
||||
static const uint32 kMsgFilesystemTranslationChanged = 'fsys';
|
||||
|
||||
|
||||
static int
|
||||
@@ -71,8 +70,7 @@ LocaleWindow::LocaleWindow()
|
||||
B_QUIT_ON_WINDOW_CLOSE | B_ASYNCHRONOUS_CONTROLS
|
||||
| B_AUTO_UPDATE_SIZE_LIMITS),
|
||||
fInitialConventionsItem(NULL),
|
||||
fDefaultConventionsItem(NULL),
|
||||
fFilesystemTranslationCheckbox(NULL)
|
||||
fDefaultConventionsItem(NULL)
|
||||
{
|
||||
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||
|
||||
@@ -185,8 +183,8 @@ LocaleWindow::LocaleWindow()
|
||||
.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
|
||||
B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING);
|
||||
|
||||
BView* countryTab = new BView(B_TRANSLATE("Formatting"), B_WILL_DRAW);
|
||||
countryTab->SetLayout(new BGroupLayout(B_VERTICAL, 0));
|
||||
BView* formattingTab = new BView(B_TRANSLATE("Formatting"), B_WILL_DRAW);
|
||||
formattingTab->SetLayout(new BGroupLayout(B_VERTICAL, 0));
|
||||
|
||||
fConventionsListView = new LanguageListView("formatting",
|
||||
B_SINGLE_SELECTION_LIST);
|
||||
@@ -242,12 +240,12 @@ LocaleWindow::LocaleWindow()
|
||||
fInitialConventionsItem));
|
||||
}
|
||||
|
||||
fConventionsListView->SetExplicitMinSize(BSize(20 * be_plain_font->Size(),
|
||||
fConventionsListView->SetExplicitMinSize(BSize(21 * be_plain_font->Size(),
|
||||
B_SIZE_UNSET));
|
||||
|
||||
fFormatView = new FormatSettingsView();
|
||||
|
||||
countryTab->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, spacing)
|
||||
formattingTab->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, spacing)
|
||||
.AddGroup(B_VERTICAL, 3)
|
||||
.Add(scrollView)
|
||||
.End()
|
||||
@@ -255,25 +253,8 @@ LocaleWindow::LocaleWindow()
|
||||
.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
|
||||
B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING));
|
||||
|
||||
BView* optionsTab = new BView(B_TRANSLATE("Options"), B_WILL_DRAW);
|
||||
optionsTab->SetLayout(new BGroupLayout(B_VERTICAL, 0));
|
||||
|
||||
fFilesystemTranslationCheckbox = new BCheckBox("filesystemTranslation",
|
||||
B_TRANSLATE("Translate application and folder names in Deskbar and Tracker."),
|
||||
new BMessage(kMsgFilesystemTranslationChanged));
|
||||
|
||||
fFilesystemTranslationCheckbox->SetValue(
|
||||
BLocaleRoster::Default()->IsFilesystemTranslationPreferred());
|
||||
|
||||
optionsTab->AddChild(BLayoutBuilder::Group<>(B_VERTICAL)
|
||||
.Add(fFilesystemTranslationCheckbox)
|
||||
.AddGlue()
|
||||
.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
|
||||
B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING));
|
||||
|
||||
tabView->AddTab(languageTab);
|
||||
tabView->AddTab(countryTab);
|
||||
tabView->AddTab(optionsTab);
|
||||
tabView->AddTab(formattingTab);
|
||||
|
||||
BButton* button
|
||||
= new BButton(B_TRANSLATE("Defaults"), new BMessage(kMsgDefaults));
|
||||
@@ -455,8 +436,9 @@ LocaleWindow::MessageReceived(BMessage* message)
|
||||
|
||||
case kMsgFilesystemTranslationChanged:
|
||||
{
|
||||
int32 value = message->FindInt32("be:value");
|
||||
MutableLocaleRoster::Default()->SetFilesystemTranslationPreferred(
|
||||
fFilesystemTranslationCheckbox->Value());
|
||||
value == B_CONTROL_ON);
|
||||
|
||||
BAlert* alert = new BAlert(B_TRANSLATE("Locale"),
|
||||
B_TRANSLATE("Deskbar and Tracker need to be restarted for this "
|
||||
@@ -664,6 +646,4 @@ LocaleWindow::_Defaults()
|
||||
fDefaultConventionsItem));
|
||||
fConventionsListView->ScrollToSelection();
|
||||
}
|
||||
|
||||
fFilesystemTranslationCheckbox->SetValue(true);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ private:
|
||||
LanguageListItem* fInitialConventionsItem;
|
||||
LanguageListItem* fDefaultConventionsItem;
|
||||
BMessage fInitialPreferredLanguages;
|
||||
BCheckBox* fFilesystemTranslationCheckbox;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user