SVN commit 620704 by apaku: Improve the plugin-paths configuration for Qt4 designer. Now we don't use some obscure "prefix", but only provide the ability to set the plugin path for Qt4 designer. M +17 -6 languages/cpp/ccconfigwidget.cpp M +2 -0 languages/cpp/ccconfigwidget.h M +20 -38 languages/cpp/ccconfigwidgetbase.ui M +4 -4 languages/cpp/qtbuildconfig.cpp M +4 -3 languages/cpp/qtbuildconfig.h M +11 -3 src/partcontroller.cpp [POSSIBLY UNSAFE: KRun::runCommand] --- branches/kdevelop/3.4/languages/cpp/ccconfigwidget.cpp #620703:620704 @@ -22,6 +22,7 @@ #include #include #include +#include // kde includes #include @@ -32,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -61,6 +63,17 @@ CCConfigWidget::CCConfigWidget( CppSupportPart* part, QWidget* parent, const char* name ) : CCConfigWidgetBase( parent, name ) { + KURLRequester * req = new KURLRequester( this ); + req->setMode( KFile::Directory ); + KEditListBox::CustomEditor pCustomEditor; + pCustomEditor = req->customEditor(); + m_designerPluginPaths = new KEditListBox( i18n( "Qt4 Designer Plugin Paths" ), pCustomEditor, m_designerBox ); + + m_designerBox->layout()->add( m_designerPluginPaths ); + m_designerPluginPaths->show(); + + connect( m_versionQt4, SIGNAL( toggled( bool ) ), m_designerPluginPaths, SLOT( setEnabled( bool ) ) ); + m_pPart = part; connect( m_pPart->codeRepository(), SIGNAL( catalogRegistered( Catalog* ) ), this, SLOT( catalogRegistered( Catalog* ) ) ); @@ -408,7 +421,7 @@ m_kdevexternal->setEnabled( false ); m_qtStyleVersion4->setEnabled( true ); m_designerPath->setEnabled( true ); - m_designerPrefix->setEnabled( true ); + m_designerPluginPaths->setEnabled( true ); m_qmakePath->setEnabled( true ); m_qtDir->setEnabled( false ); m_txtQtDir->setEnabled( false ); @@ -421,7 +434,7 @@ m_kdevexternal->setEnabled( true ); m_qtStyleVersion4->setEnabled( false ); m_designerPath->setEnabled( true ); - m_designerPrefix->setEnabled( false ); + m_designerPluginPaths->setEnabled( false ); m_qmakePath->setEnabled( true ); m_qtDir->setEnabled( true ); m_txtQtDir->setEnabled( true ); @@ -450,7 +463,7 @@ }else { m_qtdesigner->setChecked( true ); - m_designerPrefix->setText( c->designerPrefix() ); + m_designerPluginPaths->insertStringList( c->designerPluginPaths() ); } } @@ -506,7 +519,7 @@ c->setRoot( m_qtDir->url() ); c->setQMakePath( m_qmakePath->url() ); c->setDesignerPath( m_designerPath->url() ); - c->setDesignerPrefix( m_designerPrefix->text() ); + c->setDesignerPluginPaths( m_designerPluginPaths->items() ); if( m_kdevembedded->isChecked() ) { c->setDesignerIntegration( "EmbeddedKDevDesigner" ); @@ -543,7 +556,6 @@ m_qtStyleVersion3->setChecked( true ); m_kdevembedded->setEnabled( true ); m_kdevexternal->setEnabled( true ); - m_designerPrefix->setEnabled( false ); } if ( m_versionQt4->isChecked() ) { @@ -551,7 +563,6 @@ m_qtdesigner->setChecked( true ); m_kdevembedded->setEnabled( false ); m_kdevexternal->setEnabled( false ); - m_designerPrefix->setEnabled( true ); } isValidQtDir( m_qtDir->url() ); isQMakeExecutable( m_qmakePath->url() ); --- branches/kdevelop/3.4/languages/cpp/ccconfigwidget.h #620703:620704 @@ -18,6 +18,7 @@ class CppSupportPart; class Catalog; class QCheckListItem; +class KEditListBox; class CCConfigWidget : public CCConfigWidgetBase { @@ -64,6 +65,7 @@ private: CppSupportPart* m_pPart; QMap m_catalogs; + KEditListBox* m_designerPluginPaths; }; #endif --- branches/kdevelop/3.4/languages/cpp/ccconfigwidgetbase.ui #620703:620704 @@ -8,18 +8,18 @@ 0 0 - 544 - 659 + 608 + 815 C++ Options - + unnamed - + cpp_options @@ -1465,39 +1465,16 @@ - + - layout10 + textLabel1_4 - - - unnamed - - - - textLabel1_4 - - - Prefix to Designer - - - m_designerPrefix - - - - - m_designerPrefix - - - Prefix the call for external designer with this - - - Anything written here will be put in front of the designer executable when running the external Qt designer. This can be useful to set Environment variables for running the Qt4 designer so it picks up KDE4 widgets. -Example: -QT_PLUGIN_PATH=/where/kde4/is/lib/kde4/plugins - - - + + Extra Plugin Paths for Qt4 Designer: + + + m_designerPrefix + @@ -1514,14 +1491,14 @@ 20 - 270 + 70 - + @@ -1724,6 +1701,12 @@ CCConfigWidgetBase isDesignerExecutable(const QString&) + + m_versionQt4 + toggled(bool) + textLabel1_4 + setEnabled(bool) + cpp_options @@ -1786,6 +1769,5 @@ kurlrequester.h klineedit.h kpushbutton.h - klineedit.h --- branches/kdevelop/3.4/languages/cpp/qtbuildconfig.cpp #620703:620704 @@ -53,7 +53,7 @@ m_root = DomUtil::readEntry( *m_dom, m_configRoot + "/root", "" ); m_qmakePath = DomUtil::readEntry(*m_dom, m_configRoot + "/qmake", ""); m_designerPath = DomUtil::readEntry(*m_dom, m_configRoot + "/designer", ""); - m_designerPrefix = DomUtil::readEntry(*m_dom, m_configRoot + "/designerprefix", ""); + m_designerPluginPaths = DomUtil::readListEntry(*m_dom, m_configRoot + "/designerpluginpaths", "path" ); if( m_root.isEmpty() || !isValidQtDir( m_root ) ) { @@ -167,7 +167,7 @@ DomUtil::writeEntry( *m_dom, m_configRoot + "/designerintegration", m_designerIntegration ); DomUtil::writeEntry(*m_dom, m_configRoot + "/qmake", m_qmakePath ); DomUtil::writeEntry(*m_dom, m_configRoot + "/designer", m_designerPath ); - DomUtil::writeEntry(*m_dom, m_configRoot + "/designerprefix", m_designerPrefix ); + DomUtil::writeListEntry(*m_dom, m_configRoot + "/designerpluginpaths", "path", m_designerPluginPaths ); emit stored(); } @@ -197,9 +197,9 @@ m_qmakePath = path; } -void QtBuildConfig::setDesignerPrefix( const QString& pfx ) +void QtBuildConfig::setDesignerPluginPaths( const QStringList& pfx ) { - m_designerPrefix = pfx; + m_designerPluginPaths = pfx; } void QtBuildConfig::setDesignerPath( const QString& path ) --- branches/kdevelop/3.4/languages/cpp/qtbuildconfig.h #620703:620704 @@ -19,6 +19,7 @@ #define QTBUILDCONFIG_H #include +#include class CppSupportPart; class QDomDocument; @@ -42,7 +43,7 @@ inline const QString& root() const { return m_root; } inline const QString& qmakePath() const { return m_qmakePath; } inline const QString& designerPath() const { return m_designerPath; } - inline const QString& designerPrefix() const { return m_designerPrefix; } + inline const QStringList& designerPluginPaths() const { return m_designerPluginPaths; } inline const QString& designerIntegration() const { return m_designerIntegration; } void setUsed( bool used ); @@ -50,7 +51,7 @@ void setIncludeStyle( int style ); void setRoot( const QString& root ); void setDesignerPath( const QString& path ); - void setDesignerPrefix( const QString& pfx ); + void setDesignerPluginPaths( const QStringList& pfx ); void setQMakePath( const QString& path ); void setDesignerIntegration( const QString& designerIntegration ); void init(); @@ -78,7 +79,7 @@ QString m_root; ///< The root directory of the used qt installation for Qt3 QString m_designerPath; ///< The path including the binary name of Qt Designer QString m_qmakePath; ///< The path including the binary name of QMake - QString m_designerPrefix; ///< The Prefix for Designer + QStringList m_designerPluginPaths; ///< The Prefix for Designer QString m_designerIntegration; ///< The type of designer used, kdevdesigner or qt designer static const QString m_configRoot; ///< The root path of the configuration --- branches/kdevelop/3.4/src/partcontroller.cpp #620703:620704 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -387,7 +388,7 @@ { QString DesignerSetting = config->readEntry( "DesignerSetting", "ExternalDesigner" ); QString designerExec = "designer"; - QString designerPrefix = ""; + QStringList designerPluginPaths; QDomDocument* dom = API::getInstance()->projectDom(); if ( dom != 0 ) { @@ -395,11 +396,13 @@ // has no setting or no project is open. However for Qt4 // projects we want to use ExternalDesigner in any case. if ( DomUtil::readIntEntry( *dom, "/kdevcppsupport/qt/version", 3 ) == 4 ) + { + designerPluginPaths = DomUtil::readListEntry(*dom, "/kdevcppsupport/qt/designerpluginpaths", "path" ); DesignerSetting = "ExternalDesigner"; + } DesignerSetting = DomUtil::readEntry(*dom, "/kdevcppsupport/qt/designerintegration", DesignerSetting ); designerExec = DomUtil::readEntry(*dom, "/kdevcppsupport/qt/designer", designerExec ); - designerPrefix = DomUtil::readEntry(*dom, "/kdevcppsupport/qt/designerprefix", designerPrefix ); } if ( DesignerSetting == "ExternalKDevDesigner" ) { @@ -425,7 +428,12 @@ return; } } - KRun::runCommand( designerPrefix+" "+designerExec+" "+url.pathOrURL() ); + KMessageBox::warningYesNo(0, "QT_PLUGIN_PATH=\""+designerPluginPaths.join(":")+"\" "+designerExec, designerPluginPaths.join(" ") ); + if( designerPluginPaths.isEmpty() ) + KRun::runCommand( designerExec+" "+url.pathOrURL() ); + else + KRun::runCommand( "QT_PLUGIN_PATH=\""+designerPluginPaths.join(":")+"\" "+designerExec+" "+url.pathOrURL() ); + return; }