added a SourceVisitor and a TargetVisitor to go through BDiskDevice and BPartition objects
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14424 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,9 +5,32 @@
|
|||||||
|
|
||||||
#include "CopyEngine.h"
|
#include "CopyEngine.h"
|
||||||
#include "InstallerWindow.h"
|
#include "InstallerWindow.h"
|
||||||
#include <DiskDeviceRoster.h>
|
#include <DiskDeviceVisitor.h>
|
||||||
|
#include <DiskDeviceTypes.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
|
||||||
|
class SourceVisitor : public BDiskDeviceVisitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SourceVisitor(BMenu *menu);
|
||||||
|
virtual bool Visit(BDiskDevice *device);
|
||||||
|
virtual bool Visit(BPartition *partition, int32 level);
|
||||||
|
private:
|
||||||
|
BMenu *fMenu;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TargetVisitor : public BDiskDeviceVisitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TargetVisitor(BMenu *menu);
|
||||||
|
virtual bool Visit(BDiskDevice *device);
|
||||||
|
virtual bool Visit(BPartition *partition, int32 level);
|
||||||
|
private:
|
||||||
|
BMenu *fMenu;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
CopyEngine::CopyEngine(InstallerWindow *window)
|
CopyEngine::CopyEngine(InstallerWindow *window)
|
||||||
: BLooper("copy_engine"),
|
: BLooper("copy_engine"),
|
||||||
fWindow(window)
|
fWindow(window)
|
||||||
@@ -52,34 +75,77 @@ CopyEngine::Start()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CopyEngine::ScanDisksPartitions(BMenu *srcMenu, BMenu *dstMenu)
|
CopyEngine::ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu)
|
||||||
{
|
{
|
||||||
/*BDiskDeviceRoster roster;
|
|
||||||
BDiskDevice device;
|
BDiskDevice device;
|
||||||
roster.VisitEachDevice(this, &device);
|
BPartition *partition = NULL;
|
||||||
|
|
||||||
BPartition *partition;
|
printf("ScanDisksPartitions partitions begin\n");
|
||||||
roster.VisitEachPartition(this, &device, &partition);*/
|
SourceVisitor srcVisitor(srcMenu);
|
||||||
|
fDDRoster.VisitEachMountedPartition(&srcVisitor, &device, &partition);
|
||||||
|
|
||||||
|
printf("ScanDisksPartitions partitions begin\n");
|
||||||
|
TargetVisitor targetVisitor(targetMenu);
|
||||||
|
fDDRoster.VisitEachPartition(&targetVisitor, &device, &partition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
SourceVisitor::SourceVisitor(BMenu *menu)
|
||||||
CopyEngine::Visit(BDiskDevice *device)
|
: fMenu(menu)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
SourceVisitor::Visit(BDiskDevice *device)
|
||||||
|
{
|
||||||
|
if (!device->Type() || strcmp(device->Type(), kPartitionTypeBFS)!=0)
|
||||||
|
return false;
|
||||||
BPath path;
|
BPath path;
|
||||||
if (device->GetPath(&path)==B_OK)
|
if (device->GetPath(&path)==B_OK)
|
||||||
printf("CopyEngine::Visit(BDiskDevice *) : %s\n", path.Path());
|
printf("SourceVisitor::Visit(BDiskDevice *) : %s\n", path.Path());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CopyEngine::Visit(BPartition *partition, int32 level)
|
SourceVisitor::Visit(BPartition *partition, int32 level)
|
||||||
{
|
{
|
||||||
|
if (!partition->Type() || strcmp(partition->Type(), kPartitionTypeBFS)!=0)
|
||||||
|
return false;
|
||||||
BPath path;
|
BPath path;
|
||||||
if (partition->GetPath(&path)==B_OK)
|
if (partition->GetPath(&path)==B_OK)
|
||||||
printf("CopyEngine::Visit(BPartition *) : %s\n", path.Path());
|
printf("SourceVisitor::Visit(BPartition *) : %s\n", path.Path());
|
||||||
printf("CopyEngine::Visit(BPartition *) : %s\n", partition->Name());
|
printf("SourceVisitor::Visit(BPartition *) : %s\n", partition->Name());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TargetVisitor::TargetVisitor(BMenu *menu)
|
||||||
|
: fMenu(menu)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TargetVisitor::Visit(BDiskDevice *device)
|
||||||
|
{
|
||||||
|
if (device->IsReadOnly())
|
||||||
|
return false;
|
||||||
|
BPath path;
|
||||||
|
if (device->GetPath(&path)==B_OK)
|
||||||
|
printf("TargetVisitor::Visit(BDiskDevice *) : %s\n", path.Path());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TargetVisitor::Visit(BPartition *partition, int32 level)
|
||||||
|
{
|
||||||
|
if (partition->IsReadOnly())
|
||||||
|
return false;
|
||||||
|
BPath path;
|
||||||
|
if (partition->GetPath(&path)==B_OK)
|
||||||
|
printf("TargetVisitor::Visit(BPartition *) : %s\n", path.Path());
|
||||||
|
printf("TargetVisitor::Visit(BPartition *) : %s\n", partition->Name());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
#ifndef _CopyEngine_h
|
#ifndef _CopyEngine_h
|
||||||
#define _CopyEngine_h
|
#define _CopyEngine_h
|
||||||
|
|
||||||
#include <DiskDeviceVisitor.h>
|
|
||||||
#include <DiskDevice.h>
|
#include <DiskDevice.h>
|
||||||
|
#include <DiskDeviceRoster.h>
|
||||||
#include <Looper.h>
|
#include <Looper.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <Partition.h>
|
#include <Partition.h>
|
||||||
@@ -15,18 +15,17 @@
|
|||||||
|
|
||||||
class InstallerWindow;
|
class InstallerWindow;
|
||||||
|
|
||||||
class CopyEngine : public BLooper/*, BDiskDeviceVisitor*/ {
|
class CopyEngine : public BLooper {
|
||||||
public:
|
public:
|
||||||
CopyEngine(InstallerWindow *window);
|
CopyEngine(InstallerWindow *window);
|
||||||
void Start();
|
void Start();
|
||||||
void ScanDisksPartitions(BMenu *srcMenu, BMenu *dstMenu);
|
void ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu);
|
||||||
|
|
||||||
virtual bool Visit(BDiskDevice *device);
|
|
||||||
virtual bool Visit(BPartition *partition, int32 level);
|
|
||||||
private:
|
private:
|
||||||
void LaunchInitScript(BVolume *volume);
|
void LaunchInitScript(BVolume *volume);
|
||||||
void LaunchFinishScript(BVolume *volume);
|
void LaunchFinishScript(BVolume *volume);
|
||||||
InstallerWindow *fWindow;
|
InstallerWindow *fWindow;
|
||||||
|
BDiskDeviceRoster fDDRoster;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _CopyEngine_h */
|
#endif /* _CopyEngine_h */
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
/* copied from libtracker, because beos loader doesn't seem to find them correctly in libtracker.so */
|
/* copied from libtracker, because beos loader doesn't seem to find them correctly in libtracker.so */
|
||||||
|
|
||||||
BPrivate::CopyLoopControl::~CopyLoopControl()
|
/*BPrivate::CopyLoopControl::~CopyLoopControl()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ bool
|
|||||||
BPrivate::CopyLoopControl::PreserveAttribute(const char*)
|
BPrivate::CopyLoopControl::PreserveAttribute(const char*)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
InstallerCopyLoopControl::InstallerCopyLoopControl(InstallerWindow *window)
|
InstallerCopyLoopControl::InstallerCopyLoopControl(InstallerWindow *window)
|
||||||
: fWindow(window)
|
: fWindow(window)
|
||||||
|
|||||||
Reference in New Issue
Block a user