vcsconfigurationpage.cpp 2.68 KB
Newer Older
1 2 3 4
/**************************************************************************
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
6
**
Eike Ziller's avatar
Eike Ziller committed
7
** Contact: http://www.qt-project.org/
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/

#include "vcsconfigurationpage.h"

#include "vcsbaseconstants.h"

#include <coreplugin/dialogs/iwizard.h>
#include <coreplugin/icore.h>
#include <coreplugin/iversioncontrol.h>

39 40
#include <utils/qtcassert.h>

hjk's avatar
hjk committed
41 42 43 44
#include <QPushButton>
#include <QVBoxLayout>
#include <QWizardPage>

hjk's avatar
hjk committed
45
namespace VcsBase {
46
namespace Internal {
47 48 49 50 51

class VcsConfigurationPagePrivate
{
public:
    const Core::IVersionControl *m_versionControl;
hjk's avatar
hjk committed
52
    QPushButton *m_configureButton;
53 54
};

55 56
} // namespace Internal

57 58
VcsConfigurationPage::VcsConfigurationPage(const Core::IVersionControl *vc, QWidget *parent) :
    QWizardPage(parent),
59
    d(new Internal::VcsConfigurationPagePrivate)
60
{
61
    QTC_CHECK(vc);
62 63 64
    setTitle(tr("Configuration"));
    setSubTitle(tr("Please configure <b>%1</b> now.").arg(vc->displayName()));

hjk's avatar
hjk committed
65
    d->m_versionControl = vc;
hjk's avatar
hjk committed
66
    d->m_configureButton = new QPushButton(tr("Configure..."), this);
67

hjk's avatar
hjk committed
68 69
    QVBoxLayout *verticalLayout = new QVBoxLayout(this);
    verticalLayout->addWidget(d->m_configureButton);
70

hjk's avatar
hjk committed
71 72
    connect(d->m_versionControl, SIGNAL(configurationChanged()), SIGNAL(completeChanged()));
    connect(d->m_configureButton, SIGNAL(clicked()), SLOT(openConfiguration()));
73 74 75 76
}

VcsConfigurationPage::~VcsConfigurationPage()
{
Montel Laurent's avatar
Montel Laurent committed
77
    delete d;
78 79 80 81
}

bool VcsConfigurationPage::isComplete() const
{
hjk's avatar
hjk committed
82
    return d->m_versionControl->isConfigured();
83 84 85 86
}

void VcsConfigurationPage::openConfiguration()
{
87 88
    Core::ICore::showOptionsDialog(QLatin1String(VcsBase::Constants::VCS_SETTINGS_CATEGORY),
                                   d->m_versionControl->id().toString());
89 90
}

hjk's avatar
hjk committed
91
} // namespace VcsBase