Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffvli committed Feb 28, 2023
1 parent b376cb2 commit 4a16b80
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/components/player/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ const Player = ({ currentEntryList, muted, children }: any, ref: any) => {
setMetadata(playQueue.current);

// Save the queue 2.5 seconds after fade length
if (settings.getSync('resume')) {
if (settings.get('resume')) {
setTimeout(() => {
ipcRenderer.send('quicksave');
}, playQueue.fadeDuration * 1000 + 2500);
Expand Down
12 changes: 6 additions & 6 deletions src/components/settings/ConfigPanels/LookAndFeelConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ export const ThemeConfigPanel = ({ bordered }: any) => {
Boolean(settings.get('dynamicBackground'))
);
const [retainWindowSizeChk, setRetainWindowSizeChk] = useState(
Boolean(settings.getSync('retainWindowSize'))
Boolean(settings.get('retainWindowSize'))
);
const [defaultWindowHeight, setDefaultWindowHeightValue] = useState(
Number(settings.getSync('defaultWindowHeight'))
Number(settings.get('defaultWindowHeight'))
);
const [defaultWindowWidth, setDefaultWindowWidthValue] = useState(
Number(settings.getSync('defaultWindowWidth'))
Number(settings.get('defaultWindowWidth'))
);

const [selectedTheme, setSelectedTheme] = useState(String(settings.get('theme')));
Expand Down Expand Up @@ -508,7 +508,7 @@ export const ThemeConfigPanel = ({ bordered }: any) => {
defaultChecked={retainWindowSizeChk}
checked={retainWindowSizeChk}
onChange={(e: boolean) => {
settings.setSync('retainWindowSize', e);
settings.set('retainWindowSize', e);
dispatch(setRetainWindowSize(e));
setRetainWindowSizeChk(e);
}}
Expand All @@ -530,7 +530,7 @@ export const ThemeConfigPanel = ({ bordered }: any) => {
max={7680}
width={125}
onChange={(e: number) => {
settings.setSync('defaultWindowWidth', Number(e));
settings.set('defaultWindowWidth', Number(e));
dispatch(setDefaultWindowWidth(Number(e)));
setDefaultWindowWidthValue(Number(e));
}}
Expand All @@ -552,7 +552,7 @@ export const ThemeConfigPanel = ({ bordered }: any) => {
max={7680}
width={125}
onChange={(e: number) => {
settings.setSync('defaultWindowHeight', Number(e));
settings.set('defaultWindowHeight', Number(e));
dispatch(setDefaultWindowHeight(Number(e)));
setDefaultWindowHeightValue(Number(e));
}}
Expand Down
20 changes: 20 additions & 0 deletions src/components/shared/setDefaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,26 @@ export const setDefaultSettings = (force: boolean) => {
settings.set('titleBarStyle', isMacOS() ? 'mac' : 'windows');
}

if (force || !settings.has('retainWindowSize')) {
settings.set('retainWindowSize', false);
}

if (force || !settings.has('defaultWindowWidth')) {
settings.set('defaultWindowWidth', 1280);
}

if (force || !settings.has('defaultWindowHeight')) {
settings.set('defaultWindowHeight', 720);
}

if (force || !settings.has('savedWindowSize')) {
settings.set('savedWindowSize', [1280, 720]);
}

if (force || !settings.has('savedWindowPos')) {
settings.set('savedWindowPos', [50, 50]);
}

if (force || !settings.has('musicListColumns')) {
settings.set('musicListColumns', [
{
Expand Down
21 changes: 9 additions & 12 deletions src/main.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ if (isWindows() && isWindows10()) {

const Controls = windowsMediaPlayback.BackgroundMediaPlayer.current.systemMediaTransportControls;

if (settings.getSync('systemMediaTransportControls')) {
if (settings.get('systemMediaTransportControls')) {
Controls.isEnabled = true;
} else {
Controls.isEnabled = false;
Expand Down Expand Up @@ -420,15 +420,12 @@ const createWindow = async () => {
let isCentered = true;

// If retained window size is enabled, use saved dimensions and position. Otherwise, use defined defaults
if (settings.getSync('retainWindowSize')) {
windowDimensions = settings.getSync('savedWindowSize');
windowPos = settings.getSync('savedWindowPos');
if (settings.get('retainWindowSize')) {
windowDimensions = settings.get('savedWindowSize');
windowPos = settings.get('savedWindowPos');
isCentered = false;
} else {
windowDimensions = [
settings.getSync('defaultWindowWidth'),
settings.getSync('defaultWindowHeight'),
];
windowDimensions = [settings.get('defaultWindowWidth'), settings.get('defaultWindowHeight')];
}

mainWindow = new BrowserWindow({
Expand Down Expand Up @@ -560,8 +557,8 @@ const createWindow = async () => {
});

mainWindow.on('moved', () => {
if (settings.getSync('retainWindowSize')) {
settings.setSync('savedWindowPos', mainWindow.getPosition());
if (settings.get('retainWindowSize')) {
settings.set('savedWindowPos', mainWindow.getPosition());
}
});

Expand All @@ -573,9 +570,9 @@ const createWindow = async () => {
}

// If retain window size is enabled, save the dimensions
if (settings.getSync('retainWindowSize')) {
if (settings.get('retainWindowSize')) {
const curSize = mainWindow.getSize();
settings.setSync('savedWindowSize', [curSize[0], curSize[1]]);
settings.set('savedWindowSize', [curSize[0], curSize[1]]);
}

// If we have enabled saving the queue, we need to defer closing the main window until it has finished saving.
Expand Down

0 comments on commit 4a16b80

Please sign in to comment.