PoorMan: use BMessageFormat.
This commit is contained in:
@@ -8,22 +8,21 @@
|
|||||||
|
|
||||||
#include "StatusSlider.h"
|
#include "StatusSlider.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <MessageFormat.h>
|
||||||
|
|
||||||
|
|
||||||
StatusSlider::StatusSlider(const char* name, const char* label,
|
StatusSlider::StatusSlider(const char* name, const char* label,
|
||||||
char* statusPrefix, BMessage* message, int32 minValue, int32 maxValue)
|
const char* statusPrefix, BMessage* message, int32 minValue, int32 maxValue)
|
||||||
:
|
:
|
||||||
BSlider(name, label, message, minValue, maxValue, B_HORIZONTAL),
|
BSlider(name, label, message, minValue, maxValue, B_HORIZONTAL),
|
||||||
fStatusPrefix(statusPrefix)
|
fStatusPrefix(statusPrefix)
|
||||||
{
|
{
|
||||||
fTemp = fStr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
StatusSlider::UpdateText() const
|
StatusSlider::UpdateText() const
|
||||||
{
|
{
|
||||||
sprintf(fTemp, "%" B_PRId32 " %s", Value(), fStatusPrefix);
|
BMessageFormat().Format(fStr, fStatusPrefix, Value());
|
||||||
|
return fStr.String();
|
||||||
return fTemp;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,14 @@
|
|||||||
//#define BEOS_R5_COMPATIBLE
|
//#define BEOS_R5_COMPATIBLE
|
||||||
|
|
||||||
#include <Slider.h>
|
#include <Slider.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
class StatusSlider: public BSlider {
|
class StatusSlider: public BSlider {
|
||||||
public:
|
public:
|
||||||
StatusSlider(const char* name,
|
StatusSlider(const char* name,
|
||||||
const char* label,
|
const char* label,
|
||||||
char* statusPrefix,
|
const char* statusPrefix,
|
||||||
BMessage* message,
|
BMessage* message,
|
||||||
int32 minValue,
|
int32 minValue,
|
||||||
int32 maxValue);
|
int32 maxValue);
|
||||||
@@ -25,9 +26,8 @@ public:
|
|||||||
virtual const char* UpdateText() const;
|
virtual const char* UpdateText() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char* fStatusPrefix;
|
const char* fStatusPrefix;
|
||||||
char* fTemp;
|
mutable BString fStr;
|
||||||
char fStr[128];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ const char* STR_BBX_CONNECTION
|
|||||||
= B_TRANSLATE("Connections");
|
= B_TRANSLATE("Connections");
|
||||||
const char* STR_SLD_LABEL
|
const char* STR_SLD_LABEL
|
||||||
= B_TRANSLATE("Max. simultaneous connections:");
|
= B_TRANSLATE("Max. simultaneous connections:");
|
||||||
char* STR_SLD_STATUS_LABEL
|
const char* STR_SLD_STATUS_LABEL
|
||||||
= (char*)B_TRANSLATE("connections");
|
= B_TRANSLATE("{0, plural, one{# connection} other{# connections}}");
|
||||||
|
|
||||||
const char CMD_FILE_SAVE_AS
|
const char CMD_FILE_SAVE_AS
|
||||||
= 'S';
|
= 'S';
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ extern const char* STR_FILEPANEL_CREATE_LOG_FILE;
|
|||||||
extern const char* STR_TAB_ADVANCED;
|
extern const char* STR_TAB_ADVANCED;
|
||||||
extern const char* STR_BBX_CONNECTION;
|
extern const char* STR_BBX_CONNECTION;
|
||||||
extern const char* STR_SLD_LABEL;
|
extern const char* STR_SLD_LABEL;
|
||||||
extern char* STR_SLD_STATUS_LABEL;
|
extern const char* STR_SLD_STATUS_LABEL;
|
||||||
|
|
||||||
extern const char CMD_FILE_SAVE_AS;
|
extern const char CMD_FILE_SAVE_AS;
|
||||||
extern const char CMD_FILE_QUIT;
|
extern const char CMD_FILE_QUIT;
|
||||||
|
|||||||
Reference in New Issue
Block a user