summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/tools/designer/designer/configtoolboxdialog.ui.h
diff options
context:
space:
mode:
Diffstat (limited to 'tqtinterface/qt4/tools/designer/designer/configtoolboxdialog.ui.h')
-rw-r--r--tqtinterface/qt4/tools/designer/designer/configtoolboxdialog.ui.h222
1 files changed, 222 insertions, 0 deletions
diff --git a/tqtinterface/qt4/tools/designer/designer/configtoolboxdialog.ui.h b/tqtinterface/qt4/tools/designer/designer/configtoolboxdialog.ui.h
new file mode 100644
index 0000000..4eb046b
--- /dev/null
+++ b/tqtinterface/qt4/tools/designer/designer/configtoolboxdialog.ui.h
@@ -0,0 +1,222 @@
+/**********************************************************************
+** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of TQt Designer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include "mainwindow.h"
+#include "widgetaction.h"
+#include "listviewdnd.h"
+#include <tqlistview.h>
+
+void ConfigToolboxDialog::init()
+{
+ listViewTools->setSorting( -1 );
+ listViewCommon->setSorting( -1 );
+
+ ListViewDnd *toolsDnd = new ListViewDnd( listViewTools );
+ toolsDnd->setDragMode( ListViewDnd::External | ListViewDnd::NullDrop | ListViewDnd::Flat );
+
+ ListViewDnd *commonDnd = new ListViewDnd( listViewCommon );
+ commonDnd->setDragMode( ListViewDnd::Both | ListViewDnd::Move | ListViewDnd::Flat );
+
+ TQObject::connect( toolsDnd, TQT_SIGNAL( dropped( TQListViewItem * ) ),
+ commonDnd, TQT_SLOT( confirmDrop( TQListViewItem * ) ) );
+ TQObject::connect( commonDnd, TQT_SIGNAL( dropped( TQListViewItem * ) ),
+ commonDnd, TQT_SLOT( confirmDrop( TQListViewItem * ) ) );
+
+ TQDict<TQListViewItem> groups;
+ TQAction *a;
+ for ( a = MainWindow::self->toolActions.last();
+ a;
+ a = MainWindow::self->toolActions.prev() ) {
+ TQString grp = ( (WidgetAction*)a )->group();
+ TQListViewItem *tqparent = groups.tqfind( grp );
+ if ( !tqparent ) {
+ tqparent = new TQListViewItem( listViewTools );
+ tqparent->setText( 0, grp );
+ tqparent->setOpen( TRUE );
+ groups.insert( grp, tqparent );
+ }
+ TQListViewItem *i = new TQListViewItem( tqparent );
+ i->setText( 0, a->text() );
+ i->setPixmap( 0, a->iconSet().pixmap() );
+ }
+ for ( a = MainWindow::self->commonWidgetsPage.last(); a;
+ a = MainWindow::self->commonWidgetsPage.prev() ) {
+ TQListViewItem *i = new TQListViewItem( listViewCommon );
+ i->setText( 0, a->text() );
+ i->setPixmap( 0, a->iconSet().pixmap() );
+ }
+
+}
+
+
+void ConfigToolboxDialog::addTool()
+{
+ TQListView *src = listViewTools;
+
+ bool addKids = FALSE;
+ TQListViewItem *nextSibling = 0;
+ TQListViewItem *nextParent = 0;
+ TQListViewItemIterator it = src->firstChild();
+ for ( ; *it; it++ ) {
+ // Hit the nextSibling, turn of child processing
+ if ( (*it) == nextSibling )
+ addKids = FALSE;
+
+ if ( (*it)->isSelected() ) {
+ if ( (*it)->childCount() == 0 ) {
+ // Selected, no tqchildren
+ TQListViewItem *i = new TQListViewItem( listViewCommon, listViewCommon->lastItem() );
+ i->setText( 0, (*it)->text(0) );
+ i->setPixmap( 0, *((*it)->pixmap(0)) );
+ listViewCommon->setCurrentItem( i );
+ listViewCommon->ensureItemVisible( i );
+ } else if ( !addKids ) {
+ // Children processing not set, so set it
+ // Also tqfind the item were we shall quit
+ // processing tqchildren...if any such item
+ addKids = TRUE;
+ nextSibling = (*it)->nextSibling();
+ nextParent = (*it)->tqparent();
+ while ( nextParent && !nextSibling ) {
+ nextSibling = nextParent->nextSibling();
+ nextParent = nextParent->tqparent();
+ }
+ }
+ } else if ( ((*it)->childCount() == 0) && addKids ) {
+ // Leaf node, and we _do_ process tqchildren
+ TQListViewItem *i = new TQListViewItem( listViewCommon, listViewCommon->lastItem() );
+ i->setText( 0, (*it)->text(0) );
+ i->setPixmap( 0, *((*it)->pixmap(0)) );
+ listViewCommon->setCurrentItem( i );
+ listViewCommon->ensureItemVisible( i );
+ }
+ }
+}
+
+
+void ConfigToolboxDialog::removeTool()
+{
+ TQListViewItemIterator it = listViewCommon->firstChild();
+ while ( *it ) {
+ if ( (*it)->isSelected() )
+ delete (*it);
+ else
+ it++;
+ }
+}
+
+
+void ConfigToolboxDialog::moveToolUp()
+{
+ TQListViewItem *next = 0;
+ TQListViewItem *item = listViewCommon->firstChild();
+ for ( int i = 0; i < listViewCommon->childCount(); ++i ) {
+ next = item->itemBelow();
+ if ( item->isSelected() && (i > 0) && !item->itemAbove()->isSelected() )
+ item->itemAbove()->moveItem( item );
+ item = next;
+ }
+}
+
+
+void ConfigToolboxDialog::moveToolDown()
+{
+ int count = listViewCommon->childCount();
+ TQListViewItem *next = 0;
+ TQListViewItem *item = listViewCommon->lastItem();
+ for ( int i = 0; i < count; ++i ) {
+ next = item->itemAbove();
+ if ( item->isSelected() && (i > 0) && !item->itemBelow()->isSelected() )
+ item->moveItem( item->itemBelow() );
+ item = next;
+ }
+
+ // TQListViewItem *item = listViewCommon->firstChild();
+ // for ( int i = 0; i < listViewCommon->childCount(); ++i ) {
+ //if ( item == listViewCommon->currentItem() ) {
+ // item->moveItem( item->itemBelow() );
+ // currentCommonToolChanged( item );
+ // break;
+ //}
+ //item = item->itemBelow();
+ // }
+}
+
+
+void ConfigToolboxDialog::currentToolChanged( TQListViewItem *i )
+{
+ bool canAdd = FALSE;
+ TQListViewItemIterator it = listViewTools->firstChild();
+ for ( ; *it; it++ ) {
+ if ( (*it)->isSelected() ) {
+ canAdd = TRUE;
+ break;
+ }
+ }
+ buttonAdd->setEnabled( canAdd || ( i && i->isSelected() ) );
+}
+
+
+void ConfigToolboxDialog::currentCommonToolChanged( TQListViewItem *i )
+{
+ buttonUp->setEnabled( (bool) (i && i->itemAbove()) );
+ buttonDown->setEnabled( (bool) (i && i->itemBelow()) );
+
+ bool canRemove = FALSE;
+ TQListViewItemIterator it = listViewCommon->firstChild();
+ for ( ; *it; it++ ) {
+ if ( (*it)->isSelected() ) {
+ canRemove = TRUE;
+ break;
+ }
+ }
+ buttonRemove->setEnabled( canRemove || ( i && i->isSelected() ) );
+}
+
+
+void ConfigToolboxDialog::ok()
+{
+ MainWindow::self->commonWidgetsPage.clear();
+ TQListViewItem *item = listViewCommon->firstChild();
+ for ( int j = 0; j < listViewCommon->childCount(); item = item->itemBelow(), ++j ) {
+ TQAction *a = 0;
+ for ( a = MainWindow::self->toolActions.last();
+ a;
+ a = MainWindow::self->toolActions.prev() ) {
+ if ( a->text() == item->text( 0 ) )
+ break;
+ }
+ if ( a )
+ MainWindow::self->commonWidgetsPage.insert( j, a );
+ }
+}