From e193e0140419d117a52e3756ddd9d2bdf3ab7a4a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 6 Nov 2013 16:23:17 -0600 Subject: Automated update from Qt3 --- tools/designer/designer.pro | 4 +- tools/designer/designer/customwidgeteditor.ui | 2 +- tools/designer/designer/designer_de.ts | 2 +- tools/designer/designer/designer_fr.ts | 2 +- tools/designer/tools/conv2ui/conv2ui.pro | 10 -- tools/designer/tools/conv2ui/main.cpp | 220 ----------------------- tools/designer/tools/createcw/README | 18 -- tools/designer/tools/createcw/createcw.pro | 8 - tools/designer/tools/createcw/main.cpp | 190 -------------------- tools/designer/tools/tqtconv2ui/main.cpp | 220 +++++++++++++++++++++++ tools/designer/tools/tqtconv2ui/tqtconv2ui.pro | 10 ++ tools/designer/tools/tqtcreatecw/README | 18 ++ tools/designer/tools/tqtcreatecw/main.cpp | 190 ++++++++++++++++++++ tools/designer/tools/tqtcreatecw/tqtcreatecw.pro | 8 + 14 files changed, 451 insertions(+), 451 deletions(-) delete mode 100644 tools/designer/tools/conv2ui/conv2ui.pro delete mode 100644 tools/designer/tools/conv2ui/main.cpp delete mode 100644 tools/designer/tools/createcw/README delete mode 100644 tools/designer/tools/createcw/createcw.pro delete mode 100644 tools/designer/tools/createcw/main.cpp create mode 100644 tools/designer/tools/tqtconv2ui/main.cpp create mode 100644 tools/designer/tools/tqtconv2ui/tqtconv2ui.pro create mode 100644 tools/designer/tools/tqtcreatecw/README create mode 100644 tools/designer/tools/tqtcreatecw/main.cpp create mode 100644 tools/designer/tools/tqtcreatecw/tqtcreatecw.pro (limited to 'tools/designer') diff --git a/tools/designer/designer.pro b/tools/designer/designer.pro index 337bbb464..bbe68ada4 100644 --- a/tools/designer/designer.pro +++ b/tools/designer/designer.pro @@ -6,8 +6,8 @@ SUBDIRS = uic \ uilib \ designer \ app \ - tools/createcw \ - tools/conv2ui + tools/tqtcreatecw \ + tools/tqtconv2ui dll:SUBDIRS *= editor plugins shared:SUBDIRS *= editor plugins diff --git a/tools/designer/designer/customwidgeteditor.ui b/tools/designer/designer/customwidgeteditor.ui index 9dd6404d6..a8623cff2 100644 --- a/tools/designer/designer/customwidgeteditor.ui +++ b/tools/designer/designer/customwidgeteditor.ui @@ -186,7 +186,7 @@ <b>Load Descriptions</b><p>Loads a file which contains descriptions of custom widgets, so that these custom widgets can be used in the TQt Designer.</p> -<p>Since it is a lot of work to type in all the information for custom widgets, you should consider using the createcw tool which is in $QTDIR/tools/designer/tools/createcw. Using createcw you can create custom widget description files for your custom widgets without the need to type in all the information manually. For more information about the README file in the createcw directory</p> +<p>Since it is a lot of work to type in all the information for custom widgets, you should consider using the tqtcreatecw tool which is in $QTDIR/tools/designer/tools/tqtcreatecw. Using tqtcreatecw you can create custom widget description files for your custom widgets without the need to type in all the information manually. For more information about the README file in the tqtcreatecw directory</p> diff --git a/tools/designer/designer/designer_de.ts b/tools/designer/designer/designer_de.ts index 64f3cf3f5..f2c55cffd 100644 --- a/tools/designer/designer/designer_de.ts +++ b/tools/designer/designer/designer_de.ts @@ -424,7 +424,7 @@ so it is not possible to rename it to this name. <b>Load Descriptions</b><p>Loads a file which contains descriptions of custom widgets, so that these custom widgets can be used in the Qt Designer.</p> -<p>As it is a lot of work to type in all the information for custom widgets, you should check the tool createcw which you can find in $QTDIR/tools/designer/tools/createcw. Using that tool you can create custom widget description files for your custom widgets without the need of typing in all that information. For more information about that see the README file in that directory</p> +<p>As it is a lot of work to type in all the information for custom widgets, you should check the tool tqtcreatecw which you can find in $QTDIR/tools/designer/tools/tqtcreatecw. Using that tool you can create custom widget description files for your custom widgets without the need of typing in all that information. For more information about that see the README file in that directory</p> diff --git a/tools/designer/designer/designer_fr.ts b/tools/designer/designer/designer_fr.ts index 64f3cf3f5..f2c55cffd 100644 --- a/tools/designer/designer/designer_fr.ts +++ b/tools/designer/designer/designer_fr.ts @@ -424,7 +424,7 @@ so it is not possible to rename it to this name. <b>Load Descriptions</b><p>Loads a file which contains descriptions of custom widgets, so that these custom widgets can be used in the Qt Designer.</p> -<p>As it is a lot of work to type in all the information for custom widgets, you should check the tool createcw which you can find in $QTDIR/tools/designer/tools/createcw. Using that tool you can create custom widget description files for your custom widgets without the need of typing in all that information. For more information about that see the README file in that directory</p> +<p>As it is a lot of work to type in all the information for custom widgets, you should check the tool tqtcreatecw which you can find in $QTDIR/tools/designer/tools/tqtcreatecw. Using that tool you can create custom widget description files for your custom widgets without the need of typing in all that information. For more information about that see the README file in that directory</p> diff --git a/tools/designer/tools/conv2ui/conv2ui.pro b/tools/designer/tools/conv2ui/conv2ui.pro deleted file mode 100644 index 015ad94a3..000000000 --- a/tools/designer/tools/conv2ui/conv2ui.pro +++ /dev/null @@ -1,10 +0,0 @@ -###################################################################### -# Automatically generated by qmake (1.04a) Tue Oct 1 18:34:56 2002 -###################################################################### -TEMPLATE = app -CONFIG -= moc - -# Input -INCLUDEPATH += ../../interfaces -SOURCES += main.cpp -DESTDIR = $$QT_BUILD_TREE/bin diff --git a/tools/designer/tools/conv2ui/main.cpp b/tools/designer/tools/conv2ui/main.cpp deleted file mode 100644 index 31e561725..000000000 --- a/tools/designer/tools/conv2ui/main.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/********************************************************************** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of TQt GUI 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 -#include -#include -#include -#include -#include "filterinterface.h" -#include - -class Conv2ui { -public: - Conv2ui(); - ~Conv2ui(); - bool reinit(); - bool convert( const TQString & filename, const TQDir & dest ); - TQStringList featureList(); -private: - TQString getTag( const TQString & filename ); - TQString absName( const TQString & filename ); - TQPluginManager * importFiltersManager; -}; - -Conv2ui::Conv2ui() : importFiltersManager( 0 ) -{ - reinit(); -} - -Conv2ui::~Conv2ui() -{ - if ( importFiltersManager ) - delete importFiltersManager; -} - -bool Conv2ui::reinit() -{ - if ( importFiltersManager ) - delete importFiltersManager; - importFiltersManager = new TQPluginManager( IID_ImportFilter, - TQApplication::libraryPaths(), - "/designer"); - return !!importFiltersManager; -} - -bool Conv2ui::convert( const TQString & filename, const TQDir & dest ) -{ - if ( !importFiltersManager ) { - tqWarning( "Conv2ui: no TQPluginManager was found" ); - return FALSE; - } - - if ( !TQFile::exists( absName( filename ) ) ) { - tqWarning( "Conv2ui: can not find file %s", filename.latin1() ); - return FALSE; - } - - TQString tag = getTag( filename ); - TQStringList lst = importFiltersManager->featureList(); - - for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { - - ImportFilterInterface * interface = 0; - importFiltersManager->queryInterface( *it, &interface ); - - if ( !interface ) continue; - - if ( (*it).contains( tag, FALSE ) ) { - // Make sure we output the files in the destination dir - TQString absfile = absName( filename ); - TQString current = TQDir::currentDirPath(); - TQDir::setCurrent( dest.absPath() ); - interface->import( *it, absfile ); // resulting files go into the current dir - TQDir::setCurrent( current ); - } - - interface->release(); - - } - - return TRUE; -} - -TQStringList Conv2ui::featureList() -{ - if ( !importFiltersManager ) { - return 0; - } - return importFiltersManager->featureList(); -} - -TQString Conv2ui::getTag( const TQString & filename ) -{ - TQFileInfo info( filename ); - return info.extension(); -} - -TQString Conv2ui::absName( const TQString & filename ) -{ - TQString absFileName = TQDir::isRelativePath( filename ) ? - TQDir::currentDirPath() + - TQDir::separator() + - filename : - filename; - return absFileName; -} - -void printHelpMessage( TQStringList & formats ) -{ - printf( "Usage: conv2ui [options] \n\n" ); - printf( "Options:\n"); - printf( "\t-help\t\tDisplay this information\n" ); - printf( "\t-silent\t\tDon't write any messages\n"); - printf( "\t-version\tDisplay version of conv2ui\n"); - printf( "Supported file formats:\n" ); - for ( TQStringList::Iterator it = formats.begin(); it != formats.end(); ++it ) - printf( "\t%s\n", (*it).latin1() ); -} - -void printVersion() -{ - printf( "TQt user interface file converter for TQt version %s\n", TQT_VERSION_STR ); -} - -int main( int argc, char ** argv ) -{ - Conv2ui conv; - - bool help = TRUE; - bool silent = FALSE; - bool version = FALSE; - bool unrecognized = FALSE; - - // parse options - int argi = 1; - while ( argi < argc && argv[argi][0] == '-' ) { - int i = 1; - while ( argv[argi][i] != '\0' ) { - - if ( argv[argi][i] == 's' ) { - silent = TRUE; - break; - } else if ( argv[argi][i] == 'h' ) { - help = TRUE; - break; - } else if ( argv[argi][i] == 'v' ) { - version = TRUE; - silent = TRUE; - break; - } else { - unrecognized = TRUE; - } - i++; - } - argi++; - } - - // get source file - TQString src; - if ( argv[argi] ) { - src = argv[argi++]; - } - - // get destination directory - TQDir dst; - if ( argv[argi] ) { - dst.setPath( argv[argi++] ); - help = FALSE; - } - - if ( !silent ) { - printf( "TQt user interface file converter.\n" ); - if ( unrecognized ) { - printf( "conv2ui: Unrecognized option\n" ); - } - } - if ( version ) { - printVersion(); - return 0; - } else if ( help ) { - TQStringList formats = conv.featureList(); - printHelpMessage( formats ); - return 0; - } - - // do the magic - if ( conv.convert( src, dst ) ) - return 0; - return -1; -} diff --git a/tools/designer/tools/createcw/README b/tools/designer/tools/createcw/README deleted file mode 100644 index cc48234e1..000000000 --- a/tools/designer/tools/createcw/README +++ /dev/null @@ -1,18 +0,0 @@ -This small application makes it much easier to create custom widget -descriptions for Qt Designer. Using them you can use custom widgets -in Qt Designer including their signals, slots and properties. - -The usual way to do this is to enter all the information in the custom -widget dialog in Qt Designer for each widget. But this small tool can -create these description files for your custom widgets which you then -can simply import into Qt Designer. So you can use your custom widgets -without any additional work in your forms in Qt Designer. - -To do this you must modify the sourcecode (main.cpp) a bit and -recompile it afterwards. For further instructions how to use it see -the comments starting with STEP1 and STEP2 in main.cpp. - -Note that Qt Designer now supports widget plugins which are more -versatile and work just like built-in widgets, so you may prefer to -make your custom widgets into plugins. See the designer manual for -more information. diff --git a/tools/designer/tools/createcw/createcw.pro b/tools/designer/tools/createcw/createcw.pro deleted file mode 100644 index 415c0be76..000000000 --- a/tools/designer/tools/createcw/createcw.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app -CONFIG += qt warn_on release -HEADERS = -SOURCES = main.cpp -TARGET = createcw - -target.path = $$bins.path -INSTALLS += target diff --git a/tools/designer/tools/createcw/main.cpp b/tools/designer/tools/createcw/main.cpp deleted file mode 100644 index 50f8574de..000000000 --- a/tools/designer/tools/createcw/main.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/********************************************************************** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of TQt GUI 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 -#include -#include -#include -#include -#include - -// STEP1: Include header files of the widgets for which a description -// should be created here. If you have a widget which is defined in -// the file mycustomwidget.h in /home/joedeveloper/src, write here -// -// #include "/home/joedeveloper/src/mycustomwidget.h" -// -// Now go on to STEP2! - -// ----------------------------- - -struct Widget -{ - TQWidget *w; // the widget - TQString include; // header file - TQString location; // "global" for include <...> or "local" include "..." -}; - -static TQString makeIndent( int indent ) -{ - TQString s; - s.fill( ' ', indent * 4 ); - return s; -} - -static TQString entitize( const TQString &s ) -{ - TQString s2 = s; - s2 = s2.replace( "\"", """ ); - s2 = s2.replace( "&", "&" ); - s2 = s2.replace( ">", ">" ); - s2 = s2.replace( "<", "<" ); - s2 = s2.replace( "'", "'" ); - return s2; -} - -static TQString convert_type( const TQString &s ) -{ - TQString str( s ); - if (( str[ 0 ] == 'T' ) && ( str[ 1 ] == 'Q' )) - str.remove( 0, 2 ); - str[ 0 ] = str[ 0 ].upper(); - return str; -} - -static void createDescription( const TQValueList &l, TQTextStream &ts ) -{ - int indent = 0; - ts << "" << endl; - ts << makeIndent( indent ) << "" << endl; - indent++; - - for ( TQValueList::ConstIterator it = l.begin(); it != l.end(); ++it ) { - Widget w = *it; - ts << makeIndent( indent ) << "" << endl; - indent++; - ts << makeIndent( indent ) << "" << w.w->className() << "" << endl; - ts << makeIndent( indent ) << "
" << w.include << "
" << endl; - ts << makeIndent( indent ) << "" << endl; - indent++; - ts << makeIndent( indent ) << "" << w.w->sizeHint().width() << "" << endl; - ts << makeIndent( indent ) << "" << w.w->sizeHint().height() << "" << endl; - indent--; - ts << makeIndent( indent ) << "" << endl; - ts << makeIndent( indent ) << "" << ( w.w->inherits( "TQGroupBox" ) || w.w->inherits( "TQWidgetStack" ) ) << "" << endl; - ts << makeIndent( indent ) << "" << endl; - indent++; - ts << makeIndent( indent ) << "" << (int)w.w->sizePolicy().horData() << "" << endl; - ts << makeIndent( indent ) << "" << (int)w.w->sizePolicy().verData() << "" << endl; - indent--; - ts << makeIndent( indent ) << "" << endl; - - TQStrList sigs = w.w->metaObject()->signalNames( TRUE ); - if ( !sigs.isEmpty() ) { - for ( int i = 0; i < (int)sigs.count(); ++i ) - ts << makeIndent( indent ) << "" << entitize( sigs.at( i ) ) << "" << endl; - } - TQStrList slts = w.w->metaObject()->slotNames( TRUE ); - if ( !slts.isEmpty() ) { - for ( int i = 0; i < (int)slts.count(); ++i ) { - TQMetaData::Access data = w.w->metaObject()->slot( i, TRUE )->access; - if ( data == TQMetaData::Private ) - continue; - ts << makeIndent( indent ) << "" << entitize( slts.at( i ) ) << "" << endl; - } - } - TQStrList props = w.w->metaObject()->propertyNames( TRUE ); - if ( !props.isEmpty() ) { - for ( int i = 0; i < (int)props.count(); ++i ) { - const TQMetaProperty *p = w.w->metaObject()-> - property( w.w->metaObject()-> - findProperty( props.at( i ), TRUE ), TRUE ); - if ( !p ) - continue; - if ( !p->writable() || !p->designable( w.w ) ) - continue; - ts << makeIndent( indent ) << "type() ) << "\">" << entitize( p->name() ) << "" << endl; - } - } - indent--; - ts << makeIndent( indent ) << "
" << endl; - } - - indent--; - ts << makeIndent( indent ) << "
" << endl; - ts << "
" << endl; -} - -int main( int argc, char **argv ) -{ - if ( argc < 2 ) - return -1; - TQString fn = argv[1]; - TQFile f( fn ); - if ( !f.open( IO_WriteOnly ) ) - return -1; - TQTextStream ts( &f ); - TQApplication a( argc, argv ); - - TQValueList wl; - - // STEP2: Instantiate all widgets for which a description should - // be created here and add them to the list wl. If your custom widget - // is e.g. called MyCustomWidget you would write here - // - // Widget w; - // w.w = new MyCustomWidget( 0, 0 ); - // w.include = "mycustomwidget.h"; - // w.location = "global"; - // wl.append( w ); - // - // After that compile the program, link it with your custom widget - // (library or object file) and run it like this: - // (unix): ./createcw mywidgets.cw - // (win32): createcw mywidgets.cw - // - // After that you can import this description file into the TQt - // Designer using the Custom-Widget Dialog (See - // Tools->Custom->Edit Custom Widgets... in the TQt Designer) - // and use these custom widget there in your forms. - - - - // ---------------------------------------------- - - createDescription( wl, ts ); - f.close(); - return 0; -} diff --git a/tools/designer/tools/tqtconv2ui/main.cpp b/tools/designer/tools/tqtconv2ui/main.cpp new file mode 100644 index 000000000..208be173b --- /dev/null +++ b/tools/designer/tools/tqtconv2ui/main.cpp @@ -0,0 +1,220 @@ +/********************************************************************** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt GUI 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 +#include +#include +#include +#include +#include "filterinterface.h" +#include + +class Conv2ui { +public: + Conv2ui(); + ~Conv2ui(); + bool reinit(); + bool convert( const TQString & filename, const TQDir & dest ); + TQStringList featureList(); +private: + TQString getTag( const TQString & filename ); + TQString absName( const TQString & filename ); + TQPluginManager * importFiltersManager; +}; + +Conv2ui::Conv2ui() : importFiltersManager( 0 ) +{ + reinit(); +} + +Conv2ui::~Conv2ui() +{ + if ( importFiltersManager ) + delete importFiltersManager; +} + +bool Conv2ui::reinit() +{ + if ( importFiltersManager ) + delete importFiltersManager; + importFiltersManager = new TQPluginManager( IID_ImportFilter, + TQApplication::libraryPaths(), + "/designer"); + return !!importFiltersManager; +} + +bool Conv2ui::convert( const TQString & filename, const TQDir & dest ) +{ + if ( !importFiltersManager ) { + tqWarning( "Conv2ui: no TQPluginManager was found" ); + return FALSE; + } + + if ( !TQFile::exists( absName( filename ) ) ) { + tqWarning( "Conv2ui: can not find file %s", filename.latin1() ); + return FALSE; + } + + TQString tag = getTag( filename ); + TQStringList lst = importFiltersManager->featureList(); + + for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + + ImportFilterInterface * interface = 0; + importFiltersManager->queryInterface( *it, &interface ); + + if ( !interface ) continue; + + if ( (*it).contains( tag, FALSE ) ) { + // Make sure we output the files in the destination dir + TQString absfile = absName( filename ); + TQString current = TQDir::currentDirPath(); + TQDir::setCurrent( dest.absPath() ); + interface->import( *it, absfile ); // resulting files go into the current dir + TQDir::setCurrent( current ); + } + + interface->release(); + + } + + return TRUE; +} + +TQStringList Conv2ui::featureList() +{ + if ( !importFiltersManager ) { + return 0; + } + return importFiltersManager->featureList(); +} + +TQString Conv2ui::getTag( const TQString & filename ) +{ + TQFileInfo info( filename ); + return info.extension(); +} + +TQString Conv2ui::absName( const TQString & filename ) +{ + TQString absFileName = TQDir::isRelativePath( filename ) ? + TQDir::currentDirPath() + + TQDir::separator() + + filename : + filename; + return absFileName; +} + +void printHelpMessage( TQStringList & formats ) +{ + printf( "Usage: tqtconv2ui [options] \n\n" ); + printf( "Options:\n"); + printf( "\t-help\t\tDisplay this information\n" ); + printf( "\t-silent\t\tDon't write any messages\n"); + printf( "\t-version\tDisplay version of tqtconv2ui\n"); + printf( "Supported file formats:\n" ); + for ( TQStringList::Iterator it = formats.begin(); it != formats.end(); ++it ) + printf( "\t%s\n", (*it).latin1() ); +} + +void printVersion() +{ + printf( "TQt user interface file converter for TQt version %s\n", TQT_VERSION_STR ); +} + +int main( int argc, char ** argv ) +{ + Conv2ui conv; + + bool help = TRUE; + bool silent = FALSE; + bool version = FALSE; + bool unrecognized = FALSE; + + // parse options + int argi = 1; + while ( argi < argc && argv[argi][0] == '-' ) { + int i = 1; + while ( argv[argi][i] != '\0' ) { + + if ( argv[argi][i] == 's' ) { + silent = TRUE; + break; + } else if ( argv[argi][i] == 'h' ) { + help = TRUE; + break; + } else if ( argv[argi][i] == 'v' ) { + version = TRUE; + silent = TRUE; + break; + } else { + unrecognized = TRUE; + } + i++; + } + argi++; + } + + // get source file + TQString src; + if ( argv[argi] ) { + src = argv[argi++]; + } + + // get destination directory + TQDir dst; + if ( argv[argi] ) { + dst.setPath( argv[argi++] ); + help = FALSE; + } + + if ( !silent ) { + printf( "TQt user interface file converter.\n" ); + if ( unrecognized ) { + printf( "tqtconv2ui: Unrecognized option\n" ); + } + } + if ( version ) { + printVersion(); + return 0; + } else if ( help ) { + TQStringList formats = conv.featureList(); + printHelpMessage( formats ); + return 0; + } + + // do the magic + if ( conv.convert( src, dst ) ) + return 0; + return -1; +} diff --git a/tools/designer/tools/tqtconv2ui/tqtconv2ui.pro b/tools/designer/tools/tqtconv2ui/tqtconv2ui.pro new file mode 100644 index 000000000..015ad94a3 --- /dev/null +++ b/tools/designer/tools/tqtconv2ui/tqtconv2ui.pro @@ -0,0 +1,10 @@ +###################################################################### +# Automatically generated by qmake (1.04a) Tue Oct 1 18:34:56 2002 +###################################################################### +TEMPLATE = app +CONFIG -= moc + +# Input +INCLUDEPATH += ../../interfaces +SOURCES += main.cpp +DESTDIR = $$QT_BUILD_TREE/bin diff --git a/tools/designer/tools/tqtcreatecw/README b/tools/designer/tools/tqtcreatecw/README new file mode 100644 index 000000000..cc48234e1 --- /dev/null +++ b/tools/designer/tools/tqtcreatecw/README @@ -0,0 +1,18 @@ +This small application makes it much easier to create custom widget +descriptions for Qt Designer. Using them you can use custom widgets +in Qt Designer including their signals, slots and properties. + +The usual way to do this is to enter all the information in the custom +widget dialog in Qt Designer for each widget. But this small tool can +create these description files for your custom widgets which you then +can simply import into Qt Designer. So you can use your custom widgets +without any additional work in your forms in Qt Designer. + +To do this you must modify the sourcecode (main.cpp) a bit and +recompile it afterwards. For further instructions how to use it see +the comments starting with STEP1 and STEP2 in main.cpp. + +Note that Qt Designer now supports widget plugins which are more +versatile and work just like built-in widgets, so you may prefer to +make your custom widgets into plugins. See the designer manual for +more information. diff --git a/tools/designer/tools/tqtcreatecw/main.cpp b/tools/designer/tools/tqtcreatecw/main.cpp new file mode 100644 index 000000000..fcfa43168 --- /dev/null +++ b/tools/designer/tools/tqtcreatecw/main.cpp @@ -0,0 +1,190 @@ +/********************************************************************** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt GUI 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 +#include +#include +#include +#include +#include + +// STEP1: Include header files of the widgets for which a description +// should be created here. If you have a widget which is defined in +// the file mycustomwidget.h in /home/joedeveloper/src, write here +// +// #include "/home/joedeveloper/src/mycustomwidget.h" +// +// Now go on to STEP2! + +// ----------------------------- + +struct Widget +{ + TQWidget *w; // the widget + TQString include; // header file + TQString location; // "global" for include <...> or "local" include "..." +}; + +static TQString makeIndent( int indent ) +{ + TQString s; + s.fill( ' ', indent * 4 ); + return s; +} + +static TQString entitize( const TQString &s ) +{ + TQString s2 = s; + s2 = s2.replace( "\"", """ ); + s2 = s2.replace( "&", "&" ); + s2 = s2.replace( ">", ">" ); + s2 = s2.replace( "<", "<" ); + s2 = s2.replace( "'", "'" ); + return s2; +} + +static TQString convert_type( const TQString &s ) +{ + TQString str( s ); + if (( str[ 0 ] == 'T' ) && ( str[ 1 ] == 'Q' )) + str.remove( 0, 2 ); + str[ 0 ] = str[ 0 ].upper(); + return str; +} + +static void createDescription( const TQValueList &l, TQTextStream &ts ) +{ + int indent = 0; + ts << "" << endl; + ts << makeIndent( indent ) << "" << endl; + indent++; + + for ( TQValueList::ConstIterator it = l.begin(); it != l.end(); ++it ) { + Widget w = *it; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << w.w->className() << "" << endl; + ts << makeIndent( indent ) << "
" << w.include << "
" << endl; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << w.w->sizeHint().width() << "" << endl; + ts << makeIndent( indent ) << "" << w.w->sizeHint().height() << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + ts << makeIndent( indent ) << "" << ( w.w->inherits( "TQGroupBox" ) || w.w->inherits( "TQWidgetStack" ) ) << "" << endl; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << (int)w.w->sizePolicy().horData() << "" << endl; + ts << makeIndent( indent ) << "" << (int)w.w->sizePolicy().verData() << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + + TQStrList sigs = w.w->metaObject()->signalNames( TRUE ); + if ( !sigs.isEmpty() ) { + for ( int i = 0; i < (int)sigs.count(); ++i ) + ts << makeIndent( indent ) << "" << entitize( sigs.at( i ) ) << "" << endl; + } + TQStrList slts = w.w->metaObject()->slotNames( TRUE ); + if ( !slts.isEmpty() ) { + for ( int i = 0; i < (int)slts.count(); ++i ) { + TQMetaData::Access data = w.w->metaObject()->slot( i, TRUE )->access; + if ( data == TQMetaData::Private ) + continue; + ts << makeIndent( indent ) << "" << entitize( slts.at( i ) ) << "" << endl; + } + } + TQStrList props = w.w->metaObject()->propertyNames( TRUE ); + if ( !props.isEmpty() ) { + for ( int i = 0; i < (int)props.count(); ++i ) { + const TQMetaProperty *p = w.w->metaObject()-> + property( w.w->metaObject()-> + findProperty( props.at( i ), TRUE ), TRUE ); + if ( !p ) + continue; + if ( !p->writable() || !p->designable( w.w ) ) + continue; + ts << makeIndent( indent ) << "type() ) << "\">" << entitize( p->name() ) << "" << endl; + } + } + indent--; + ts << makeIndent( indent ) << "
" << endl; + } + + indent--; + ts << makeIndent( indent ) << "
" << endl; + ts << "
" << endl; +} + +int main( int argc, char **argv ) +{ + if ( argc < 2 ) + return -1; + TQString fn = argv[1]; + TQFile f( fn ); + if ( !f.open( IO_WriteOnly ) ) + return -1; + TQTextStream ts( &f ); + TQApplication a( argc, argv ); + + TQValueList wl; + + // STEP2: Instantiate all widgets for which a description should + // be created here and add them to the list wl. If your custom widget + // is e.g. called MyCustomWidget you would write here + // + // Widget w; + // w.w = new MyCustomWidget( 0, 0 ); + // w.include = "mycustomwidget.h"; + // w.location = "global"; + // wl.append( w ); + // + // After that compile the program, link it with your custom widget + // (library or object file) and run it like this: + // (unix): ./tqtcreatecw mywidgets.cw + // (win32): tqtcreatecw mywidgets.cw + // + // After that you can import this description file into the TQt + // Designer using the Custom-Widget Dialog (See + // Tools->Custom->Edit Custom Widgets... in the TQt Designer) + // and use these custom widget there in your forms. + + + + // ---------------------------------------------- + + createDescription( wl, ts ); + f.close(); + return 0; +} diff --git a/tools/designer/tools/tqtcreatecw/tqtcreatecw.pro b/tools/designer/tools/tqtcreatecw/tqtcreatecw.pro new file mode 100644 index 000000000..875a2e7b1 --- /dev/null +++ b/tools/designer/tools/tqtcreatecw/tqtcreatecw.pro @@ -0,0 +1,8 @@ +TEMPLATE = app +CONFIG += qt warn_on release +HEADERS = +SOURCES = main.cpp +TARGET = tqtcreatecw + +target.path = $$bins.path +INSTALLS += target -- cgit v1.2.1