OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qt4projectmanager / projectloadwizard.cpp
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #include "projectloadwizard.h"
34 #include "wizards/targetsetuppage.h"
35 #include "qt4project.h"
36
37 #include <QtGui/QCheckBox>
38 #include <QtGui/QHeaderView>
39 #include <QtGui/QLabel>
40 #include <QtGui/QVBoxLayout>
41 #include <QtGui/QWizardPage>
42 #include <QtGui/QApplication>
43
44 using namespace Qt4ProjectManager;
45 using namespace Qt4ProjectManager::Internal;
46
47 ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::WindowFlags flags)
48     : QWizard(parent, flags), m_project(project), m_targetSetupPage(0)
49 {
50     Q_ASSERT(project);
51
52     setWindowTitle(tr("Project Setup"));
53
54     setupTargetPage();
55
56     setOptions(options() | QWizard::NoBackButtonOnLastPage);
57 }
58
59 // We don't want to actually show the dialog if we don't show the import page
60 // We used to simply call ::exec() on the dialog
61 void ProjectLoadWizard::execDialog()
62 {
63     if (!pageIds().isEmpty()) {
64         QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
65         exec();
66         QApplication::restoreOverrideCursor();
67     } else {
68         done(QDialog::Accepted);
69     }
70 }
71
72 ProjectLoadWizard::~ProjectLoadWizard()
73 {
74 }
75
76 void ProjectLoadWizard::done(int result)
77 {
78     QWizard::done(result);
79     // This normally happens on showing the final page, but since we
80     // don't show it anymore, do it here
81
82     if (result == Accepted)
83         applySettings();
84 }
85
86 void ProjectLoadWizard::setupTargetPage()
87 {
88     if (m_targetSetupPage)
89         return;
90
91     m_targetSetupPage = new TargetSetupPage(this);
92     m_targetSetupPage->setProFilePath(m_project->file()->fileName());
93     m_targetSetupPage->setImportSearch(true);
94     resize(900, 450);
95
96     addPage(m_targetSetupPage);
97 }
98
99 void ProjectLoadWizard::applySettings()
100 {
101     Q_ASSERT(m_targetSetupPage);
102     m_targetSetupPage->setupProject(m_project);
103 }