Tracker: Style fixes

* Style fixes to QueryContainerWindow.h
* Style fixes to ContainerWindow
* Style fixes to Model
* Style fixes to Tracker
* Style fixes to PoseView
  - Most of the changes come from unindenting the code
This commit is contained in:
John Scipione 2015-02-27 20:08:15 -05:00
parent f19ef17518
commit 7ef62fb6c2
6 changed files with 99 additions and 98 deletions

View File

@ -203,7 +203,7 @@ AddOneAddon(const Model* model, const char* name, uint32 shortcut,
static int32
AddOnThread(BMessage* refsMessage, entry_ref addonRef, entry_ref dirRef)
AddOnThread(BMessage* refsMessage, entry_ref addonRef, entry_ref directoryRef)
{
std::auto_ptr<BMessage> refsMessagePtr(refsMessage);
@ -222,7 +222,7 @@ AddOnThread(BMessage* refsMessage, entry_ref addonRef, entry_ref dirRef)
if (result >= 0) {
// call add-on code
(*processRefs)(dirRef, refsMessagePtr.get(), 0);
(*processRefs)(directoryRef, refsMessagePtr.get(), NULL);
unload_add_on(addonImage);
return B_OK;
@ -1664,7 +1664,7 @@ BContainerWindow::MessageReceived(BMessage* message)
// there is fMenuBar
if (fMenuBar && fFileMenu) {
item = fFileMenu->FindItem(kMoveToTrash);
if (item) {
if (item != NULL) {
item->SetLabel(dontMoveToTrash
? B_TRANSLATE("Delete")
: B_TRANSLATE("Move to Trash"));
@ -3213,12 +3213,11 @@ BContainerWindow::LoadAddOn(BMessage* message)
// add selected refs to message
BMessage* refs = new BMessage(B_REFS_RECEIVED);
BObjectList<BPose>* list = PoseView()->SelectionList();
BObjectList<BPose>* selectionList = PoseView()->SelectionList();
int32 index = 0;
BPose* pose;
while ((pose = list->ItemAt(index++)) != NULL)
while ((pose = selectionList->ItemAt(index++)) != NULL)
refs->AddRef("refs", pose->TargetModel()->EntryRef());
refs->AddMessenger("TrackerViewToken", BMessenger(PoseView()));

View File

@ -118,33 +118,33 @@ Model::Model()
}
Model::Model(const Model &cloneThis)
Model::Model(const Model& other)
:
fEntryRef(cloneThis.fEntryRef),
fMimeType(cloneThis.fMimeType),
fEntryRef(other.fEntryRef),
fMimeType(other.fMimeType),
fPreferredAppName(NULL),
fBaseType(cloneThis.fBaseType),
fIconFrom(cloneThis.fIconFrom),
fBaseType(other.fBaseType),
fIconFrom(other.fIconFrom),
fWritable(false),
fNode(NULL),
fLocalizedName(cloneThis.fLocalizedName),
fHasLocalizedName(cloneThis.fHasLocalizedName),
fLocalizedNameIsCached(cloneThis.fLocalizedNameIsCached)
fLocalizedName(other.fLocalizedName),
fHasLocalizedName(other.fHasLocalizedName),
fLocalizedNameIsCached(other.fLocalizedNameIsCached)
{
fStatBuf.st_dev = cloneThis.NodeRef()->device;
fStatBuf.st_ino = cloneThis.NodeRef()->node;
fStatBuf.st_dev = other.NodeRef()->device;
fStatBuf.st_ino = other.NodeRef()->node;
if (cloneThis.IsSymLink() && cloneThis.LinkTo())
fLinkTo = new Model(*cloneThis.LinkTo());
if (other.IsSymLink() && other.LinkTo())
fLinkTo = new Model(*other.LinkTo());
fStatus = OpenNode(cloneThis.IsNodeOpenForWriting());
fStatus = OpenNode(other.IsNodeOpenForWriting());
if (fStatus == B_OK) {
ASSERT(fNode);
fNode->GetStat(&fStatBuf);
ASSERT(fStatBuf.st_dev == cloneThis.NodeRef()->device);
ASSERT(fStatBuf.st_ino == cloneThis.NodeRef()->node);
ASSERT(fStatBuf.st_dev == other.NodeRef()->device);
ASSERT(fStatBuf.st_ino == other.NodeRef()->node);
}
if (!cloneThis.IsNodeOpen())
if (!other.IsNodeOpen())
CloseNode();
}
@ -866,7 +866,7 @@ void
Model::UpdateEntryRef(const node_ref* dirNode, const char* name)
{
if (IsVolume()) {
if (fVolumeName)
if (fVolumeName != NULL)
DeletePreferredAppVolumeNameLinkTo();
fVolumeName = strdup(name);
@ -875,7 +875,7 @@ Model::UpdateEntryRef(const node_ref* dirNode, const char* name)
fEntryRef.device = dirNode->device;
fEntryRef.directory = dirNode->node;
if (fEntryRef.name && strcmp(fEntryRef.name, name) == 0)
if (fEntryRef.name != NULL && strcmp(fEntryRef.name, name) == 0)
return;
fEntryRef.set_name(name);
@ -887,7 +887,7 @@ Model::WatchVolumeAndMountPoint(uint32 , BHandler* target)
{
ASSERT(IsVolume());
if (fEntryRef.name && fVolumeName
if (fEntryRef.name != NULL && fVolumeName != NULL
&& strcmp(fEntryRef.name, "boot") == 0) {
// watch mount point for boot volume
BString bootMountPoint("/");

View File

@ -78,7 +78,7 @@ enum {
class Model {
public:
Model();
Model(const Model &);
Model(const Model& other);
Model(const BEntry* entry, bool open = false, bool writable = false);
Model(const entry_ref*, bool traverse = false, bool open = false,
bool writable = false);

View File

@ -8566,8 +8566,7 @@ BPoseView::ClearSelection()
fSelectionPivotPose = NULL;
fRealPivotPose = NULL;
if (fSelectionList->CountItems()) {
if (fSelectionList->CountItems() > 0) {
// scan all visible poses first
BRect bounds(Bounds());
@ -8613,6 +8612,7 @@ BPoseView::ClearSelection()
fSelectionList->MakeEmpty();
}
fMimeTypesInSelectionCache.MakeEmpty();
}
@ -8625,7 +8625,8 @@ BPoseView::ShowSelection(bool show)
fSelectionVisible = show;
if (fSelectionList->CountItems()) {
if (fSelectionList->CountItems() <= 0)
return;
// scan all visible poses first
BRect bounds(Bounds());
@ -8689,10 +8690,10 @@ BPoseView::ShowSelection(bool show)
} else {
if (fRealPivotPose)
fSelectionPivotPose = fRealPivotPose;
fRealPivotPose = NULL;
}
}
}
void

View File

@ -50,7 +50,8 @@ class BQueryPoseView;
class BQueryContainerWindow : public BContainerWindow {
public:
BQueryContainerWindow(LockingList<BWindow>* windowList,
BQueryContainerWindow(
LockingList<BWindow>* windowList,
uint32 containerWindowFlags);
BQueryPoseView* PoseView() const;

View File

@ -67,6 +67,7 @@ All rights reserved.
#include "ContainerWindow.h"
#include "DeskWindow.h"
#include "FindPanel.h"
#include "FunctionObject.h"
#include "FSClipboard.h"
#include "FSUtils.h"
#include "InfoWindow.h"
@ -77,12 +78,11 @@ All rights reserved.
#include "PoseView.h"
#include "QueryContainerWindow.h"
#include "StatusWindow.h"
#include "TrashWatcher.h"
#include "FunctionObject.h"
#include "TrackerSettings.h"
#include "TrackerSettingsWindow.h"
#include "TaskLoop.h"
#include "Thread.h"
#include "TrackerSettings.h"
#include "TrackerSettingsWindow.h"
#include "TrashWatcher.h"
#include "VirtualDirectoryWindow.h"
@ -677,7 +677,6 @@ TTracker::MoveRefsToTrash(const BMessage* message)
BObjectList<entry_ref>* srcList = new BObjectList<entry_ref>(count, true);
for (int32 index = 0; index < count; index++) {
entry_ref ref;
ASSERT(message->FindRef("refs", index, &ref) == B_OK);
if (message->FindRef("refs", index, &ref) != B_OK)
@ -685,14 +684,15 @@ TTracker::MoveRefsToTrash(const BMessage* message)
AutoLock<WindowList> lock(&fWindowList);
BContainerWindow* window = FindParentContainerWindow(&ref);
if (window)
if (window != NULL) {
// if we have a window open for this entry, ask the pose to
// delete it, this will select the next entry
window->PoseView()->MoveEntryToTrash(&ref);
else
} else {
// add all others to a list that gets deleted separately
srcList->AddItem(new entry_ref(ref));
}
}
// async move to trash
FSMoveToTrash(srcList);
@ -817,7 +817,7 @@ TTracker::OpenRef(const entry_ref* ref, const node_ref* nodeToClose,
if (openAsContainer || selector == kRunOpenWithWindow) {
// special case opening plain folders, queries or using open with
OpenContainerWindow(model, 0, selector, kRestoreDecor);
OpenContainerWindow(model, NULL, selector, kRestoreDecor);
// window adopts model
if (nodeToClose)
CloseParentWaitingForChildSoon(ref, nodeToClose);
@ -878,7 +878,7 @@ TTracker::RefsReceived(BMessage* message)
switch (selector) {
case kRunOpenWithWindow:
OpenContainerWindow(0, message, selector);
OpenContainerWindow(NULL, message, selector);
// window adopts model
break;