Laid out views to fit better on-screen. Made it use BAboutWindow and BWindow::CenterOnScreen(). Partial clean-up of code I passed by. A few obvious comments removed. Hopefully an improvement. Still needs a lot of work.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33563 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2,13 +2,14 @@ SubDir HAIKU_TOP src preferences locale ;
|
|||||||
|
|
||||||
UseLibraryHeaders icu ;
|
UseLibraryHeaders icu ;
|
||||||
UsePrivateHeaders locale ;
|
UsePrivateHeaders locale ;
|
||||||
|
UsePrivateHeaders shared ;
|
||||||
|
|
||||||
Preference Locale :
|
Preference Locale :
|
||||||
Locale.cpp
|
Locale.cpp
|
||||||
LocaleWindow.cpp
|
LocaleWindow.cpp
|
||||||
TimeFormatSettingsView.cpp
|
TimeFormatSettingsView.cpp
|
||||||
: be liblocale.so $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) libicu-common.so
|
: be liblocale.so $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) libicu-common.so
|
||||||
libicu-data.so
|
libicu-data.so libshared.a
|
||||||
: Locale.rdef
|
: Locale.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -22,3 +23,4 @@ DoCatalogs Locale # application name
|
|||||||
: # translations
|
: # translations
|
||||||
fi.catkeys fr.catkeys de.catkeys ru.catkeys sv.catkeys
|
fi.catkeys fr.catkeys de.catkeys ru.catkeys sv.catkeys
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "Locale.h"
|
#include "Locale.h"
|
||||||
#include "LocaleWindow.h"
|
#include "LocaleWindow.h"
|
||||||
|
|
||||||
|
#include <AboutWindow.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
@@ -29,14 +30,14 @@ static const uint32 kMsgLocaleSettings = 'LCst';
|
|||||||
|
|
||||||
|
|
||||||
class Settings {
|
class Settings {
|
||||||
public:
|
public:
|
||||||
Settings();
|
Settings();
|
||||||
~Settings();
|
~Settings();
|
||||||
|
|
||||||
const BMessage &Message() const { return fMessage; }
|
const BMessage& Message() const { return fMessage; }
|
||||||
void UpdateFrom(BMessage *message);
|
void UpdateFrom(BMessage *message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
status_t Open(BFile *file, int32 mode);
|
status_t Open(BFile *file, int32 mode);
|
||||||
|
|
||||||
BMessage fMessage;
|
BMessage fMessage;
|
||||||
@@ -45,22 +46,18 @@ class Settings {
|
|||||||
|
|
||||||
|
|
||||||
class LocalePreflet : public BApplication {
|
class LocalePreflet : public BApplication {
|
||||||
public:
|
public:
|
||||||
LocalePreflet();
|
LocalePreflet();
|
||||||
virtual ~LocalePreflet();
|
virtual ~LocalePreflet();
|
||||||
|
|
||||||
virtual void ReadyToRun();
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
virtual void AboutRequested();
|
virtual void AboutRequested();
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Settings fSettings;
|
Settings fSettings;
|
||||||
BWindow *fOpenWindow;
|
LocaleWindow* fLocaleWindow;
|
||||||
BRect fWindowFrame;
|
BCatalog fCatalog;
|
||||||
|
|
||||||
BCatalog cat;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -76,7 +73,6 @@ Settings::Settings()
|
|||||||
if (Open(&file, B_READ_ONLY) != B_OK
|
if (Open(&file, B_READ_ONLY) != B_OK
|
||||||
|| fMessage.Unflatten(&file) != B_OK) {
|
|| fMessage.Unflatten(&file) != B_OK) {
|
||||||
// set default prefs
|
// set default prefs
|
||||||
fMessage.AddRect("window_frame", BRect(50, 50, 550, 500));
|
|
||||||
fMessage.AddString("language", "en");
|
fMessage.AddString("language", "en");
|
||||||
fMessage.AddString("country", "en_US");
|
fMessage.AddString("country", "en_US");
|
||||||
return;
|
return;
|
||||||
@@ -86,12 +82,11 @@ Settings::Settings()
|
|||||||
|
|
||||||
Settings::~Settings()
|
Settings::~Settings()
|
||||||
{
|
{
|
||||||
// only save the settings if something has changed
|
|
||||||
if (!fUpdated)
|
if (!fUpdated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BFile file;
|
BFile file;
|
||||||
if (Open(&file, B_CREATE_FILE | B_WRITE_ONLY) != B_OK)
|
if (Open(&file, B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY) != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fMessage.Flatten(&file);
|
fMessage.Flatten(&file);
|
||||||
@@ -114,20 +109,24 @@ Settings::Open(BFile *file, int32 mode)
|
|||||||
void
|
void
|
||||||
Settings::UpdateFrom(BMessage *message)
|
Settings::UpdateFrom(BMessage *message)
|
||||||
{
|
{
|
||||||
BRect frame;
|
BPoint point;
|
||||||
if (message->FindRect("window_frame", &frame) == B_OK)
|
if (message->FindPoint("window_location", &point) == B_OK) {
|
||||||
fMessage.ReplaceRect("window_frame", frame);
|
fMessage.RemoveName("window_location");
|
||||||
|
fMessage.AddPoint("window_location", point);
|
||||||
|
}
|
||||||
|
|
||||||
BString langName;
|
BString langName;
|
||||||
// We make sure there is at least one string before erasing the previous
|
// We make sure there is at least one string before erasing the previous
|
||||||
// settings, then we add the remaining ones, if any
|
// settings, then we add the remaining ones, if any
|
||||||
if (message->FindString("language",&langName) == B_OK) {
|
if (message->FindString("language", &langName) == B_OK) {
|
||||||
// Remove any old data as we know we have newer one to replace it
|
// Remove any old data as we know we have newer one to replace it
|
||||||
fMessage.RemoveName("language");
|
fMessage.RemoveName("language");
|
||||||
for (int i = 0; message->FindString("language", i, &langName) == B_OK;
|
for (int i = 0;; i++) {
|
||||||
i++)
|
if (message->FindString("language", i, &langName) != B_OK)
|
||||||
|
break;
|
||||||
fMessage.AddString("language", langName);
|
fMessage.AddString("language", langName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (message->FindString("country",&langName) == B_OK)
|
if (message->FindString("country",&langName) == B_OK)
|
||||||
fMessage.ReplaceString("country", langName);
|
fMessage.ReplaceString("country", langName);
|
||||||
@@ -141,14 +140,19 @@ Settings::UpdateFrom(BMessage *message)
|
|||||||
|
|
||||||
|
|
||||||
LocalePreflet::LocalePreflet()
|
LocalePreflet::LocalePreflet()
|
||||||
: BApplication(kSignature)
|
:
|
||||||
|
BApplication(kSignature)
|
||||||
{
|
{
|
||||||
fWindowFrame = fSettings.Message().FindRect("window_frame");
|
be_locale->GetAppCatalog(&fCatalog);
|
||||||
|
|
||||||
be_locale -> GetAppCatalog(&cat);
|
fLocaleWindow = new LocaleWindow();
|
||||||
|
|
||||||
BWindow* window = new LocaleWindow(fWindowFrame);
|
if (fSettings.Message().HasPoint("window_location")) {
|
||||||
window->Show();
|
BPoint point = fSettings.Message().FindPoint("window_location");
|
||||||
|
fLocaleWindow->MoveTo(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
fLocaleWindow->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -157,18 +161,6 @@ LocalePreflet::~LocalePreflet()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
LocalePreflet::ReadyToRun()
|
|
||||||
{
|
|
||||||
// are there already windows open?
|
|
||||||
if (CountWindows() != 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// if not, ask the user to open a file
|
|
||||||
PostMessage(kMsgOpenOpenWindow);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LocalePreflet::MessageReceived(BMessage *message)
|
LocalePreflet::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
@@ -187,20 +179,11 @@ LocalePreflet::MessageReceived(BMessage *message)
|
|||||||
void
|
void
|
||||||
LocalePreflet::AboutRequested()
|
LocalePreflet::AboutRequested()
|
||||||
{
|
{
|
||||||
BAlert *alert = new BAlert("about", TR("Locale\n"
|
const char* authors[3];
|
||||||
"\twritten by Axel Dörfler\n"
|
authors[0] = "Axel Dörfler";
|
||||||
"\tCopyright 2005, Haiku.\n\n"), "Ok");
|
authors[1] = "Adrien Destugues";
|
||||||
BTextView *view = alert->TextView();
|
authors[2] = NULL;
|
||||||
BFont font;
|
(new BAboutWindow("Locale", 2005, authors))->Show();
|
||||||
|
|
||||||
view->SetStylable(true);
|
|
||||||
|
|
||||||
view->GetFont(&font);
|
|
||||||
font.SetSize(18);
|
|
||||||
font.SetFace(B_BOLD_FACE);
|
|
||||||
view->SetFontAndColor(0, 7, &font);
|
|
||||||
|
|
||||||
alert->Go();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -218,7 +201,7 @@ int
|
|||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
LocalePreflet app;
|
LocalePreflet app;
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2005-2009, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef LOCALE_H
|
#ifndef LOCALE_H
|
||||||
#define LOCALE_H
|
#define LOCALE_H
|
||||||
@@ -9,17 +9,11 @@
|
|||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
extern const char *kSignature;
|
extern const char* kSignature;
|
||||||
|
|
||||||
static const uint32 kMsgOpenFilePanel = 'opFp';
|
|
||||||
static const uint32 kMsgOpenOpenWindow = 'opOw';
|
|
||||||
static const uint32 kMsgOpenWindowClosed = 'clOw';
|
|
||||||
static const uint32 kMsgWindowClosed = 'WiCl';
|
|
||||||
static const uint32 kMsgSettingsChanged = 'SeCh';
|
static const uint32 kMsgSettingsChanged = 'SeCh';
|
||||||
|
static const uint32 kMsgSelectLanguage = 'slng';
|
||||||
static const uint32 kMsgOpenFindWindow = 'OpFw';
|
static const uint32 kMsgDefaults = 'dflt';
|
||||||
static const uint32 kMsgFindWindowClosed = 'clFw';
|
static const uint32 kMsgRevert = 'revt';
|
||||||
static const uint32 kMsgFindTarget = 'FTgt';
|
|
||||||
static const uint32 kMsgFind = 'find';
|
|
||||||
|
|
||||||
#endif /* LOCALE_H */
|
#endif /* LOCALE_H */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2005-2009, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <GroupLayout.h>
|
#include <GroupLayout.h>
|
||||||
#include <GroupLayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
#include <ListView.h>
|
#include <ListView.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <LocaleRoster.h>
|
#include <LocaleRoster.h>
|
||||||
@@ -35,52 +35,25 @@
|
|||||||
#define ALPHA 170
|
#define ALPHA 170
|
||||||
#define TEXT_OFFSET 5.0
|
#define TEXT_OFFSET 5.0
|
||||||
|
|
||||||
// Language lists management
|
|
||||||
|
|
||||||
|
|
||||||
// This is a language item. It's a BStringItem but we also want to keep the
|
|
||||||
// language code and not only the displayName
|
|
||||||
class LanguageListItem: public BStringItem
|
class LanguageListItem: public BStringItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LanguageListItem(const char* display, const char* code)
|
LanguageListItem(const char* text, const char* code)
|
||||||
: BStringItem(display)
|
:
|
||||||
, LanguageCode(code)
|
BStringItem(text),
|
||||||
|
fLanguageCode(code)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~LanguageListItem() {};
|
~LanguageListItem() {};
|
||||||
|
|
||||||
const inline BString getLanguageCode() { return LanguageCode; }
|
const inline BString LanguageCode() { return fLanguageCode; }
|
||||||
void Draw(BView *owner, BRect frame);
|
|
||||||
private:
|
private:
|
||||||
const BString LanguageCode;
|
const BString fLanguageCode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
LanguageListItem::Draw(BView *owner, BRect frame)
|
|
||||||
{
|
|
||||||
owner->SetLowColor(255, 255, 255, 255);
|
|
||||||
owner->FillRect(frame, B_SOLID_LOW);
|
|
||||||
// label
|
|
||||||
owner->SetHighColor(0, 0, 0, 255);
|
|
||||||
font_height fh;
|
|
||||||
owner->GetFontHeight(&fh);
|
|
||||||
const char* text = Text();
|
|
||||||
BString truncatedString(text);
|
|
||||||
owner->TruncateString(&truncatedString, B_TRUNCATE_MIDDLE,
|
|
||||||
frame.Width() - TEXT_OFFSET - 4.0);
|
|
||||||
float height = frame.Height();
|
|
||||||
float textHeight = fh.ascent + fh.descent;
|
|
||||||
BPoint textPoint;
|
|
||||||
textPoint.x = frame.left + TEXT_OFFSET;
|
|
||||||
textPoint.y = frame.top
|
|
||||||
+ ceilf(height / 2.0 - textHeight / 2.0 + fh.ascent);
|
|
||||||
owner->DrawString(truncatedString.String(), textPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// This is a language list. Basically, a drag-n-drop enabled list.
|
|
||||||
class LanguageListView: public BListView
|
class LanguageListView: public BListView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -107,7 +80,6 @@ class LanguageListView: public BListView
|
|||||||
if (fDropIndex < 0 || fDropIndex > count)
|
if (fDropIndex < 0 || fDropIndex > count)
|
||||||
fDropIndex = count;
|
fDropIndex = count;
|
||||||
|
|
||||||
// gather all the items from the BMessage
|
|
||||||
BList items;
|
BList items;
|
||||||
int32 index;
|
int32 index;
|
||||||
for (int32 i = 0; message->FindInt32("index", i, &index)
|
for (int32 i = 0; message->FindInt32("index", i, &index)
|
||||||
@@ -115,7 +87,6 @@ class LanguageListView: public BListView
|
|||||||
if (BListItem* item = ItemAt(index))
|
if (BListItem* item = ItemAt(index))
|
||||||
items.AddItem((void*)item);
|
items.AddItem((void*)item);
|
||||||
|
|
||||||
// handle them
|
|
||||||
if (items.CountItems() > 0) {
|
if (items.CountItems() > 0) {
|
||||||
MoveItems(items, fDropIndex);
|
MoveItems(items, fDropIndex);
|
||||||
}
|
}
|
||||||
@@ -125,7 +96,6 @@ class LanguageListView: public BListView
|
|||||||
if (fDropIndex < 0 || fDropIndex > count)
|
if (fDropIndex < 0 || fDropIndex > count)
|
||||||
fDropIndex = count;
|
fDropIndex = count;
|
||||||
|
|
||||||
// gather all the items from the BMessage
|
|
||||||
int32 index;
|
int32 index;
|
||||||
for (int32 i = 0; message->FindInt32("index", i, &index)
|
for (int32 i = 0; message->FindInt32("index", i, &index)
|
||||||
== B_OK; i++)
|
== B_OK; i++)
|
||||||
@@ -224,7 +194,7 @@ LanguageListView::InitiateDrag(BPoint point, int32 index, bool)
|
|||||||
itemBounds.bottom = itemBounds.top + ceilf(item->Height());
|
itemBounds.bottom = itemBounds.top + ceilf(item->Height());
|
||||||
if (itemBounds.bottom > dragRect.bottom)
|
if (itemBounds.bottom > dragRect.bottom)
|
||||||
itemBounds.bottom = dragRect.bottom;
|
itemBounds.bottom = dragRect.bottom;
|
||||||
item->Draw(v, itemBounds);
|
item->DrawItem(v, itemBounds);
|
||||||
itemBounds.top = itemBounds.bottom + 1.0;
|
itemBounds.top = itemBounds.bottom + 1.0;
|
||||||
}
|
}
|
||||||
// make a black frame arround the edge
|
// make a black frame arround the edge
|
||||||
@@ -324,40 +294,31 @@ LanguageListView::MouseMoved(BPoint where, uint32 transit, const BMessage *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const static uint32 kMsgSelectLanguage = 'slng';
|
LocaleWindow::LocaleWindow()
|
||||||
const static uint32 kMsgDefaults = 'dflt';
|
:
|
||||||
const static uint32 kMsgRevert = 'revt';
|
BWindow(BRect(0, 0, 0, 0), "Locale", B_TITLED_WINDOW, B_NOT_RESIZABLE
|
||||||
|
| B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
|
||||||
|
|
||||||
LocaleWindow::LocaleWindow(BRect rect)
|
|
||||||
: BWindow(rect, "Locale", B_TITLED_WINDOW,
|
|
||||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
|
|
||||||
| B_AUTO_UPDATE_SIZE_LIMITS)
|
|
||||||
{
|
{
|
||||||
|
BCountry* defaultCountry;
|
||||||
|
be_locale_roster->GetDefaultCountry(&defaultCountry);
|
||||||
|
|
||||||
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||||
|
|
||||||
// Buttons at the bottom
|
BButton* button = new BButton(TR("Defaults"), new BMessage(kMsgDefaults));
|
||||||
|
|
||||||
BButton *button = new BButton(TR("Defaults"), new BMessage(kMsgDefaults));
|
|
||||||
|
|
||||||
fRevertButton = new BButton(TR("Revert"), new BMessage(kMsgRevert));
|
fRevertButton = new BButton(TR("Revert"), new BMessage(kMsgRevert));
|
||||||
fRevertButton->SetEnabled(false);
|
fRevertButton->SetEnabled(false);
|
||||||
|
|
||||||
// Tabs
|
BTabView* tabView = new BTabView("tabview");
|
||||||
BTabView *tabView = new BTabView("tabview");
|
|
||||||
|
|
||||||
// Language tab
|
BView* languageTab = new BView(TR("Language"), B_WILL_DRAW);
|
||||||
BView *tab = new BView(TR("Language"), B_WILL_DRAW);
|
languageTab->SetLayout(new BGroupLayout(B_VERTICAL, 0));
|
||||||
//tab->SetViewColor(tabView->ViewColor());
|
|
||||||
tab->SetLayout(new BGroupLayout(B_VERTICAL, 0));
|
|
||||||
tabView->AddTab(tab);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// first list: available languages
|
// first list: available languages
|
||||||
LanguageListView *listView = new LanguageListView("available",
|
LanguageListView *listView = new LanguageListView("available",
|
||||||
B_MULTIPLE_SELECTION_LIST);
|
B_MULTIPLE_SELECTION_LIST);
|
||||||
BScrollView *scrollView = new BScrollView("scroller", listView,
|
BScrollView *scrollView = new BScrollView("scroller", listView,
|
||||||
0, false, true, B_FANCY_BORDER);
|
B_WILL_DRAW | B_FRAME_EVENTS, false, true);
|
||||||
|
|
||||||
// Fill the language list from the LocaleRoster data
|
// Fill the language list from the LocaleRoster data
|
||||||
BMessage installedLanguages;
|
BMessage installedLanguages;
|
||||||
@@ -395,7 +356,7 @@ LocaleWindow::LocaleWindow(BRect rect)
|
|||||||
fPreferredListView = new LanguageListView("preferred",
|
fPreferredListView = new LanguageListView("preferred",
|
||||||
B_MULTIPLE_SELECTION_LIST);
|
B_MULTIPLE_SELECTION_LIST);
|
||||||
BScrollView *scrollViewEnabled = new BScrollView("scroller",
|
BScrollView *scrollViewEnabled = new BScrollView("scroller",
|
||||||
fPreferredListView, 0, false, true, B_FANCY_BORDER);
|
fPreferredListView, B_WILL_DRAW | B_FRAME_EVENTS, false, true);
|
||||||
|
|
||||||
// get the preferred languages from the Settings. Move them here from
|
// get the preferred languages from the Settings. Move them here from
|
||||||
// the other list.
|
// the other list.
|
||||||
@@ -408,49 +369,41 @@ LocaleWindow::LocaleWindow(BRect rect)
|
|||||||
for (int listPos = 0; LanguageListItem* lli
|
for (int listPos = 0; LanguageListItem* lli
|
||||||
= static_cast<LanguageListItem*>(listView->ItemAt(listPos));
|
= static_cast<LanguageListItem*>(listView->ItemAt(listPos));
|
||||||
listPos++) {
|
listPos++) {
|
||||||
if (langCode == lli->getLanguageCode()) {
|
if (langCode == lli->LanguageCode()) {
|
||||||
fPreferredListView->AddItem(lli);
|
fPreferredListView->AddItem(lli);
|
||||||
listView->RemoveItem(lli);
|
listView->RemoveItem(lli);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tab->AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10)
|
languageTab->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 10)
|
||||||
.Add(BGroupLayoutBuilder(B_VERTICAL, 10)
|
.AddGroup(B_VERTICAL, 10)
|
||||||
.Add(new BStringView("", TR("Available languages")))
|
.Add(new BStringView("", TR("Available languages")))
|
||||||
.Add(scrollView)
|
.Add(scrollView)
|
||||||
)
|
.End()
|
||||||
.Add(BGroupLayoutBuilder(B_VERTICAL, 10)
|
.AddGroup(B_VERTICAL, 10)
|
||||||
.Add(new BStringView("", TR("Preferred languages")))
|
.Add(new BStringView("", TR("Preferred languages")))
|
||||||
.Add(scrollViewEnabled)
|
.Add(scrollViewEnabled)
|
||||||
)
|
.End()
|
||||||
);
|
.View());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Country tab
|
BView* countryTab = new BView(TR("Country"), B_WILL_DRAW);
|
||||||
tab = new BView(TR("Country"), B_WILL_DRAW);
|
countryTab->SetLayout(new BGroupLayout(B_VERTICAL, 0));
|
||||||
//tab->SetViewColor(tabView->ViewColor());
|
|
||||||
tab->SetLayout(new BGroupLayout(B_VERTICAL, 0));
|
|
||||||
tabView->AddTab(tab);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
BListView* listView = new BListView("country", B_SINGLE_SELECTION_LIST);
|
BListView* listView = new BListView("country", B_SINGLE_SELECTION_LIST);
|
||||||
BScrollView *scrollView = new BScrollView("scroller",
|
BScrollView *scrollView = new BScrollView("scroller",
|
||||||
listView, 0, false, true, B_FANCY_BORDER);
|
listView, B_WILL_DRAW | B_FRAME_EVENTS, false, true);
|
||||||
|
|
||||||
BMessage* msg = new BMessage('csel');
|
BMessage* msg = new BMessage('csel');
|
||||||
listView->SetSelectionMessage(msg);
|
listView->SetSelectionMessage(msg);
|
||||||
|
|
||||||
|
|
||||||
// get all available countries from ICU
|
// get all available countries from ICU
|
||||||
// Use DateFormat::getAvailableLocale so we get only the one we can
|
// Use DateFormat::getAvailableLocale so we get only the one we can
|
||||||
// use. Maybe check the NumberFormat one and see if there is more.
|
// use. Maybe check the NumberFormat one and see if there is more.
|
||||||
int32_t localeCount;
|
int32_t localeCount;
|
||||||
const Locale* currentLocale
|
const Locale* currentLocale
|
||||||
= Locale::getAvailableLocales(localeCount);
|
= Locale::getAvailableLocales(localeCount);
|
||||||
BCountry* defaultCountry;
|
|
||||||
be_locale_roster->GetDefaultCountry(&defaultCountry);
|
|
||||||
|
|
||||||
for (int index = 0; index < localeCount; index++)
|
for (int index = 0; index < localeCount; index++)
|
||||||
{
|
{
|
||||||
@@ -467,41 +420,37 @@ LocaleWindow::LocaleWindow(BRect rect)
|
|||||||
listView->Select(listView->CountItems() - 1);
|
listView->Select(listView->CountItems() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fTimeFormatSettings
|
// TODO: find a real solution intead of this hack
|
||||||
= new TimeFormatSettingsView(defaultCountry);
|
listView->SetExplicitMinSize(BSize(300, B_SIZE_UNSET));
|
||||||
|
|
||||||
tab->AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 5)
|
fTimeFormatSettings = new TimeFormatSettingsView(defaultCountry);
|
||||||
|
|
||||||
|
countryTab->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 5)
|
||||||
|
.AddGroup(B_VERTICAL, 3)
|
||||||
.Add(scrollView)
|
.Add(scrollView)
|
||||||
.Add(new BScrollView("advanced", fTimeFormatSettings, 0,
|
.End()
|
||||||
false, true, B_NO_BORDER))
|
.Add(fTimeFormatSettings)
|
||||||
|
.View()
|
||||||
);
|
);
|
||||||
|
|
||||||
listView->ScrollToSelection();
|
listView->ScrollToSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the window is on screen
|
tabView->AddTab(languageTab);
|
||||||
rect = BScreen().Frame();
|
tabView->AddTab(countryTab);
|
||||||
rect.right -= 20;
|
|
||||||
rect.bottom -= 20;
|
|
||||||
|
|
||||||
BPoint position = Frame().LeftTop();
|
BLayoutBuilder::Group<>(this)
|
||||||
if (!rect.Contains(position)) {
|
.AddGroup(B_VERTICAL, 3)
|
||||||
// center window on screen as it doesn't fit on the saved position
|
|
||||||
position.x = (rect.Width() - Bounds().Width()) / 2;
|
|
||||||
position.y = (rect.Height() - Bounds().Height()) / 2;
|
|
||||||
}
|
|
||||||
MoveTo(position);
|
|
||||||
|
|
||||||
// Layout management
|
|
||||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 3)
|
|
||||||
.Add(tabView)
|
.Add(tabView)
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(button)
|
.Add(button)
|
||||||
.Add(fRevertButton)
|
.Add(fRevertButton)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
)
|
.End()
|
||||||
.SetInsets(5, 5, 5, 5)
|
.SetInsets(5, 5, 5, 5)
|
||||||
);
|
.End();
|
||||||
|
|
||||||
|
CenterOnScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -509,11 +458,11 @@ bool
|
|||||||
LocaleWindow::QuitRequested()
|
LocaleWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
BMessage update(kMsgSettingsChanged);
|
BMessage update(kMsgSettingsChanged);
|
||||||
update.AddRect("window_frame", Frame());
|
update.AddPoint("window_location", Frame().LeftTop());
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while (index < fPreferredListView->CountItems()) {
|
while (index < fPreferredListView->CountItems()) {
|
||||||
update.AddString("language", static_cast<LanguageListItem*>
|
update.AddString("language", static_cast<LanguageListItem*>
|
||||||
(fPreferredListView->ItemAt(index))->getLanguageCode());
|
(fPreferredListView->ItemAt(index))->LanguageCode());
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
// TODO also save Country tab settings
|
// TODO also save Country tab settings
|
||||||
@@ -547,10 +496,10 @@ LocaleWindow::MessageReceived(BMessage *message)
|
|||||||
LanguageListItem* lli = static_cast<LanguageListItem*>
|
LanguageListItem* lli = static_cast<LanguageListItem*>
|
||||||
(countryList->ItemAt(countryList->CurrentSelection()));
|
(countryList->ItemAt(countryList->CurrentSelection()));
|
||||||
BMessage* newMessage = new BMessage(kMsgSettingsChanged);
|
BMessage* newMessage = new BMessage(kMsgSettingsChanged);
|
||||||
newMessage->AddString("country",lli->getLanguageCode());
|
newMessage->AddString("country",lli->LanguageCode());
|
||||||
be_app_messenger.SendMessage(newMessage);
|
be_app_messenger.SendMessage(newMessage);
|
||||||
|
|
||||||
BCountry* country = new BCountry(lli->getLanguageCode());
|
BCountry* country = new BCountry(lli->LanguageCode());
|
||||||
fTimeFormatSettings->SetCountry(country);
|
fTimeFormatSettings->SetCountry(country);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class TimeFormatSettingsView;
|
|||||||
|
|
||||||
class LocaleWindow : public BWindow {
|
class LocaleWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
LocaleWindow(BRect rect);
|
LocaleWindow();
|
||||||
|
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
#include "TimeFormatSettingsView.h"
|
#include "TimeFormatSettingsView.h"
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Box.h>
|
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
#include <Country.h>
|
#include <Country.h>
|
||||||
#include <GroupLayout.h>
|
#include <GroupLayout.h>
|
||||||
#include <GroupLayoutBuilder.h>
|
#include <GroupLayoutBuilder.h>
|
||||||
|
#include <LayoutBuilder.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <LocaleRoster.h>
|
#include <LocaleRoster.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
@@ -39,8 +39,8 @@ BMessage*
|
|||||||
MenuMessage(const char* format, BMenuField* field)
|
MenuMessage(const char* format, BMenuField* field)
|
||||||
{
|
{
|
||||||
BMessage* msg = new BMessage('FRMT');
|
BMessage* msg = new BMessage('FRMT');
|
||||||
msg->AddPointer("dest",field);
|
msg->AddPointer("dest", field);
|
||||||
msg->AddString("format",format);
|
msg->AddString("format", format);
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
@@ -116,26 +116,22 @@ CreateDateMenu(BMenuField** field, bool longFormat = true)
|
|||||||
|
|
||||||
|
|
||||||
TimeFormatSettingsView::TimeFormatSettingsView(BCountry* country)
|
TimeFormatSettingsView::TimeFormatSettingsView(BCountry* country)
|
||||||
: BView("WindowsSettingsView", 0)
|
:
|
||||||
, fCountry(country)
|
BView("WindowsSettingsView", B_FRAME_EVENTS),
|
||||||
|
fCountry(country)
|
||||||
{
|
{
|
||||||
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||||
|
|
||||||
// Date
|
|
||||||
BSeparatorView* dateHeader = new BSeparatorView(TR("Date"));
|
|
||||||
|
|
||||||
// Long format
|
|
||||||
fLongDateExampleView = new BStringView("", "");
|
fLongDateExampleView = new BStringView("", "");
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
CreateDateMenu(&fLongDateMenu[i]);
|
CreateDateMenu(&fLongDateMenu[i]);
|
||||||
fLongDateSeparator[i] = new BTextControl("","","",
|
fLongDateSeparator[i] = new BTextControl("", "", "",
|
||||||
new BMessage(kSettingsContentsModified));
|
new BMessage(kSettingsContentsModified));
|
||||||
fLongDateSeparator[i]->SetModificationMessage(
|
fLongDateSeparator[i]->SetModificationMessage(
|
||||||
new BMessage(kSettingsContentsModified));
|
new BMessage(kSettingsContentsModified));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Short format
|
|
||||||
fShortDateExampleView = new BStringView("", "");
|
fShortDateExampleView = new BStringView("", "");
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
@@ -154,9 +150,6 @@ TimeFormatSettingsView::TimeFormatSettingsView(BCountry* country)
|
|||||||
|
|
||||||
fSeparatorMenuField = new BMenuField(TR("Separator:"), menu);
|
fSeparatorMenuField = new BMenuField(TR("Separator:"), menu);
|
||||||
|
|
||||||
// Time
|
|
||||||
BSeparatorView* timeHeader = new BSeparatorView(TR("Time"));
|
|
||||||
|
|
||||||
BBox *clockBox = new BBox("Clock");
|
BBox *clockBox = new BBox("Clock");
|
||||||
clockBox->SetLabel(TR("Clock"));
|
clockBox->SetLabel(TR("Clock"));
|
||||||
|
|
||||||
@@ -177,9 +170,6 @@ TimeFormatSettingsView::TimeFormatSettingsView(BCountry* country)
|
|||||||
fLongTimeExampleView = new BStringView("", "");
|
fLongTimeExampleView = new BStringView("", "");
|
||||||
fShortTimeExampleView = new BStringView("", "");
|
fShortTimeExampleView = new BStringView("", "");
|
||||||
|
|
||||||
// Numbers
|
|
||||||
BSeparatorView* numberHeader = new BSeparatorView(TR("Numbers"));
|
|
||||||
|
|
||||||
fNumberFormatExampleView = new BStringView("", "");
|
fNumberFormatExampleView = new BStringView("", "");
|
||||||
|
|
||||||
BTextControl* numberThousand = new BTextControl("",
|
BTextControl* numberThousand = new BTextControl("",
|
||||||
@@ -193,8 +183,6 @@ TimeFormatSettingsView::TimeFormatSettingsView(BCountry* country)
|
|||||||
new BMessage(kSettingsContentsModified));
|
new BMessage(kSettingsContentsModified));
|
||||||
// Unit system (US/Metric) (radio)
|
// Unit system (US/Metric) (radio)
|
||||||
|
|
||||||
// Currency
|
|
||||||
BSeparatorView* currencyHeader = new BSeparatorView(TR("Currency"));
|
|
||||||
BTextControl* currencySymbol = new BTextControl("", TR("Currency symbol:"),
|
BTextControl* currencySymbol = new BTextControl("", TR("Currency symbol:"),
|
||||||
"", new BMessage(kSettingsContentsModified));
|
"", new BMessage(kSettingsContentsModified));
|
||||||
menu = new BPopUpMenu(TR("Negative marker"));
|
menu = new BPopUpMenu(TR("Negative marker"));
|
||||||
@@ -228,76 +216,120 @@ TimeFormatSettingsView::TimeFormatSettingsView(BCountry* country)
|
|||||||
_UpdateExamples();
|
_UpdateExamples();
|
||||||
_ParseDateFormat();
|
_ParseDateFormat();
|
||||||
|
|
||||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 5)
|
fDateBox = new BBox(TR("Date"));
|
||||||
.Add(dateHeader)
|
fTimeBox = new BBox(TR("Time"));
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
fNumbersBox = new BBox(TR("Numbers"));
|
||||||
|
fCurrencyBox = new BBox(TR("Currency"));
|
||||||
|
|
||||||
|
fDateBox->SetLabel(TR("Date"));
|
||||||
|
fTimeBox->SetLabel(TR("Time"));
|
||||||
|
fNumbersBox->SetLabel(TR("Numbers"));
|
||||||
|
fCurrencyBox->SetLabel(TR("Currency"));
|
||||||
|
|
||||||
|
fDateBox->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 5)
|
||||||
|
.AddGroup(B_VERTICAL, 5)
|
||||||
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(new BStringView("",TR("Long format:")))
|
.Add(new BStringView("",TR("Long format:")))
|
||||||
.Add(fLongDateExampleView)
|
.Add(fLongDateExampleView)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
)
|
.End()
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(fLongDateMenu[0])
|
.Add(fLongDateMenu[0])
|
||||||
.Add(fLongDateSeparator[0])
|
.Add(fLongDateSeparator[0])
|
||||||
)
|
.End()
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(fLongDateMenu[1])
|
.Add(fLongDateMenu[1])
|
||||||
.Add(fLongDateSeparator[1])
|
.Add(fLongDateSeparator[1])
|
||||||
)
|
.End()
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(fLongDateMenu[2])
|
.Add(fLongDateMenu[2])
|
||||||
.Add(fLongDateSeparator[2])
|
.Add(fLongDateSeparator[2])
|
||||||
)
|
.End()
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(fLongDateMenu[3])
|
.Add(fLongDateMenu[3])
|
||||||
.Add(fLongDateSeparator[3])
|
.Add(fLongDateSeparator[3])
|
||||||
)
|
.End()
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(new BStringView("",TR("Short format:")))
|
.Add(new BStringView("",TR("Short format:")))
|
||||||
.Add(fShortDateExampleView)
|
.Add(fShortDateExampleView)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
)
|
.End()
|
||||||
.Add(fDateMenu[0])
|
.Add(fDateMenu[0])
|
||||||
.Add(fDateMenu[1])
|
.Add(fDateMenu[1])
|
||||||
.Add(fDateMenu[2])
|
.Add(fDateMenu[2])
|
||||||
.Add(fSeparatorMenuField)
|
.End()
|
||||||
|
.SetInsets(5, 5, 5, 5)
|
||||||
|
.View()
|
||||||
|
);
|
||||||
|
|
||||||
.Add(timeHeader)
|
fTimeBox->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 5)
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_VERTICAL, 5)
|
||||||
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(new BStringView("",TR("Long format:")))
|
.Add(new BStringView("",TR("Long format:")))
|
||||||
.Add(fLongTimeExampleView)
|
.Add(fLongTimeExampleView)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
)
|
.End()
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(new BStringView("",TR("Short format:")))
|
.Add(new BStringView("",TR("Short format:")))
|
||||||
.Add(fShortTimeExampleView)
|
.Add(fShortTimeExampleView)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
)
|
.End()
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(clockBox)
|
.Add(clockBox)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
)
|
.End()
|
||||||
|
.AddGlue()
|
||||||
|
.End()
|
||||||
|
.SetInsets(5, 5, 5, 5)
|
||||||
|
.View()
|
||||||
|
);
|
||||||
|
|
||||||
.Add(numberHeader)
|
fNumbersBox->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 5)
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_VERTICAL, 5)
|
||||||
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(new BStringView("",TR("Example:")))
|
.Add(new BStringView("",TR("Example:")))
|
||||||
.Add(fNumberFormatExampleView)
|
.Add(fNumberFormatExampleView)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
)
|
.End()
|
||||||
.Add(numberThousand)
|
.Add(numberThousand)
|
||||||
.Add(numberDecimal)
|
.Add(numberDecimal)
|
||||||
.Add(numberLeadingZero)
|
.Add(numberLeadingZero)
|
||||||
.Add(numberList)
|
.Add(numberList)
|
||||||
|
.AddGlue()
|
||||||
|
.End()
|
||||||
|
.SetInsets(5, 5, 5, 5)
|
||||||
|
.View()
|
||||||
|
);
|
||||||
|
|
||||||
.Add(currencyHeader)
|
fCurrencyBox->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 5)
|
||||||
|
.AddGroup(B_VERTICAL, 5)
|
||||||
.Add(currencySymbol)
|
.Add(currencySymbol)
|
||||||
.Add(currencyNegative)
|
.Add(currencyNegative)
|
||||||
.Add(currencyDecimal)
|
.Add(currencyDecimal)
|
||||||
.Add(currencyLeadingZero)
|
.Add(currencyLeadingZero)
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 3)
|
.AddGroup(B_HORIZONTAL, 3)
|
||||||
.Add(formatBox)
|
.Add(formatBox)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
)
|
.End()
|
||||||
|
.AddGlue()
|
||||||
|
.End()
|
||||||
.SetInsets(5, 5, 5, 5)
|
.SetInsets(5, 5, 5, 5)
|
||||||
|
.View()
|
||||||
|
);
|
||||||
|
|
||||||
|
AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 5)
|
||||||
|
.AddGroup(B_VERTICAL, 5)
|
||||||
|
.Add(fDateBox)
|
||||||
|
.Add(fTimeBox)
|
||||||
|
.AddGlue()
|
||||||
|
.End()
|
||||||
|
.AddGroup(B_VERTICAL, 5)
|
||||||
|
.Add(fNumbersBox)
|
||||||
|
.Add(fCurrencyBox)
|
||||||
|
.AddGlue()
|
||||||
|
.End()
|
||||||
|
.SetInsets(5, 5, 5, 5)
|
||||||
|
.View()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,7 +501,7 @@ TimeFormatSettingsView::_UpdateLongDateFormatString()
|
|||||||
newDateFormat.Append(fDateString[2]);
|
newDateFormat.Append(fDateString[2]);
|
||||||
|
|
||||||
// TODO save this in the settings preflet and make the roster load it back
|
// TODO save this in the settings preflet and make the roster load it back
|
||||||
fCountry->SetDateFormat(newDateFormat.String(),false);
|
fCountry->SetDateFormat(newDateFormat.String(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -689,4 +721,3 @@ TimeFormatSettingsView::_UpdateExamples()
|
|||||||
fNumberFormatExampleView->SetText(u_errorName((UErrorCode)Error));
|
fNumberFormatExampleView->SetText(u_errorName((UErrorCode)Error));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2009, Adrien Destugues, [email protected]. All rights reserved.
|
* Copyright 2009, Adrien Destugues, [email protected]. All rights reserved.
|
||||||
** Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __TIMEFORMATSETTINGS_H__
|
#ifndef __TIMEFORMATSETTINGS_H__
|
||||||
#define __TIMEFORMATSETTINGS_H__
|
#define __TIMEFORMATSETTINGS_H__
|
||||||
|
|
||||||
|
|
||||||
|
#include <Box.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ const uint32 kSettingsContentsModified = 'Scmo';
|
|||||||
|
|
||||||
|
|
||||||
class TimeFormatSettingsView : public BView {
|
class TimeFormatSettingsView : public BView {
|
||||||
public:
|
public:
|
||||||
TimeFormatSettingsView(BCountry* country);
|
TimeFormatSettingsView(BCountry* country);
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
@@ -47,27 +46,27 @@ class TimeFormatSettingsView : public BView {
|
|||||||
virtual void RecordRevertSettings();
|
virtual void RecordRevertSettings();
|
||||||
virtual bool IsRevertable() const;
|
virtual bool IsRevertable() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _UpdateExamples();
|
void _UpdateExamples();
|
||||||
void _SendNotices();
|
void _SendNotices();
|
||||||
void _ParseDateFormat();
|
void _ParseDateFormat();
|
||||||
void _UpdateLongDateFormatString();
|
void _UpdateLongDateFormatString();
|
||||||
|
|
||||||
BRadioButton *f24HrRadioButton;
|
BRadioButton* f24HrRadioButton;
|
||||||
BRadioButton *f12HrRadioButton;
|
BRadioButton* f12HrRadioButton;
|
||||||
|
|
||||||
BMenuField *fLongDateMenu[4];
|
BMenuField* fLongDateMenu[4];
|
||||||
BString fLongDateString[4];
|
BString fLongDateString[4];
|
||||||
BTextControl* fLongDateSeparator[4];
|
BTextControl* fLongDateSeparator[4];
|
||||||
BMenuField *fDateMenu[3];
|
BMenuField* fDateMenu[3];
|
||||||
BString fDateString[3];
|
BString fDateString[3];
|
||||||
|
|
||||||
BMenuField *fSeparatorMenuField;
|
BMenuField* fSeparatorMenuField;
|
||||||
|
|
||||||
BStringView *fLongDateExampleView;
|
BStringView* fLongDateExampleView;
|
||||||
BStringView *fShortDateExampleView;
|
BStringView* fShortDateExampleView;
|
||||||
BStringView *fLongTimeExampleView;
|
BStringView* fLongTimeExampleView;
|
||||||
BStringView *fShortTimeExampleView;
|
BStringView* fShortTimeExampleView;
|
||||||
BStringView* fNumberFormatExampleView;
|
BStringView* fNumberFormatExampleView;
|
||||||
|
|
||||||
bool f24HrClock;
|
bool f24HrClock;
|
||||||
@@ -77,8 +76,14 @@ class TimeFormatSettingsView : public BView {
|
|||||||
|
|
||||||
BCountry* fCountry;
|
BCountry* fCountry;
|
||||||
|
|
||||||
|
BBox* fDateBox;
|
||||||
|
BBox* fTimeBox;
|
||||||
|
BBox* fNumbersBox;
|
||||||
|
BBox* fCurrencyBox;
|
||||||
|
|
||||||
typedef BView _inherited;
|
typedef BView _inherited;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user