MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / addRecentOpenWidget

Method addRecentOpenWidget

src/plugins/project/projectcore.cpp:90–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void ProjectCore::addRecentOpenWidget(WindowService *windowService)
91{
92 RecentOpenWidget *openedWidget = new RecentOpenWidget();
93 auto editSrv = dpfGetService(EditorService);
94 connect(ProjectProxy::instance(), &ProjectProxy::switchedFile, this, [=](const QString &file) {
95 openedWidget->setOpenedFiles(editSrv->openedFiles().toVector());
96 openedWidget->setListViewSelection(file);
97 },
98 Qt::DirectConnection);
99 connect(openedWidget, &RecentOpenWidget::triggered, [=](const QModelIndex &index) {
100 QFileInfo info(index.data(RecentOpenWidget::RecentOpenedUserRole::FilePathRole).toString());
101 if (info.exists() && info.isFile()) {
102 editor.openFile(QString(), info.filePath());
103 }
104 });
105 connect(openedWidget, &RecentOpenWidget::closePage, [=](const QModelIndex &index) {
106 QFileInfo info(index.data(RecentOpenWidget::RecentOpenedUserRole::FilePathRole).toString());
107 if (info.exists() && info.isFile()) {
108 editor.closeFile(info.filePath());
109 }
110 });
111 connect(ProjectProxy::instance(), &ProjectProxy::modeRaised, this, [=](const QString &mode) {
112 if (mode != CM_EDIT || openFileWidgetInited)
113 return;
114 initOpenFilesWidget(windowService);
115 },
116 Qt::DirectConnection);
117 auto openFilesWidget = new AbstractWidget(openedWidget);
118 openFilesWidget->setDisplayIcon(QIcon::fromTheme("opened_files"));
119 windowService->registerWidgetToMode(openFilesWidgetName, openFilesWidget, CM_EDIT, Position::Left, false, true);
120 windowService->setDockHeaderName(openFilesWidgetName, tr("Opened Files"));
121}
122
123void ProjectCore::addAutoFocusSwitcher(WindowService *windowService, DToolButton *autoFocusSwitcher, DToolButton *focusFile)
124{

Callers

nothing calls this directly

Calls 13

connectFunction · 0.85
setDisplayIconMethod · 0.80
registerWidgetToModeMethod · 0.80
QStringClass · 0.50
setOpenedFilesMethod · 0.45
openedFilesMethod · 0.45
setListViewSelectionMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
existsMethod · 0.45
openFileMethod · 0.45
filePathMethod · 0.45

Tested by

no test coverage detected