Right now every time codeblocks fails to load a project from a workspace it pops up an error message box to inform the user. If this workspace has 20 invalid projects the user can klick 20 message boxes away. It would be much better to inform the user after loading the workspace with one dialog about all invalid projects. A dialog like the assert dialog or error dialog of wxWidgets, with a scrollable list, would be nice..
I agree with you. I see the same issue if I open the wx3.1 32bit C::B workspace(I'm using the git, I think a lot of project need to checkout by the external svn repo)
Ok, i made workspace loading a bit more userfriendly
some comments?
It adds a progress dialog, that informs about the progess of loading, and if some projects are not loaded at the end a dialog that informs the user about all not loaded projects...
Also it will be good if you can show the name of the currently loaded project in the progress dialog.
i have implemented all comments. Thank you!
The patch is a bit noisy... Do not know what my git has...
BTW: Why do you use a logger and not just a plane string? We don't use this logging stuff much in other places. Also I'm not sure this logger works well on macOS.
Because this shows a nice dialog, with error message icon, error message, an expand button if you want to know more, and a scrollable list with all failed projects that can be copied.
If i use a message box with a big string i can not copy the values, and if a workspace has 100 faulty projects the dialog won't fit on the screen.
This all is provided free by the wxLoggerGui and it is easy to implement (as you can see)
I doubt this, but ii can not verify it. This is the main logger for wx>3.0 internal errors like in the resource system...
Last edit: bluehazzard 2019-04-03
Currently cb crashes on macOS if you run it with -v and there is something in the log.
Is this a wxWidgets issue or a codeblocks issue?
Can you try this patch with mac os? (to have some wrong workspace, simply load the wx3.1 32bit C::B workspace of windows)
Can everybody confirm, that this implementation does not steal focus during the loading of the workspace? I am not 100% sure if the progress dialog won't steal focus on all platforms...
I have tested it on windows 10 at the moment....
The logWindow didn't show at all in my system (Windows 7), I had to add
after
and
just before
When closing the log window, if there is a window behind C::B then it becomes top window and C::B goes to the background.
Two comments: calling progressDlg.Show() is not needed, and the for still lacks the space before the bracket.
Last edit: Miguel Gimenez 2019-04-03
But looking at the code I've found one major problem. The workspace loader is not supposed to have any GUI code in it. This should be abstracted away in a similar fashion to the one done in the project manager ui stuff.
I'm not sure if someone would work on console only capable C::B batch in the future, but we must not make his/her task harder!
Setting the parent of progressDlg as Teodor suggested fixes C::B jumping to background
@Miguel Gimenez
Thank you for testing and your investigation
Yes. This is a problem.... Is this not a bit overkill? For the progress dialog we could simply #ifdef it out on console builds, for the log window it could be redirected to the console easily...
(The project manager is full of cbMessageBox. Is there a implementation that redirects the error message to the stdout if it is run in console mode?)
Does the wx samples also behave like this?
What is your alternative sugestion? Create a own dialog?
No, it is not an overkill. Tests in the past have shown that having two builds won't work. We need a single dll/so to work for both console and ui. I guess all UI sdk related code would be moved there.
For the dialog: I have no suggestions yet. Lets tackle the bigger problem first.
Another thing we should consider is that it will be good if we can show a progress for any particular project. Loading big cmake projects isn't really fast. So moving the UI code in the src/src folder might be a mean to achieve this goal, too.
Ok, i suspected that this ticket will go this direction....
So we basically have two problems:
1) Show the user a dialog that there are failed projects
2) Show the user a progress dialog how far the loading of the workspace is going
The requirement for both is to be able to run on a console environment, where the number two is non critical to show during console screen
For the progress dialog my suggestion is to introduce a progress manager, with a deticated log panel. There different "things" like plugins and main progress can register progresses and update them via some string identifier for example... This would make progress things pretty easy... We could introduce an global progress bar in the status bar, so sumarize all other progress bars
for 2)... no idea... If you do not like the thew log example, we have to introduce our own dialog... I do not favor the message box example....
If you introduce a progress manager you'd have to consider the case where two separate peices of code would want to have separate progresses.
But if you ask me I'd rather not go the manager way. I'll just pass the progress showing object to the loader and be done with it. As simple as possible. Then as the next step do the same thing with the project loader.
After we have some uses of the progress we could think about something more complex.
https://twitter.com/mike_acton/status/1076888085256904704?lang=en
I think the manager approach is the simplest way... We have 100 places where a progress should be showed to the user (loading workspace, loading project, loading dependencies, loading wxSmith files, cc parser, starting debugger, updating watches, compiling workspace, compiling project, probably some update manager in the future, ecc...) All this places should show the user some progress. Some are plugins, some are in the sdk and some in the src. All this progress reporting should be in one central place and showed to the user. If possible not blocking, stealing focus or being intrusive in any way. I like the eclipse approach here a lot...
For me the codebase is to large to introducing and passing an object to all this places. A singleton class like the managers are, would make thins a lot easier and less intrusive. Like the log manager. We could probably introduce this to the log manager...
This discussion goes to wide for this ticket. In this ticket i really wanted only to get rid of this 100es message boxes that pop up on loading the workspace.
well i really wanted to fix only this dialog right now...
BTW: I'd rather prefer the current solution instead of some generic complex solution based on managers.
OK, lets reduce the problem to more small bits, so we can improve the usability and find some common base to work with.
This patch will reduce the verbosity of the workspace loading to a minimum. This will help now and does not introduce more UI code in some SDK part.
In a second ticket we can discuss about some progress dialog and remove the whole UI code from this place. But this will take some time and i think this is a acceptable middle point for the moment.
GetpMsg is an inline function and it is checked at the beginning of the function if it returns nullptr
It gets the Log Manager and if he is not null at the start of the function hopefully it wont get null during loading
Fixed in revision: 11706