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

Method initMainWindow

src/plugins/core/uicontroller/controller.cpp:887–939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

885}
886
887void Controller::initMainWindow()
888{
889 qInfo() << __FUNCTION__;
890 if (!d->mainWindow) {
891 d->mainWindow = new MainWindow;
892 d->mainWindow->setObjectName("MainWindow");
893 d->mainWindow->setMinimumSize(MW_MIN_WIDTH, MW_MIN_HEIGHT);
894 new ActionManager(this);
895 registerDefaultContainers();
896 registerDefaultActions();
897
898 QString initFile = CustomPaths::user(CustomPaths::Configures) + "/mainwindow.ini";
899 QFile file(initFile);
900 if (file.open(QFile::ReadOnly)) {
901 QByteArray ba;
902 QDataStream inFile(&file);
903 inFile >> ba;
904 d->mainWindow->restoreGeometry(ba);
905 d->mainWindow->show();
906 } else {
907 d->mainWindow->resize(MW_WIDTH, MW_HEIGHT);
908 d->mainWindow->showMaximized();
909 }
910
911 if (CommandParser::instance().getModel() == CommandParser::CommandLine) {
912 d->mainWindow->hide();
913 }
914
915 loading();
916
917 if (!d->mainWindow->isMaximized()) {
918 auto desktop = QApplication::desktop();
919 int currentScreenIndex = desktop->screenNumber(d->mainWindow);
920 QList<QScreen *> screenList = QGuiApplication::screens();
921
922 if (currentScreenIndex < screenList.count()) {
923 QRect screenRect = screenList[currentScreenIndex]->geometry();
924 int screenWidth = screenRect.width();
925 int screenHeight = screenRect.height();
926 d->mainWindow->move((screenWidth - d->mainWindow->width()) / 2, (screenHeight - d->mainWindow->height()) / 2);
927 }
928 }
929
930 connect(d->mainWindow, &MainWindow::dockHidden, this, [=](const QString &dockName) {
931 if (d->allWidgets.contains(dockName)) {
932 auto &info = d->allWidgets[dockName];
933 info.hiddenByManual = true;
934 if (d->widgetBindToNavigation.contains(dockName))
935 d->navigationBar->setNavActionChecked(d->widgetBindToNavigation[dockName]->text(), false);
936 }
937 });
938 }
939}
940
941void Controller::initNavigationBar()
942{

Callers

nothing calls this directly

Calls 10

connectFunction · 0.85
widthMethod · 0.80
setNavActionCheckedMethod · 0.80
openMethod · 0.45
showMethod · 0.45
getModelMethod · 0.45
hideMethod · 0.45
countMethod · 0.45
containsMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected