From 98cce525f01af60d70b908762aae3ca99be70440 Mon Sep 17 00:00:00 2001 From: Humdinger Date: Tue, 28 Feb 2012 17:42:01 +0100 Subject: [PATCH] Clean up. No functional change. --- src/apps/expander/ExpanderPreferences.cpp | 36 +++++++--- src/apps/expander/ExpanderPreferences.h | 83 ++++++++++------------- 2 files changed, 59 insertions(+), 60 deletions(-) diff --git a/src/apps/expander/ExpanderPreferences.cpp b/src/apps/expander/ExpanderPreferences.cpp index c3b3b273c6..91a0dd4d51 100644 --- a/src/apps/expander/ExpanderPreferences.cpp +++ b/src/apps/expander/ExpanderPreferences.cpp @@ -1,9 +1,12 @@ /* - * Copyright 2004-2006, Jérôme DUVAL. All rights reserved. + * Copyright 2004-2012, Haiku. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Jérôme Duval + * Humdinger */ -#include "ExpanderPreferences.h" #include #include #include @@ -13,18 +16,21 @@ #include #include +#include "ExpanderPreferences.h" + const uint32 MSG_OK = 'mgOK'; const uint32 MSG_CANCEL = 'mCan'; -const uint32 MSG_LEAVEDEST = 'mLed'; -const uint32 MSG_SAMEDIR = 'mSad'; -const uint32 MSG_DESTUSE = 'mDeu'; -const uint32 MSG_DESTTEXT = 'mDet'; +const uint32 MSG_LEAVEDEST = 'mLed'; +const uint32 MSG_SAMEDIR = 'mSad'; +const uint32 MSG_DESTUSE = 'mDeu'; +const uint32 MSG_DESTTEXT = 'mDet'; const uint32 MSG_DESTSELECT = 'mDes'; #undef B_TRANSLATE_CONTEXT #define B_TRANSLATE_CONTEXT "ExpanderPreferences" -ExpanderPreferences::ExpanderPreferences(BMessage *settings) + +ExpanderPreferences::ExpanderPreferences(BMessage* settings) : BWindow(BRect(0, 0, 325, 305), B_TRANSLATE("Expander settings"), B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), @@ -40,17 +46,16 @@ ExpanderPreferences::ExpanderPreferences(BMessage *settings) BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, kSpacing / 2); buttonBox->SetLayout(buttonLayout); - BStringView *expansionLabel = new BStringView("stringViewExpansion", + BStringView* expansionLabel = new BStringView("stringViewExpansion", B_TRANSLATE("Expansion")); expansionLabel->SetFont(be_bold_font); - BStringView *destinationLabel = new BStringView("stringViewDestination", + BStringView* destinationLabel = new BStringView("stringViewDestination", B_TRANSLATE("Destination folder")); destinationLabel->SetFont(be_bold_font); - BStringView *otherLabel = new BStringView("stringViewOther", + BStringView* otherLabel = new BStringView("stringViewOther", B_TRANSLATE("Other")); otherLabel->SetFont(be_bold_font); - fAutoExpand = new BCheckBox("autoExpand", B_TRANSLATE("Automatically expand files"), NULL); fCloseWindow = new BCheckBox("closeWindowWhenDone", @@ -219,26 +224,34 @@ ExpanderPreferences::MessageReceived(BMessage* msg) break; } case B_REFS_RECEIVED: + { if (msg->FindRef("refs", 0, &fRef) == B_OK) { BEntry entry(&fRef, true); BPath path(&entry); fDestText->SetText(path.Path()); } break; + } case MSG_LEAVEDEST: case MSG_SAMEDIR: + { fDestText->SetEnabled(false); fSelect->SetEnabled(false); break; + } case MSG_DESTUSE: + { fDestText->SetEnabled(true); fSelect->SetEnabled(true); fDestText->TextView()->MakeEditable(false); break; + } case MSG_CANCEL: Hide(); break; + case MSG_OK: + { fSettings->ReplaceBool("automatically_expand_files", fAutoExpand->Value() == B_CONTROL_ON); fSettings->ReplaceBool("close_when_done", @@ -253,6 +266,7 @@ ExpanderPreferences::MessageReceived(BMessage* msg) fAutoShow->Value() == B_CONTROL_ON); Hide(); break; + } default: break; } diff --git a/src/apps/expander/ExpanderPreferences.h b/src/apps/expander/ExpanderPreferences.h index 48944f5996..31b930dc64 100644 --- a/src/apps/expander/ExpanderPreferences.h +++ b/src/apps/expander/ExpanderPreferences.h @@ -1,57 +1,42 @@ -/*****************************************************************************/ -// Expander -// Written by Jérôme Duval -// -// ExpanderPreferences.h -// -// -// Copyright (c) 2004 OpenBeOS Project -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -/*****************************************************************************/ +/* + * Copyright 2004-2012, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Jérôme Duval + */ +#ifndef _EXPANDERPREFERENCES_H +#define _EXPANDERPREFERENCES_H -#ifndef _ExpanderPreferences_h -#define _ExpanderPreferences_h + +#include +#include +#include +#include +#include +#include +#include #include "DirectoryFilePanel.h" -#include -#include -#include -#include -#include -#include -#include + class ExpanderPreferences : public BWindow { - public: - ExpanderPreferences(BMessage *settings); - virtual ~ExpanderPreferences(); - virtual void MessageReceived(BMessage *msg); +public: + ExpanderPreferences(BMessage* settings); + virtual ~ExpanderPreferences(); + virtual void MessageReceived(BMessage* msg); - private: - BMessage *fSettings; - BCheckBox *fAutoExpand, *fCloseWindow, *fAutoShow, *fOpenDest; - BRadioButton *fDestUse, *fSameDest, *fLeaveDest; - BButton *fSelect; - BTextControl *fDestText; - entry_ref fRef; - DirectoryFilePanel *fUsePanel; +private: + void _LoadSettings(); + void _SaveSettings(); + + BButton *fSelect; + BCheckBox *fAutoExpand, *fCloseWindow, *fAutoShow, *fOpenDest; + BMessage *fSettings; + BRadioButton *fDestUse, *fSameDest, *fLeaveDest; + BTextControl *fDestText; + DirectoryFilePanel *fUsePanel; + entry_ref fRef; }; -#endif /* _ExpanderPreferences_h */ +#endif // _EXPANDERPREFERENCES_H