blob: 7fb2a828dbf6fd51ccb025629dae9d3a24f25a22 (
plain)
1
2
3
4
5
6
7
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "projectexplorer.h"
#include <coreplugin/iwelcomepage.h>
#include <utils/filepath.h>
#include <QAbstractListModel>
#include <QCoreApplication>
namespace Core { class SessionModel; }
namespace ProjectExplorer {
namespace Internal {
class SessionsPage;
class ProjectModel : public QAbstractListModel
{
Q_OBJECT
public:
enum { FilePathRole = Qt::UserRole+1, PrettyFilePathRole, ShortcutRole };
ProjectModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
public slots:
void resetProjects();
private:
RecentProjectsEntries m_projects;
};
class ProjectWelcomePage : public Core::IWelcomePage
{
Q_OBJECT
public:
ProjectWelcomePage();
QString title() const override { return QCoreApplication::translate("QtC::ProjectExplorer", "Projects"); }
int priority() const override { return 20; }
Utils::Id id() const override;
QWidget *createWidget() const override;
void reloadWelcomeScreenData() const;
public slots:
void newProject();
void openProject();
signals:
void requestProject(const Utils::FilePath &project);
private:
void openSessionAt(int index);
void openProjectAt(int index);
void createActions();
friend class SessionsPage;
Core::SessionModel *m_sessionModel = nullptr;
ProjectModel *m_projectModel = nullptr;
};
} // namespace Internal
} // namespace ProjectExplorer
|