Changeset View
Changeset View
Standalone View
Standalone View
plugins/phabricator/phabricatorhookupconfigpage.cpp
- This file was added.
1 | /* This file is part of KDevelop | ||||
---|---|---|---|---|---|
2 | Copyright 2017 Friedrich W. H. Kossebau <kossebau@kde.org> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Library General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2 of the License, or (at your option) any later version. | ||||
8 | | ||||
9 | This library is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | Library General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU Library General Public License | ||||
15 | along with this library; see the file COPYING.LIB. If not, write to | ||||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
17 | Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #include "phabricatorhookupconfigpage.h" | ||||
21 | #include "ui_phabricatorhookupconfigpage.h" | ||||
22 | | ||||
23 | #include "phabricatorhookupconfiguration.h" | ||||
24 | | ||||
25 | using namespace KDevelop; | ||||
26 | | ||||
27 | PhabricatorHookupConfigPage::PhabricatorHookupConfigPage(QWidget* parent) | ||||
28 | : ProjectServiceHookupConfigPage(parent) | ||||
29 | , m_ui(new Ui::PhabricatorHookupConfigPage) | ||||
30 | { | ||||
31 | m_ui->setupUi(this); | ||||
32 | connect(m_ui->baseUrlEdit, &QLineEdit::textEdited, this, &PhabricatorHookupConfigPage::changed); | ||||
33 | connect(m_ui->repositoryNameEdit, &QLineEdit::textEdited, this, &PhabricatorHookupConfigPage::changed); | ||||
34 | connect(m_ui->repositoryIdEdit, &QLineEdit::textEdited, this, &PhabricatorHookupConfigPage::changed); | ||||
35 | } | ||||
36 | | ||||
37 | PhabricatorHookupConfigPage::~PhabricatorHookupConfigPage() = default; | ||||
38 | | ||||
39 | | ||||
40 | void PhabricatorHookupConfigPage::loadFromConfiguration(const IProjectServiceHookupConfiguration* configuration) | ||||
41 | { | ||||
42 | const PhabricatorHookupConfiguration* phabricatorHookupConfiguration = dynamic_cast<const PhabricatorHookupConfiguration*>(configuration); | ||||
43 | m_ui->baseUrlEdit->setText(phabricatorHookupConfiguration->baseUrl().toString()); | ||||
44 | m_ui->repositoryNameEdit->setText(phabricatorHookupConfiguration->repositoryName()); | ||||
45 | m_ui->repositoryIdEdit->setText(phabricatorHookupConfiguration->repositoryId()); | ||||
46 | } | ||||
47 | | ||||
48 | void PhabricatorHookupConfigPage::saveToConfiguration(IProjectServiceHookupConfiguration* configuration) const | ||||
49 | { | ||||
50 | PhabricatorHookupConfiguration* phabricatorHookupConfiguration = dynamic_cast<PhabricatorHookupConfiguration*>(configuration); | ||||
51 | phabricatorHookupConfiguration->setBaseUrl(QUrl::fromUserInput(m_ui->baseUrlEdit->text())); | ||||
52 | phabricatorHookupConfiguration->setRepositoryName(m_ui->repositoryNameEdit->text()); | ||||
53 | phabricatorHookupConfiguration->setRepositoryId(m_ui->repositoryIdEdit->text()); | ||||
54 | } |