Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window properties not saved #57

Open
darealshinji opened this issue Jan 18, 2019 · 2 comments
Open

Window properties not saved #57

darealshinji opened this issue Jan 18, 2019 · 2 comments
Labels

Comments

@darealshinji
Copy link
Collaborator

QH doesn't seem to save the last window properties in ~/.quickhash.
It always remains the same:

<?xml version="1.0" encoding="utf-8"?>
<CONFIG>
  <TApplication>
    <MainForm MainForm_Position="poScreenCenter"/>
  </TApplication>
</CONFIG>

This is on Linux, I haven't checked the behavior on Windows yet.

By the way, using the following code seems to help to save the file in a specific user directory, which would help to install QH on Windows in a directory without write access for regular users:

  {$ifdef Windows}
    envVar := GetEnvironmentVariable('LocalAppData'); // XP only has %AppData%
    if envVar <> '' then
    begin
      if DirectoryExists(envVar + '/QuickHash') = false then
      begin
        CreateDir(envVar + '/QuickHash');
      end;
      if DirectoryExists(envVar + '/QuickHash') = true then
      begin
        QH_MainFormXMLPropStorage.FileName := envVar + '/QuickHash/PropStorage.xml';
      end;
    end;
  {$endif}

  {$ifdef UNIX}
    envVar := GetEnvironmentVariable('HOME');
    if envVar <> '' then
    begin
      // $HOME/.config should already exist on Mac and Linux
      if DirectoryExists(envVar + '/.config/QuickHash') = false then
      begin
        CreateDir(envVar + '/.config/QuickHash');
      end;
      if DirectoryExists(envVar + '/.config/QuickHash') = true then
      begin
        QH_MainFormXMLPropStorage.FileName := envVar + '/.config/QuickHash/PropStorage.xml';
      end;
    end;
  {$endif}
@tedsmith
Copy link
Owner

looks sensible. Except the ifdef for windows needs to be backslash instead of forward slash.

@darealshinji
Copy link
Collaborator Author

darealshinji commented Jan 21, 2019

I need to use SysUtils.GetEnvironmentVariable() to compile it on Windows. Forward slashes as directory delimiters are working fine. The xml file is stored in the right AppData directory, but the issue that the actual window properties aren't saved in there remains (it's the same with self-compile and your pre-compiled versions).
Since nobody has had an issue with that so far I'd say the TXMLPropStorage stuff could be removed.

PS: the 32 bit and 64 bit releases only need their 32/64 bit versions of sqlite in the same directory and not both. Cause currently your zip packages ship both dlls for each binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants