Cleanup while I was searching for a bug that ended up being in the app_server;
the decorators now return non-sense as their frame, thank you Clemens! * Got rid of Settings::CurrentSettings() - the get/store pair wasn't really thread-safe anyway, as it always updated all fields, so settings could get lost easily. The mechanism is still being used in the settings window, though. * Introduced some getters/setters for the settings that work on the message directly which simplifies some code. * Minor style cleanups. * Automatic whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42732 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -966,8 +966,8 @@ Controller::RemoveListener(Listener* listener)
|
|||||||
void
|
void
|
||||||
Controller::_AdoptGlobalSettings()
|
Controller::_AdoptGlobalSettings()
|
||||||
{
|
{
|
||||||
mpSettings settings = Settings::CurrentSettings();
|
mpSettings settings;
|
||||||
// thread safe
|
Settings::Default()->Get(settings);
|
||||||
|
|
||||||
fAutoplaySetting = settings.autostart;
|
fAutoplaySetting = settings.autostart;
|
||||||
// not yet used:
|
// not yet used:
|
||||||
|
|||||||
@@ -75,8 +75,7 @@ MainApp::MainApp()
|
|||||||
fAudioWindowFrameSaved(false),
|
fAudioWindowFrameSaved(false),
|
||||||
fLastSavedAudioWindowCreationTime(0)
|
fLastSavedAudioWindowCreationTime(0)
|
||||||
{
|
{
|
||||||
mpSettings settings = Settings::CurrentSettings();
|
fLastFilePanelFolder = Settings::Default()->FilePanelFolder();
|
||||||
fLastFilePanelFolder = settings.filePanelFolder;
|
|
||||||
|
|
||||||
// Now tell the application roster, that we're interested
|
// Now tell the application roster, that we're interested
|
||||||
// in getting notifications of apps being launched or quit.
|
// in getting notifications of apps being launched or quit.
|
||||||
@@ -91,7 +90,7 @@ MainApp::MainApp()
|
|||||||
if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
|
if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
|
||||||
BAlert* alert = new BAlert("start_media_server",
|
BAlert* alert = new BAlert("start_media_server",
|
||||||
B_TRANSLATE("It appears the media server is not running.\n"
|
B_TRANSLATE("It appears the media server is not running.\n"
|
||||||
"Would you like to start it ?"), B_TRANSLATE("Quit"),
|
"Would you like to start it ?"), B_TRANSLATE("Quit"),
|
||||||
B_TRANSLATE("Start media server"), NULL,
|
B_TRANSLATE("Start media server"), NULL,
|
||||||
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||||
if (alert->Go() == 0) {
|
if (alert->Go() == 0) {
|
||||||
@@ -145,9 +144,7 @@ MainApp::QuitRequested()
|
|||||||
fSettingsWindow = NULL;
|
fSettingsWindow = NULL;
|
||||||
|
|
||||||
// store the current file panel ref in the global settings
|
// store the current file panel ref in the global settings
|
||||||
mpSettings settings = Settings::CurrentSettings();
|
Settings::Default()->SetFilePanelFolder(fLastFilePanelFolder);
|
||||||
settings.filePanelFolder = fLastFilePanelFolder;
|
|
||||||
Settings::Default()->SaveSettings(settings);
|
|
||||||
|
|
||||||
return BApplication::QuitRequested();
|
return BApplication::QuitRequested();
|
||||||
}
|
}
|
||||||
@@ -294,16 +291,12 @@ MainApp::MessageReceived(BMessage* message)
|
|||||||
&& message->FindBool("audio only", &audioOnly) == B_OK
|
&& message->FindBool("audio only", &audioOnly) == B_OK
|
||||||
&& message->FindRect("window frame", &windowFrame) == B_OK
|
&& message->FindRect("window frame", &windowFrame) == B_OK
|
||||||
&& message->FindInt64("creation time", &creationTime) == B_OK) {
|
&& message->FindInt64("creation time", &creationTime) == B_OK) {
|
||||||
if (audioOnly) {
|
if (audioOnly && (!fAudioWindowFrameSaved
|
||||||
if (!fAudioWindowFrameSaved
|
|| creationTime < fLastSavedAudioWindowCreationTime)) {
|
||||||
|| creationTime < fLastSavedAudioWindowCreationTime) {
|
fAudioWindowFrameSaved = true;
|
||||||
fAudioWindowFrameSaved = true;
|
fLastSavedAudioWindowCreationTime = creationTime;
|
||||||
fLastSavedAudioWindowCreationTime = creationTime;
|
|
||||||
mpSettings settings
|
Settings::Default()->SetAudioPlayerWindowFrame(windowFrame);
|
||||||
= Settings::Default()->CurrentSettings();
|
|
||||||
settings.audioPlayerWindowFrame = windowFrame;
|
|
||||||
Settings::Default()->SaveSettings(settings);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -211,8 +211,7 @@ MainWin::MainWin(bool isFirstWindow, BMessage* message)
|
|||||||
MoveBy(pos * 25, pos * 25);
|
MoveBy(pos * 25, pos * 25);
|
||||||
pos = (pos + 1) % 15;
|
pos = (pos + 1) % 15;
|
||||||
|
|
||||||
BRect frame = Settings::Default()->CurrentSettings()
|
BRect frame = Settings::Default()->AudioPlayerWindowFrame();
|
||||||
.audioPlayerWindowFrame;
|
|
||||||
if (frame.IsValid()) {
|
if (frame.IsValid()) {
|
||||||
if (isFirstWindow) {
|
if (isFirstWindow) {
|
||||||
if (message == NULL) {
|
if (message == NULL) {
|
||||||
@@ -2585,8 +2584,8 @@ MainWin::_MarkItem(BMenu* menu, uint32 command, bool mark)
|
|||||||
void
|
void
|
||||||
MainWin::_AdoptGlobalSettings()
|
MainWin::_AdoptGlobalSettings()
|
||||||
{
|
{
|
||||||
mpSettings settings = Settings::CurrentSettings();
|
mpSettings settings;
|
||||||
// thread safe
|
Settings::Default()->Get(settings);
|
||||||
|
|
||||||
fCloseWhenDonePlayingMovie = settings.closeWhenDonePlayingMovie;
|
fCloseWhenDonePlayingMovie = settings.closeWhenDonePlayingMovie;
|
||||||
fCloseWhenDonePlayingSound = settings.closeWhenDonePlayingSound;
|
fCloseWhenDonePlayingSound = settings.closeWhenDonePlayingSound;
|
||||||
|
|||||||
@@ -168,8 +168,7 @@ VideoView::SetBitmap(const BBitmap* bitmap)
|
|||||||
rgb_color key;
|
rgb_color key;
|
||||||
status_t ret = SetViewOverlay(bitmap, bitmap->Bounds(),
|
status_t ret = SetViewOverlay(bitmap, bitmap->Bounds(),
|
||||||
fVideoFrame, &key, B_FOLLOW_ALL,
|
fVideoFrame, &key, B_FOLLOW_ALL,
|
||||||
B_OVERLAY_FILTER_HORIZONTAL
|
B_OVERLAY_FILTER_HORIZONTAL | B_OVERLAY_FILTER_VERTICAL);
|
||||||
| B_OVERLAY_FILTER_VERTICAL);
|
|
||||||
if (ret == B_OK) {
|
if (ret == B_OK) {
|
||||||
fOverlayKeyColor = key;
|
fOverlayKeyColor = key;
|
||||||
SetLowColor(key);
|
SetLowColor(key);
|
||||||
@@ -181,8 +180,7 @@ VideoView::SetBitmap(const BBitmap* bitmap)
|
|||||||
|
|
||||||
// update restrictions
|
// update restrictions
|
||||||
overlay_restrictions restrictions;
|
overlay_restrictions restrictions;
|
||||||
if (bitmap->GetOverlayRestrictions(&restrictions)
|
if (bitmap->GetOverlayRestrictions(&restrictions) == B_OK)
|
||||||
== B_OK)
|
|
||||||
fOverlayRestrictions = restrictions;
|
fOverlayRestrictions = restrictions;
|
||||||
} else {
|
} else {
|
||||||
// try again next time
|
// try again next time
|
||||||
@@ -391,8 +389,8 @@ VideoView::_DrawSubtitle()
|
|||||||
void
|
void
|
||||||
VideoView::_AdoptGlobalSettings()
|
VideoView::_AdoptGlobalSettings()
|
||||||
{
|
{
|
||||||
mpSettings settings = Settings::CurrentSettings();
|
mpSettings settings;
|
||||||
// thread safe
|
Settings::Default()->Get(settings);
|
||||||
|
|
||||||
fUseOverlays = settings.useOverlays;
|
fUseOverlays = settings.useOverlays;
|
||||||
fUseBilinearScaling = settings.scaleBilinear;
|
fUseBilinearScaling = settings.scaleBilinear;
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008, Haiku. All rights reserved.
|
* Copyright 2008-2011, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Fredrik Modéen <fredrik@modeen.se>
|
* Fredrik Modéen <fredrik@modeen.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*static*/ Settings Settings::sGlobalInstance;
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
mpSettings::operator!=(const mpSettings& other) const
|
mpSettings::operator!=(const mpSettings& other) const
|
||||||
{
|
{
|
||||||
@@ -40,7 +44,7 @@ Settings::Settings(const char* filename)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Settings::LoadSettings(mpSettings& settings) const
|
Settings::Get(mpSettings& settings) const
|
||||||
{
|
{
|
||||||
BAutolock _(const_cast<Settings*>(this));
|
BAutolock _(const_cast<Settings*>(this));
|
||||||
|
|
||||||
@@ -68,25 +72,20 @@ Settings::LoadSettings(mpSettings& settings) const
|
|||||||
= fSettingsMessage.GetValue("bgMovieVolumeMode",
|
= fSettingsMessage.GetValue("bgMovieVolumeMode",
|
||||||
(uint32)mpSettings::BG_MOVIES_FULL_VOLUME);
|
(uint32)mpSettings::BG_MOVIES_FULL_VOLUME);
|
||||||
|
|
||||||
entry_ref defaultFilePanelFolder;
|
settings.filePanelFolder = FilePanelFolder();
|
||||||
// an "unset" entry_ref
|
settings.audioPlayerWindowFrame = AudioPlayerWindowFrame();
|
||||||
settings.filePanelFolder = fSettingsMessage.GetValue(
|
|
||||||
"filePanelDirectory", defaultFilePanelFolder);
|
|
||||||
|
|
||||||
settings.audioPlayerWindowFrame = fSettingsMessage.GetValue(
|
|
||||||
"audioPlayerWindowFrame", BRect());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Settings::SaveSettings(const mpSettings& settings)
|
Settings::Update(const mpSettings& settings)
|
||||||
{
|
{
|
||||||
BAutolock _(this);
|
BAutolock _(this);
|
||||||
|
|
||||||
fSettingsMessage.SetValue("autostart", settings.autostart);
|
fSettingsMessage.SetValue("autostart", settings.autostart);
|
||||||
fSettingsMessage.SetValue("closeWhenDonePlayingMovie",
|
fSettingsMessage.SetValue("closeWhenDonePlayingMovie",
|
||||||
settings.closeWhenDonePlayingMovie);
|
settings.closeWhenDonePlayingMovie);
|
||||||
fSettingsMessage.SetValue("closeWhenDonePlayingSound",
|
fSettingsMessage.SetValue("closeWhenDonePlayingSound",
|
||||||
settings.closeWhenDonePlayingSound);
|
settings.closeWhenDonePlayingSound);
|
||||||
fSettingsMessage.SetValue("loopMovie", settings.loopMovie);
|
fSettingsMessage.SetValue("loopMovie", settings.loopMovie);
|
||||||
fSettingsMessage.SetValue("loopSound", settings.loopSound);
|
fSettingsMessage.SetValue("loopSound", settings.loopSound);
|
||||||
@@ -105,33 +104,47 @@ Settings::SaveSettings(const mpSettings& settings)
|
|||||||
fSettingsMessage.SetValue("filePanelDirectory",
|
fSettingsMessage.SetValue("filePanelDirectory",
|
||||||
settings.filePanelFolder);
|
settings.filePanelFolder);
|
||||||
|
|
||||||
fSettingsMessage.SetValue("audioPlayerWindowFrame",
|
SetAudioPlayerWindowFrame(settings.audioPlayerWindowFrame);
|
||||||
settings.audioPlayerWindowFrame);
|
|
||||||
|
|
||||||
// Save at this point, although saving is also done on destruction,
|
|
||||||
// this will make sure the settings are saved even when the player
|
|
||||||
// crashes.
|
|
||||||
fSettingsMessage.Save();
|
|
||||||
|
|
||||||
Notify();
|
Notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - static
|
entry_ref
|
||||||
|
Settings::FilePanelFolder() const
|
||||||
/*static*/ Settings
|
|
||||||
Settings::sGlobalInstance;
|
|
||||||
|
|
||||||
|
|
||||||
/*static*/ mpSettings
|
|
||||||
Settings::CurrentSettings()
|
|
||||||
{
|
{
|
||||||
mpSettings settings;
|
BAutolock locker(const_cast<Settings*>(this));
|
||||||
sGlobalInstance.LoadSettings(settings);
|
return fSettingsMessage.GetValue("filePanelDirectory", entry_ref());
|
||||||
return settings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Settings::SetFilePanelFolder(const entry_ref& ref)
|
||||||
|
{
|
||||||
|
BAutolock locker(this);
|
||||||
|
fSettingsMessage.SetValue("filePanelDirectory", ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BRect
|
||||||
|
Settings::AudioPlayerWindowFrame() const
|
||||||
|
{
|
||||||
|
BAutolock locker(const_cast<Settings*>(this));
|
||||||
|
return fSettingsMessage.GetValue("audioPlayerWindowFrame", BRect());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Settings::SetAudioPlayerWindowFrame(BRect frame)
|
||||||
|
{
|
||||||
|
BAutolock locker(this);
|
||||||
|
fSettingsMessage.SetValue("audioPlayerWindowFrame", frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - static
|
||||||
|
|
||||||
|
|
||||||
/*static*/ Settings*
|
/*static*/ Settings*
|
||||||
Settings::Default()
|
Settings::Default()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008, Haiku. All rights reserved.
|
* Copyright 2008-2011, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Fredrik Modéen <fredrik@modeen.se>
|
* Fredrik Modéen <fredrik@modeen.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SETTINGS_H
|
#ifndef SETTINGS_H
|
||||||
#define SETTINGS_H
|
#define SETTINGS_H
|
||||||
|
|
||||||
|
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
|
|
||||||
#include "Notifier.h"
|
#include "Notifier.h"
|
||||||
#include "SettingsMessage.h"
|
#include "SettingsMessage.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define SETTINGS_FILENAME "MediaPlayer"
|
||||||
|
|
||||||
|
|
||||||
struct mpSettings {
|
struct mpSettings {
|
||||||
enum {
|
enum {
|
||||||
SUBTITLE_SIZE_SMALL = 0,
|
SUBTITLE_SIZE_SMALL = 0,
|
||||||
@@ -43,23 +47,27 @@ struct mpSettings {
|
|||||||
uint32 subtitlePlacement;
|
uint32 subtitlePlacement;
|
||||||
uint32 backgroundMovieVolumeMode;
|
uint32 backgroundMovieVolumeMode;
|
||||||
entry_ref filePanelFolder;
|
entry_ref filePanelFolder;
|
||||||
|
|
||||||
bool operator!=(const mpSettings& other) const;
|
bool operator!=(const mpSettings& other) const;
|
||||||
|
|
||||||
BRect audioPlayerWindowFrame;
|
BRect audioPlayerWindowFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SETTINGS_FILENAME "MediaPlayer"
|
|
||||||
|
|
||||||
class Settings : public BLocker, public Notifier {
|
class Settings : public BLocker, public Notifier {
|
||||||
public:
|
public:
|
||||||
Settings(
|
Settings(
|
||||||
const char* filename = SETTINGS_FILENAME);
|
const char* filename = SETTINGS_FILENAME);
|
||||||
|
|
||||||
void LoadSettings(mpSettings& settings) const;
|
void Get(mpSettings& settings) const;
|
||||||
void SaveSettings(const mpSettings& settings);
|
void Update(const mpSettings& settings);
|
||||||
|
|
||||||
|
entry_ref FilePanelFolder() const;
|
||||||
|
void SetFilePanelFolder(const entry_ref& ref);
|
||||||
|
|
||||||
|
BRect AudioPlayerWindowFrame() const;
|
||||||
|
void SetAudioPlayerWindowFrame(BRect frame);
|
||||||
|
|
||||||
static mpSettings CurrentSettings();
|
|
||||||
static Settings* Default();
|
static Settings* Default();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -69,4 +77,5 @@ private:
|
|||||||
static Settings sGlobalInstance;
|
static Settings sGlobalInstance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008-2010, Haiku, Inc. All rights reserved.
|
* Copyright 2008-2011, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -41,7 +41,7 @@ enum {
|
|||||||
|
|
||||||
|
|
||||||
#define SPACE 10
|
#define SPACE 10
|
||||||
#define SPACEING 7
|
#define SPACEING 7
|
||||||
#define BUTTONHEIGHT 20
|
#define BUTTONHEIGHT 20
|
||||||
|
|
||||||
|
|
||||||
@@ -61,9 +61,9 @@ SettingsWindow::SettingsWindow(BRect frame)
|
|||||||
|
|
||||||
BStringView* playModeLabel = new BStringView("stringViewPlayMode",
|
BStringView* playModeLabel = new BStringView("stringViewPlayMode",
|
||||||
B_TRANSLATE("Play mode"));
|
B_TRANSLATE("Play mode"));
|
||||||
BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions",
|
BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions",
|
||||||
B_TRANSLATE("View options"));
|
B_TRANSLATE("View options"));
|
||||||
BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg",
|
BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg",
|
||||||
B_TRANSLATE("Volume of background clips"));
|
B_TRANSLATE("Volume of background clips"));
|
||||||
BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
|
BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
|
||||||
playModeLabel->SetExplicitAlignment(alignment);
|
playModeLabel->SetExplicitAlignment(alignment);
|
||||||
@@ -73,14 +73,14 @@ SettingsWindow::SettingsWindow(BRect frame)
|
|||||||
bgMoviesModeLabel->SetExplicitAlignment(alignment);
|
bgMoviesModeLabel->SetExplicitAlignment(alignment);
|
||||||
bgMoviesModeLabel->SetFont(be_bold_font);
|
bgMoviesModeLabel->SetFont(be_bold_font);
|
||||||
|
|
||||||
fAutostartCB = new BCheckBox("chkboxAutostart",
|
fAutostartCB = new BCheckBox("chkboxAutostart",
|
||||||
B_TRANSLATE("Automatically start playing"),
|
B_TRANSLATE("Automatically start playing"),
|
||||||
new BMessage(M_SETTINGS_CHANGED));
|
new BMessage(M_SETTINGS_CHANGED));
|
||||||
|
|
||||||
fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies",
|
fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies",
|
||||||
B_TRANSLATE("Close window after playing video"),
|
B_TRANSLATE("Close window after playing video"),
|
||||||
new BMessage(M_SETTINGS_CHANGED));
|
new BMessage(M_SETTINGS_CHANGED));
|
||||||
fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds",
|
fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds",
|
||||||
B_TRANSLATE("Close window after playing audio"),
|
B_TRANSLATE("Close window after playing audio"),
|
||||||
new BMessage(M_SETTINGS_CHANGED));
|
new BMessage(M_SETTINGS_CHANGED));
|
||||||
|
|
||||||
@@ -120,17 +120,17 @@ SettingsWindow::SettingsWindow(BRect frame)
|
|||||||
|
|
||||||
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
|
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
|
||||||
B_TRANSLATE("Full volume"), new BMessage(M_SETTINGS_CHANGED));
|
B_TRANSLATE("Full volume"), new BMessage(M_SETTINGS_CHANGED));
|
||||||
|
|
||||||
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
|
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
|
||||||
B_TRANSLATE("Low volume"), new BMessage(M_SETTINGS_CHANGED));
|
B_TRANSLATE("Low volume"), new BMessage(M_SETTINGS_CHANGED));
|
||||||
|
|
||||||
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
|
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
|
||||||
B_TRANSLATE("Muted"), new BMessage(M_SETTINGS_CHANGED));
|
B_TRANSLATE("Muted"), new BMessage(M_SETTINGS_CHANGED));
|
||||||
|
|
||||||
fRevertB = new BButton("revert", B_TRANSLATE("Revert"),
|
fRevertB = new BButton("revert", B_TRANSLATE("Revert"),
|
||||||
new BMessage(M_SETTINGS_REVERT));
|
new BMessage(M_SETTINGS_REVERT));
|
||||||
|
|
||||||
BButton* cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
|
BButton* cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
|
||||||
new BMessage(M_SETTINGS_CANCEL));
|
new BMessage(M_SETTINGS_CANCEL));
|
||||||
|
|
||||||
BButton* okButton = new BButton("ok", B_TRANSLATE("OK"),
|
BButton* okButton = new BButton("ok", B_TRANSLATE("OK"),
|
||||||
@@ -208,7 +208,7 @@ SettingsWindow::Show()
|
|||||||
// The Settings that we want to be able to revert to is the state at which
|
// The Settings that we want to be able to revert to is the state at which
|
||||||
// the SettingsWindow was shown. So the current settings are stored in
|
// the SettingsWindow was shown. So the current settings are stored in
|
||||||
// fLastSettings.
|
// fLastSettings.
|
||||||
Settings::Default()->LoadSettings(fLastSettings);
|
Settings::Default()->Get(fLastSettings);
|
||||||
fSettings = fLastSettings;
|
fSettings = fLastSettings;
|
||||||
AdoptSettings();
|
AdoptSettings();
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ SettingsWindow::ApplySettings()
|
|||||||
= mpSettings::BG_MOVIES_MUTED;
|
= mpSettings::BG_MOVIES_MUTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings::Default()->SaveSettings(fSettings);
|
Settings::Default()->Update(fSettings);
|
||||||
|
|
||||||
fRevertB->SetEnabled(IsRevertable());
|
fRevertB->SetEnabled(IsRevertable());
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ SettingsWindow::Revert()
|
|||||||
{
|
{
|
||||||
fSettings = fLastSettings;
|
fSettings = fLastSettings;
|
||||||
AdoptSettings();
|
AdoptSettings();
|
||||||
Settings::Default()->SaveSettings(fSettings);
|
Settings::Default()->Update(fSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user