Jump to content
dummzeuch

wuppdi import

Recommended Posts

@baka0815 I would like to discuss the patch for GExperts you put on SourceForge. I think this forum is better suited for that discussion than a bug report on SourceForge.

 

For everybody else:

The patch adds a menu item to the GExperts Favorite Files expert to import the favourites from the wuppdi welcome page. It does that by reading the ini file that wuppdi uses to store its configuration. The user has to select that file and after a confirmation the entries are imported and replace the current configuration.

 

You requested feedback, so here we go (I'll start with some problems I found and will offer some suggestions) :

  1. Your patch did not compile with Delphi 2007 (and anything older) because scoped enums were introduced at some later time. That was easy to fix by simply removing the scope. After that change it compiled and worked
  2. It created a new menu item with an associated event rather than using an action as all the other menu items on that form do. I changed that.
  3. The file select dialog does not open to %appdata%\embarcadero\bds but only puts that into the filename edit. After pressing enter that directory was shown. In my opinion it should open to the directory that is used by wuppdi in the version of the IDE it runs on, for Delphi 10.2 that would be "%appdata\emvarcadero\bds\19.0", and it should preselect wuppdiwp.ini
  4. Overwriting the existing configuration might be fine for people who have used wuppdi and never used the GExperts Favorite Files expert. Others will probably not want to overwrite their configuration, so I think the import should offer to create a folder "wuppdi" with the new entries.
  5. If somebody continues to use wuppdi he probably doesn't want to import these entries every time he changes his favourites. Maybe having an option to automatically replace the GExperst favorites with the ones from wuppdi would be a good idea. Nobody wants to maintain such lists in parallel.
  6. Alternatively GExperts could add these favorites on the fly whenever the favorites menu is opened, again replacing the GExperts favorites or adding a folder "wuppdi" to the menu.
  7. An export to wuppdi might also be a nice feature, but I don't know when wuppdi reads and writes its .ini file so the data might be overwritten.

 

As always I appreciate any contributions to GExperts.

Share this post


Link to post

Thanks for the feedback and sorry for opening the ticket as a "bug" instead of a "feature request"!

 

  1. Unfortunatly I don't have access to D2007 anymore. I only have an installation of 11 Alexandria available. I thought I considered all compatibility-problems and didn't use inline variables this time. 😉
    1. The only scoped enum I used is "TMsgDlgType.mtWarning" right? Or did I miss another instance?
  2. I oversaw that and my version uses an action now as well.
  3. I would need two hints here:
    1. How should I open the file open dialog? There are only two overloads of ShowOpenDialog in GX_GenericUtils and both don't allow a directory as a parameter.
      1. Should I directly use a TOpenDialog dialog?
      2. Should I create an overload for ShowOpenDialog?
    2. How do I get the part of the path specific to the Delphi version? I couldn't find anything in the Embarcadero wiki to get the "19.0" for Delphi 10.2 or the "22.0" for 11.0.
  4. I was kinda confused at first when I wrote this import logic, because my settings were not saved. I imported the configuration file and the GUI displayed everything correctly but after a reload of Delphi all those settings were gone. That was the main reason I added the SaveEntries call at the end and the warning at the beginning. If I understand you correctly you would prefer if the import of the configuration file would not clear the root, but add a new subfolder called "wuppdi" (or similar)?
  5. As Daniel mentioned in the original wuppdi thread he does not plan to continue working on the wuppdi welcome page plugin, so I don't know if effort is necessary to sync the two files. The GExperts favourites have more options that the wuppdi wp as you can specify the "open mode" (IDE, custom, project, ...) and you can support an unlimited depth of subfolders which is both not supported by the wuppdi wp. It would be a hassle to sync the two files if one adds an entry from one of the two sides. I see this option more as a one-time conversion from wuppdi wp to GExperts favourites.
  6. This would surely be possible as an option, but won't work in all cases (especially in my case). I have Delphi 11 which is not supported by the wuppdi wp and so I don't have the configuration file in my BDS\11.0 folder. I would need to copy the old configuration file to the new directory to only use it with GExperts. So that doesn't seem viable to me.
  7. See my answers to 5 and 6.

Attached is my current version of the patch with 1 and 2 addressed (hopefully).

GX_FavFiles.pas.patch

  • Like 1

Share this post


Link to post
On 8/22/2022 at 7:54 AM, baka0815 said:

Attached is my current version of the patch with 1 and 2 addressed (hopefully).

GX_FavFiles.pas.patch

This patch was missing the changes to the .dfm file.

 

On 8/22/2022 at 7:54 AM, baka0815 said:

I would need two hints here:

  1. How should I open the file open dialog? There are only two overloads of ShowOpenDialog in GX_GenericUtils and both don't allow a directory as a parameter.
    1. Should I directly use a TOpenDialog dialog?
    2. Should I create an overload for ShowOpenDialog?
  2. How do I get the part of the path specific to the Delphi version? I couldn't find anything in the Embarcadero wiki to get the "19.0" for Delphi 10.2 or the "22.0" for 11.0.
  1. GX_GenericUtils.GetUserApplicationDataFolder can replace the %appdata% environment variable which is what causes the dialog to fail showing the correct directory.
  2. As far as I am aware there is no official way to get that number. GExperts declares some constants depending on the VERnnn symbols in GX_VerDepConst. The public documents subdirectory is not one of them, but you could easily add a constant for that. since the required number is already part of the CompilerDefinedProductRegistryKey.

Please remember that Wuppdi was only available for some Delphi versions (I don't really known which ones), so that option doesn't make sense for e.g. Delphi 6.

 

On 8/22/2022 at 7:54 AM, baka0815 said:

I was kinda confused at first when I wrote this import logic, because my settings were not saved. I imported the configuration file and the GUI displayed everything correctly but after a reload of Delphi all those settings were gone. That was the main reason I added the SaveEntries call at the end and the warning at the beginning. If I understand you correctly you would prefer if the import of the configuration file would not clear the root, but add a new subfolder called "wuppdi" (or similar)?

Yes. I would implement it this way:

Instead of showing the file select dialog show your own dialog. It gives the path of the wuppdi ini file in an edit field (you know the path and filename, so you can check whether it exists and display an error if it doesn't). This edit should allow drag and drop (TWinControl_ActivateDropFiles) and autocompletion (TEdit_SetAutocomplete) and offer a ... button to let the user select the file. A second edit field allows entering the name of a subfolder to import into.

Edited by dummzeuch

Share this post


Link to post

Ok, I hope I addressed all issues.

 

I created a new form to select the WuppdiWP configuration file as well as a subfolder. The default is "WuppdiWP" and an empty subfolder means "overwrite existing favorites". The user get's an appropriate message.

Otherwise the new subfolder is created and the the configuration file is read into that.

 

I didn't touch any of the project files as I only have Delphi 11 and I didn't want to break any existing project files and was unsure adding the new unit with a text editor or similar. I can still do that if you want.

But it was enough of a hassle to create the new form completely in Notepad++ to not include some Delphi 11 specialities.

FavoriteFiles.patch

  • Thanks 1

Share this post


Link to post

I like this a lot better but there seems to be one major problem:

After importing the Wuppdi entries, it's impossible to delete the created folder. I get the error "You cannot delete the root folder, please select a different folder." I guess that's not too difficult to fix. I'll look into that later.

 

A few things were not quite to my taste with the new dialog:

  1. It is not resizable
  2. The labels were to the left of the edit fields rather than above (which makes a possible future translation more difficult as that changes the size of the labels - but translation is not going to happen anyway).
  3. Due to 1 and 2 the input field for the filename is very small.
  4. The dialog opens centered on the monitor rather than the form
  5. There was a property and corresponding field for a reference to the Favorite Files dialog which wasn't used anywhere.

I fixed these issues and once I fixed the problem with the root folder error message and did some additional tests, I'll commit it to the repository.

Thanks again for your contribution.

Share this post


Link to post

Hmm, I need to look into that. I thought I fixed that, as the "WuppdiWP"-subfolder is now below the "Favorites" folder (it was a sibling before). But it looks like I messed something up, as it's still a sibling...

Ah, I need to call AddChildObject instead of AddObject - that fixes the issue (btw. restarting Delphi also fixes this as a sibling to Favorites is unsupported).

 

  1. I can change that. How should the fields behave? Should I anchor them left, top and right?
  2. I used the "folder properties" dialog as a starting point and there the labels are in front of the edit fields. The same for the file properties. So I would leave it like that.
  3. see above
  4. This is also the same for folder and file properties.
  5. Which property?

 

Share this post


Link to post
1 minute ago, baka0815 said:

Hmm, I need to look into that. I thought I fixed that, as the "WuppdiWP"-subfolder is now below the "Favorites" folder (it was a sibling before). But it looks like I messed something up, as it's still a sibling...

Ah, I need to call AddChildObject instead of AddObject - that fixes the issue (btw. restarting Delphi also fixes this as a sibling to Favorites is unsupported).

 

  1. I can change that. How should the fields behave? Should I anchor them left, top and right?
  2. I used the "folder properties" dialog as a starting point and there the labels are in front of the edit fields. The same for the file properties. So I would leave it like that.
  3. see above
  4. This is also the same for folder and file properties.
  5. Which property

No need to fix the dialog, I already did that. Yes, the other forms work differently and should possibly be changed as well.

re 5.: FavoriteFilesForm

 

As for the root folder error: After looking at the code for switching to a different file, I think the easiest fix is to clear the tree view and call CreateFolders. But I'm not yet sure. I don't know this code well enough.

Share this post


Link to post

See my comment above. I used "AddObject":

FavNode := tvFolders.Items.AddObject(tvFolders.Items.GetFirstNode, FavSubfolder, BaseFolder);

but it should be "AddChildObject":

FavNode := tvFolders.Items.AddChildObject(tvFolders.Items.GetFirstNode, FavSubfolder, BaseFolder);

AddObject wants a "sibling" as the first parameter where AddChildObject wants the parent. And we want to use the parent here.

Share this post


Link to post

Apart from restarting the IDE, File -> Favorite File Collection -> Open Default Collection also works.

Yes, calling AddChildObject fixes the problem. Sorry, I missed that.

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×