Hello,
I wanted to debug my Document dialog crash but I got lost within these
huge classes. I hope that Edwin Leuwen will not be upset but I ended up
re-architecturing it quite a lot.
The first thing I have done is to put everything related to GUI access
inside QDocumentDialog. The QDocument class is now just a small
interface controller (IMHO, we should apply this same philosophy to all
controllers). Then I started to create classes instead of using the ui
element directly from QDocumentDialog. I started with the Branches
module which I named QBranches. With enough time and energy I will try
to create one class per module (there are still 9 modules to creates).
Ultimately, I would like QDocumentDialog to just update a vector of
widgets without knowing their purpose. All those widget would derive
from a common base class, let's call it buffer_settings_widget:
class buffer_settings_widget
{
public:
virtual ~buffer_settings_widget() {}
/// Update the Widget with the BufferParam
void update(const BufferParams &) = 0;
void apply(BufferParam &) const = 0;
}
Once I have converted all modules, the idea would be to move their
instantiation in QDocument. This way the widgets would be available
outside of the document setting dialog.
With this base class, it would be possible to create configuration
plugins if need for this is apparent. And if we push that to the GUII
framework, all frontends could benefit from it.
There is already a side benefit to this new architecture: There are two
UI for branches, the one in the Document Settings and a simpler one.
Would it be a good idea to replace the latter by the former?
Before converting the modules, I have a question (to Edwin Leuwen I
presume):
Most of the modules are connected to QDocumentDialog::change_adaptator
which calls QDialogView::changed() which is:
void QDialogView::changed()
{
if (updating_)
return;
bc().valid(isValid());
}
My question is: is this really necessary? Isn't that enough is we call
this when the "close" button or the "apply" button are pressed?
Comments? Please...
Abdel.