forked from qt-creator/qt-creator
Add "Open Project" to welcome page
By popular request I added a "open project" option. We don't currently have a way of differentiating project types from other files so I had to hardcode .pro and .qmlproject for now. Themed icons was also added to the new and open buttons. Reviewed-by: danimo Task-number: QTCREATORBUG-1142
This commit is contained in:
@@ -35,6 +35,8 @@
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/dialogs/iwizard.h>
|
||||
#include <coreplugin/mainwindow.h>
|
||||
#include <coreplugin/filemanager.h>
|
||||
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QDir>
|
||||
@@ -89,7 +91,13 @@ 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->manageSessionsButton, SIGNAL(clicked()), SIGNAL(manageSessions()));
|
||||
|
||||
ui->createNewProjectButton->setIcon(
|
||||
QIcon::fromTheme("document-new", ui->createNewProjectButton->icon()));
|
||||
ui->openProjectButton->setIcon(
|
||||
QIcon::fromTheme("document-open", ui->openProjectButton->icon()));
|
||||
}
|
||||
|
||||
ProjectWelcomePageWidget::~ProjectWelcomePageWidget()
|
||||
@@ -152,6 +160,22 @@ 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)
|
||||
{
|
||||
|
||||
@@ -69,6 +69,7 @@ private slots:
|
||||
void slotSessionClicked(const QString &data);
|
||||
void slotProjectClicked(const QString &data);
|
||||
void slotCreateNewProject();
|
||||
void slotOpenProject();
|
||||
|
||||
private:
|
||||
void activateEditMode();
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::WelcomeModeTreeWidget" name="sessTreeWidget"/>
|
||||
<widget class="Utils::WelcomeModeTreeWidget" name="sessTreeWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -85,7 +85,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::WelcomeModeTreeWidget" name="projTreeWidget"/>
|
||||
<widget class="Utils::WelcomeModeTreeWidget" name="projTreeWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -98,7 +98,23 @@
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<widget class="QPushButton" name="manageSessionsButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manage Sessions...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@@ -111,18 +127,15 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="manageSessionsButton">
|
||||
<widget class="QPushButton" name="openProjectButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>40</height>
|
||||
<width>160</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manage Sessions...</string>
|
||||
<string>Open Project...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -130,8 +143,8 @@
|
||||
<widget class="QPushButton" name="createNewProjectButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>40</height>
|
||||
<width>160</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
|
||||
@@ -87,6 +87,9 @@ GettingStartedWelcomePageWidget::GettingStartedWelcomePageWidget(QWidget *parent
|
||||
connect(ui->nextTipBtn, SIGNAL(clicked()), this, SLOT(slotNextTip()));
|
||||
connect(ui->prevTipBtn, SIGNAL(clicked()), this, SLOT(slotPrevTip()));
|
||||
connect(ui->createNewProjectButton, SIGNAL(clicked()), this, SLOT(slotCreateNewProject()));
|
||||
|
||||
ui->createNewProjectButton->setIcon(
|
||||
QIcon::fromTheme("document-new", ui->createNewProjectButton->icon()));
|
||||
}
|
||||
|
||||
GettingStartedWelcomePageWidget::~GettingStartedWelcomePageWidget()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>646</width>
|
||||
<height>361</height>
|
||||
<height>367</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -357,8 +357,8 @@
|
||||
<widget class="QPushButton" name="createNewProjectButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>40</height>
|
||||
<width>160</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
|
||||
Reference in New Issue
Block a user