File indexing completed on 2024-05-19 15:46:09

0001 /*
0002     SPDX-FileCopyrightText: 2018 Morten Danielsen Volden
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_PERFORCEIMPORTMETADATAWIDGET_H
0008 #define KDEVPLATFORM_PERFORCEIMPORTMETADATAWIDGET_H
0009 
0010 #include "ui_perforceimportmetadatawidget.h"
0011 
0012 #include <vcs/widgets/vcsimportmetadatawidget.h>
0013 
0014 /**
0015  * Asks the user for all options needed to import an existing directory into
0016  * a Perforce repository
0017  */
0018 class PerforceImportMetadataWidget
0019     : public KDevelop::VcsImportMetadataWidget
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit PerforceImportMetadataWidget(QWidget* parent = nullptr);
0025 
0026     QUrl source() const override;
0027     KDevelop::VcsLocation destination() const override;
0028     //  TODO: Is not used, it returns an empty string
0029     QString message() const override;
0030     void setSourceLocation(const KDevelop::VcsLocation&) override;
0031     void setSourceLocationEditable(bool) override;
0032     void setMessage(const QString& message) override;
0033     bool hasValidData() const override;
0034 
0035 private Q_SLOTS:
0036     void testP4setup();
0037 
0038 private:
0039 
0040     bool validateP4executable();
0041 
0042     bool validateP4port(const QString& projectDir) const;
0043 
0044     bool validateP4user(const QString& projectDir) const;
0045 
0046     Ui::PerforceImportMetadataWidget* m_ui;
0047     QString m_errorDescription;
0048 };
0049 
0050 #endif