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

Method initializeUi

src/plugins/recent/mainframe/recentdisplaywidget.cpp:276–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276void RecentDisplayWidget::initializeUi()
277{
278 d->navFrame = new DFrame();
279
280 d->navFrame->setLineWidth(0);
281 d->navFrame->setContentsMargins(0, 0, 0, 0);
282 DStyle::setFrameRadius(d->navFrame, 0);
283 QVBoxLayout *vLayoutNav = new QVBoxLayout();
284 QLabel *recentLogo = new QLabel();
285 QPixmap logo = QIcon(":/recent/images/recentLogo.png").pixmap(200, 143);
286 logo.setDevicePixelRatio(recentLogo->devicePixelRatioF());
287 recentLogo->setPixmap(logo);
288
289 d->btnOpenFile = new DPushButton(tr("Open File"));
290 d->btnOpenProject = new DPushButton(tr("Open Project"));
291 d->btnNewFileOrPro = new DPushButton(tr("New File or Project"));
292 d->nullRecentText = new DLabel(tr("No Project"));
293 d->nullRecentText->setAlignment(Qt::AlignCenter);
294 vLayoutNav->setContentsMargins(60, 0, 60, 0);
295 vLayoutNav->setSpacing(20);
296 vLayoutNav->setAlignment(Qt::AlignCenter);
297 vLayoutNav->addWidget(recentLogo);
298 vLayoutNav->addWidget(d->nullRecentText);
299 vLayoutNav->addWidget(d->btnOpenFile);
300 vLayoutNav->addWidget(d->btnOpenProject);
301 vLayoutNav->addWidget(d->btnNewFileOrPro);
302 d->navFrame->setLayout(vLayoutNav);
303
304 DLabel *recentTitle = new DLabel(tr("Recent Open"));
305 recentTitle->setForegroundRole(QPalette::BrightText);
306 recentTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
307 DFontSizeManager::instance()->bind(recentTitle, DFontSizeManager::T4, QFont::Medium);
308
309 d->createRecentWidget();
310 d->createSessionWidget();
311
312 QHBoxLayout *proAndDocLayout = new QHBoxLayout();
313 proAndDocLayout->addWidget(d->recentFrame);
314 proAndDocLayout->setSpacing(2);
315 proAndDocLayout->addWidget(d->sessionFrame);
316
317 QWidget *recentOpen = new QWidget(this);
318 QVBoxLayout *recentNavLayout = new QVBoxLayout(recentOpen);
319 recentNavLayout->setContentsMargins(15, 0, 25, 20);
320 recentNavLayout->addSpacing(25);
321 recentNavLayout->setAlignment(Qt::AlignTop);
322 recentNavLayout->addWidget(recentTitle);
323 recentNavLayout->addSpacing(5);
324 recentNavLayout->addLayout(proAndDocLayout);
325
326 QHBoxLayout *hLayout = new QHBoxLayout(this);
327 hLayout->setContentsMargins(0, 0, 0, 0);
328 hLayout->addWidget(d->navFrame);
329 hLayout->addWidget(recentOpen);
330
331 if (!isProAndDocNull()) {
332 d->nullRecentText->setVisible(false);
333 }

Callers

nothing calls this directly

Calls 5

createRecentWidgetMethod · 0.80
createSessionWidgetMethod · 0.80
setVisibleMethod · 0.80
addWidgetMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected