Localized DriveSetup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35229 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-01-21 20:02:57 +00:00
parent e07fca806a
commit 7d24c6470f
10 changed files with 267 additions and 172 deletions
+12 -6
View File
@@ -12,6 +12,7 @@
#include "Support.h" #include "Support.h"
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <DiskDeviceTypes.h> #include <DiskDeviceTypes.h>
#include <GridLayoutBuilder.h> #include <GridLayoutBuilder.h>
@@ -27,6 +28,9 @@
#include <String.h> #include <String.h>
#define TR_CONTEXT "CreateParamsPanel"
class CreateParamsPanel::EscapeFilter : public BMessageFilter { class CreateParamsPanel::EscapeFilter : public BMessageFilter {
public: public:
EscapeFilter(CreateParamsPanel* target) EscapeFilter(CreateParamsPanel* target)
@@ -216,11 +220,11 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
off_t size) off_t size)
{ {
// Setup the controls // Setup the controls
fSizeSlider = new SizeSlider("Slider", "Partition size", NULL, offset, fSizeSlider = new SizeSlider("Slider", TR("Partition size"), NULL, offset,
offset + size); offset + size);
fSizeSlider->SetPosition(1.0); fSizeSlider->SetPosition(1.0);
fNameTextControl = new BTextControl("Name Control", "Partition name:", fNameTextControl = new BTextControl("Name Control", TR("Partition name:"),
"", NULL); "", NULL);
if (!parent->SupportsChildName()) if (!parent->SupportsChildName())
fNameTextControl->SetEnabled(false); fNameTextControl->SetEnabled(false);
@@ -229,7 +233,8 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
int32 cookie = 0; int32 cookie = 0;
BString supportedType; BString supportedType;
while (parent->GetNextSupportedChildType(&cookie, &supportedType) == B_OK) { while (parent->GetNextSupportedChildType(&cookie, &supportedType)
== B_OK) {
BMessage* message = new BMessage(MSG_PARTITION_TYPE); BMessage* message = new BMessage(MSG_PARTITION_TYPE);
message->AddString("type", supportedType); message->AddString("type", supportedType);
BMenuItem* item = new BMenuItem(supportedType, message); BMenuItem* item = new BMenuItem(supportedType, message);
@@ -239,7 +244,8 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
item->SetMarked(true); item->SetMarked(true);
} }
fTypeMenuField = new BMenuField("Partition type:", fTypePopUpMenu, NULL); fTypeMenuField = new BMenuField(TR("Partition type:"), fTypePopUpMenu,
NULL);
const float spacing = be_control_look->DefaultItemSpacing(); const float spacing = be_control_look->DefaultItemSpacing();
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, spacing); BGroupLayout* layout = new BGroupLayout(B_VERTICAL, spacing);
@@ -261,10 +267,10 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
if (fEditor) if (fEditor)
AddChild(fEditor->View()); AddChild(fEditor->View());
BButton* okButton = new BButton("Create", new BMessage(MSG_OK)); BButton* okButton = new BButton(TR("Create"), new BMessage(MSG_OK));
AddChild(BGroupLayoutBuilder(B_HORIZONTAL, spacing) AddChild(BGroupLayoutBuilder(B_HORIZONTAL, spacing)
.AddGlue() .AddGlue()
.Add(new BButton("Cancel", new BMessage(MSG_CANCEL))) .Add(new BButton(TR("Cancel"), new BMessage(MSG_CANCEL)))
.Add(okButton) .Add(okButton)
); );
SetDefaultButton(okButton); SetDefaultButton(okButton);
+24 -15
View File
@@ -1,35 +1,40 @@
/* /*
* Copyright 2007-2009 Haiku Inc. All rights reserved. * Copyright 2007-2010 Stephan Aßmus <[email protected]>.
* Distributed under the terms of the MIT license. * All rights reserved. Distributed under the terms of the MIT license.
*
* Authors:
* Stephan Aßmus <[email protected]>
*/ */
#include "DiskView.h" #include "DiskView.h"
#include "MainWindow.h"
#include <stdio.h>
#include <DiskDeviceVisitor.h> #include <DiskDeviceVisitor.h>
#include <Catalog.h>
#include <GroupLayout.h> #include <GroupLayout.h>
#include <HashMap.h> #include <HashMap.h>
#include <LayoutItem.h> #include <LayoutItem.h>
#include <PartitioningInfo.h> #include <PartitioningInfo.h>
#include <String.h> #include <String.h>
#include "MainWindow.h"
#define TR_CONTEXT "DiskView"
using BPrivate::HashMap; using BPrivate::HashMap;
using BPrivate::HashKey32; using BPrivate::HashKey32;
static const pattern kStripes = { { 0xc7, 0x8f, 0x1f, 0x3e, static const pattern kStripes = { { 0xc7, 0x8f, 0x1f, 0x3e,
0x7c, 0xf8, 0xf1, 0xe3 } }; 0x7c, 0xf8, 0xf1, 0xe3 } };
static const float kLayoutInset = 6; static const float kLayoutInset = 6;
class PartitionView : public BView { class PartitionView : public BView {
public: public:
PartitionView(const char* name, float weight, off_t offset, PartitionView(const char* name, float weight, off_t offset,
int32 level, partition_id id) int32 level, partition_id id)
: BView(name, B_WILL_DRAW | B_SUPPORTS_LAYOUT | B_FULL_UPDATE_ON_RESIZE), :
BView(name, B_WILL_DRAW | B_SUPPORTS_LAYOUT | B_FULL_UPDATE_ON_RESIZE),
fID(id), fID(id),
fWeight(weight), fWeight(weight),
fOffset(offset), fOffset(offset),
@@ -195,7 +200,7 @@ public:
virtual bool Visit(BDiskDevice* device) virtual bool Visit(BDiskDevice* device)
{ {
PartitionView* view = new PartitionView("Device", 1.0, PartitionView* view = new PartitionView(TR("Device"), 1.0,
device->Offset(), 0, device->ID()); device->Offset(), 0, device->ID());
fViewMap.Put(device->ID(), view); fViewMap.Put(device->ID(), view);
fView->GetLayout()->AddView(view); fView->GetLayout()->AddView(view);
@@ -220,8 +225,11 @@ public:
if (name.Length() == 0) { if (name.Length() == 0) {
if (partition->CountChildren() > 0) if (partition->CountChildren() > 0)
name << partition->Type(); name << partition->Type();
else else {
name << "Partition " << partition->ID(); char buffer[64];
snprintf(buffer, 64, TR("Partition %ld"), partition->ID());
name << buffer;
}
} }
partition_id id = partition->ID(); partition_id id = partition->ID();
PartitionView* view = new PartitionView(name.String(), scale, offset, PartitionView* view = new PartitionView(name.String(), scale, offset,
@@ -279,7 +287,7 @@ public:
double scale = (double)size / parentSize; double scale = (double)size / parentSize;
partition_id id partition_id id
= fSpaceIDMap.SpaceIDFor(partition->ID(), offset); = fSpaceIDMap.SpaceIDFor(partition->ID(), offset);
PartitionView* view = new PartitionView("<empty>", scale, PartitionView* view = new PartitionView(TR("<empty>"), scale,
offset, parentView->Level() + 1, id); offset, parentView->Level() + 1, id);
fViewMap.Put(id, view); fViewMap.Put(id, view);
@@ -320,7 +328,8 @@ public:
DiskView::DiskView(const BRect& frame, uint32 resizeMode, DiskView::DiskView(const BRect& frame, uint32 resizeMode,
SpaceIDMap& spaceIDMap) SpaceIDMap& spaceIDMap)
: Inherited(frame, "diskview", resizeMode, :
Inherited(frame, "diskview", resizeMode,
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
fDiskCount(0), fDiskCount(0),
fDisk(NULL), fDisk(NULL),
@@ -390,9 +399,9 @@ DiskView::Draw(BRect updateRect)
const char* helpfulMessage; const char* helpfulMessage;
if (fDiskCount == 0) if (fDiskCount == 0)
helpfulMessage = "No disk devices have been recognized."; helpfulMessage = TR("No disk devices have been recognized.");
else else
helpfulMessage = "Select a partition from the list below."; helpfulMessage = TR("Select a partition from the list below.");
float width = StringWidth(helpfulMessage); float width = StringWidth(helpfulMessage);
font_height fh; font_height fh;
+3
View File
@@ -16,6 +16,7 @@
#include <File.h> #include <File.h>
#include <FindDirectory.h> #include <FindDirectory.h>
#include <Locale.h>
#include <Path.h> #include <Path.h>
@@ -35,6 +36,8 @@ DriveSetup::~DriveSetup()
void void
DriveSetup::ReadyToRun() DriveSetup::ReadyToRun()
{ {
be_locale->GetAppCatalog(&fCatalog);
fWindow = new MainWindow(BRect(50, 50, 600, 450)); fWindow = new MainWindow(BRect(50, 50, 600, 450));
if (_RestoreSettings() != B_OK) if (_RestoreSettings() != B_OK)
fWindow->ApplyDefaultSettings(); fWindow->ApplyDefaultSettings();
+2
View File
@@ -7,6 +7,7 @@
#include <Application.h> #include <Application.h>
#include <Catalog.h>
#include <Message.h> #include <Message.h>
@@ -31,6 +32,7 @@ private:
MainWindow* fWindow; MainWindow* fWindow;
BMessage fSettings; BMessage fSettings;
BCatalog fCatalog;
}; };
+11 -5
View File
@@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <GroupLayout.h> #include <GroupLayout.h>
#include <GroupLayoutBuilder.h> #include <GroupLayoutBuilder.h>
@@ -21,10 +22,14 @@
#include <String.h> #include <String.h>
#define TR_CONTEXT "InitParamsPanel"
class InitParamsPanel::EscapeFilter : public BMessageFilter { class InitParamsPanel::EscapeFilter : public BMessageFilter {
public: public:
EscapeFilter(InitParamsPanel* target) EscapeFilter(InitParamsPanel* target)
: BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE), :
BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
fPanel(target) fPanel(target)
{ {
} }
@@ -70,8 +75,9 @@ enum {
InitParamsPanel::InitParamsPanel(BWindow* window, const BString& diskSystem, InitParamsPanel::InitParamsPanel(BWindow* window, const BString& diskSystem,
BPartition* partition) BPartition* partition)
: BWindow(BRect(300.0, 200.0, 600.0, 300.0), 0, B_MODAL_WINDOW_LOOK, :
BWindow(BRect(300.0, 200.0, 600.0, 300.0), 0, B_MODAL_WINDOW_LOOK,
B_MODAL_SUBSET_WINDOW_FEEL, B_MODAL_SUBSET_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
fEscapeFilter(new EscapeFilter(this)), fEscapeFilter(new EscapeFilter(this)),
@@ -81,7 +87,7 @@ InitParamsPanel::InitParamsPanel(BWindow* window, const BString& diskSystem,
{ {
AddCommonFilter(fEscapeFilter); AddCommonFilter(fEscapeFilter);
BButton* okButton = new BButton("Initialize", new BMessage(MSG_OK)); BButton* okButton = new BButton(TR("Initialize"), new BMessage(MSG_OK));
partition->GetInitializationParameterEditor(diskSystem.String(), partition->GetInitializationParameterEditor(diskSystem.String(),
&fEditor); &fEditor);
@@ -92,7 +98,7 @@ InitParamsPanel::InitParamsPanel(BWindow* window, const BString& diskSystem,
.Add(fEditor->View()) .Add(fEditor->View())
.AddGroup(B_HORIZONTAL, spacing) .AddGroup(B_HORIZONTAL, spacing)
.AddGlue() .AddGlue()
.Add(new BButton("Cancel", new BMessage(MSG_CANCEL))) .Add(new BButton(TR("Cancel"), new BMessage(MSG_CANCEL)))
.Add(okButton) .Add(okButton)
.End() .End()
.SetInsets(spacing, spacing, spacing, spacing) .SetInsets(spacing, spacing, spacing, spacing)
+15 -1
View File
@@ -13,6 +13,20 @@ Preference DriveSetup :
PartitionList.cpp PartitionList.cpp
Support.cpp Support.cpp
: be libcolumnlistview.a libshared.a $(TARGET_LIBSUPC++) : be liblocale.so libcolumnlistview.a libshared.a $(TARGET_LIBSUPC++)
: DriveSetup.rdef : DriveSetup.rdef
; ;
DoCatalogs DriveSetup :
x-vnd.Haiku-DriveSetup
:
CreateParamsPanel.cpp
DiskView.cpp
InitParamsPanel.cpp
MainWindow.cpp
PartitionList.cpp
Support.cpp
: en.catalog
: de.catkeys
;
+152 -115
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 Haiku Inc. All rights reserved. * Copyright 2002-2010 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
* *
* Authors: * Authors:
@@ -10,18 +10,13 @@
*/ */
#include "MainWindow.h" #include "MainWindow.h"
#include "DiskView.h"
#include "InitParamsPanel.h"
#include "CreateParamsPanel.h"
#include "PartitionList.h"
#include "Support.h"
#include "tracker_private.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Catalog.h>
#include <ColumnListView.h> #include <ColumnListView.h>
#include <ColumnTypes.h> #include <ColumnTypes.h>
#include <Debug.h> #include <Debug.h>
@@ -40,6 +35,17 @@
#include <Volume.h> #include <Volume.h>
#include <VolumeRoster.h> #include <VolumeRoster.h>
#include "CreateParamsPanel.h"
#include "DiskView.h"
#include "InitParamsPanel.h"
#include "PartitionList.h"
#include "Support.h"
#include "tracker_private.h"
#define TR_CONTEXT "MainWindow"
class ListPopulatorVisitor : public BDiskDeviceVisitor { class ListPopulatorVisitor : public BDiskDeviceVisitor {
public: public:
ListPopulatorVisitor(PartitionListView* list, int32& diskCount, ListPopulatorVisitor(PartitionListView* list, int32& diskCount,
@@ -161,24 +167,24 @@ MainWindow::MainWindow(BRect frame)
BMenuBar* menuBar = new BMenuBar(Bounds(), "root menu"); BMenuBar* menuBar = new BMenuBar(Bounds(), "root menu");
// create all the menu items // create all the menu items
fFormatMI = new BMenuItem("Format (not implemented)", fFormatMI = new BMenuItem(TR("Format (not implemented)"),
new BMessage(MSG_FORMAT)); new BMessage(MSG_FORMAT));
fEjectMI = new BMenuItem("Eject", new BMessage(MSG_EJECT), 'E'); fEjectMI = new BMenuItem(TR("Eject"), new BMessage(MSG_EJECT), 'E');
fSurfaceTestMI = new BMenuItem("Surface test (not implemented)", fSurfaceTestMI = new BMenuItem(TR("Surface test (not implemented)"),
new BMessage(MSG_SURFACE_TEST)); new BMessage(MSG_SURFACE_TEST));
fRescanMI = new BMenuItem("Rescan", new BMessage(MSG_RESCAN)); fRescanMI = new BMenuItem(TR("Rescan"), new BMessage(MSG_RESCAN));
fCreateMI = new BMenuItem("Create" B_UTF8_ELLIPSIS, fCreateMI = new BMenuItem(TR("Create" B_UTF8_ELLIPSIS),
new BMessage(MSG_CREATE), 'C'); new BMessage(MSG_CREATE), 'C');
fDeleteMI = new BMenuItem("Delete", new BMessage(MSG_DELETE), 'D'); fDeleteMI = new BMenuItem(TR("Delete"), new BMessage(MSG_DELETE), 'D');
fMountMI = new BMenuItem("Mount", new BMessage(MSG_MOUNT), 'M'); fMountMI = new BMenuItem(TR("Mount"), new BMessage(MSG_MOUNT), 'M');
fUnmountMI = new BMenuItem("Unmount", new BMessage(MSG_UNMOUNT), 'U'); fUnmountMI = new BMenuItem(TR("Unmount"), new BMessage(MSG_UNMOUNT), 'U');
fMountAllMI = new BMenuItem("Mount all", fMountAllMI = new BMenuItem(TR("Mount all"),
new BMessage(MSG_MOUNT_ALL), 'M', B_SHIFT_KEY); new BMessage(MSG_MOUNT_ALL), 'M', B_SHIFT_KEY);
// Disk menu // Disk menu
fDiskMenu = new BMenu("Disk"); fDiskMenu = new BMenu(TR("Disk"));
fDiskMenu->AddItem(fFormatMI); fDiskMenu->AddItem(fFormatMI);
fDiskMenu->AddItem(fEjectMI); fDiskMenu->AddItem(fEjectMI);
fDiskMenu->AddItem(fSurfaceTestMI); fDiskMenu->AddItem(fSurfaceTestMI);
@@ -189,10 +195,10 @@ MainWindow::MainWindow(BRect frame)
menuBar->AddItem(fDiskMenu); menuBar->AddItem(fDiskMenu);
// Parition menu // Parition menu
fPartitionMenu = new BMenu("Partition"); fPartitionMenu = new BMenu(TR("Partition"));
fPartitionMenu->AddItem(fCreateMI); fPartitionMenu->AddItem(fCreateMI);
fInitMenu = new BMenu("Initialize"); fInitMenu = new BMenu(TR("Initialize"));
fPartitionMenu->AddItem(fInitMenu); fPartitionMenu->AddItem(fInitMenu);
fPartitionMenu->AddItem(fDeleteMI); fPartitionMenu->AddItem(fDeleteMI);
@@ -468,8 +474,8 @@ void
MainWindow::_SetToDiskAndPartition(partition_id disk, partition_id partition, MainWindow::_SetToDiskAndPartition(partition_id disk, partition_id partition,
partition_id parent) partition_id parent)
{ {
printf("MainWindow::_SetToDiskAndPartition(disk: %ld, partition: %ld, " //printf("MainWindow::_SetToDiskAndPartition(disk: %ld, partition: %ld, "
"parent: %ld)\n", disk, partition, parent); // "parent: %ld)\n", disk, partition, parent);
BDiskDevice* oldDisk = NULL; BDiskDevice* oldDisk = NULL;
if (!fCurrentDisk || fCurrentDisk->ID() != disk) { if (!fCurrentDisk || fCurrentDisk->ID() != disk) {
@@ -611,18 +617,20 @@ MainWindow::_DisplayPartitionError(BString _message,
if (partition && _message.FindFirst("%s") >= 0) { if (partition && _message.FindFirst("%s") >= 0) {
BString name; BString name;
name << "\"" << partition->ContentName() << "\""; name << "\"" << partition->ContentName() << "\"";
sprintf(message, _message.String(), name.String()); snprintf(message, sizeof(message), _message.String(), name.String());
} else { } else {
_message.ReplaceAll("%s", ""); _message.ReplaceAll("%s", "");
sprintf(message, _message.String()); snprintf(message, sizeof(message), _message.String());
} }
if (error < B_OK) { if (error < B_OK) {
BString helper = message; BString helper = message;
sprintf(message, "%s\n\nError: %s", helper.String(), strerror(error)); const char* errorString = TR_CMT("Error: ", "in any error alert");
snprintf(message, sizeof(message), "%s\n\n%s%s", helper.String(),
errorString, strerror(error));
} }
BAlert* alert = new BAlert("error", message, "OK", NULL, NULL, BAlert* alert = new BAlert("error", message, TR("OK"), NULL, NULL,
B_WIDTH_FROM_WIDEST, error < B_OK ? B_STOP_ALERT : B_INFO_ALERT); B_WIDTH_FROM_WIDEST, error < B_OK ? B_STOP_ALERT : B_INFO_ALERT);
alert->Go(NULL); alert->Go(NULL);
} }
@@ -635,28 +643,29 @@ void
MainWindow::_Mount(BDiskDevice* disk, partition_id selectedPartition) MainWindow::_Mount(BDiskDevice* disk, partition_id selectedPartition)
{ {
if (!disk || selectedPartition < 0) { if (!disk || selectedPartition < 0) {
_DisplayPartitionError("You need to select a partition " _DisplayPartitionError(TR("You need to select a partition "
"entry from the list."); "entry from the list."));
return; return;
} }
BPartition* partition = disk->FindDescendant(selectedPartition); BPartition* partition = disk->FindDescendant(selectedPartition);
if (!partition) { if (!partition) {
_DisplayPartitionError("Unable to find the selected partition by ID."); _DisplayPartitionError(TR("Unable to find the selected partition "
"by ID."));
return; return;
} }
if (!partition->IsMounted()) { if (!partition->IsMounted()) {
status_t ret = partition->Mount(); status_t ret = partition->Mount();
if (ret < B_OK) { if (ret < B_OK) {
_DisplayPartitionError("Could not mount partition %s.", _DisplayPartitionError(TR("Could not mount partition %s."),
partition, ret); partition, ret);
} else { } else {
// successful mount, adapt to the changes // successful mount, adapt to the changes
_ScanDrives(); _ScanDrives();
} }
} else { } else {
_DisplayPartitionError("The partition %s is already mounted.", _DisplayPartitionError(TR("The partition %s is already mounted."),
partition); partition);
} }
} }
@@ -666,14 +675,15 @@ void
MainWindow::_Unmount(BDiskDevice* disk, partition_id selectedPartition) MainWindow::_Unmount(BDiskDevice* disk, partition_id selectedPartition)
{ {
if (!disk || selectedPartition < 0) { if (!disk || selectedPartition < 0) {
_DisplayPartitionError("You need to select a partition " _DisplayPartitionError(TR("You need to select a partition "
"entry from the list."); "entry from the list."));
return; return;
} }
BPartition* partition = disk->FindDescendant(selectedPartition); BPartition* partition = disk->FindDescendant(selectedPartition);
if (!partition) { if (!partition) {
_DisplayPartitionError("Unable to find the selected partition by ID."); _DisplayPartitionError(TR("Unable to find the selected partition "
"by ID."));
return; return;
} }
@@ -682,7 +692,7 @@ MainWindow::_Unmount(BDiskDevice* disk, partition_id selectedPartition)
partition->GetMountPoint(&path); partition->GetMountPoint(&path);
status_t ret = partition->Unmount(); status_t ret = partition->Unmount();
if (ret < B_OK) { if (ret < B_OK) {
_DisplayPartitionError("Could not unmount partition %s.", _DisplayPartitionError(TR("Could not unmount partition %s."),
partition, ret); partition, ret);
} else { } else {
if (dev_for_path(path.Path()) == dev_for_path("/")) if (dev_for_path(path.Path()) == dev_for_path("/"))
@@ -691,7 +701,7 @@ MainWindow::_Unmount(BDiskDevice* disk, partition_id selectedPartition)
_ScanDrives(); _ScanDrives();
} }
} else { } else {
_DisplayPartitionError("The partition %s is already unmounted.", _DisplayPartitionError(TR("The partition %s is already unmounted."),
partition); partition);
} }
} }
@@ -745,35 +755,45 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
const BString& diskSystemName) const BString& diskSystemName)
{ {
if (!disk || selectedPartition < 0) { if (!disk || selectedPartition < 0) {
_DisplayPartitionError("You need to select a partition " _DisplayPartitionError(TR("You need to select a partition "
"entry from the list."); "entry from the list."));
return; return;
} }
if (disk->IsReadOnly()) { if (disk->IsReadOnly()) {
_DisplayPartitionError("The selected disk is read-only."); _DisplayPartitionError(TR("The selected disk is read-only."));
return; return;
} }
BPartition* partition = disk->FindDescendant(selectedPartition); BPartition* partition = disk->FindDescendant(selectedPartition);
if (!partition) { if (!partition) {
_DisplayPartitionError("Unable to find the selected partition by ID."); _DisplayPartitionError(TR("Unable to find the selected partition "
"by ID."));
return; return;
} }
if (partition->IsMounted()) { if (partition->IsMounted()) {
_DisplayPartitionError("The partition %s is currently mounted."); _DisplayPartitionError(TR("The partition %s is currently mounted."));
// TODO: option to unmount and continue on success to unmount // TODO: option to unmount and continue on success to unmount
return; return;
} }
BString message("Are you sure you want to initialize the partition "); char message[512];
message << "\"" << partition->ContentName(); if (partition->ContentName() && strlen(partition->ContentName()) > 0) {
message << "\"? After entering the initialization parameters, "; snprintf(message, sizeof(message), TR("Are you sure you want to "
message << "you can abort this operation right before writing "; "initialize the partition \"%s\"? After entering the "
message << "changes back to the disk."; "initialization parameters, you can abort this operation "
BAlert* alert = new BAlert("first notice", message.String(), "right before writing changes back to the disk."),
"Continue", "Cancel", NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); partition->ContentName());
} else {
snprintf(message, sizeof(message), TR("Are you sure you want to "
"initialize the selected partition? After entering the "
"initialization parameters, you can abort this operation "
"right before writing changes back to the disk."));
}
BAlert* alert = new BAlert("first notice", message,
TR("Continue"), TR("Cancel"), NULL, B_WIDTH_FROM_WIDEST,
B_WARNING_ALERT);
int32 choice = alert->Go(); int32 choice = alert->Go();
if (choice == 1) if (choice == 1)
@@ -792,8 +812,8 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
} }
if (!found) { if (!found) {
BString message("Disk system \""); snprintf(message, sizeof(message), TR("Disk system \"%s\"\" not "
message << diskSystemName << "\" not found!"; "found!"));
_DisplayPartitionError(message); _DisplayPartitionError(message);
return; return;
} }
@@ -804,16 +824,16 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
if (diskSystemName != "Be File System" if (diskSystemName != "Be File System"
&& diskSystemName != "Intel Partition Map" && diskSystemName != "Intel Partition Map"
&& diskSystemName != "Intel Extended Partition") { && diskSystemName != "Intel Extended Partition") {
_DisplayPartitionError("Don't know how to gather initialization " _DisplayPartitionError(TR("Don't know how to gather initialization "
"parameters for this file system."); "parameters for this disk system."));
return; return;
} }
ModificationPreparer modificationPreparer(disk); ModificationPreparer modificationPreparer(disk);
status_t ret = modificationPreparer.ModificationStatus(); status_t ret = modificationPreparer.ModificationStatus();
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError("There was an error preparing the " _DisplayPartitionError(TR("There was an error preparing the "
"disk for modifications.", NULL, ret); "disk for modifications."), NULL, ret);
return; return;
} }
@@ -835,8 +855,8 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
ret = partition->ValidateInitialize(diskSystem.PrettyName(), ret = partition->ValidateInitialize(diskSystem.PrettyName(),
supportsName ? &validatedName : NULL, parameters.String()); supportsName ? &validatedName : NULL, parameters.String());
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError("Validation of the given initialization " _DisplayPartitionError(TR("Validation of the given initialization "
"parameters failed.", partition, ret); "parameters failed."), partition, ret);
return; return;
} }
@@ -845,8 +865,8 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
ret = partition->Initialize(diskSystem.PrettyName(), ret = partition->Initialize(diskSystem.PrettyName(),
supportsName ? validatedName.String() : NULL, parameters.String()); supportsName ? validatedName.String() : NULL, parameters.String());
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError("Initialization of the partition %s " _DisplayPartitionError(TR("Initialization of the partition %s "
"failed. (Nothing has been written to disk.)", partition, ret); "failed. (Nothing has been written to disk.)"), partition, ret);
return; return;
} }
@@ -854,17 +874,34 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
// to disk // to disk
// Warn the user one more time... // Warn the user one more time...
message = "Are you sure you want to write the changes back to " if (previousName.Length() > 0) {
"disk now?\n\n"; if (partition->IsDevice()) {
if (partition->IsDevice()) snprintf(message, sizeof(message), TR("Are you sure you want to "
message << "All data on the disk"; "write the changes back to disk now?\n\n"
else "All data on the disk %s will be irretrievably lost if you "
message << "All data on the partition"; "do so!"), previousName.String());
if (previousName.Length() > 0) } else {
message << " \"" << previousName << "\""; snprintf(message, sizeof(message), TR("Are you sure you want to "
message << " will be irretrievably lost if you do so!"; "write the changes back to disk now?\n\n"
alert = new BAlert("final notice", message.String(), "All data on the partition %s will be irretrievably lost if you "
"Write changes", "Cancel", NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); "do so!"), previousName.String());
}
} else {
if (partition->IsDevice()) {
snprintf(message, sizeof(message), TR("Are you sure you want to "
"write the changes back to disk now?\n\n"
"All data on the selected disk will be irretrievably lost if "
"you do so!"));
} else {
snprintf(message, sizeof(message), TR("Are you sure you want to "
"write the changes back to disk now?\n\n"
"All data on the selected partition will be irretrievably lost "
"if you do so!"));
}
}
alert = new BAlert("final notice", message,
TR("Write changes"), TR("Cancel"), NULL, B_WIDTH_FROM_WIDEST,
B_WARNING_ALERT);
choice = alert->Go(); choice = alert->Go();
if (choice == 1) if (choice == 1)
@@ -878,11 +915,11 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
partition = disk->FindDescendant(selectedPartition); partition = disk->FindDescendant(selectedPartition);
if (ret == B_OK) { if (ret == B_OK) {
_DisplayPartitionError("The partition %s has been successfully " _DisplayPartitionError(TR("The partition %s has been successfully "
"initialized.\n", partition); "initialized.\n"), partition);
} else { } else {
_DisplayPartitionError("Failed to initialize the partition " _DisplayPartitionError(TR("Failed to initialize the partition "
"%s!\n", partition, ret); "%s!\n"), partition, ret);
} }
_ScanDrives(); _ScanDrives();
@@ -893,42 +930,42 @@ void
MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition) MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition)
{ {
if (!disk || selectedPartition > -2) { if (!disk || selectedPartition > -2) {
_DisplayPartitionError("The currently selected partition is not" _DisplayPartitionError(TR("The currently selected partition is not "
" empty"); "empty."));
return; return;
} }
if (disk->IsReadOnly()) { if (disk->IsReadOnly()) {
_DisplayPartitionError("The selected disk is read-only."); _DisplayPartitionError(TR("The selected disk is read-only."));
return; return;
} }
PartitionListRow* currentSelection = dynamic_cast<PartitionListRow*>( PartitionListRow* currentSelection = dynamic_cast<PartitionListRow*>(
fListView->CurrentSelection()); fListView->CurrentSelection());
if (!currentSelection) { if (!currentSelection) {
_DisplayPartitionError("There was an error acquiring the partition " _DisplayPartitionError(TR("There was an error acquiring the partition "
"row"); "row."));
return; return;
} }
BPartition* parent = disk->FindDescendant(currentSelection->ParentID()); BPartition* parent = disk->FindDescendant(currentSelection->ParentID());
if (!parent) { if (!parent) {
_DisplayPartitionError("The currently selected partition does not " _DisplayPartitionError(TR("The currently selected partition does not "
"have a parent partition"); "have a parent partition."));
return; return;
} }
if (!parent->ContainsPartitioningSystem()) { if (!parent->ContainsPartitioningSystem()) {
_DisplayPartitionError("The selected partition does not contain " _DisplayPartitionError(TR("The selected partition does not contain "
"a partitioning system.\n"); "a partitioning system."));
return; return;
} }
ModificationPreparer modificationPreparer(disk); ModificationPreparer modificationPreparer(disk);
status_t ret = modificationPreparer.ModificationStatus(); status_t ret = modificationPreparer.ModificationStatus();
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError("There was an error preparing the " _DisplayPartitionError(TR("There was an error preparing the "
"disk for modifications.", NULL, ret); "disk for modifications."), NULL, ret);
return; return;
} }
@@ -936,14 +973,15 @@ MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition)
BPartitioningInfo partitioningInfo; BPartitioningInfo partitioningInfo;
status_t error = parent->GetPartitioningInfo(&partitioningInfo); status_t error = parent->GetPartitioningInfo(&partitioningInfo);
if (error != B_OK) { if (error != B_OK) {
_DisplayPartitionError("Could not aquire partitioning information.\n"); _DisplayPartitionError(TR("Could not aquire partitioning "
"information."));
return; return;
} }
int32 spacesCount = partitioningInfo.CountPartitionableSpaces(); int32 spacesCount = partitioningInfo.CountPartitionableSpaces();
if (spacesCount == 0) { if (spacesCount == 0) {
_DisplayPartitionError("There's no space on the partition where a " _DisplayPartitionError(TR("There's no space on the partition where "
"child partition could be created\n"); "a child partition could be created."));
return; return;
} }
@@ -960,18 +998,17 @@ MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition)
&name, parameters.String()); &name, parameters.String());
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError("Validation of the given creation " _DisplayPartitionError(TR("Validation of the given creation "
"parameters failed."); "parameters failed."));
return; return;
} }
// Warn the user one more time... // Warn the user one more time...
BString message = "Are you sure you want to write the changes back to " BAlert* alert = new BAlert("final notice", TR("Are you sure you want "
"disk now?\n\n"; "to write the changes back to disk now?\n\n"
message << "All data on the partition"; "All data on the partition will be irretrievably lost if you do "
message << " will be irretrievably lost if you do so!"; "so!"), TR("Write changes"), TR("Cancel"), NULL, B_WIDTH_FROM_WIDEST,
BAlert* alert = new BAlert("final notice", message.String(), B_WARNING_ALERT);
"Write changes", "Cancel", NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT);
int32 choice = alert->Go(); int32 choice = alert->Go();
if (choice == 1) if (choice == 1)
@@ -981,7 +1018,7 @@ MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition)
name.String(), parameters.String()); name.String(), parameters.String());
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError("Creation of the partition has failed\n"); _DisplayPartitionError(TR("Creation of the partition has failed."));
return; return;
} }
@@ -989,8 +1026,8 @@ MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition)
ret = modificationPreparer.CommitModifications(); ret = modificationPreparer.CommitModifications();
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError("Failed to initialize the partition. " _DisplayPartitionError(TR("Failed to initialize the partition. "
"This operation is exiting.\nNo changes have been made!\n"); "No changes have been written to disk."));
return; return;
} }
@@ -1006,49 +1043,49 @@ void
MainWindow::_Delete(BDiskDevice* disk, partition_id selectedPartition) MainWindow::_Delete(BDiskDevice* disk, partition_id selectedPartition)
{ {
if (!disk || selectedPartition < 0) { if (!disk || selectedPartition < 0) {
_DisplayPartitionError("You need to select a partition " _DisplayPartitionError(TR("You need to select a partition "
"entry from the list."); "entry from the list."));
return; return;
} }
if (disk->IsReadOnly()) { if (disk->IsReadOnly()) {
_DisplayPartitionError("The selected disk is read-only."); _DisplayPartitionError(TR("The selected disk is read-only."));
return; return;
} }
BPartition* partition = disk->FindDescendant(selectedPartition); BPartition* partition = disk->FindDescendant(selectedPartition);
if (!partition) { if (!partition) {
_DisplayPartitionError("Unable to find the selected partition by ID."); _DisplayPartitionError(TR("Unable to find the selected partition "
"by ID."));
return; return;
} }
BPartition* parent = partition->Parent(); BPartition* parent = partition->Parent();
if (!parent) { if (!parent) {
_DisplayPartitionError("The currently selected partition does not " _DisplayPartitionError(TR("The currently selected partition does "
"have a parent partition"); "not have a parent partition."));
return; return;
} }
ModificationPreparer modificationPreparer(disk); ModificationPreparer modificationPreparer(disk);
status_t ret = modificationPreparer.ModificationStatus(); status_t ret = modificationPreparer.ModificationStatus();
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError("There was an error preparing the " _DisplayPartitionError(TR("There was an error preparing the "
"disk for modifications.", NULL, ret); "disk for modifications."), NULL, ret);
return; return;
} }
if (!parent->CanDeleteChild(partition->Index())) { if (!parent->CanDeleteChild(partition->Index())) {
_DisplayPartitionError("Cannot delete the selected partition"); _DisplayPartitionError(TR("Cannot delete the selected partition."));
return; return;
} }
// Warn the user one more time... // Warn the user one more time...
BString message = "Are you sure you want to delete the selected "; BAlert* alert = new BAlert("final notice", TR("Are you sure you want "
message << "partition?\n\nAll data on the partition"; "to delete the selected partition?\n\n"
message << " will be irretrievably lost if you do so!"; "All data on the partition will be irretrievably lost if you "
BAlert* alert = new BAlert("final notice", message.String(), "do so!"), TR("Delete partition"), TR("Cancel"), NULL,
"Delete partition", "Cancel", NULL, B_WIDTH_FROM_WIDEST, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT);
B_WARNING_ALERT);
int32 choice = alert->Go(); int32 choice = alert->Go();
if (choice == 1) if (choice == 1)
@@ -1056,15 +1093,15 @@ MainWindow::_Delete(BDiskDevice* disk, partition_id selectedPartition)
ret = parent->DeleteChild(partition->Index()); ret = parent->DeleteChild(partition->Index());
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError("Could not delete the selected partition"); _DisplayPartitionError(TR("Could not delete the selected partition."));
return; return;
} }
ret = modificationPreparer.CommitModifications(); ret = modificationPreparer.CommitModifications();
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError("Failed to delete the partition. " _DisplayPartitionError(TR("Failed to delete the partition. "
"This operation is exiting.\nNo changes have been made!\n"); "No changes have been written to disk."));
return; return;
} }
+23 -13
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2006-2009 Haiku Inc. All rights reserved. * Copyright 2006-2010 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
* *
* Authors: * Authors:
@@ -7,18 +7,25 @@
* James Urquhart * James Urquhart
* Stephan Aßmus <[email protected]> * Stephan Aßmus <[email protected]>
*/ */
#include "PartitionList.h"
#include "Support.h"
#include "PartitionList.h"
#include <Catalog.h>
#include <ColumnTypes.h> #include <ColumnTypes.h>
#include <Path.h> #include <Path.h>
#include "Support.h"
#define TR_CONTEXT "PartitionList"
// #pragma mark - BBitmapStringField // #pragma mark - BBitmapStringField
BBitmapStringField::BBitmapStringField(BBitmap* bitmap, const char* string) BBitmapStringField::BBitmapStringField(BBitmap* bitmap, const char* string)
: Inherited(string), :
Inherited(string),
fBitmap(bitmap) fBitmap(bitmap)
{ {
} }
@@ -47,7 +54,8 @@ float PartitionColumn::sTextMargin = 0.0;
PartitionColumn::PartitionColumn(const char* title, float width, float minWidth, PartitionColumn::PartitionColumn(const char* title, float width, float minWidth,
float maxWidth, uint32 truncateMode, alignment align) float maxWidth, uint32 truncateMode, alignment align)
: Inherited(title, width, minWidth, maxWidth, align), :
Inherited(title, width, minWidth, maxWidth, align),
fTruncateMode(truncateMode) fTruncateMode(truncateMode)
{ {
SetWantsEvents(true); SetWantsEvents(true);
@@ -179,7 +187,8 @@ enum {
PartitionListRow::PartitionListRow(BPartition* partition) PartitionListRow::PartitionListRow(BPartition* partition)
: Inherited(), :
Inherited(),
fPartitionID(partition->ID()), fPartitionID(partition->ID()),
fParentID(partition->Parent() ? partition->Parent()->ID() : -1), fParentID(partition->Parent() ? partition->Parent()->ID() : -1),
fOffset(partition->Offset()), fOffset(partition->Offset()),
@@ -225,7 +234,8 @@ PartitionListRow::PartitionListRow(BPartition* partition)
PartitionListRow::PartitionListRow(partition_id parentID, partition_id id, PartitionListRow::PartitionListRow(partition_id parentID, partition_id id,
off_t offset, off_t size) off_t offset, off_t size)
: Inherited(), :
Inherited(),
fPartitionID(id), fPartitionID(id),
fParentID(parentID), fParentID(parentID),
fOffset(offset), fOffset(offset),
@@ -234,7 +244,7 @@ PartitionListRow::PartitionListRow(partition_id parentID, partition_id id,
// TODO: design icon for spaces on partitions // TODO: design icon for spaces on partitions
SetField(new BBitmapStringField(NULL, "-"), kDeviceColumn); SetField(new BBitmapStringField(NULL, "-"), kDeviceColumn);
SetField(new BStringField("<empty>"), kFilesystemColumn); SetField(new BStringField(TR("<empty>")), kFilesystemColumn);
SetField(new BStringField(kUnavailableString), kVolumeNameColumn); SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
SetField(new BStringField(kUnavailableString), kMountedAtColumn); SetField(new BStringField(kUnavailableString), kMountedAtColumn);
@@ -250,15 +260,15 @@ PartitionListRow::PartitionListRow(partition_id parentID, partition_id id,
PartitionListView::PartitionListView(const BRect& frame, uint32 resizeMode) PartitionListView::PartitionListView(const BRect& frame, uint32 resizeMode)
: Inherited(frame, "storagelist", resizeMode, 0, B_NO_BORDER, true) : Inherited(frame, "storagelist", resizeMode, 0, B_NO_BORDER, true)
{ {
AddColumn(new PartitionColumn("Device", 150, 50, 500, AddColumn(new PartitionColumn(TR("Device"), 150, 50, 500,
B_TRUNCATE_MIDDLE), kDeviceColumn); B_TRUNCATE_MIDDLE), kDeviceColumn);
AddColumn(new PartitionColumn("File system", 100, 50, 500, AddColumn(new PartitionColumn(TR("File system"), 100, 50, 500,
B_TRUNCATE_MIDDLE), kFilesystemColumn); B_TRUNCATE_MIDDLE), kFilesystemColumn);
AddColumn(new PartitionColumn("Volume name", 130, 50, 500, AddColumn(new PartitionColumn(TR("Volume name"), 130, 50, 500,
B_TRUNCATE_MIDDLE), kVolumeNameColumn); B_TRUNCATE_MIDDLE), kVolumeNameColumn);
AddColumn(new PartitionColumn("Mounted at", 100, 50, 500, AddColumn(new PartitionColumn(TR("Mounted at"), 100, 50, 500,
B_TRUNCATE_MIDDLE), kMountedAtColumn); B_TRUNCATE_MIDDLE), kMountedAtColumn);
AddColumn(new PartitionColumn("Size", 100, 50, 500, AddColumn(new PartitionColumn(TR("Size"), 100, 50, 500,
B_TRUNCATE_END, B_ALIGN_RIGHT), kSizeColumn); B_TRUNCATE_END, B_ALIGN_RIGHT), kSizeColumn);
SetSortingEnabled(false); SetSortingEnabled(false);
+24 -16
View File
@@ -13,34 +13,38 @@
#include <stdio.h> #include <stdio.h>
#include <Catalog.h>
#include <Partition.h> #include <Partition.h>
#include <String.h> #include <String.h>
#define TR_CONTEXT "Support"
const char* const char*
string_for_size(off_t size, char *string) string_for_size(off_t size, char *string)
{ {
double kb = size / 1024.0; double kb = size / 1024.0;
if (kb < 1.0) { if (kb < 1.0) {
sprintf(string, "%Ld B", size); sprintf(string, TR("%Ld B"), size);
return string; return string;
} }
float mb = kb / 1024.0; float mb = kb / 1024.0;
if (mb < 1.0) { if (mb < 1.0) {
sprintf(string, "%3.1f KB", kb); sprintf(string, TR("%3.1f KB"), kb);
return string; return string;
} }
float gb = mb / 1024.0; float gb = mb / 1024.0;
if (gb < 1.0) { if (gb < 1.0) {
sprintf(string, "%3.1f MB", mb); sprintf(string, TR("%3.1f MB"), mb);
return string; return string;
} }
float tb = gb / 1024.0; float tb = gb / 1024.0;
if (tb < 1.0) { if (tb < 1.0) {
sprintf(string, "%3.1f GB", gb); sprintf(string, TR("%3.1f GB"), gb);
return string; return string;
} }
sprintf(string, "%.1f TB", tb); sprintf(string, TR("%.1f TB"), tb);
return string; return string;
} }
@@ -86,7 +90,8 @@ is_valid_partitionable_space(size_t size)
SpaceIDMap::SpaceIDMap() SpaceIDMap::SpaceIDMap()
: HashMap<HashString, partition_id>(), :
HashMap<HashString, partition_id>(),
fNextSpaceID(-2) fNextSpaceID(-2)
{ {
} }
@@ -114,17 +119,21 @@ SpaceIDMap::SpaceIDFor(partition_id parentID, off_t spaceOffset)
SizeSlider::SizeSlider(const char* name, const char* label, SizeSlider::SizeSlider(const char* name, const char* label,
BMessage* message, int32 minValue, int32 maxValue) BMessage* message, int32 minValue, int32 maxValue)
: BSlider(name, label, message, minValue, maxValue, :
BSlider(name, label, message, minValue, maxValue,
B_HORIZONTAL, B_TRIANGLE_THUMB), B_HORIZONTAL, B_TRIANGLE_THUMB),
fStartOffset(minValue), fStartOffset(minValue),
fEndOffset(maxValue) fEndOffset(maxValue)
{ {
SetBarColor((rgb_color){ 0, 80, 255, 255 }); SetBarColor((rgb_color){ 0, 80, 255, 255 });
BString startOffset, endOffset; char minString[64];
startOffset << "Offset: " << fStartOffset << " MB"; char maxString[64];
endOffset << "End: " << fEndOffset << " MB"; snprintf(minString, sizeof(minString), TR("Offset: %ld MB"),
SetLimitLabels(startOffset.String(), endOffset.String()); fStartOffset);
snprintf(maxString, sizeof(maxString), TR("End: %ld MB"),
fEndOffset);
SetLimitLabels(minString, maxString);
} }
@@ -136,11 +145,10 @@ SizeSlider::~SizeSlider()
const char* const char*
SizeSlider::UpdateText() const SizeSlider::UpdateText() const
{ {
fStatusLabel.Truncate(0); snprintf(fStatusLabel, sizeof(fStatusLabel), TR("%ld MB"),
fStatusLabel << Value() - fStartOffset; Value() - fStartOffset);
fStatusLabel << " MB";
return fStatusLabel.String(); return fStatusLabel;
} }
+1 -1
View File
@@ -56,7 +56,7 @@ public:
private: private:
off_t fStartOffset; off_t fStartOffset;
off_t fEndOffset; off_t fEndOffset;
mutable BString fStatusLabel; mutable char fStatusLabel[64];
}; };
#endif // SUPPORT_H #endif // SUPPORT_H