OSDN Git Service

Use Open Project button in Getting Started mode
authorJens Bache-Wiig <jbache@trolltech.com>
Thu, 29 Apr 2010 17:07:13 +0000 (19:07 +0200)
committerJens Bache-Wiig <jbache@trolltech.com>
Thu, 29 Apr 2010 17:07:53 +0000 (19:07 +0200)
We already have it in the projects mode so we might as well
use the same in "Getting Started".

Reviewed-by: danimo
src/plugins/coreplugin/mainwindow.cpp
src/plugins/coreplugin/mainwindow.h
src/plugins/projectexplorer/projectwelcomepagewidget.cpp
src/plugins/projectexplorer/projectwelcomepagewidget.h
src/plugins/projectexplorer/projectwelcomepagewidget.ui
src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.ui

index 05f1891..c10f0da 100644 (file)
@@ -1283,6 +1283,18 @@ QPrinter *MainWindow::printer() const
     return m_printer;
 }
 
+void MainWindow::openProject()
+{
+    // ### We need a way to access the mimedatabase and differentiate
+    // between project types and other files. This is currently not possible
+    const QString filters = "All Files (*);;Projects(*.pro *.qmlproject)";
+    QString selectedFilters = "Projects(*.pro *.qmlproject)";
+    QStringList files =
+            Core::ICore::instance()->fileManager()->getOpenFileNames(
+                    filters, tr("Open Project"), &selectedFilters);
+    openFiles(files);
+}
+
 void MainWindow::setFullScreen(bool on)
 {
     if (bool(windowState() & Qt::WindowFullScreen) == on)
index 1c9b53e..2aecdef 100644 (file)
@@ -126,6 +126,7 @@ signals:
     void windowActivated();
 
 public slots:
+    void openProject();
     void newFile();
     void openFileWith();
     void exit();
index 44bd83d..2daca86 100644 (file)
@@ -91,7 +91,8 @@ ProjectWelcomePageWidget::ProjectWelcomePageWidget(QWidget *parent) :
     connect(ui->sessTreeWidget, SIGNAL(activated(QString)), SLOT(slotSessionClicked(QString)));
     connect(ui->projTreeWidget, SIGNAL(activated(QString)), SLOT(slotProjectClicked(QString)));
     connect(ui->createNewProjectButton, SIGNAL(clicked()), SLOT(slotCreateNewProject()));
-    connect(ui->openProjectButton, SIGNAL(clicked()), this, SLOT(slotOpenProject()));
+    connect(ui->openProjectButton, SIGNAL(clicked()),
+            Core::ICore::instance()->mainWindow(), SLOT(openProject()));
     connect(ui->manageSessionsButton, SIGNAL(clicked()), SIGNAL(manageSessions()));
 
     ui->createNewProjectButton->setIcon(
@@ -160,23 +161,6 @@ void ProjectWelcomePageWidget::activateEditMode()
         modeManager->activateMode(Core::Constants::MODE_EDIT);
 }
 
-void ProjectWelcomePageWidget::slotOpenProject()
-{
-    // ### We need a way to access the mimedatabase and differentiate
-    // between project types and other files. This is currently not possible
-
-    const QString filters = "All Files (*);;Projects(*.pro *.qmlproject)";
-    QString selectedFilters = "Projects(*.pro *.qmlproject)";
-    QStringList files =
-            Core::ICore::instance()->fileManager()->getOpenFileNames(
-                    filters, tr("Open Project"), &selectedFilters);
-
-    Core::Internal::MainWindow *mw = qobject_cast<Core::Internal::MainWindow*>
-                                     (Core::ICore::instance()->mainWindow());
-    Q_ASSERT(mw);
-    mw->openFiles(files);
-}
-
 void ProjectWelcomePageWidget::slotSessionClicked(const QString &data)
 {
     emit requestSession(data);
index c49904d..67e4d08 100644 (file)
@@ -69,7 +69,6 @@ private slots:
     void slotSessionClicked(const QString &data);
     void slotProjectClicked(const QString &data);
     void slotCreateNewProject();
-    void slotOpenProject();
 
 private:
     void activateEditMode();
index 33c956a..f13cfd6 100644 (file)
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>486</width>
+    <width>520</width>
     <height>221</height>
    </rect>
   </property>
           <property name="text">
            <string>Create Project...</string>
           </property>
-          <property name="icon">
-           <iconset resource="../coreplugin/core.qrc">
-            <normaloff>:/core/images/filenew.png</normaloff>:/core/images/filenew.png</iconset>
-          </property>
           <property name="flat">
            <bool>false</bool>
           </property>
    <header location="global">utils/welcomemodetreewidget.h</header>
   </customwidget>
  </customwidgets>
- <resources>
-  <include location="../coreplugin/core.qrc"/>
- </resources>
+ <resources/>
  <connections/>
 </ui>
index 62d2627..b0c2f56 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <coreplugin/icore.h>
 #include <coreplugin/coreconstants.h>
+#include <coreplugin/mainwindow.h>
 
 #include <utils/pathchooser.h>
 
@@ -86,10 +87,13 @@ GettingStartedWelcomePageWidget::GettingStartedWelcomePageWidget(QWidget *parent
 
     connect(ui->nextTipBtn, SIGNAL(clicked()), this, SLOT(slotNextTip()));
     connect(ui->prevTipBtn, SIGNAL(clicked()), this, SLOT(slotPrevTip()));
+    connect(ui->openProjectButton, SIGNAL(clicked()), Core::ICore::instance()->mainWindow(), SLOT(openProject()));
     connect(ui->createNewProjectButton, SIGNAL(clicked()), this, SLOT(slotCreateNewProject()));
 
     ui->createNewProjectButton->setIcon(
             QIcon::fromTheme("document-new", ui->createNewProjectButton->icon()));
+    ui->openProjectButton->setIcon(
+            QIcon::fromTheme("document-open", ui->openProjectButton->icon()));
 }
 
 GettingStartedWelcomePageWidget::~GettingStartedWelcomePageWidget()
index 6a2155d..9f03d49 100644 (file)
@@ -61,7 +61,9 @@
           </widget>
          </item>
          <item row="1" column="0">
-          <widget class="Utils::WelcomeModeTreeWidget" name="tutorialTreeWidget" native="true"/>
+          <widget class="Utils::WelcomeModeTreeWidget" name="tutorialTreeWidget" native="true">
+           <zorder></zorder>
+          </widget>
          </item>
         </layout>
        </widget>
          </spacer>
         </item>
         <item>
+         <widget class="QPushButton" name="openProjectButton">
+          <property name="minimumSize">
+           <size>
+            <width>160</width>
+            <height>36</height>
+           </size>
+          </property>
+          <property name="text">
+           <string>Open Project...</string>
+          </property>
+         </widget>
+        </item>
+        <item>
          <widget class="QPushButton" name="createNewProjectButton">
           <property name="minimumSize">
            <size>
           <property name="text">
            <string>Create Project...</string>
           </property>
-          <property name="icon">
-           <iconset resource="../coreplugin/core.qrc">
-            <normaloff>:/core/images/filenew.png</normaloff>:/core/images/filenew.png</iconset>
-          </property>
           <property name="flat">
            <bool>false</bool>
           </property>
   </customwidget>
  </customwidgets>
  <resources>
-  <include location="../coreplugin/core.qrc"/>
   <include location="../welcome/welcome.qrc"/>
  </resources>
  <connections/>