* sort the partitions by id (TODO: should be disk offset, but works as intended now) * expand the partition tree entries by default * renamed DriveVisitor to ListPopulatorVisitor, moved implementation into class definition * added MountAllVisitor and used it to implement according menu item * added menu item members to MainWindow, so it keeps the pointers * added MainWindow::_EnabledDisableMenuItems() which looks for the current disk and partition and their properties to en-/disable the items * moved BDiskDevice member from DiskView to MainWindow, renamed to fCurrentDisk * implemented mounting and unmounting the currently selected partition, mounting works, unmounting does not work as in Tracker, but the error description is not as helpful, or just as helpful, since Force Unmount does not work in Tracker at the moment * implemented initializing the selected partition, not tested to the end, but likely works, so beware! (TODO: finish the parameter window and use it, partitions are hardcoded to "BFS Init Test" and 2048 blocksize). The process displays a warning at the beginning and another one at the end before writing anything to disk, but please do take it seriously... :-) * store and restore the listview column settings (width of columns mostly) * more appropriate usage of the BDiskDeviceRoster API * improved DiskView display a little with frames and more contrast in the colors * implemented FrameResized() to adapt the box layout * no longer pass disk pointer to BDiskDeviceRoster::VisitEachPartition(), since it will overwrite it! * no longer use BDiskDeviceRoster at all, BPartition::VisitEachDescendant() is what we need * added a WIP InitParamsPanel, does not compile, but is not added to the Jamfile yet, it will be a blocking panel like a BAlert and will later be refactored into the parameter editor add-on for BFS git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23545 a95241bf-73f2-0310-859d-f6bbb57e9c96
84 lines
1.9 KiB
C++
84 lines
1.9 KiB
C++
/*
|
|
* Copyright 2002-2007 Haiku Inc. All rights reserved.
|
|
* Distributed under the terms of the MIT license.
|
|
*/
|
|
#ifndef MAIN_WINDOW_H
|
|
#define MAIN_WINDOW_H
|
|
|
|
|
|
#include <DiskDeviceRoster.h>
|
|
#include <Window.h>
|
|
|
|
|
|
class BDiskDevice;
|
|
class BPartition;
|
|
class BMenu;
|
|
class BMenuItem;
|
|
class DiskView;
|
|
class PartitionListView;
|
|
|
|
|
|
class MainWindow : public BWindow {
|
|
public:
|
|
MainWindow(BRect frame);
|
|
virtual ~MainWindow();
|
|
|
|
// BWindow interface
|
|
virtual bool QuitRequested();
|
|
virtual void MessageReceived(BMessage* message);
|
|
|
|
// MainWindow
|
|
status_t StoreSettings(BMessage* archive) const;
|
|
status_t RestoreSettings(BMessage* archive);
|
|
|
|
private:
|
|
void _ScanDrives();
|
|
void _ScanFileSystems();
|
|
|
|
void _AdaptToSelectedPartition();
|
|
void _EnabledDisableMenuItems(BDiskDevice* disk,
|
|
partition_id selectedPartition);
|
|
|
|
void _DisplayPartitionError(BString message,
|
|
const BPartition* partition = NULL,
|
|
status_t error = B_OK) const;
|
|
|
|
void _Mount(BDiskDevice* disk,
|
|
partition_id selectedPartition);
|
|
void _Unmount(BDiskDevice* disk,
|
|
partition_id selectedPartition);
|
|
void _MountAll();
|
|
|
|
void _Initialize(BDiskDevice* disk,
|
|
partition_id selectedPartition,
|
|
const BString& diskSystemName);
|
|
|
|
|
|
BDiskDeviceRoster fDDRoster;
|
|
BDiskDevice* fCurrentDisk;
|
|
partition_id fCurrentPartitionID;
|
|
|
|
PartitionListView* fListView;
|
|
DiskView* fDiskView;
|
|
|
|
BMenu* fDiskMenu;
|
|
BMenu* fPartitionMenu;
|
|
BMenu* fInitMenu;
|
|
BMenu* fCreateMenu;
|
|
|
|
BMenuItem* fFormatMI;
|
|
BMenuItem* fEjectMI;
|
|
BMenuItem* fSurfaceTestMI;
|
|
BMenuItem* fRescanMI;
|
|
|
|
BMenuItem* fCreatePrimaryMI;
|
|
BMenuItem* fCreateExtendedMI;
|
|
BMenuItem* fCreateLogicalMI;
|
|
BMenuItem* fMountMI;
|
|
BMenuItem* fUnmountMI;
|
|
BMenuItem* fMountAllMI;
|
|
};
|
|
|
|
|
|
#endif // MAIN_WINDOW_H
|