Clean up. No functional change.
This commit is contained in:
parent
a866fc60f9
commit
98cce525f0
@ -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.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Jérôme Duval
|
||||||
|
* Humdinger <humdingerb@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ExpanderPreferences.h"
|
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
@ -13,18 +16,21 @@
|
|||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
|
||||||
|
#include "ExpanderPreferences.h"
|
||||||
|
|
||||||
const uint32 MSG_OK = 'mgOK';
|
const uint32 MSG_OK = 'mgOK';
|
||||||
const uint32 MSG_CANCEL = 'mCan';
|
const uint32 MSG_CANCEL = 'mCan';
|
||||||
const uint32 MSG_LEAVEDEST = 'mLed';
|
const uint32 MSG_LEAVEDEST = 'mLed';
|
||||||
const uint32 MSG_SAMEDIR = 'mSad';
|
const uint32 MSG_SAMEDIR = 'mSad';
|
||||||
const uint32 MSG_DESTUSE = 'mDeu';
|
const uint32 MSG_DESTUSE = 'mDeu';
|
||||||
const uint32 MSG_DESTTEXT = 'mDet';
|
const uint32 MSG_DESTTEXT = 'mDet';
|
||||||
const uint32 MSG_DESTSELECT = 'mDes';
|
const uint32 MSG_DESTSELECT = 'mDes';
|
||||||
|
|
||||||
#undef B_TRANSLATE_CONTEXT
|
#undef B_TRANSLATE_CONTEXT
|
||||||
#define B_TRANSLATE_CONTEXT "ExpanderPreferences"
|
#define B_TRANSLATE_CONTEXT "ExpanderPreferences"
|
||||||
|
|
||||||
ExpanderPreferences::ExpanderPreferences(BMessage *settings)
|
|
||||||
|
ExpanderPreferences::ExpanderPreferences(BMessage* settings)
|
||||||
: BWindow(BRect(0, 0, 325, 305), B_TRANSLATE("Expander settings"),
|
: BWindow(BRect(0, 0, 325, 305), B_TRANSLATE("Expander settings"),
|
||||||
B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_CLOSABLE
|
B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_CLOSABLE
|
||||||
| B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
|
| 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);
|
BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, kSpacing / 2);
|
||||||
buttonBox->SetLayout(buttonLayout);
|
buttonBox->SetLayout(buttonLayout);
|
||||||
|
|
||||||
BStringView *expansionLabel = new BStringView("stringViewExpansion",
|
BStringView* expansionLabel = new BStringView("stringViewExpansion",
|
||||||
B_TRANSLATE("Expansion"));
|
B_TRANSLATE("Expansion"));
|
||||||
expansionLabel->SetFont(be_bold_font);
|
expansionLabel->SetFont(be_bold_font);
|
||||||
BStringView *destinationLabel = new BStringView("stringViewDestination",
|
BStringView* destinationLabel = new BStringView("stringViewDestination",
|
||||||
B_TRANSLATE("Destination folder"));
|
B_TRANSLATE("Destination folder"));
|
||||||
destinationLabel->SetFont(be_bold_font);
|
destinationLabel->SetFont(be_bold_font);
|
||||||
BStringView *otherLabel = new BStringView("stringViewOther",
|
BStringView* otherLabel = new BStringView("stringViewOther",
|
||||||
B_TRANSLATE("Other"));
|
B_TRANSLATE("Other"));
|
||||||
otherLabel->SetFont(be_bold_font);
|
otherLabel->SetFont(be_bold_font);
|
||||||
|
|
||||||
|
|
||||||
fAutoExpand = new BCheckBox("autoExpand",
|
fAutoExpand = new BCheckBox("autoExpand",
|
||||||
B_TRANSLATE("Automatically expand files"), NULL);
|
B_TRANSLATE("Automatically expand files"), NULL);
|
||||||
fCloseWindow = new BCheckBox("closeWindowWhenDone",
|
fCloseWindow = new BCheckBox("closeWindowWhenDone",
|
||||||
@ -219,26 +224,34 @@ ExpanderPreferences::MessageReceived(BMessage* msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
|
{
|
||||||
if (msg->FindRef("refs", 0, &fRef) == B_OK) {
|
if (msg->FindRef("refs", 0, &fRef) == B_OK) {
|
||||||
BEntry entry(&fRef, true);
|
BEntry entry(&fRef, true);
|
||||||
BPath path(&entry);
|
BPath path(&entry);
|
||||||
fDestText->SetText(path.Path());
|
fDestText->SetText(path.Path());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MSG_LEAVEDEST:
|
case MSG_LEAVEDEST:
|
||||||
case MSG_SAMEDIR:
|
case MSG_SAMEDIR:
|
||||||
|
{
|
||||||
fDestText->SetEnabled(false);
|
fDestText->SetEnabled(false);
|
||||||
fSelect->SetEnabled(false);
|
fSelect->SetEnabled(false);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MSG_DESTUSE:
|
case MSG_DESTUSE:
|
||||||
|
{
|
||||||
fDestText->SetEnabled(true);
|
fDestText->SetEnabled(true);
|
||||||
fSelect->SetEnabled(true);
|
fSelect->SetEnabled(true);
|
||||||
fDestText->TextView()->MakeEditable(false);
|
fDestText->TextView()->MakeEditable(false);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MSG_CANCEL:
|
case MSG_CANCEL:
|
||||||
Hide();
|
Hide();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSG_OK:
|
case MSG_OK:
|
||||||
|
{
|
||||||
fSettings->ReplaceBool("automatically_expand_files",
|
fSettings->ReplaceBool("automatically_expand_files",
|
||||||
fAutoExpand->Value() == B_CONTROL_ON);
|
fAutoExpand->Value() == B_CONTROL_ON);
|
||||||
fSettings->ReplaceBool("close_when_done",
|
fSettings->ReplaceBool("close_when_done",
|
||||||
@ -253,6 +266,7 @@ ExpanderPreferences::MessageReceived(BMessage* msg)
|
|||||||
fAutoShow->Value() == B_CONTROL_ON);
|
fAutoShow->Value() == B_CONTROL_ON);
|
||||||
Hide();
|
Hide();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,57 +1,42 @@
|
|||||||
/*****************************************************************************/
|
/*
|
||||||
// Expander
|
* Copyright 2004-2012, Haiku. All rights reserved.
|
||||||
// Written by Jérôme Duval
|
* Distributed under the terms of the MIT License.
|
||||||
//
|
*
|
||||||
// ExpanderPreferences.h
|
* Authors:
|
||||||
//
|
* Jérôme Duval
|
||||||
//
|
*/
|
||||||
// Copyright (c) 2004 OpenBeOS Project
|
#ifndef _EXPANDERPREFERENCES_H
|
||||||
//
|
#define _EXPANDERPREFERENCES_H
|
||||||
// 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.
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef _ExpanderPreferences_h
|
|
||||||
#define _ExpanderPreferences_h
|
#include <Button.h>
|
||||||
|
#include <CheckBox.h>
|
||||||
|
#include <Entry.h>
|
||||||
|
#include <Message.h>
|
||||||
|
#include <RadioButton.h>
|
||||||
|
#include <TextControl.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
#include "DirectoryFilePanel.h"
|
#include "DirectoryFilePanel.h"
|
||||||
#include <Window.h>
|
|
||||||
#include <Message.h>
|
|
||||||
#include <Button.h>
|
|
||||||
#include <Entry.h>
|
|
||||||
#include <TextControl.h>
|
|
||||||
#include <CheckBox.h>
|
|
||||||
#include <RadioButton.h>
|
|
||||||
|
|
||||||
class ExpanderPreferences : public BWindow {
|
class ExpanderPreferences : public BWindow {
|
||||||
public:
|
public:
|
||||||
ExpanderPreferences(BMessage *settings);
|
ExpanderPreferences(BMessage* settings);
|
||||||
virtual ~ExpanderPreferences();
|
virtual ~ExpanderPreferences();
|
||||||
virtual void MessageReceived(BMessage *msg);
|
virtual void MessageReceived(BMessage* msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMessage *fSettings;
|
void _LoadSettings();
|
||||||
BCheckBox *fAutoExpand, *fCloseWindow, *fAutoShow, *fOpenDest;
|
void _SaveSettings();
|
||||||
BRadioButton *fDestUse, *fSameDest, *fLeaveDest;
|
|
||||||
BButton *fSelect;
|
BButton *fSelect;
|
||||||
BTextControl *fDestText;
|
BCheckBox *fAutoExpand, *fCloseWindow, *fAutoShow, *fOpenDest;
|
||||||
entry_ref fRef;
|
BMessage *fSettings;
|
||||||
DirectoryFilePanel *fUsePanel;
|
BRadioButton *fDestUse, *fSameDest, *fLeaveDest;
|
||||||
|
BTextControl *fDestText;
|
||||||
|
DirectoryFilePanel *fUsePanel;
|
||||||
|
entry_ref fRef;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _ExpanderPreferences_h */
|
#endif // _EXPANDERPREFERENCES_H
|
||||||
|
Loading…
Reference in New Issue
Block a user