102be5353SAxel Dörfler/*
202be5353SAxel DörflerOpen Tracker License
302be5353SAxel Dörfler
402be5353SAxel DörflerTerms and Conditions
502be5353SAxel Dörfler
602be5353SAxel DörflerCopyright (c) 1991-2000, Be Incorporated. All rights reserved.
702be5353SAxel Dörfler
802be5353SAxel DörflerPermission is hereby granted, free of charge, to any person obtaining a copy of
902be5353SAxel Dörflerthis software and associated documentation files (the "Software"), to deal in
1002be5353SAxel Dörflerthe Software without restriction, including without limitation the rights to
1102be5353SAxel Dörfleruse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
1202be5353SAxel Dörflerof the Software, and to permit persons to whom the Software is furnished to do
1302be5353SAxel Dörflerso, subject to the following conditions:
1402be5353SAxel Dörfler
1502be5353SAxel DörflerThe above copyright notice and this permission notice applies to all licensees
1602be5353SAxel Dörflerand shall be included in all copies or substantial portions of the Software.
1702be5353SAxel Dörfler
1802be5353SAxel DörflerTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1902be5353SAxel DörflerIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
2002be5353SAxel DörflerFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
2102be5353SAxel DörflerBE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
2202be5353SAxel DörflerAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
2302be5353SAxel DörflerWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2402be5353SAxel Dörfler
2502be5353SAxel DörflerExcept as contained in this notice, the name of Be Incorporated shall not be
2602be5353SAxel Dörflerused in advertising or otherwise to promote the sale, use or other dealings in
2702be5353SAxel Dörflerthis Software without prior written authorization from Be Incorporated.
2802be5353SAxel Dörfler
2902be5353SAxel DörflerTracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
3002be5353SAxel Dörflerof Be Incorporated in the United States and other countries. Other brand product
3102be5353SAxel Dörflernames are registered trademarks or trademarks of their respective holders.
3202be5353SAxel DörflerAll rights reserved.
3302be5353SAxel Dörfler*/
3402be5353SAxel Dörfler
3502be5353SAxel Dörfler
3602be5353SAxel Dörfler#include "SettingsViews.h"
3702be5353SAxel Dörfler
3802be5353SAxel Dörfler#include <Box.h>
3902be5353SAxel Dörfler#include <Button.h>
404ed28a57SAlexandre Deckner#include <Catalog.h>
4162bcb75cSJohn Scipione#include <CheckBox.h>
4262bcb75cSJohn Scipione#include <ColorControl.h>
43894cf4f3SAlexandre Deckner#include <ControlLook.h>
4464c61228SJohn Scipione#include <LayoutBuilder.h>
454ed28a57SAlexandre Deckner#include <Locale.h>
4602be5353SAxel Dörfler#include <MenuField.h>
4702be5353SAxel Dörfler#include <NodeMonitor.h>
4862bcb75cSJohn Scipione#include <Point.h>
4962bcb75cSJohn Scipione#include <RadioButton.h>
5002be5353SAxel Dörfler#include <StringView.h>
5102be5353SAxel Dörfler
5262bcb75cSJohn Scipione#include "Commands.h"
5362bcb75cSJohn Scipione#include "DeskWindow.h"
5462bcb75cSJohn Scipione#include "Model.h"
5562bcb75cSJohn Scipione#include "Tracker.h"
5662bcb75cSJohn Scipione#include "WidgetAttributeText.h"
5762bcb75cSJohn Scipione
587befa79aSAxel Dörfler
597befa79aSAxel Dörflerstatic const uint32 kSpaceBarSwitchColor = 'SBsc';
607befa79aSAxel Dörfler
613831b0dcSAlexandre Deckner//TODO: defaults should be set in one place only (TrackerSettings.cpp) while
623831b0dcSAlexandre Deckner//		being accessible from here.
63ea001e58SJohn Scipione//		What about adding DefaultValue(), IsDefault() etc... methods to
64ea001e58SJohn Scipione//		xxxValueSetting ?
653831b0dcSAlexandre Decknerstatic const uint8 kSpaceBarAlpha = 192;
667fd5989dSJohn Scipionestatic const rgb_color kDefaultUsedSpaceColor = { 0, 203, 0, kSpaceBarAlpha };
67ea001e58SJohn Scipionestatic const rgb_color kDefaultFreeSpaceColor
687fd5989dSJohn Scipione	= { 255, 255, 255, kSpaceBarAlpha };
69ea001e58SJohn Scipionestatic const rgb_color kDefaultWarningSpaceColor
707fd5989dSJohn Scipione	= { 203, 0, 0, kSpaceBarAlpha };
717befa79aSAxel Dörfler
72c1b274fdSStephan Aßmus
737befa79aSAxel Dörflerstatic void
74b05aa8b5SJohn Scipionesend_bool_notices(uint32 what, const char* name, bool value)
757befa79aSAxel Dörfler{
76b05aa8b5SJohn Scipione	TTracker* tracker = dynamic_cast<TTracker*>(be_app);
7754e2dd72SJohn Scipione	if (tracker == NULL)
787befa79aSAxel Dörfler		return;
797befa79aSAxel Dörfler
807befa79aSAxel Dörfler	BMessage message;
817befa79aSAxel Dörfler	message.AddBool(name, value);
827befa79aSAxel Dörfler	tracker->SendNotices(what, &message);
837befa79aSAxel Dörfler}
847befa79aSAxel Dörfler
857befa79aSAxel Dörfler
86546208a5SOliver Tappe#undef B_TRANSLATION_CONTEXT
87546208a5SOliver Tappe#define B_TRANSLATION_CONTEXT "SettingsView"
884ed28a57SAlexandre Deckner
89f435b678SJohn Scipione
90f435b678SJohn Scipione//	#pragma mark - SettingsView
91f435b678SJohn Scipione
92f435b678SJohn Scipione
93894cf4f3SAlexandre DecknerSettingsView::SettingsView(const char* name)
94894cf4f3SAlexandre Deckner	:
95894cf4f3SAlexandre Deckner	BGroupView(name)
9602be5353SAxel Dörfler{
9702be5353SAxel Dörfler}
9802be5353SAxel Dörfler
997befa79aSAxel Dörfler
10002be5353SAxel DörflerSettingsView::~SettingsView()
10102be5353SAxel Dörfler{
10202be5353SAxel Dörfler}
10302be5353SAxel Dörfler
10402be5353SAxel Dörfler
1057befa79aSAxel Dörfler/*!
1067befa79aSAxel Dörfler	The inherited functions should set the default values
1077befa79aSAxel Dörfler	and update the UI gadgets. The latter can by done by
1087befa79aSAxel Dörfler	calling ShowCurrentSettings().
1097befa79aSAxel Dörfler*/
1107befa79aSAxel Dörflervoid
1117befa79aSAxel DörflerSettingsView::SetDefaults()
1127befa79aSAxel Dörfler{
1137befa79aSAxel Dörfler}
1147befa79aSAxel Dörfler
1157befa79aSAxel Dörfler
1166eb01296SRyan Leavengood/*!
1176eb01296SRyan Leavengood	This function is used by the window to tell whether
1186eb01296SRyan Leavengood	it can ghost the defaults button or not. It doesn't
1196eb01296SRyan Leavengood	shows the default settings, this function should
1206eb01296SRyan Leavengood	return true.
1216eb01296SRyan Leavengood*/
1226eb01296SRyan Leavengoodbool
1236eb01296SRyan LeavengoodSettingsView::IsDefaultable() const
1246eb01296SRyan Leavengood{
1256eb01296SRyan Leavengood	return true;
1266eb01296SRyan Leavengood}
1276eb01296SRyan Leavengood
1286eb01296SRyan Leavengood
1297befa79aSAxel Dörfler/*!
1307befa79aSAxel Dörfler	The inherited functions should set the values that was
1317befa79aSAxel Dörfler	active when the settings window opened. It should also
1327befa79aSAxel Dörfler	update the UI widgets accordingly, preferrable by calling
1337befa79aSAxel Dörfler	ShowCurrentSettings().
1347befa79aSAxel Dörfler*/
1357befa79aSAxel Dörflervoid
1367befa79aSAxel DörflerSettingsView::Revert()
1377befa79aSAxel Dörfler{
1387befa79aSAxel Dörfler}
1397befa79aSAxel Dörfler
14002be5353SAxel Dörfler
1417befa79aSAxel Dörfler/*!
1427befa79aSAxel Dörfler	This function is called when the window is shown to let
1437befa79aSAxel Dörfler	the settings views record the state to revert to.
1447befa79aSAxel Dörfler*/
1457befa79aSAxel Dörflervoid
1467befa79aSAxel DörflerSettingsView::RecordRevertSettings()
1477befa79aSAxel Dörfler{
1487befa79aSAxel Dörfler}
1497befa79aSAxel Dörfler
1507befa79aSAxel Dörfler
1517befa79aSAxel Dörfler/*!
1527befa79aSAxel Dörfler	This function is used by the window to tell the view
1537befa79aSAxel Dörfler	to display the current settings in the tracker.
1547befa79aSAxel Dörfler*/
1557befa79aSAxel Dörflervoid
1567befa79aSAxel DörflerSettingsView::ShowCurrentSettings()
1577befa79aSAxel Dörfler{
1587befa79aSAxel Dörfler}
15902be5353SAxel Dörfler
16002be5353SAxel Dörfler
1617befa79aSAxel Dörfler/*!
1627befa79aSAxel Dörfler	This function is used by the window to tell whether
1637befa79aSAxel Dörfler	it can ghost the revert button or not. It it shows the
1647befa79aSAxel Dörfler	reverted settings, this function should return true.
1657befa79aSAxel Dörfler*/
1667befa79aSAxel Dörflerbool
1677befa79aSAxel DörflerSettingsView::IsRevertable() const
1687befa79aSAxel Dörfler{
169c1b274fdSStephan Aßmus	return true;
17002be5353SAxel Dörfler}
17102be5353SAxel Dörfler
1727befa79aSAxel Dörfler
173f435b678SJohn Scipione// #pragma mark - DesktopSettingsView
17402be5353SAxel Dörfler
1757befa79aSAxel Dörfler
176894cf4f3SAlexandre DecknerDesktopSettingsView::DesktopSettingsView()
177894cf4f3SAlexandre Deckner	:
17868295c92SJohn Scipione	SettingsView("DesktopSettingsView"),
17968295c92SJohn Scipione	fShowDisksIconRadioButton(NULL),
18068295c92SJohn Scipione	fMountVolumesOntoDesktopRadioButton(NULL),
18168295c92SJohn Scipione	fMountSharedVolumesOntoDesktopCheckBox(NULL),
18268295c92SJohn Scipione	fShowDisksIcon(false),
18368295c92SJohn Scipione	fMountVolumesOntoDesktop(false),
18468295c92SJohn Scipione	fMountSharedVolumesOntoDesktop(false),
18568295c92SJohn Scipione	fIntegrateNonBootBeOSDesktops(false),
18668295c92SJohn Scipione	fEjectWhenUnmounting(false)
18702be5353SAxel Dörfler{
188894cf4f3SAlexandre Deckner	fShowDisksIconRadioButton = new BRadioButton("",
1894ed28a57SAlexandre Deckner		B_TRANSLATE("Show Disks icon"),
19002be5353SAxel Dörfler		new BMessage(kShowDisksIconChanged));
191c1b274fdSStephan Aßmus
192894cf4f3SAlexandre Deckner	fMountVolumesOntoDesktopRadioButton = new BRadioButton("",
1934ed28a57SAlexandre Deckner		B_TRANSLATE("Show volumes on Desktop"),
1944ed28a57SAlexandre Deckner		new BMessage(kVolumesOnDesktopChanged));
19502be5353SAxel Dörfler
196894cf4f3SAlexandre Deckner	fMountSharedVolumesOntoDesktopCheckBox = new BCheckBox("",
1974ed28a57SAlexandre Deckner		B_TRANSLATE("Show shared volumes on Desktop"),
1984ed28a57SAlexandre Deckner		new BMessage(kVolumesOnDesktopChanged));
19902be5353SAxel Dörfler
200894cf4f3SAlexandre Deckner	const float spacing = be_control_look->DefaultItemSpacing();
201894cf4f3SAlexandre Deckner
20264c61228SJohn Scipione	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
20364c61228SJohn Scipione		.Add(fShowDisksIconRadioButton)
20464c61228SJohn Scipione		.Add(fMountVolumesOntoDesktopRadioButton)
205e80276e2SAlex Wilson		.AddGroup(B_VERTICAL, 0)
20664c61228SJohn Scipione			.Add(fMountSharedVolumesOntoDesktopCheckBox)
20764c61228SJohn Scipione			.SetInsets(spacing * 2, 0, 0, 0)
208894cf4f3SAlexandre Deckner			.End()
20964c61228SJohn Scipione		.AddGlue()
21064c61228SJohn Scipione		.SetInsets(spacing);
211190650c3SAxel Dörfler}
212190650c3SAxel Dörfler
213190650c3SAxel Dörfler
21402be5353SAxel Dörflervoid
21502be5353SAxel DörflerDesktopSettingsView::AttachedToWindow()
21602be5353SAxel Dörfler{
21702be5353SAxel Dörfler	fShowDisksIconRadioButton->SetTarget(this);
21802be5353SAxel Dörfler	fMountVolumesOntoDesktopRadioButton->SetTarget(this);
21902be5353SAxel Dörfler	fMountSharedVolumesOntoDesktopCheckBox->SetTarget(this);
22002be5353SAxel Dörfler}
22102be5353SAxel Dörfler
2227befa79aSAxel Dörfler
22302be5353SAxel Dörflervoid
224b05aa8b5SJohn ScipioneDesktopSettingsView::MessageReceived(BMessage* message)
22502be5353SAxel Dörfler{
226b05aa8b5SJohn Scipione	TTracker* tracker = dynamic_cast<TTracker*>(be_app);
22754e2dd72SJohn Scipione	if (tracker == NULL)
22802be5353SAxel Dörfler		return;
22902be5353SAxel Dörfler
23002be5353SAxel Dörfler	TrackerSettings settings;
23102be5353SAxel Dörfler
232c1b274fdSStephan Aßmus	switch (message->what) {
23302be5353SAxel Dörfler		case kShowDisksIconChanged:
23402be5353SAxel Dörfler		{
23502be5353SAxel Dörfler			// Turn on and off related settings:
23602be5353SAxel Dörfler			fMountVolumesOntoDesktopRadioButton->SetValue(
237d0017f37SJérôme Duval				!(fShowDisksIconRadioButton->Value() == 1));
23802be5353SAxel Dörfler			fMountSharedVolumesOntoDesktopCheckBox->SetEnabled(
23902be5353SAxel Dörfler				fMountVolumesOntoDesktopRadioButton->Value() == 1);
240c1b274fdSStephan Aßmus
24102be5353SAxel Dörfler			// Set the new settings in the tracker:
24202be5353SAxel Dörfler			settings.SetShowDisksIcon(fShowDisksIconRadioButton->Value() == 1);
24302be5353SAxel Dörfler			settings.SetMountVolumesOntoDesktop(
24402be5353SAxel Dörfler				fMountVolumesOntoDesktopRadioButton->Value() == 1);
24502be5353SAxel Dörfler			settings.SetMountSharedVolumesOntoDesktop(
24602be5353SAxel Dörfler				fMountSharedVolumesOntoDesktopCheckBox->Value() == 1);
247c1b274fdSStephan Aßmus
248c1b274fdSStephan Aßmus			// Construct the notification message:
24902be5353SAxel Dörfler			BMessage notificationMessage;
25002be5353SAxel Dörfler			notificationMessage.AddBool("ShowDisksIcon",
25102be5353SAxel Dörfler				fShowDisksIconRadioButton->Value() == 1);
25202be5353SAxel Dörfler			notificationMessage.AddBool("MountVolumesOntoDesktop",
25302be5353SAxel Dörfler				fMountVolumesOntoDesktopRadioButton->Value() == 1);
25402be5353SAxel Dörfler			notificationMessage.AddBool("MountSharedVolumesOntoDesktop",
25502be5353SAxel Dörfler				fMountSharedVolumesOntoDesktopCheckBox->Value() == 1);
25602be5353SAxel Dörfler
25702be5353SAxel Dörfler			// Send the notification message:
258f435b678SJohn Scipione			tracker->SendNotices(kVolumesOnDesktopChanged,
259f435b678SJohn Scipione				&notificationMessage);
26002be5353SAxel Dörfler
26102be5353SAxel Dörfler			// Tell the settings window the contents have changed:
26202be5353SAxel Dörfler			Window()->PostMessage(kSettingsContentsModified);
26302be5353SAxel Dörfler			break;
26402be5353SAxel Dörfler		}
26502be5353SAxel Dörfler
26602be5353SAxel Dörfler		case kVolumesOnDesktopChanged:
26702be5353SAxel Dörfler		{
26802be5353SAxel Dörfler			// Turn on and off related settings:
26902be5353SAxel Dörfler			fShowDisksIconRadioButton->SetValue(
270d0017f37SJérôme Duval				!(fMountVolumesOntoDesktopRadioButton->Value() == 1));
27102be5353SAxel Dörfler			fMountSharedVolumesOntoDesktopCheckBox->SetEnabled(
27202be5353SAxel Dörfler				fMountVolumesOntoDesktopRadioButton->Value() == 1);
273c1b274fdSStephan Aßmus
27402be5353SAxel Dörfler			// Set the new settings in the tracker:
27502be5353SAxel Dörfler			settings.SetShowDisksIcon(fShowDisksIconRadioButton->Value() == 1);
27602be5353SAxel Dörfler			settings.SetMountVolumesOntoDesktop(
27702be5353SAxel Dörfler				fMountVolumesOntoDesktopRadioButton->Value() == 1);
27802be5353SAxel Dörfler			settings.SetMountSharedVolumesOntoDesktop(
27902be5353SAxel Dörfler				fMountSharedVolumesOntoDesktopCheckBox->Value() == 1);
280c1b274fdSStephan Aßmus
281c1b274fdSStephan Aßmus			// Construct the notification message:
28202be5353SAxel Dörfler			BMessage notificationMessage;
28302be5353SAxel Dörfler			notificationMessage.AddBool("ShowDisksIcon",
28402be5353SAxel Dörfler				fShowDisksIconRadioButton->Value() == 1);
28502be5353SAxel Dörfler			notificationMessage.AddBool("MountVolumesOntoDesktop",
28602be5353SAxel Dörfler				fMountVolumesOntoDesktopRadioButton->Value() == 1);
28702be5353SAxel Dörfler			notificationMessage.AddBool("MountSharedVolumesOntoDesktop",
28802be5353SAxel Dörfler				fMountSharedVolumesOntoDesktopCheckBox->Value() == 1);
28902be5353SAxel Dörfler
29002be5353SAxel Dörfler			// Send the notification message:
291f435b678SJohn Scipione			tracker->SendNotices(kVolumesOnDesktopChanged,\
292f435b678SJohn Scipione				&notificationMessage);
29302be5353SAxel Dörfler
29402be5353SAxel Dörfler			// Tell the settings window the contents have changed:
29502be5353SAxel Dörfler			Window()->PostMessage(kSettingsContentsModified);
29602be5353SAxel Dörfler			break;
29702be5353SAxel Dörfler		}
29802be5353SAxel Dörfler
29902be5353SAxel Dörfler		default:
30002be5353SAxel Dörfler			_inherited::MessageReceived(message);
301f435b678SJohn Scipione			break;
30202be5353SAxel Dörfler	}
30302be5353SAxel Dörfler}
30402be5353SAxel Dörfler
3057befa79aSAxel Dörfler
30602be5353SAxel Dörflervoid
30702be5353SAxel DörflerDesktopSettingsView::SetDefaults()
30802be5353SAxel Dörfler{
30902be5353SAxel Dörfler	// ToDo: Avoid the duplication of the default values.
31002be5353SAxel Dörfler	TrackerSettings settings;
31102be5353SAxel Dörfler
31202be5353SAxel Dörfler	settings.SetShowDisksIcon(false);
31302be5353SAxel Dörfler	settings.SetMountVolumesOntoDesktop(true);
314efd98f31SAxel Dörfler	settings.SetMountSharedVolumesOntoDesktop(true);
31502be5353SAxel Dörfler	settings.SetEjectWhenUnmounting(true);
31602be5353SAxel Dörfler
3177befa79aSAxel Dörfler	ShowCurrentSettings();
3187befa79aSAxel Dörfler	_SendNotices();
31902be5353SAxel Dörfler}
32002be5353SAxel Dörfler
32102be5353SAxel Dörfler
3226eb01296SRyan Leavengoodbool
3236eb01296SRyan LeavengoodDesktopSettingsView::IsDefaultable() const
3246eb01296SRyan Leavengood{
3256eb01296SRyan Leavengood	TrackerSettings settings;
3266eb01296SRyan Leavengood
3276eb01296SRyan Leavengood	return settings.ShowDisksIcon() != false
3286eb01296SRyan Leavengood		|| settings.MountVolumesOntoDesktop() != true
3296eb01296SRyan Leavengood		|| settings.MountSharedVolumesOntoDesktop() != true
3306eb01296SRyan Leavengood		|| settings.EjectWhenUnmounting() != true;
3316eb01296SRyan Leavengood}
3326eb01296SRyan Leavengood
3336eb01296SRyan Leavengood
33402be5353SAxel Dörflervoid
33502be5353SAxel DörflerDesktopSettingsView::Revert()
33602be5353SAxel Dörfler{
33702be5353SAxel Dörfler	TrackerSettings settings;
33802be5353SAxel Dörfler
33902be5353SAxel Dörfler	settings.SetShowDisksIcon(fShowDisksIcon);
34002be5353SAxel Dörfler	settings.SetMountVolumesOntoDesktop(fMountVolumesOntoDesktop);
34102be5353SAxel Dörfler	settings.SetMountSharedVolumesOntoDesktop(fMountSharedVolumesOntoDesktop);
34202be5353SAxel Dörfler	settings.SetEjectWhenUnmounting(fEjectWhenUnmounting);
34302be5353SAxel Dörfler
3447befa79aSAxel Dörfler	ShowCurrentSettings();
3457befa79aSAxel Dörfler	_SendNotices();
3467befa79aSAxel Dörfler}
3477befa79aSAxel Dörfler
3487befa79aSAxel Dörfler
3497befa79aSAxel Dörflervoid
3507befa79aSAxel DörflerDesktopSettingsView::_SendNotices()
3517befa79aSAxel Dörfler{
352b05aa8b5SJohn Scipione	TTracker* tracker = dynamic_cast<TTracker*>(be_app);
35354e2dd72SJohn Scipione	if (tracker == NULL)
3547befa79aSAxel Dörfler		return;
3557befa79aSAxel Dörfler
356c1b274fdSStephan Aßmus	// Construct the notification message:
3577befa79aSAxel Dörfler	BMessage notificationMessage;
3587befa79aSAxel Dörfler	notificationMessage.AddBool("ShowDisksIcon",
3597befa79aSAxel Dörfler		fShowDisksIconRadioButton->Value() == 1);
3607befa79aSAxel Dörfler	notificationMessage.AddBool("MountVolumesOntoDesktop",
3617befa79aSAxel Dörfler		fMountVolumesOntoDesktopRadioButton->Value() == 1);
3627befa79aSAxel Dörfler	notificationMessage.AddBool("MountSharedVolumesOntoDesktop",
3637befa79aSAxel Dörfler		fMountSharedVolumesOntoDesktopCheckBox->Value() == 1);
3647befa79aSAxel Dörfler
3657befa79aSAxel Dörfler	// Send notices to the tracker about the change:
3667befa79aSAxel Dörfler	tracker->SendNotices(kVolumesOnDesktopChanged, &notificationMessage);
3677befa79aSAxel Dörfler	tracker->SendNotices(kDesktopIntegrationChanged, &notificationMessage);
36802be5353SAxel Dörfler}
36902be5353SAxel Dörfler
3707befa79aSAxel Dörfler
37102be5353SAxel Dörflervoid
3727befa79aSAxel DörflerDesktopSettingsView::ShowCurrentSettings()
37302be5353SAxel Dörfler{
37402be5353SAxel Dörfler	TrackerSettings settings;
37502be5353SAxel Dörfler
37602be5353SAxel Dörfler	fShowDisksIconRadioButton->SetValue(settings.ShowDisksIcon());
377ea001e58SJohn Scipione	fMountVolumesOntoDesktopRadioButton->SetValue(
378ea001e58SJohn Scipione		settings.MountVolumesOntoDesktop());
37902be5353SAxel Dörfler
380ea001e58SJohn Scipione	fMountSharedVolumesOntoDesktopCheckBox->SetValue(
381ea001e58SJohn Scipione		settings.MountSharedVolumesOntoDesktop());
382ea001e58SJohn Scipione	fMountSharedVolumesOntoDesktopCheckBox->SetEnabled(
383ea001e58SJohn Scipione		settings.MountVolumesOntoDesktop());
38402be5353SAxel Dörfler}
38502be5353SAxel Dörfler
38602be5353SAxel Dörfler
38702be5353SAxel Dörflervoid
38802be5353SAxel DörflerDesktopSettingsView::RecordRevertSettings()
38902be5353SAxel Dörfler{
39002be5353SAxel Dörfler	TrackerSettings settings;
39102be5353SAxel Dörfler
39202be5353SAxel Dörfler	fShowDisksIcon = settings.ShowDisksIcon();
39302be5353SAxel Dörfler	fMountVolumesOntoDesktop = settings.MountVolumesOntoDesktop();
39402be5353SAxel Dörfler	fMountSharedVolumesOntoDesktop = settings.MountSharedVolumesOntoDesktop();
39502be5353SAxel Dörfler	fEjectWhenUnmounting = settings.EjectWhenUnmounting();
39602be5353SAxel Dörfler}
39702be5353SAxel Dörfler
39802be5353SAxel Dörfler
39902be5353SAxel Dörflerbool
4007befa79aSAxel DörflerDesktopSettingsView::IsRevertable() const
40102be5353SAxel Dörfler{
4027befa79aSAxel Dörfler	return fShowDisksIcon != (fShowDisksIconRadioButton->Value() > 0)
4037befa79aSAxel Dörfler		|| fMountVolumesOntoDesktop !=
4047befa79aSAxel Dörfler			(fMountVolumesOntoDesktopRadioButton->Value() > 0)
4057befa79aSAxel Dörfler		|| fMountSharedVolumesOntoDesktop !=
406c1b274fdSStephan Aßmus			(fMountSharedVolumesOntoDesktopCheckBox->Value() > 0);
40702be5353SAxel Dörfler}
40802be5353SAxel Dörfler
40902be5353SAxel Dörfler
410f435b678SJohn Scipione// #pragma mark - WindowsSettingsView
41102be5353SAxel Dörfler
41202be5353SAxel Dörfler
413894cf4f3SAlexandre DecknerWindowsSettingsView::WindowsSettingsView()
414894cf4f3SAlexandre Deckner	:
415e741289aSJohn Scipione	SettingsView("WindowsSettingsView"),
416e741289aSJohn Scipione	fShowFullPathInTitleBarCheckBox(NULL),
417e741289aSJohn Scipione	fSingleWindowBrowseCheckBox(NULL),
418e741289aSJohn Scipione	fShowNavigatorCheckBox(NULL),
419e741289aSJohn Scipione	fOutlineSelectionCheckBox(NULL),
420e741289aSJohn Scipione	fSortFolderNamesFirstCheckBox(NULL),
4214e357263SAugustin Cavalier	fHideDotFilesCheckBox(NULL),
422e741289aSJohn Scipione	fTypeAheadFilteringCheckBox(NULL),
423e741289aSJohn Scipione	fShowFullPathInTitleBar(false),
424e741289aSJohn Scipione	fSingleWindowBrowse(false),
425e741289aSJohn Scipione	fShowNavigator(false),
426e741289aSJohn Scipione	fTransparentSelection(false),
427e741289aSJohn Scipione	fSortFolderNamesFirst(false),
4284e357263SAugustin Cavalier	fHideDotFiles(false),
429e741289aSJohn Scipione	fTypeAheadFiltering(false)
43002be5353SAxel Dörfler{
431894cf4f3SAlexandre Deckner	fShowFullPathInTitleBarCheckBox = new BCheckBox("",
4324ed28a57SAlexandre Deckner		B_TRANSLATE("Show folder location in title tab"),
43302be5353SAxel Dörfler		new BMessage(kWindowsShowFullPathChanged));
43402be5353SAxel Dörfler
435894cf4f3SAlexandre Deckner	fSingleWindowBrowseCheckBox = new BCheckBox("",
4364ed28a57SAlexandre Deckner		B_TRANSLATE("Single window navigation"),
43702be5353SAxel Dörfler		new BMessage(kSingleWindowBrowseChanged));
43802be5353SAxel Dörfler
439894cf4f3SAlexandre Deckner	fShowNavigatorCheckBox = new BCheckBox("",
4404ed28a57SAlexandre Deckner		B_TRANSLATE("Show navigator"),
44102be5353SAxel Dörfler		new BMessage(kShowNavigatorChanged));
44202be5353SAxel Dörfler
443894cf4f3SAlexandre Deckner	fOutlineSelectionCheckBox = new BCheckBox("",
4444ed28a57SAlexandre Deckner		B_TRANSLATE("Outline selection rectangle only"),
44502be5353SAxel Dörfler		new BMessage(kTransparentSelectionChanged));
44602be5353SAxel Dörfler
447894cf4f3SAlexandre Deckner	fSortFolderNamesFirstCheckBox = new BCheckBox("",
4484ed28a57SAlexandre Deckner		B_TRANSLATE("List folders first"),
44902be5353SAxel Dörfler		new BMessage(kSortFolderNamesFirstChanged));
450545ebde0SMichael Lotz
4514e357263SAugustin Cavalier	fHideDotFilesCheckBox = new BCheckBox("",
4524e357263SAugustin Cavalier		B_TRANSLATE("Hide dotfiles"),
4534e357263SAugustin Cavalier		new BMessage(kHideDotFilesChanged));
4544e357263SAugustin Cavalier
455894cf4f3SAlexandre Deckner	fTypeAheadFilteringCheckBox = new BCheckBox("",
4564ed28a57SAlexandre Deckner		B_TRANSLATE("Enable type-ahead filtering"),
457545ebde0SMichael Lotz		new BMessage(kTypeAheadFilteringChanged));
458190650c3SAxel Dörfler
459894cf4f3SAlexandre Deckner	const float spacing = be_control_look->DefaultItemSpacing();
460894cf4f3SAlexandre Deckner
46164c61228SJohn Scipione	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
462e80276e2SAlex Wilson		.AddGroup(B_VERTICAL, 0)
46364c61228SJohn Scipione			.Add(fShowFullPathInTitleBarCheckBox)
46464c61228SJohn Scipione			.Add(fSingleWindowBrowseCheckBox)
465894cf4f3SAlexandre Deckner			.End()
46664c61228SJohn Scipione		.AddGroup(B_VERTICAL)
46764c61228SJohn Scipione			.Add(fShowNavigatorCheckBox)
46864c61228SJohn Scipione			.SetInsets(spacing * 2, 0, 0, 0)
469894cf4f3SAlexandre Deckner			.End()
47064c61228SJohn Scipione		.AddGroup(B_VERTICAL, 0)
47164c61228SJohn Scipione			.Add(fOutlineSelectionCheckBox)
47264c61228SJohn Scipione			.Add(fSortFolderNamesFirstCheckBox)
4734e357263SAugustin Cavalier			.Add(fHideDotFilesCheckBox)
47464c61228SJohn Scipione			.Add(fTypeAheadFilteringCheckBox)
475894cf4f3SAlexandre Deckner			.End()
476894cf4f3SAlexandre Deckner		.AddGlue()
47764c61228SJohn Scipione		.SetInsets(spacing);
47802be5353SAxel Dörfler}
47902be5353SAxel Dörfler
48002be5353SAxel Dörfler
48102be5353SAxel Dörflervoid
48202be5353SAxel DörflerWindowsSettingsView::AttachedToWindow()
48302be5353SAxel Dörfler{
48402be5353SAxel Dörfler	fSingleWindowBrowseCheckBox->SetTarget(this);
48502be5353SAxel Dörfler	fShowNavigatorCheckBox->SetTarget(this);
48602be5353SAxel Dörfler	fShowFullPathInTitleBarCheckBox->SetTarget(this);
4877befa79aSAxel Dörfler	fOutlineSelectionCheckBox->SetTarget(this);
48802be5353SAxel Dörfler	fSortFolderNamesFirstCheckBox->SetTarget(this);
4894e357263SAugustin Cavalier	fHideDotFilesCheckBox->SetTarget(this);
490545ebde0SMichael Lotz	fTypeAheadFilteringCheckBox->SetTarget(this);
49102be5353SAxel Dörfler}
49202be5353SAxel Dörfler
49302be5353SAxel Dörfler
49402be5353SAxel Dörflervoid
495b05aa8b5SJohn ScipioneWindowsSettingsView::MessageReceived(BMessage* message)
49602be5353SAxel Dörfler{
497b05aa8b5SJohn Scipione	TTracker* tracker = dynamic_cast<TTracker*>(be_app);
498f435b678SJohn Scipione	if (tracker == NULL)
49902be5353SAxel Dörfler		return;
500f435b678SJohn Scipione
50102be5353SAxel Dörfler	TrackerSettings settings;
502c1b274fdSStephan Aßmus
50302be5353SAxel Dörfler	switch (message->what) {
50402be5353SAxel Dörfler		case kWindowsShowFullPathChanged:
505ea001e58SJohn Scipione			settings.SetShowFullPathInTitleBar(
506ea001e58SJohn Scipione				fShowFullPathInTitleBarCheckBox->Value() == 1);
50702be5353SAxel Dörfler			tracker->SendNotices(kWindowsShowFullPathChanged);
50802be5353SAxel Dörfler			Window()->PostMessage(kSettingsContentsModified);
50902be5353SAxel Dörfler			break;
5107befa79aSAxel Dörfler
51102be5353SAxel Dörfler		case kSingleWindowBrowseChanged:
512ea001e58SJohn Scipione			settings.SetSingleWindowBrowse(
513ea001e58SJohn Scipione				fSingleWindowBrowseCheckBox->Value() == 1);
51402be5353SAxel Dörfler			if (fSingleWindowBrowseCheckBox->Value() == 0) {
51502be5353SAxel Dörfler				fShowNavigatorCheckBox->SetEnabled(false);
51602be5353SAxel Dörfler				settings.SetShowNavigator(0);
51702be5353SAxel Dörfler			} else {
51802be5353SAxel Dörfler				fShowNavigatorCheckBox->SetEnabled(true);
519ea001e58SJohn Scipione				settings.SetShowNavigator(
520ea001e58SJohn Scipione					fShowNavigatorCheckBox->Value() != 0);
521c1b274fdSStephan Aßmus			}
52202be5353SAxel Dörfler			tracker->SendNotices(kShowNavigatorChanged);
52302be5353SAxel Dörfler			tracker->SendNotices(kSingleWindowBrowseChanged);
52402be5353SAxel Dörfler			Window()->PostMessage(kSettingsContentsModified);
52502be5353SAxel Dörfler			break;
52602be5353SAxel Dörfler
52702be5353SAxel Dörfler		case kShowNavigatorChanged:
52802be5353SAxel Dörfler			settings.SetShowNavigator(fShowNavigatorCheckBox->Value() == 1);
52902be5353SAxel Dörfler			tracker->SendNotices(kShowNavigatorChanged);
53002be5353SAxel Dörfler			Window()->PostMessage(kSettingsContentsModified);
53102be5353SAxel Dörfler			break;
53202be5353SAxel Dörfler
53302be5353SAxel Dörfler		case kTransparentSelectionChanged:
53402be5353SAxel Dörfler		{
53502be5353SAxel Dörfler			settings.SetTransparentSelection(
5367befa79aSAxel Dörfler				fOutlineSelectionCheckBox->Value() == B_CONTROL_OFF);
53702be5353SAxel Dörfler
53802be5353SAxel Dörfler			// Make the notification message and send it to the tracker:
5397befa79aSAxel Dörfler			send_bool_notices(kTransparentSelectionChanged,
5407befa79aSAxel Dörfler				"TransparentSelection", settings.TransparentSelection());
54102be5353SAxel Dörfler
54202be5353SAxel Dörfler			Window()->PostMessage(kSettingsContentsModified);
54302be5353SAxel Dörfler			break;
54402be5353SAxel Dörfler		}
54502be5353SAxel Dörfler
54602be5353SAxel Dörfler		case kSortFolderNamesFirstChanged:
54702be5353SAxel Dörfler		{
548ea001e58SJohn Scipione			settings.SetSortFolderNamesFirst(
549ea001e58SJohn Scipione				fSortFolderNamesFirstCheckBox->Value() == 1);
55002be5353SAxel Dörfler
55102be5353SAxel Dörfler			// Make the notification message and send it to the tracker:
552ea001e58SJohn Scipione			send_bool_notices(kSortFolderNamesFirstChanged,
553ea001e58SJohn Scipione				"SortFolderNamesFirst",
55402be5353SAxel Dörfler				fSortFolderNamesFirstCheckBox->Value() == 1);
55502be5353SAxel Dörfler
55602be5353SAxel Dörfler			Window()->PostMessage(kSettingsContentsModified);
55702be5353SAxel Dörfler			break;
55802be5353SAxel Dörfler		}
55902be5353SAxel Dörfler
5604e357263SAugustin Cavalier		case kHideDotFilesChanged:
5614e357263SAugustin Cavalier		{
5624e357263SAugustin Cavalier			settings.SetHideDotFiles(
5634e357263SAugustin Cavalier				fHideDotFilesCheckBox->Value() == 1);
5644e357263SAugustin Cavalier
5654e357263SAugustin Cavalier			// Make the notification message and send it to the tracker:
5664e357263SAugustin Cavalier			send_bool_notices(kHideDotFilesChanged,
5674e357263SAugustin Cavalier				"HideDotFiles",
5684e357263SAugustin Cavalier				fHideDotFilesCheckBox->Value() == 1);
5694e357263SAugustin Cavalier
5704e357263SAugustin Cavalier			Window()->PostMessage(kSettingsContentsModified);
5714e357263SAugustin Cavalier			break;
5724e357263SAugustin Cavalier		}
5734e357263SAugustin Cavalier
574545ebde0SMichael Lotz		case kTypeAheadFilteringChanged:
575545ebde0SMichael Lotz		{
576ea001e58SJohn Scipione			settings.SetTypeAheadFiltering(
577ea001e58SJohn Scipione				fTypeAheadFilteringCheckBox->Value() == 1);
578ea001e58SJohn Scipione			send_bool_notices(kTypeAheadFilteringChanged,
579ea001e58SJohn Scipione				"TypeAheadFiltering",
580545ebde0SMichael Lotz				fTypeAheadFilteringCheckBox->Value() == 1);
581545ebde0SMichael Lotz			Window()->PostMessage(kSettingsContentsModified);
582545ebde0SMichael Lotz			break;
583545ebde0SMichael Lotz		}
584545ebde0SMichael Lotz
58502be5353SAxel Dörfler		default:
58602be5353SAxel Dörfler			_inherited::MessageReceived(message);
58702be5353SAxel Dörfler			break;
58802be5353SAxel Dörfler	}
58902be5353SAxel Dörfler}
59002be5353SAxel Dörfler
591c1b274fdSStephan Aßmus
59202be5353SAxel Dörflervoid
59302be5353SAxel DörflerWindowsSettingsView::SetDefaults()
59402be5353SAxel Dörfler{
595b05aa8b5SJohn Scipione	TTracker* tracker = dynamic_cast<TTracker*>(be_app);
59654e2dd72SJohn Scipione	if (tracker == NULL)
5977befa79aSAxel Dörfler		return;
5987befa79aSAxel Dörfler
59902be5353SAxel Dörfler	TrackerSettings settings;
60002be5353SAxel Dörfler
6017befa79aSAxel Dörfler	if (settings.ShowFullPathInTitleBar()) {
602e89c2353SWaldemar Kornewald		settings.SetShowFullPathInTitleBar(false);
6037befa79aSAxel Dörfler		tracker->SendNotices(kWindowsShowFullPathChanged);
6047befa79aSAxel Dörfler	}
6057befa79aSAxel Dörfler
6067befa79aSAxel Dörfler	if (settings.SingleWindowBrowse()) {
6077befa79aSAxel Dörfler		settings.SetSingleWindowBrowse(false);
6087befa79aSAxel Dörfler		tracker->SendNotices(kSingleWindowBrowseChanged);
6097befa79aSAxel Dörfler	}
6107befa79aSAxel Dörfler
6117befa79aSAxel Dörfler	if (settings.ShowNavigator()) {
6127befa79aSAxel Dörfler		settings.SetShowNavigator(false);
6137befa79aSAxel Dörfler		tracker->SendNotices(kShowNavigatorChanged);
6147befa79aSAxel Dörfler	}
6157befa79aSAxel Dörfler
6167befa79aSAxel Dörfler	if (!settings.TransparentSelection()) {
6177befa79aSAxel Dörfler		settings.SetTransparentSelection(true);
6187befa79aSAxel Dörfler		send_bool_notices(kTransparentSelectionChanged,
6197befa79aSAxel Dörfler			"TransparentSelection", true);
6207befa79aSAxel Dörfler	}
6217befa79aSAxel Dörfler
622545ebde0SMichael Lotz	if (!settings.SortFolderNamesFirst()) {
62361b44b93SAxel Dörfler		settings.SetSortFolderNamesFirst(true);
6247befa79aSAxel Dörfler		send_bool_notices(kSortFolderNamesFirstChanged,
62561b44b93SAxel Dörfler			"SortFolderNamesFirst", true);
6267befa79aSAxel Dörfler	}
62702be5353SAxel Dörfler
6284e357263SAugustin Cavalier	if (!settings.HideDotFiles()) {
6294e357263SAugustin Cavalier		settings.SetHideDotFiles(true);
6304e357263SAugustin Cavalier		send_bool_notices(kHideDotFilesChanged,
6314e357263SAugustin Cavalier			"HideDotFiles", true);
6324e357263SAugustin Cavalier	}
6334e357263SAugustin Cavalier
634545ebde0SMichael Lotz	if (settings.TypeAheadFiltering()) {
635545ebde0SMichael Lotz		settings.SetTypeAheadFiltering(false);
636545ebde0SMichael Lotz		send_bool_notices(kTypeAheadFilteringChanged,
637545ebde0SMichael Lotz			"TypeAheadFiltering", true);
638545ebde0SMichael Lotz	}
639545ebde0SMichael Lotz
6407befa79aSAxel Dörfler	ShowCurrentSettings();
64102be5353SAxel Dörfler}
64202be5353SAxel Dörfler
64302be5353SAxel Dörfler
6446eb01296SRyan Leavengoodbool
6456eb01296SRyan LeavengoodWindowsSettingsView::IsDefaultable() const
6466eb01296SRyan Leavengood{
6476eb01296SRyan Leavengood	TrackerSettings settings;
6486eb01296SRyan Leavengood
6496eb01296SRyan Leavengood	return settings.ShowFullPathInTitleBar() != false
6506eb01296SRyan Leavengood		|| settings.SingleWindowBrowse() != false
6516eb01296SRyan Leavengood		|| settings.ShowNavigator() != false
6526eb01296SRyan Leavengood		|| settings.TransparentSelection() != true
653545ebde0SMichael Lotz		|| settings.SortFolderNamesFirst() != true
654545ebde0SMichael Lotz		|| settings.TypeAheadFiltering() != false;
6556eb01296SRyan Leavengood}
6566eb01296SRyan Leavengood
6576eb01296SRyan Leavengood
65802be5353SAxel Dörflervoid
65902be5353SAxel DörflerWindowsSettingsView::Revert()
66002be5353SAxel Dörfler{
661b05aa8b5SJohn Scipione	TTracker* tracker = dynamic_cast<TTracker*>(be_app);
66254e2dd72SJohn Scipione	if (tracker == NULL)
6637befa79aSAxel Dörfler		return;
6647befa79aSAxel Dörfler
66502be5353SAxel Dörfler	TrackerSettings settings;
66602be5353SAxel Dörfler
6677befa79aSAxel Dörfler	if (settings.ShowFullPathInTitleBar() != fShowFullPathInTitleBar) {
6687befa79aSAxel Dörfler		settings.SetShowFullPathInTitleBar(fShowFullPathInTitleBar);
6697befa79aSAxel Dörfler		tracker->SendNotices(kWindowsShowFullPathChanged);
6707befa79aSAxel Dörfler	}
6717befa79aSAxel Dörfler
6727befa79aSAxel Dörfler	if (settings.SingleWindowBrowse() != fSingleWindowBrowse) {
6737befa79aSAxel Dörfler		settings.SetSingleWindowBrowse(fSingleWindowBrowse);
6747befa79aSAxel Dörfler		tracker->SendNotices(kSingleWindowBrowseChanged);
6757befa79aSAxel Dörfler	}
6767befa79aSAxel Dörfler
6777befa79aSAxel Dörfler	if (settings.ShowNavigator() != fShowNavigator) {
6787befa79aSAxel Dörfler		settings.SetShowNavigator(fShowNavigator);
6797befa79aSAxel Dörfler		tracker->SendNotices(kShowNavigatorChanged);
6807befa79aSAxel Dörfler	}
6817befa79aSAxel Dörfler
6827befa79aSAxel Dörfler	if (settings.TransparentSelection() != fTransparentSelection) {
6837befa79aSAxel Dörfler		settings.SetTransparentSelection(fTransparentSelection);
6847befa79aSAxel Dörfler		send_bool_notices(kTransparentSelectionChanged,
6857befa79aSAxel Dörfler			"TransparentSelection", fTransparentSelection);
6867befa79aSAxel Dörfler	}
68702be5353SAxel Dörfler
6887befa79aSAxel Dörfler	if (settings.SortFolderNamesFirst() != fSortFolderNamesFirst) {
6897befa79aSAxel Dörfler		settings.SetSortFolderNamesFirst(fSortFolderNamesFirst);
6907befa79aSAxel Dörfler		send_bool_notices(kSortFolderNamesFirstChanged,
6917befa79aSAxel Dörfler			"SortFolderNamesFirst", fSortFolderNamesFirst);
6927befa79aSAxel Dörfler	}
6937befa79aSAxel Dörfler
6944e357263SAugustin Cavalier	if (settings.HideDotFiles() != fHideDotFiles) {
6954e357263SAugustin Cavalier		settings.SetSortFolderNamesFirst(fHideDotFiles);
6964e357263SAugustin Cavalier		send_bool_notices(kHideDotFilesChanged,
6974e357263SAugustin Cavalier			"HideDotFiles", fHideDotFiles);
6984e357263SAugustin Cavalier	}
6994e357263SAugustin Cavalier
700545ebde0SMichael Lotz	if (settings.TypeAheadFiltering() != fTypeAheadFiltering) {
701545ebde0SMichael Lotz		settings.SetTypeAheadFiltering(fTypeAheadFiltering);
702545ebde0SMichael Lotz		send_bool_notices(kTypeAheadFilteringChanged,
703545ebde0SMichael Lotz			"TypeAheadFiltering", fTypeAheadFiltering);
704545ebde0SMichael Lotz	}
705545ebde0SMichael Lotz
7067befa79aSAxel Dörfler	ShowCurrentSettings();
70702be5353SAxel Dörfler}
70802be5353SAxel Dörfler
70902be5353SAxel Dörfler
71002be5353SAxel Dörflervoid
7117befa79aSAxel DörflerWindowsSettingsView::ShowCurrentSettings()
71202be5353SAxel Dörfler{
71302be5353SAxel Dörfler	TrackerSettings settings;
71402be5353SAxel Dörfler
715ea001e58SJohn Scipione	fShowFullPathInTitleBarCheckBox->SetValue(
716ea001e58SJohn Scipione		settings.ShowFullPathInTitleBar());
71702be5353SAxel Dörfler	fSingleWindowBrowseCheckBox->SetValue(settings.SingleWindowBrowse());
71802be5353SAxel Dörfler	fShowNavigatorCheckBox->SetEnabled(settings.SingleWindowBrowse());
71902be5353SAxel Dörfler	fShowNavigatorCheckBox->SetValue(settings.ShowNavigator());
7207befa79aSAxel Dörfler	fOutlineSelectionCheckBox->SetValue(settings.TransparentSelection()
7217befa79aSAxel Dörfler		? B_CONTROL_OFF : B_CONTROL_ON);
72202be5353SAxel Dörfler	fSortFolderNamesFirstCheckBox->SetValue(settings.SortFolderNamesFirst());
7234e357263SAugustin Cavalier	fHideDotFilesCheckBox->SetValue(settings.HideDotFiles());
724545ebde0SMichael Lotz	fTypeAheadFilteringCheckBox->SetValue(settings.TypeAheadFiltering());
72502be5353SAxel Dörfler}
72602be5353SAxel Dörfler
72702be5353SAxel Dörfler
72802be5353SAxel Dörflervoid
72902be5353SAxel DörflerWindowsSettingsView::RecordRevertSettings()
73002be5353SAxel Dörfler{
73102be5353SAxel Dörfler	TrackerSettings settings;
73202be5353SAxel Dörfler
73302be5353SAxel Dörfler	fShowFullPathInTitleBar = settings.ShowFullPathInTitleBar();
73402be5353SAxel Dörfler	fSingleWindowBrowse = settings.SingleWindowBrowse();
73502be5353SAxel Dörfler	fShowNavigator = settings.ShowNavigator();
73602be5353SAxel Dörfler	fTransparentSelection = settings.TransparentSelection();
73702be5353SAxel Dörfler	fSortFolderNamesFirst = settings.SortFolderNamesFirst();
7384e357263SAugustin Cavalier	fHideDotFiles = settings.HideDotFiles();
739545ebde0SMichael Lotz	fTypeAheadFiltering = settings.TypeAheadFiltering();
74002be5353SAxel Dörfler}
74102be5353SAxel Dörfler
74202be5353SAxel Dörfler
74302be5353SAxel Dörflerbool
7447befa79aSAxel DörflerWindowsSettingsView::IsRevertable() const
74502be5353SAxel Dörfler{
7467befa79aSAxel Dörfler	TrackerSettings settings;
7477befa79aSAxel Dörfler
7487befa79aSAxel Dörfler	return fShowFullPathInTitleBar != settings.ShowFullPathInTitleBar()
7497befa79aSAxel Dörfler		|| fSingleWindowBrowse != settings.SingleWindowBrowse()
7507befa79aSAxel Dörfler		|| fShowNavigator != settings.ShowNavigator()
7517befa79aSAxel Dörfler		|| fTransparentSelection != settings.TransparentSelection()
752545ebde0SMichael Lotz		|| fSortFolderNamesFirst != settings.SortFolderNamesFirst()
7534e357263SAugustin Cavalier		|| fHideDotFiles != settings.HideDotFiles()
754545ebde0SMichael Lotz		|| fTypeAheadFiltering != settings.TypeAheadFiltering();
75502be5353SAxel Dörfler}
75602be5353SAxel Dörfler
75702be5353SAxel Dörfler
758f435b678SJohn Scipione// #pragma mark - SpaceBarSettingsView
75902be5353SAxel Dörfler
76002be5353SAxel Dörfler
761894cf4f3SAlexandre DecknerSpaceBarSettingsView::SpaceBarSettingsView()
762894cf4f3SAlexandre Deckner	:
763894cf4f3SAlexandre Deckner	SettingsView("SpaceBarSettingsView")
76402be5353SAxel Dörfler{
765894cf4f3SAlexandre Deckner	fSpaceBarShowCheckBox = new BCheckBox("",
7664ed28a57SAlexandre Deckner		B_TRANSLATE("Show space bars on volumes"),
76702be5353SAxel Dörfler		new BMessage(kUpdateVolumeSpaceBar));
768190650c3SAxel Dörfler
769894cf4f3SAlexandre Deckner	BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING);
77002be5353SAxel Dörfler	menu->SetFont(be_plain_font);
77102be5353SAxel Dörfler
772894cf4f3SAlexandre Deckner	BMenuItem* item;
7734ed28a57SAlexandre Deckner	menu->AddItem(item = new BMenuItem(
7744ed28a57SAlexandre Deckner		B_TRANSLATE("Used space color"),
7754ed28a57SAlexandre Deckner		new BMessage(kSpaceBarSwitchColor)));
77602be5353SAxel Dörfler	item->SetMarked(true);
77702be5353SAxel Dörfler	fCurrentColor = 0;
7784ed28a57SAlexandre Deckner	menu->AddItem(new BMenuItem(
7794ed28a57SAlexandre Deckner		B_TRANSLATE("Free space color"),
7804ed28a57SAlexandre Deckner		new BMessage(kSpaceBarSwitchColor)));
781