[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: DialogCore / AboutCore classes
From:       Espen Sand <espensa () online ! no>
Date:       1999-08-30 21:24:12
[Download RAW message or body]

Hello Mirko.

I will see what I can do to merge the two classes. I will however first
complete CDialogCore so I know exactly what I will need. I hope you 
understand. 

Yes I have studied the DialogBase but I found that I could not use it for 
all the dialogs I have in khexedit (which area rather many and different
looking). So decided to make one that was a bit more versatile, but also a bit
more restrictive. Some Issues:


1. Perhaps most important. I use no resizeEvent() event handler. Everything 
is taken care of by the Qt layout mechanism. This makes the dialog code *much*
simpler to maintain (at least my experience :-). I have reimplemented the
show() method where I basically only do:
setGeometry( x(), y(), minimumSize().width(),minimumSize().height() );
QDialog::show();
Thats the only place I set the size of anything in the CDialogCore.


2. I needed more Action buttons (other than Apply,Ok and Cancel) at the same
time So I added Help,Default and Close, as well as the user definable buttons.
In all, eight button can be used in a dialog at the same time.

3. The user can not change the text of a button after it has be created. I
really don't like that possibility. The user can only set the text of the
three special buttons in the constructor.

4. I needed to be able to set a default button (minor issue though).

5. This is more personal taste. I like to define as much as possible in the
constructor so a dialog should normally be a class of its own. The CDialogCore
constructor is shown below: (the separator controls a horizontal line above the
action buttons)

CDialogCore( int dialogType, int buttonMask, int defaultButton,
  QWidget *parent=0, const char *name = 0,
  const QString &title = QString::null,
  bool separator = false, bool modal = false,
  const QString &user1 = QString::null,
  const QString &user2 = QString::null,
  const QString &user3 = QString::null);



A few examples below (from khexedit)

The configuration dialog box:
---------------------

COptionDialog::COptionDialog( const QString &title, QWidget *parent, 
			      char *name, bool modal )
  :CDialogCore( TreeList, Help|Default|Apply|Ok|Cancel,Ok, parent, name,
		title, true, modal )
{
  setupLayoutPage();
  setupCursorPage();
  setupColorPage();
  setupFontPage();
  setupFilePage();
  setupMiscPage();
}


while the printer dialog is created as:
---------------------------

CPrinterDialog::CPrinterDialog( const QString &title, QWidget *parent, 
				char *name, bool modal )
  :CDialogCore( Tabbed, Help|User2|User1|Cancel, User1, parent, name, 
		title, false, modal, i18n("&Print"), i18n("Pre&view") ),
  setupDestinationPage();
  setupOptionPage();
  setupLayoutPage();
}




On Mon, 30 Aug 1999, Mirko Sucker wrote:
>Espen Sand wrote:
>
>> FYI: From My Struggle towards (even) better dialogs in KDE.
>>
>> I have been working this weekend on a dialog base class - DialogCore
>> The reason for this is to make a class that more or less forces the user to
>> follow certain rules when making dialogs. My goal is to get this class into
>> kdeui so that I can use it in other (than khexedit) programs I have planned to
>> "clean up".
>
>Hello Espen,
>there is a class in kdeui that provides this stuff, it is DialogBase. Apart from
>the three different layouts, it provides everything you are talking about.
>
>> *DialogCore provides three layouts (defined in constructor)
>> +Plain (std dialog)
>> +Tabbed (a tabbed dialog)
>> +TreeList (treelist+pages as config window in khexedit, korganizer). The
>> treelist is based on the QSplitter + QlistView.
>
>> *DialogCore defines an inner and outer margin. The outer is used by the
>> DialogCore itself and and the user should use the "innerMagin()" only.
>> (I hope DialogCore can read these margins from a central KDE object later).
>
>Instead of this, in DialogBase the user creates a widget that is child of the
>dialog:
>---
>DialogBase dialog;
>QMultiLineEdit line(&dialog);
>dialog.setMainWidget(&line);
>if(!dialog.exec()) ...
>---
>This is everything needed to create a dialog to enter a multi line text. The user
>does not have to take care about inner and outer margins (that, BTW, arew there,
>too).
>I would be happy if you manage to add the three different styles to DialogBase,
>instead of adding another class that implements the same stuff once again.
>Greetings,
>--Mirko.
>
>> ... I have begun making a general "about dialog" core class, AboutCore, that will
>> be
>
>> able to create the "About KDE dialog" as well as my current "About khexedit" and
>> more. The  AboutCore is sublassed from the "DialogCore". I can
>> already make the "About KDE dialog" using this class. I will try to implement
>> all features from the (nice :-) "KAboutDialog" by Mirko Sucker.
>
>But remember that KAboutDialog is not THE About Dialog for KDE, it is meant for
>application about dialogs.
>Greetings,
>--Mirko.
>
>--
>Denn der  Mensch  liebt und ehrt den  Menschen,  solange er ihn
>nicht zu beurteilen vermag, und die Sehnsucht ist ein Erzeugnis
>mangelhafter Erkenntnis. (Thomas Mann)


-- 
Espen Sand

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic