OSDN Git Service

Adding qt plugin support to Symbian's library wizard.
authorPawel Polanski <pawel.3.polanski@nokia.com>
Tue, 4 Jan 2011 16:06:42 +0000 (17:06 +0100)
committerPawel Polanski <pawel.3.polanski@nokia.com>
Wed, 5 Jan 2011 14:43:26 +0000 (15:43 +0100)
Task-number: QTCREATORBUG-3436
Reviewed-by: Tobias Hunger
src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp
src/plugins/qt4projectmanager/wizards/mobileappwizardsymbianoptionspage.ui
src/plugins/qt4projectmanager/wizards/mobilelibraryparameters.cpp
src/plugins/qt4projectmanager/wizards/mobilelibraryparameters.h
src/plugins/qt4projectmanager/wizards/mobilelibrarywizardoptionpage.cpp
src/plugins/qt4projectmanager/wizards/mobilelibrarywizardoptionpage.h
src/plugins/qt4projectmanager/wizards/mobilelibrarywizardoptionpage.ui

index 12605ef..c6f21a2 100644 (file)
@@ -43,6 +43,7 @@
 #include <utils/projectintropage.h>
 
 #include <QtCore/QDebug>
+#include <QtCore/QDir>
 
 #include <QtGui/QComboBox>
 #include <QtGui/QLabel>
@@ -244,7 +245,9 @@ int LibraryWizardDialog::nextId() const
 
             // If there was no Symbian target defined we omit "Symbian specific" step
             // We also omit this step if the library type is not dll
-            if (symbianTargetEnabled && type() == QtProjectParameters::SharedLibrary)
+            if (symbianTargetEnabled
+                    && (type() == QtProjectParameters::SharedLibrary
+                        || type() == QtProjectParameters::Qt4Plugin))
                 next = m_mobilePageId;
 
             if (next == m_modulesPageId)
@@ -353,6 +356,9 @@ void LibraryWizardDialog::setupFilesPage()
 void LibraryWizardDialog::setupMobilePage()
 {
     m_mobilePage->setSymbianUid(AbstractMobileApp::symbianUidForPath(path()+projectName()));
+
+    if (type() == QtProjectParameters::Qt4Plugin)
+        m_mobilePage->setQtPluginDirectory(projectName());
     m_mobilePage->setLibraryType(type());
 }
 
@@ -381,6 +387,7 @@ MobileLibraryParameters LibraryWizardDialog::mobileLibraryParameters() const
 
     if (mlp.type & MobileLibraryParameters::Symbian) {
         mlp.symbianUid = m_mobilePage->symbianUid();
+        mlp.qtPluginDirectory = m_mobilePage->qtPluginDirectory();
         mlp.symbianCapabilities |= m_mobilePage->networkEnabled()?MobileLibraryParameters::NetworkServices:0;
     }
 
index 48919f8..a4dfcb7 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>315</width>
+    <height>116</height>
    </rect>
   </property>
   <property name="windowTitle">
index 9cd1778..17b0b8c 100644 (file)
@@ -35,6 +35,7 @@
 #include "qtprojectparameters.h"
 
 #include <QtCore/QTextStream>
+#include <QtCore/QDir>
 
 namespace Qt4ProjectManager {
 namespace Internal {
@@ -94,19 +95,31 @@ void MobileLibraryParameters::writeProFile(QTextStream &str) const
 
 void MobileLibraryParameters::writeSymbianProFile(QTextStream &str) const
 {
-    if (libraryType != QtProjectParameters::SharedLibrary)
-        return; //nothing to do when the library is not a shared library
-
-    str << "\n"
-           "symbian {\n"
-           "    MMP_RULES += EXPORTUNFROZEN\n"
-           "    TARGET.UID3 = " + symbianUid + "\n"
-           "    TARGET.CAPABILITY = " + generateCapabilitySet(symbianCapabilities).toAscii() + "\n"
-           "    TARGET.EPOCALLOWDLLDATA = 1\n"
-           "    addFiles.sources = " + fileName + ".dll\n"
-           "    addFiles.path = !:/sys/bin\n"
-           "    DEPLOYMENT += addFiles\n"
-           "}\n";
+    if (libraryType == QtProjectParameters::SharedLibrary) {
+        str << "\n"
+               "symbian {\n"
+               "    MMP_RULES += EXPORTUNFROZEN\n"
+               "    TARGET.UID3 = " + symbianUid + "\n"
+               "    TARGET.CAPABILITY = " + generateCapabilitySet(symbianCapabilities).toAscii() + "\n"
+               "    TARGET.EPOCALLOWDLLDATA = 1\n"
+               "    addFiles.sources = " + fileName + ".dll\n"
+               "    addFiles.path = !:/sys/bin\n"
+               "    DEPLOYMENT += addFiles\n"
+               "}\n";
+    } else if (libraryType == QtProjectParameters::Qt4Plugin) {
+        str << "\n"
+               "symbian {\n"
+               "# Load predefined include paths (e.g. QT_PLUGINS_BASE_DIR) to be used in the pro-files\n"
+               "    load(data_caging_paths)\n"
+               "    MMP_RULES += EXPORTUNFROZEN\n"
+               "    TARGET.UID3 = " + symbianUid + "\n"
+               "    TARGET.CAPABILITY = " + generateCapabilitySet(symbianCapabilities).toAscii() + "\n"
+               "    TARGET.EPOCALLOWDLLDATA = 1\n"
+               "    pluginDeploy.sources = " + fileName + ".dll\n"
+               "    pluginDeploy.path = $$QT_PLUGINS_BASE_DIR/" + QDir::fromNativeSeparators(qtPluginDirectory) + "\n"
+               "    DEPLOYMENT += pluginDeploy\n"
+               "}\n";
+    }
 }
 
 void MobileLibraryParameters::writeMaemoProFile(QTextStream &str) const
index 86ebf0d..7f31c05 100644 (file)
@@ -84,6 +84,7 @@ public:
     QString fileName;
 
     QString symbianUid;
+    QString qtPluginDirectory;
     uint symbianCapabilities;
 };
 
index cbdc7e9..025df87 100644 (file)
@@ -84,9 +84,27 @@ bool MobileLibraryWizardOptionPage::networkEnabled() const
     return m_d->ui.symbianEnableNetworkCheckBox->isChecked();
 }
 
