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

List:       kde-core-devel
Subject:    PROPOSAL: A way to make standard UIs *much* easier
From:       Kurt Granroth <granroth () kde ! org>
Date:       2000-02-10 22:59:24
[Download RAW message or body]

Okay, I'll start out by saying that I'm *very* excited by this.  I
think it is trés cool!

For some time now, I've been trying to figure out a way that we can
make menu and toolbar building a lot easier while enforcing out UI
standards at the same time.  KStdActions and the like came close.. but
the actual GUI building was still up to the developer.  Then it hit me
that the code to do that was under my nose all along -- KParts (using
Simon's excellent XML merging code) already did automatic GUI
building!

Proposal:
---------
I propose that we/I move the XML and GUI building code from KParts
into kdeui and ktmainwindow.  We would then create a "global" XML file
that contains *all* menus and toolbars defined by our UI standards
guide.  All KDE apps that use KTMainWindow will automagically read and
use this global definition.  Apps that have non-standard menu entries
(e.g., nearly all apps) will have a local XML file that will be merged
into the global XML tree in the right places.

Why:
----
Doing this will do TONS of stuff for us!  Here are some off the top of
my head.

1) Most KDE apps will be UI Standard compliant automagically with NO
   extra coding
2) Creating menus and toolbars will be *much* easier.  An example:

    KStdAction::openNew(this, SLOT(fileNew()), actionCollection());
	KStdAction::quit(kapp, SLOT(quit()), actionCollection());

	KStdAction::showToolbar(this, SLOT(optionsShowToolbar()),
                            actionCollection());

	KStdAction::preferences(this, SLOT(optionsPreferences()),
                            actionCollection());
    createGUI();

   That code (only five lines of code!) would create a menubar and
   toolbar.  It would then create a File menu with the "New" and
   "Quit" items and a Options menu with "Show Toolbar" and
   "Configure".  It would also insert the "New" item into the main
   toolbar.  All items will automagically have the correct icon and
   text and accel and everything.  

   That's it!

3) Adding your own entries is just as easy.  You create a local XML
   file like so (snippet):

    <Menu name="options">
      <Action name="show_me" append="show_merge"/>
    </Menu>

   and use the lines:

    (void)new KAction(i18n("Show My Item"), 0, this, SLOT(myslot()),
                      actionCollection(), "show_me");
     createGUI( "xmluigui.rc" );

   That will put your own "Show" item right under the "Show Toolbar"
   item in the Options menu.  Cool, eh?

4) Creating a global (or local) menu editor will be almost trivial.
   If, for instance, a person wants the File menu on the right instead
   of the left (maybe hebrew?), then the global .rc file needs one
   quick change and ALL KDE apps will automagically have the menu in
   the "right" place.

5) Apps that really do not want to follow the UI standard for some
   reason can opt out of this by just not defining any standard items
   or calling the 'createGUI' call.

Status:
-------
o I have already checked with God^H^H^HSimon and David and both like
  the idea (and, in fact, I couldn't have done it without Simon's help).

o I already have it working on my hard drive.. I just need to commit
  it!!

o I don't have any docs on using this new system yet.. but you can bet
  that I *will* soon (mostly since this is all so easy to use) :-)

So?
---
So what do y'all think of this?  Should I commit and start converting
apps?
-- 
Kurt Granroth            | http://www.granroth.org
KDE Developer/Evangelist | SuSE Labs Open Source Developer
granroth@kde.org         | granroth@suse.com
           KDE -- Putting a Friendly Face on Unix

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

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