Patch by Jorma Karvonnen : localize BaseTranslator. Thanks !
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37462 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -32,8 +32,16 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <Locale.h>
|
||||
|
||||
#include "BaseTranslator.h"
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "BaseTranslator"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Constructor
|
||||
//
|
||||
@@ -53,17 +61,21 @@ BaseTranslator::BaseTranslator(const char *name, const char *info,
|
||||
int32 inCount, const translation_format *outFormats, int32 outCount,
|
||||
const char *settingsFile, TranSetting *defaults, int32 defCount,
|
||||
uint32 tranGroup, uint32 tranType)
|
||||
: BTranslator()
|
||||
:
|
||||
BTranslator()
|
||||
{
|
||||
const char* _name = NULL;
|
||||
const char* _info = NULL;
|
||||
|
||||
fSettings = new TranslatorSettings(settingsFile, defaults, defCount);
|
||||
fSettings->LoadSettings();
|
||||
// load settings from the Base Translator settings file
|
||||
|
||||
fVersion = version;
|
||||
fName = new char[strlen(name) + 1];
|
||||
strcpy(fName, name);
|
||||
fInfo = new char[strlen(info) + 41];
|
||||
sprintf(fInfo, "%s v%d.%d.%d %s", info,
|
||||
fName = new char[strlen(_name) + 1];
|
||||
strcpy(fName, _name);
|
||||
fInfo = new char[strlen(_info) + 41];
|
||||
sprintf(fInfo, "%s v%d.%d.%d %s", _info,
|
||||
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(fVersion)),
|
||||
static_cast<int>(B_TRANSLATION_MINOR_VERSION(fVersion)),
|
||||
static_cast<int>(B_TRANSLATION_REVISION_VERSION(fVersion)),
|
||||
@@ -77,6 +89,7 @@ BaseTranslator::BaseTranslator(const char *name, const char *info,
|
||||
fTranType = tranType;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Destructor
|
||||
//
|
||||
@@ -100,6 +113,7 @@ BaseTranslator::~BaseTranslator()
|
||||
delete[] fInfo;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// TranslatorName
|
||||
//
|
||||
@@ -119,6 +133,7 @@ BaseTranslator::TranslatorName() const
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// TranslatorInfo
|
||||
//
|
||||
@@ -139,6 +154,7 @@ BaseTranslator::TranslatorInfo() const
|
||||
return fInfo;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// TranslatorVersion
|
||||
//
|
||||
@@ -159,6 +175,7 @@ BaseTranslator::TranslatorVersion() const
|
||||
return fVersion;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// InputFormats
|
||||
//
|
||||
@@ -184,6 +201,7 @@ BaseTranslator::InputFormats(int32 *out_count) const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// OutputFormats
|
||||
//
|
||||
@@ -209,6 +227,7 @@ BaseTranslator::OutputFormats(int32 *out_count) const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// identify_bits_header
|
||||
//
|
||||
@@ -289,7 +308,7 @@ BaseTranslator::identify_bits_header(BPositionIO *inSource,
|
||||
outInfo->group = B_TRANSLATOR_BITMAP;
|
||||
outInfo->quality = 0.2;
|
||||
outInfo->capability = 0.2;
|
||||
strcpy(outInfo->name, "Be Bitmap Format");
|
||||
strcpy(outInfo->name, B_TRANSLATE("Be Bitmap Format"));
|
||||
strcpy(outInfo->MIME, "image/x-be-bitmap");
|
||||
|
||||
// Look for quality / capability info in fInputFormats
|
||||
@@ -315,6 +334,7 @@ BaseTranslator::identify_bits_header(BPositionIO *inSource,
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// BitsCheck
|
||||
//
|
||||
@@ -386,6 +406,7 @@ BaseTranslator::BitsCheck(BPositionIO *inSource, BMessage *ioExtension,
|
||||
return B_OK + 1;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BaseTranslator::BitsIdentify(BPositionIO *inSource,
|
||||
const translation_format *inFormat, BMessage *ioExtension,
|
||||
@@ -407,6 +428,7 @@ BaseTranslator::BitsIdentify(BPositionIO *inSource,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Identify
|
||||
//
|
||||
@@ -460,6 +482,7 @@ BaseTranslator::Identify(BPositionIO *inSource,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// translate_from_bits_to_bits
|
||||
//
|
||||
@@ -539,6 +562,7 @@ BaseTranslator::translate_from_bits_to_bits(BPositionIO *inSource,
|
||||
return B_NO_TRANSLATOR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BaseTranslator::BitsTranslate(BPositionIO *inSource,
|
||||
const translator_info *inInfo, BMessage *ioExtension, uint32 outType,
|
||||
@@ -556,6 +580,7 @@ BaseTranslator::BitsTranslate(BPositionIO *inSource,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Translate
|
||||
//
|
||||
@@ -603,6 +628,7 @@ BaseTranslator::Translate(BPositionIO *inSource,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// returns the current translator settings into ioExtension
|
||||
status_t
|
||||
BaseTranslator::GetConfigurationMessage(BMessage *ioExtension)
|
||||
@@ -610,6 +636,7 @@ BaseTranslator::GetConfigurationMessage(BMessage *ioExtension)
|
||||
return fSettings->GetConfigurationMessage(ioExtension);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// MakeConfigurationView
|
||||
//
|
||||
@@ -656,12 +683,14 @@ BaseTranslator::MakeConfigurationView(BMessage *ioExtension, BView **outView,
|
||||
outExtent);
|
||||
}
|
||||
|
||||
|
||||
TranslatorSettings *
|
||||
BaseTranslator::AcquireSettings()
|
||||
{
|
||||
return fSettings->Acquire();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Functions to be implemented by derived classes
|
||||
|
||||
@@ -673,6 +702,7 @@ BaseTranslator::DerivedIdentify(BPositionIO *inSource,
|
||||
return B_NO_TRANSLATOR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BaseTranslator::DerivedTranslate(BPositionIO *inSource,
|
||||
const translator_info *inInfo, BMessage *ioExtension, uint32 outType,
|
||||
@@ -695,6 +725,7 @@ BaseTranslator::NewConfigView(TranslatorSettings *settings)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
translate_direct_copy(BPositionIO *inSource, BPositionIO *outDestination)
|
||||
{
|
||||
|
||||
@@ -33,13 +33,13 @@
|
||||
#ifndef BASE_TRANSLATOR_H
|
||||
#define BASE_TRANSLATOR_H
|
||||
|
||||
#include <ByteOrder.h>
|
||||
#include <DataIO.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Translator.h>
|
||||
#include <TranslatorFormats.h>
|
||||
#include <TranslationDefs.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <DataIO.h>
|
||||
#include <ByteOrder.h>
|
||||
#include <View.h>
|
||||
#include "TranslatorSettings.h"
|
||||
|
||||
|
||||
@@ -7,4 +7,11 @@ StaticLibrary libtranslatorsutils.a :
|
||||
StreamBuffer.cpp
|
||||
TranslatorSettings.cpp
|
||||
TranslatorWindow.cpp
|
||||
;
|
||||
: $(HAIKU_LOCALE_LIBS)
|
||||
;
|
||||
|
||||
DoCatalogs libtranslatorsutils.a :
|
||||
:
|
||||
BaseTranslator.cpp
|
||||
TranslatorWindow.cpp
|
||||
;
|
||||
|
||||
@@ -34,6 +34,11 @@
|
||||
#include <GroupLayout.h>
|
||||
#include "TranslatorWindow.h"
|
||||
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "TranslatorWindow"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Constructor
|
||||
//
|
||||
@@ -56,6 +61,7 @@ TranslatorWindow::TranslatorWindow(BRect area, const char *title)
|
||||
// Do nothing for a non-layout window
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Destructor
|
||||
//
|
||||
@@ -74,13 +80,14 @@ TranslatorWindow::~TranslatorWindow()
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
LaunchTranslatorWindow(BTranslator *translator, const char *title, BRect rect)
|
||||
{
|
||||
BView *view = NULL;
|
||||
if (translator->MakeConfigurationView(NULL, &view, &rect)) {
|
||||
BAlert *err = new BAlert("Error",
|
||||
"Unable to create the view.", "OK");
|
||||
BAlert *err = new BAlert(B_TRANSLATE("Error"),
|
||||
B_TRANSLATE("Unable to create the view."), B_TRANSLATE("OK"));
|
||||
err->Go();
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -33,10 +33,13 @@
|
||||
#define TRANSLATORWINDOW_H
|
||||
|
||||
#include <Application.h>
|
||||
#include <Window.h>
|
||||
#include <View.h>
|
||||
#include <Catalog.h>
|
||||
#include <Locale.h>
|
||||
#include <Rect.h>
|
||||
#include <Translator.h>
|
||||
#include <View.h>
|
||||
#include <Window.h>
|
||||
|
||||
|
||||
class TranslatorWindow : public BWindow {
|
||||
public:
|
||||
@@ -47,6 +50,7 @@ public:
|
||||
// Posts a quit message so that the application closes properly
|
||||
};
|
||||
|
||||
|
||||
status_t
|
||||
LaunchTranslatorWindow(BTranslator *translator, const char *title,
|
||||
BRect rect = BRect(0, 0, 1, 1));
|
||||
|
||||
Reference in New Issue
Block a user