+QString MobileLibraryWizardOptionPage::qtPluginDirectory() const
+{
+    return m_d->ui.qtPluginLocationLineEdit->text();
+}
+
+void MobileLibraryWizardOptionPage::setQtPluginDirectory(const QString &directory)
+{
+    m_d->ui.qtPluginLocationLineEdit->setText(directory);
+}
+
 void MobileLibraryWizardOptionPage::setLibraryType(int type)
 {
     m_d->libraryType = static_cast<QtProjectParameters::Type>(type);
+
+    if (type != QtProjectParameters::Qt4Plugin) {
+        m_d->ui.qtPluginLocationLineEdit->setVisible(false);
+        m_d->ui.qtPluginLocationLabel->setVisible(false);
+        m_d->ui.formLayout_2->removeItem(m_d->ui.horizontalLayout_2);
+        delete m_d->ui.horizontalLayout_2;
+        m_d->ui.horizontalLayout_2 = 0;
+    }
 }
 
 } // namespace Internal
index 3315da0..414f04f 100644 (file)
@@ -52,6 +52,8 @@ public:
     QString symbianUid() const;
     void setNetworkEnabled(bool enableIt);
     bool networkEnabled() const;
+    QString qtPluginDirectory() const;
+    void setQtPluginDirectory(const QString &directory);
     void setLibraryType(int type);
 
 private:
index 6b49cd1..c42815f 100644 (file)
@@ -7,13 +7,13 @@
     <x>0</x>
     <y>0</y>
     <width>404</width>
-    <height>548</height>
+    <height>130</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>WizardPage</string>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
+  <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
     <widget class="QFrame" name="frame">
      <property name="frameShape">
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
-     <layout class="QHBoxLayout" name="horizontalLayout">
+     <layout class="QVBoxLayout" name="verticalLayout_4">
       <item>
-       <layout class="QFormLayout" name="formLayout">
-        <item row="1" column="0">
-         <widget class="QCheckBox" name="symbianEnableNetworkCheckBox">
-          <property name="text">
-           <string>Enable network access</string>
-          </property>
-         </widget>
-        </item>
+       <layout class="QFormLayout" name="formLayout_2">
         <item row="0" column="0">
          <widget class="QLabel" name="symbianTargetUid3Label">
           <property name="sizePolicy">
@@ -54,7 +47,7 @@
            <widget class="QLineEdit" name="symbianTargetUid3LineEdit"/>
           </item>
           <item>
-           <spacer name="horizontalSpacer_2">
+           <spacer name="horizontalSpacer">
             <property name="orientation">
              <enum>Qt::Horizontal</enum>
             </property>
           </item>
          </layout>
         </item>
+        <item row="1" column="0">
+         <widget class="QLabel" name="qtPluginLocationLabel">
+          <property name="text">
+           <string>Plugin's directory name:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <layout class="QHBoxLayout" name="horizontalLayout_7">
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout_2">
+            <item>
+             <widget class="QLineEdit" name="qtPluginLocationLineEdit"/>
+            </item>
+            <item>
+             <spacer name="horizontalSpacer_2">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>40</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </item>
+        <item row="2" column="0">
+         <widget class="QCheckBox" name="symbianEnableNetworkCheckBox">
+          <property name="text">
+           <string>Enable network access</string>
+          </property>
+         </widget>
+        </item>
        </layout>
       </item>
      </layout>
     </widget>
    </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <resources/>