2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
#include "importwidget.h"
|
|
|
|
|
|
|
|
|
|
#include <utils/detailswidget.h>
|
|
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
|
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
2013-08-13 10:52:57 +02:00
|
|
|
namespace ProjectExplorer {
|
2012-04-24 15:49:09 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
ImportWidget::ImportWidget(QWidget *parent) :
|
|
|
|
|
QWidget(parent),
|
|
|
|
|
m_pathChooser(new Utils::PathChooser)
|
|
|
|
|
{
|
|
|
|
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
2016-04-13 15:52:14 +02:00
|
|
|
auto vboxLayout = new QVBoxLayout();
|
2012-04-24 15:49:09 +02:00
|
|
|
setLayout(vboxLayout);
|
|
|
|
|
vboxLayout->setContentsMargins(0, 0, 0, 0);
|
2016-04-13 15:52:14 +02:00
|
|
|
auto detailsWidget = new Utils::DetailsWidget(this);
|
2012-04-24 15:49:09 +02:00
|
|
|
detailsWidget->setUseCheckBox(false);
|
2013-10-09 16:44:28 +02:00
|
|
|
detailsWidget->setSummaryText(tr("Import Build From..."));
|
2012-04-24 15:49:09 +02:00
|
|
|
detailsWidget->setSummaryFontBold(true);
|
|
|
|
|
// m_detailsWidget->setIcon(); // FIXME: Set icon!
|
|
|
|
|
vboxLayout->addWidget(detailsWidget);
|
|
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
auto widget = new QWidget;
|
|
|
|
|
auto layout = new QVBoxLayout(widget);
|
2012-04-24 15:49:09 +02:00
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
layout->addWidget(m_pathChooser);
|
|
|
|
|
|
|
|
|
|
m_pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
|
2014-02-07 14:33:53 +01:00
|
|
|
m_pathChooser->setHistoryCompleter(QLatin1String("Import.SourceDir.History"));
|
2016-04-13 15:52:14 +02:00
|
|
|
auto importButton = new QPushButton(tr("Import"), widget);
|
2012-04-24 15:49:09 +02:00
|
|
|
layout->addWidget(importButton);
|
|
|
|
|
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(importButton, &QAbstractButton::clicked, this, &ImportWidget::handleImportRequest);
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
detailsWidget->setWidget(widget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ImportWidget::setCurrentDirectory(const Utils::FileName &dir)
|
|
|
|
|
{
|
|
|
|
|
m_pathChooser->setBaseFileName(dir);
|
|
|
|
|
m_pathChooser->setFileName(dir);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ImportWidget::handleImportRequest()
|
|
|
|
|
{
|
|
|
|
|
Utils::FileName dir = m_pathChooser->fileName();
|
|
|
|
|
emit importFrom(dir);
|
|
|
|
|
|
|
|
|
|
m_pathChooser->setFileName(m_pathChooser->baseFileName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
2013-08-13 10:52:57 +02:00
|
|
|
} // namespace ProjectExplorer
|