actually uses the copyengine looper to handle the copy process
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16011 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -15,6 +15,13 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <VolumeRoster.h>
|
#include <VolumeRoster.h>
|
||||||
|
|
||||||
|
//#define COPY_TRACE
|
||||||
|
#ifdef COPY_TRACE
|
||||||
|
#define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__)
|
||||||
|
#else
|
||||||
|
#define CALLED()
|
||||||
|
#endif
|
||||||
|
|
||||||
extern void SizeAsString(off_t size, char *string);
|
extern void SizeAsString(off_t size, char *string);
|
||||||
|
|
||||||
class SourceVisitor : public BDiskDeviceVisitor
|
class SourceVisitor : public BDiskDeviceVisitor
|
||||||
@@ -45,6 +52,28 @@ CopyEngine::CopyEngine(InstallerWindow *window)
|
|||||||
fWindow(window)
|
fWindow(window)
|
||||||
{
|
{
|
||||||
fControl = new InstallerCopyLoopControl(window);
|
fControl = new InstallerCopyLoopControl(window);
|
||||||
|
Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CopyEngine::MessageReceived(BMessage*msg)
|
||||||
|
{
|
||||||
|
CALLED();
|
||||||
|
switch (msg->what) {
|
||||||
|
case ENGINE_START:
|
||||||
|
Start(fWindow->GetSourceMenu(), fWindow->GetTargetMenu());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CopyEngine::SetStatusMessage(char *status)
|
||||||
|
{
|
||||||
|
BMessage msg(STATUS_MESSAGE);
|
||||||
|
msg.AddString("status", status);
|
||||||
|
BMessenger(fWindow).SendMessage(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -56,7 +85,7 @@ CopyEngine::LaunchInitScript(BPath &path)
|
|||||||
BString command(bootPath.Path());
|
BString command(bootPath.Path());
|
||||||
command += "/InstallerInitScript ";
|
command += "/InstallerInitScript ";
|
||||||
command += path.Path();
|
command += path.Path();
|
||||||
fWindow->SetStatusMessage("Starting Installation.");
|
SetStatusMessage("Starting Installation.");
|
||||||
system(command.String());
|
system(command.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +98,7 @@ CopyEngine::LaunchFinishScript(BPath &path)
|
|||||||
BString command(bootPath.Path());
|
BString command(bootPath.Path());
|
||||||
command += "/InstallerFinishScript ";
|
command += "/InstallerFinishScript ";
|
||||||
command += path.Path();
|
command += path.Path();
|
||||||
fWindow->SetStatusMessage("Finishing Installation.");
|
SetStatusMessage("Finishing Installation.");
|
||||||
system(command.String());
|
system(command.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,10 +106,13 @@ CopyEngine::LaunchFinishScript(BPath &path)
|
|||||||
void
|
void
|
||||||
CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
PartitionMenuItem *targetItem = (PartitionMenuItem *)targetMenu->FindMarked();
|
PartitionMenuItem *targetItem = (PartitionMenuItem *)targetMenu->FindMarked();
|
||||||
PartitionMenuItem *srcItem = (PartitionMenuItem *)srcMenu->FindMarked();
|
PartitionMenuItem *srcItem = (PartitionMenuItem *)srcMenu->FindMarked();
|
||||||
if (!srcItem || !targetItem)
|
if (!srcItem || !targetItem) {
|
||||||
|
fprintf(stderr, "bad menu items\n");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BPath targetDirectory;
|
BPath targetDirectory;
|
||||||
BDiskDevice device;
|
BDiskDevice device;
|
||||||
@@ -113,6 +145,7 @@ CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
|||||||
bootVolume.GetRootDirectory(&bootDir);
|
bootVolume.GetRootDirectory(&bootDir);
|
||||||
bootDir.GetEntry(&bootEntry);
|
bootDir.GetEntry(&bootEntry);
|
||||||
bootEntry.GetPath(&bootPath);
|
bootEntry.GetPath(&bootPath);
|
||||||
|
printf("Copying to boot disk ? '%s' / '%s'\n", bootPath.Path(), targetDirectory.Path());
|
||||||
if (strncmp(bootPath.Path(), targetDirectory.Path(), strlen(bootPath.Path())) == 0) {
|
if (strncmp(bootPath.Path(), targetDirectory.Path(), strlen(bootPath.Path())) == 0) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,13 @@
|
|||||||
|
|
||||||
class InstallerWindow;
|
class InstallerWindow;
|
||||||
|
|
||||||
|
const uint32 ENGINE_START = 'eSRT';
|
||||||
|
|
||||||
class CopyEngine : public BLooper {
|
class CopyEngine : public BLooper {
|
||||||
public:
|
public:
|
||||||
CopyEngine(InstallerWindow *window);
|
CopyEngine(InstallerWindow *window);
|
||||||
|
void MessageReceived(BMessage *msg);
|
||||||
|
void SetStatusMessage(char *status);
|
||||||
void Start(BMenu *srcMenu, BMenu *targetMenu);
|
void Start(BMenu *srcMenu, BMenu *targetMenu);
|
||||||
void ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu);
|
void ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu);
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ InstallerWindow::MessageReceived(BMessage *msg)
|
|||||||
StartScan();
|
StartScan();
|
||||||
break;
|
break;
|
||||||
case BEGIN_MESSAGE:
|
case BEGIN_MESSAGE:
|
||||||
fCopyEngine.Start(fSrcMenu, fDestMenu);
|
printf("BEGIN_MESSAGE\n");
|
||||||
|
BMessenger(&fCopyEngine).SendMessage(ENGINE_START);
|
||||||
break;
|
break;
|
||||||
case SHOW_BOTTOM_MESSAGE:
|
case SHOW_BOTTOM_MESSAGE:
|
||||||
ShowBottom();
|
ShowBottom();
|
||||||
@@ -187,6 +188,11 @@ InstallerWindow::MessageReceived(BMessage *msg)
|
|||||||
fSizeView->SetText(string);
|
fSizeView->SetText(string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case STATUS_MESSAGE: {
|
||||||
|
const char *status;
|
||||||
|
if (msg->FindString("status", &status) == B_OK)
|
||||||
|
SetStatusMessage(status);
|
||||||
|
}
|
||||||
case B_SOME_APP_LAUNCHED:
|
case B_SOME_APP_LAUNCHED:
|
||||||
case B_SOME_APP_QUIT:
|
case B_SOME_APP_QUIT:
|
||||||
{
|
{
|
||||||
@@ -373,7 +379,7 @@ InstallerWindow::ComparePackages(const void *firstArg, const void *secondArg)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallerWindow::SetStatusMessage(char *text)
|
InstallerWindow::SetStatusMessage(const char *text)
|
||||||
{
|
{
|
||||||
BAutolock(this);
|
BAutolock(this);
|
||||||
fStatusView->SetText(text);
|
fStatusView->SetText(text);
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#define INSTALLER_RIGHT 402
|
#define INSTALLER_RIGHT 402
|
||||||
|
|
||||||
|
const uint32 STATUS_MESSAGE = 'iSTM';
|
||||||
|
|
||||||
class InstallerWindow : public BWindow {
|
class InstallerWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
InstallerWindow(BRect frameRect);
|
InstallerWindow(BRect frameRect);
|
||||||
@@ -26,7 +28,9 @@ public:
|
|||||||
|
|
||||||
virtual void MessageReceived(BMessage *msg);
|
virtual void MessageReceived(BMessage *msg);
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
void SetStatusMessage(char *text);
|
void SetStatusMessage(const char *text);
|
||||||
|
BMenu *GetSourceMenu() { return fSrcMenu; };
|
||||||
|
BMenu *GetTargetMenu() { return fDestMenu; };
|
||||||
private:
|
private:
|
||||||
void DisableInterface(bool disable);
|
void DisableInterface(bool disable);
|
||||||
void LaunchDriveSetup();
|
void LaunchDriveSetup();
|
||||||
|
|||||||
Reference in New Issue
Block a user