kdewidgets: adjust to Katie changes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-10-28 19:59:11 +03:00
parent 304482299e
commit cb621f540d
2 changed files with 14 additions and 16 deletions

View file

@ -27,7 +27,7 @@ install(
########### next target ############### ########### next target ###############
if(QT_QTDESIGNER_FOUND) if(QT_QTUITOOLS_FOUND)
kde4_add_widget(kdewidgets_SRCS kde.widgets) kde4_add_widget(kdewidgets_SRCS kde.widgets)
kde4_add_plugin(kdewidgets ${kdewidgets_SRCS}) kde4_add_plugin(kdewidgets ${kdewidgets_SRCS})
@ -38,5 +38,5 @@ if(QT_QTDESIGNER_FOUND)
TARGETS kdewidgets TARGETS kdewidgets
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}/plugins/designer DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}/plugins/designer
) )
endif(QT_QTDESIGNER_FOUND) endif(QT_QTUITOOLS_FOUND)

View file

@ -23,27 +23,25 @@ static const char classHeader[] = "/**\n"
"* input file.\n" "* input file.\n"
"*/\n" "*/\n"
"#include <QtGui/qicon.h>\n" "#include <QtGui/qicon.h>\n"
"#include <QtDesigner/container.h>\n" "#include <QtUiTools/customwidget.h>\n"
"#include <QtDesigner/customwidget.h>\n"
"#include <QtCore/qplugin.h>\n" "#include <QtCore/qplugin.h>\n"
"#include <QtCore/qdebug.h>\n"; "#include <QtCore/qdebug.h>\n";
static const char collClassDef[] = "class %CollName : public QObject, public QDesignerCustomWidgetCollectionInterface\n" static const char collClassDef[] = "class %CollName : public QCustomWidgetPlugin\n"
"{\n" "{\n"
" Q_OBJECT\n" " Q_OBJECT\n"
" Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)\n"
"public:\n" "public:\n"
" %CollName(QObject *parent = 0);\n" " %CollName(QObject *parent = 0);\n"
" virtual ~%CollName();\n" " virtual ~%CollName();\n"
" QList<QDesignerCustomWidgetInterface*> customWidgets() const { return m_plugins; } \n" " QList<QCustomWidget*> customWidgets() const { return m_plugins; } \n"
" \n" " \n"
"private:\n" "private:\n"
" QList<QDesignerCustomWidgetInterface*> m_plugins;\n" " QList<QCustomWidget*> m_plugins;\n"
"};\n\n" "};\n\n"
"Q_EXPORT_PLUGIN2(%CollName, %CollName)\n\n"; "Q_EXPORT_PLUGIN2(%CollName, %CollName)\n\n";
static const char collClassImpl[] = "%CollName::%CollName(QObject *parent)\n" static const char collClassImpl[] = "%CollName::%CollName(QObject *parent)\n"
" : QObject(parent)" " : QCustomWidgetPlugin(parent)"
"{\n" "{\n"
" %CollInit\n" " %CollInit\n"
" (void) new KComponentData(\"%CollName\");\n" " (void) new KComponentData(\"%CollName\");\n"
@ -56,12 +54,11 @@ static const char collClassImpl[] = "%CollName::%CollName(QObject *parent)\n"
"}\n"; "}\n";
static const char classDef[] = "class %PluginName : public QObject, public QDesignerCustomWidgetInterface\n" static const char classDef[] = "class %PluginName : public QCustomWidget\n"
"{\n" "{\n"
" Q_OBJECT\n" " Q_OBJECT\n"
" Q_INTERFACES(QDesignerCustomWidgetInterface)\n"
"public:\n" "public:\n"
" %PluginName(QObject *parent = 0) :\n\t\tQObject(parent), mInitialized(false) {}\n" " %PluginName(QObject *parent = 0) :\n\t\tQCustomWidget(parent), mInitialized(false) {}\n"
" virtual ~%PluginName() {}\n" " virtual ~%PluginName() {}\n"
" \n" " \n"
" bool isContainer() const { return %IsContainer; }\n" " bool isContainer() const { return %IsContainer; }\n"
@ -75,7 +72,7 @@ static const char classDef[] = "class %PluginName : public QObject, public QDes
" QString toolTip() const { return QLatin1String(\"%ToolTip\"); }\n" " QString toolTip() const { return QLatin1String(\"%ToolTip\"); }\n"
" QString whatsThis() const { return QLatin1String(\"%WhatsThis\"); }\n\n" " QString whatsThis() const { return QLatin1String(\"%WhatsThis\"); }\n\n"
" QWidget* createWidget( QWidget* parent ) \n\t{%CreateWidget\n\t}\n" " QWidget* createWidget( QWidget* parent ) \n\t{%CreateWidget\n\t}\n"
" void initialize(QDesignerFormEditorInterface *core) \n\t{%Initialize\n\t}\n" " void initialize() \n\t{%Initialize\n\t}\n"
"\n" "\n"
"private:\n" "private:\n"
" bool mInitialized;\n" " bool mInitialized;\n"
@ -91,7 +88,7 @@ int main( int argc, char **argv ) {
new KComponentData( "makekdewidgets" ); new KComponentData( "makekdewidgets" );
KLocalizedString description = ki18n( "Builds Qt widget plugins from an ini style description file." ); KLocalizedString description = ki18n( "Builds Qt widget plugins from an ini style description file." );
const char version[] = "0.4"; const char version[] = "0.5";
KCmdLineOptions options; KCmdLineOptions options;
options.add("+file", ki18n( "Input file" ) ); options.add("+file", ki18n( "Input file" ) );
@ -103,6 +100,7 @@ int main( int argc, char **argv ) {
KAboutData about( "makekdewidgets", 0, ki18n( "makekdewidgets" ), version, description, KAboutData::License_GPL, ki18n("(C) 2004-2005 Ian Reinhart Geiser"), KLocalizedString(), 0, "geiseri@kde.org" ); KAboutData about( "makekdewidgets", 0, ki18n( "makekdewidgets" ), version, description, KAboutData::License_GPL, ki18n("(C) 2004-2005 Ian Reinhart Geiser"), KLocalizedString(), 0, "geiseri@kde.org" );
about.addAuthor( ki18n("Ian Reinhart Geiser"), KLocalizedString(), "geiseri@kde.org" ); about.addAuthor( ki18n("Ian Reinhart Geiser"), KLocalizedString(), "geiseri@kde.org" );
about.addAuthor( ki18n("Daniel Molkentin"), KLocalizedString(), "molkentin@kde.org" ); about.addAuthor( ki18n("Daniel Molkentin"), KLocalizedString(), "molkentin@kde.org" );
about.addAuthor( ki18n("Ivalo Monev"), KLocalizedString(), "xakepa10@gmail.com" );
KCmdLineArgs::init( argc, argv, &about ); KCmdLineArgs::init( argc, argv, &about );
KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs::addCmdLineOptions( options );
KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
@ -207,7 +205,7 @@ QString buildWidgetClass( const QString &name, KConfig &_input, const QString &g
QString domXml = input.readEntry("DomXML", QString()); QString domXml = input.readEntry("DomXML", QString());
// If domXml is empty then we shoud call base class function // If domXml is empty then we shoud call base class function
if ( domXml.isEmpty() ) { if ( domXml.isEmpty() ) {
domXml = QLatin1String("QDesignerCustomWidgetInterface::domXml()"); domXml = QLatin1String("QCustomWidget::domXml()");
} }
else { else {
// Wrap domXml value into QLatin1String // Wrap domXml value into QLatin1String
@ -219,7 +217,7 @@ QString buildWidgetClass( const QString &name, KConfig &_input, const QString &g
QString( "\n\t\treturn new %1%2;" ) QString( "\n\t\treturn new %1%2;" )
.arg( input.readEntry( "ImplClass", name ) ) .arg( input.readEntry( "ImplClass", name ) )
.arg( input.readEntry( "ConstructorArgs", "( parent )" ) ) ) ); .arg( input.readEntry( "ConstructorArgs", "( parent )" ) ) ) );
defMap.insert( "Initialize", input.readEntry( "Initialize", "\n\t\tQ_UNUSED(core);\n\t\tif (mInitialized) return;\n\t\tmInitialized=true;" ) ); defMap.insert( "Initialize", input.readEntry( "Initialize", "\n\t\tif (mInitialized) return;\n\t\tmInitialized=true;" ) );
return KMacroExpander::expandMacros( classDef, defMap ); return KMacroExpander::expandMacros( classDef, defMap );
} }