MCPcopy Create free account
hub / github.com/comaps/comaps / OnBuildPhonePackage

Method OnBuildPhonePackage

qt/mainwindow.cpp:759–802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

757}
758
759void MainWindow::OnBuildPhonePackage()
760{
761 try
762 {
763 char const * const kStylesFolder = "styles";
764 char const * const kClearStyleFolder = "clear";
765
766 QString const targetDir = QFileDialog::getExistingDirectory(nullptr, "Choose output directory");
767 if (targetDir.isEmpty())
768 return;
769 auto outDir = QDir(JoinPathQt({targetDir, kStylesFolder}));
770 if (outDir.exists())
771 {
772 QMessageBox msgBox;
773 msgBox.setWindowTitle("Warning");
774 msgBox.setText(QString("Folder ") + outDir.absolutePath() + " will be deleted?");
775 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
776 msgBox.setDefaultButton(QMessageBox::No);
777 auto result = msgBox.exec();
778 if (result == QMessageBox::No)
779 throw std::runtime_error(std::string("Target directory exists: ") + outDir.absolutePath().toStdString());
780 }
781
782 QString const stylesDir = JoinPathQt({m_mapcssFilePath, "..", "..", ".."});
783 if (!QDir(JoinPathQt({stylesDir, kClearStyleFolder})).exists())
784 throw std::runtime_error(std::string("Styles folder is not found in ") + stylesDir.toStdString());
785
786 QString text = build_style::RunBuildingPhonePack(stylesDir, targetDir);
787 text.append("\nMobile device style package is in the directory: ");
788 text.append(JoinPathQt({targetDir, kStylesFolder}));
789 text.append(". Copy it to your mobile device.\n");
790 InfoDialog dlg(QString("Building phone pack"), text, nullptr);
791 dlg.exec();
792 }
793 catch (std::exception & e)
794 {
795 QMessageBox msgBox;
796 msgBox.setWindowTitle("Error");
797 msgBox.setText(e.what());
798 msgBox.setStandardButtons(QMessageBox::Ok);
799 msgBox.setDefaultButton(QMessageBox::Ok);
800 msgBox.exec();
801 }
802}
803#endif // BUILD_DESIGNER
804
805#ifndef NO_DOWNLOADER

Callers

nothing calls this directly

Calls 5

JoinPathQtFunction · 0.85
RunBuildingPhonePackFunction · 0.85
isEmptyMethod · 0.45
appendMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected