File indexing completed on 2024-04-28 04:37:48

0001 /*
0002     SPDX-FileCopyrightText: 2007 Alexander Dymo <adymo@kdevelop.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef _PROJECTSELECTIONPAGE_H_
0008 #define _PROJECTSELECTIONPAGE_H_
0009 
0010 #include "appwizardpagewidget.h"
0011 #include "appwizarddialog.h"
0012 
0013 // KNSCore::Entry is only a typedef in KF5, defined here
0014 #include <KNSWidgets/Button>
0015 
0016 namespace Ui {
0017 class ProjectSelectionPage;
0018 }
0019 
0020 class ProjectTemplatesModel;
0021 class QModelIndex;
0022 class QStandardItem;
0023 class QUrl;
0024 
0025 class ProjectSelectionPage : public AppWizardPageWidget {
0026 Q_OBJECT
0027 public:
0028     explicit ProjectSelectionPage(ProjectTemplatesModel *templatesModel, AppWizardDialog *wizardDialog);
0029     ~ProjectSelectionPage() override;
0030 
0031     bool shouldContinue() override;
0032 
0033     QString selectedTemplate();
0034     QString projectName();
0035     QUrl location();
0036 Q_SIGNALS:
0037     void locationChanged( const QUrl& );
0038     void valid();
0039     void invalid();
0040 private Q_SLOTS:
0041     void itemChanged( const QModelIndex& current );
0042     void urlEdited();
0043     void validateData();
0044     void nameChanged();
0045     void typeChanged(const QModelIndex& idx);
0046     void templateChanged(int);
0047 
0048     void loadFileClicked();
0049     void handleNewStuffDialogFinished(const QList<KNSCore::Entry>& changedEntries);
0050 
0051 private:
0052     inline QByteArray encodedProjectName();
0053     inline QStandardItem* currentItem() const;
0054     void setCurrentTemplate(const QString& fileName);
0055 
0056     Ui::ProjectSelectionPage *ui;
0057     ProjectTemplatesModel *m_templatesModel;
0058     AppWizardDialog *m_wizardDialog;
0059 };
0060 
0061 #endif