From 3a8e43439901d5199d862e15418bfd4db23686d0 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 8 Aug 2023 14:41:23 +0800 Subject: [PATCH] - change: Git support is disabled in the distributed buildings. --- NEWS.md | 1 + RedPandaIDE/RedPandaIDE.pro | 86 +++++++++++-------- RedPandaIDE/customfileiconprovider.cpp | 27 +++++- RedPandaIDE/customfileiconprovider.h | 4 + RedPandaIDE/main.cpp | 2 + RedPandaIDE/mainwindow.cpp | 64 ++++++++++---- RedPandaIDE/mainwindow.h | 7 +- RedPandaIDE/project.cpp | 4 + RedPandaIDE/settings.cpp | 8 ++ RedPandaIDE/settings.h | 7 +- RedPandaIDE/settingsdialog/settingsdialog.cpp | 5 +- RedPandaIDE/vcs/gitmanager.cpp | 2 + RedPandaIDE/widgets/customfilesystemmodel.cpp | 2 - RedPandaIDE/widgets/customfilesystemmodel.h | 2 - Red_Panda_CPP.pro | 4 +- 15 files changed, 159 insertions(+), 66 deletions(-) diff --git a/NEWS.md b/NEWS.md index 22fcfcb7..55d10910 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,6 +18,7 @@ Red Panda C++ Version 2.24 - fix: Can't parse full class name when handle inheritance. - fix: Can't parse virtual inherit. - fix: Filename in the gcc 13.1 error messages when building project is using wrong encoding. + - change: Git support is disabled in the distributed buildings. Red Panda C++ Version 2.23 diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 9ea3a526..f6594693 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -3,6 +3,9 @@ QT += core gui printsupport network svg xml widgets CONFIG += c++17 CONFIG += nokey +# uncomment the following line to enable vcs (git) support +# CONFIG += ENABLE_VCS + isEmpty(APP_NAME) { APP_NAME = RedPandaCPP } @@ -140,25 +143,12 @@ SOURCES += \ settingsdialog/projectoutputwidget.cpp \ settingsdialog/projectprecompilewidget.cpp \ settingsdialog/toolsgeneralwidget.cpp \ - settingsdialog/toolsgitwidget.cpp \ shortcutmanager.cpp \ symbolusagemanager.cpp \ syntaxermanager.cpp \ thememanager.cpp \ todoparser.cpp \ toolsmanager.cpp \ - vcs/gitbranchdialog.cpp \ - vcs/gitfetchdialog.cpp \ - vcs/gitlogdialog.cpp \ - vcs/gitmanager.cpp \ - vcs/gitmergedialog.cpp \ - vcs/gitpulldialog.cpp \ - vcs/gitpushdialog.cpp \ - vcs/gitremotedialog.cpp \ - vcs/gitrepository.cpp \ - vcs/gitresetdialog.cpp \ - vcs/gituserconfigdialog.cpp \ - vcs/gitutils.cpp \ visithistorymanager.cpp \ widgets/aboutdialog.cpp \ widgets/bookmarkmodel.cpp \ @@ -276,25 +266,12 @@ HEADERS += \ settingsdialog/projectoutputwidget.h \ settingsdialog/projectprecompilewidget.h \ settingsdialog/toolsgeneralwidget.h \ - settingsdialog/toolsgitwidget.h \ shortcutmanager.h \ symbolusagemanager.h \ syntaxermanager.h \ thememanager.h \ todoparser.h \ toolsmanager.h \ - vcs/gitbranchdialog.h \ - vcs/gitfetchdialog.h \ - vcs/gitlogdialog.h \ - vcs/gitmanager.h \ - vcs/gitmergedialog.h \ - vcs/gitpulldialog.h \ - vcs/gitpushdialog.h \ - vcs/gitremotedialog.h \ - vcs/gitrepository.h \ - vcs/gitresetdialog.h \ - vcs/gituserconfigdialog.h \ - vcs/gitutils.h \ visithistorymanager.h \ widgets/aboutdialog.h \ widgets/bookmarkmodel.h \ @@ -384,16 +361,6 @@ FORMS += \ settingsdialog/projectoutputwidget.ui \ settingsdialog/projectprecompilewidget.ui \ settingsdialog/toolsgeneralwidget.ui \ - settingsdialog/toolsgitwidget.ui \ - vcs/gitbranchdialog.ui \ - vcs/gitfetchdialog.ui \ - vcs/gitlogdialog.ui \ - vcs/gitmergedialog.ui \ - vcs/gitpulldialog.ui \ - vcs/gitpushdialog.ui \ - vcs/gitremotedialog.ui \ - vcs/gitresetdialog.ui \ - vcs/gituserconfigdialog.ui \ widgets/aboutdialog.ui \ widgets/choosethemedialog.ui \ widgets/cpudialog.ui \ @@ -423,6 +390,53 @@ FORMS += \ widgets/searchinfiledialog.ui \ widgets/signalmessagedialog.ui +ENABLE_VCS { + + DEFINES += ENABLE_VCS + SOURCES += \ + vcs/gitbranchdialog.cpp \ + vcs/gitfetchdialog.cpp \ + vcs/gitlogdialog.cpp \ + vcs/gitmanager.cpp \ + vcs/gitmergedialog.cpp \ + vcs/gitpulldialog.cpp \ + vcs/gitpushdialog.cpp \ + vcs/gitremotedialog.cpp \ + vcs/gitrepository.cpp \ + vcs/gitresetdialog.cpp \ + vcs/gituserconfigdialog.cpp \ + vcs/gitutils.cpp \ + settingsdialog/toolsgitwidget.cpp + + HEADERS += \ + vcs/gitbranchdialog.h \ + vcs/gitfetchdialog.h \ + vcs/gitlogdialog.h \ + vcs/gitmanager.h \ + vcs/gitmergedialog.h \ + vcs/gitpulldialog.h \ + vcs/gitpushdialog.h \ + vcs/gitremotedialog.h \ + vcs/gitrepository.h \ + vcs/gitresetdialog.h \ + vcs/gituserconfigdialog.h \ + vcs/gitutils.h \ + settingsdialog/toolsgitwidget.h + + + FORMS += \ + vcs/gitbranchdialog.ui \ + vcs/gitfetchdialog.ui \ + vcs/gitlogdialog.ui \ + vcs/gitmergedialog.ui \ + vcs/gitpulldialog.ui \ + vcs/gitpushdialog.ui \ + vcs/gitremotedialog.ui \ + vcs/gitresetdialog.ui \ + vcs/gituserconfigdialog.ui \ + settingsdialog/toolsgitwidget.ui +} + win32: { FORMS += \ settingsdialog/projectversioninfowidget.ui \ diff --git a/RedPandaIDE/customfileiconprovider.cpp b/RedPandaIDE/customfileiconprovider.cpp index 4a401ce7..fcb426e9 100644 --- a/RedPandaIDE/customfileiconprovider.cpp +++ b/RedPandaIDE/customfileiconprovider.cpp @@ -16,33 +16,45 @@ */ #include "customfileiconprovider.h" #include "iconsmanager.h" +#ifdef ENABLE_VCS #include "vcs/gitrepository.h" +#endif CustomFileIconProvider::CustomFileIconProvider() { //provider delete it in the destructor +#ifdef ENABLE_VCS mVCSRepository = new GitRepository(""); +#endif } CustomFileIconProvider::~CustomFileIconProvider() { +#ifdef ENABLE_VCS delete mVCSRepository; +#endif } void CustomFileIconProvider::setRootFolder(const QString &folder) { +#ifdef ENABLE_VCS mVCSRepository->setFolder(folder); +#endif } void CustomFileIconProvider::update() { +#ifdef ENABLE_VCS mVCSRepository->update(); +#endif } +#ifdef ENABLE_VCS GitRepository *CustomFileIconProvider::VCSRepository() const { return mVCSRepository; } +#endif QIcon CustomFileIconProvider::icon(IconType type) const { @@ -59,6 +71,7 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const { QIcon icon; if (info.isDir()) { +#ifdef ENABLE_VCS if (mVCSRepository->isFileInRepository(info)) { if (mVCSRepository->isFileConflicting(info)) icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER_VCS_CONFLICT); @@ -69,10 +82,12 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const else icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER_VCS_NOCHANGE); } else +#endif icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER); } else if (!info.exists()) { icon = pIconsManager->getIcon(IconsManager::ACTION_MISC_CROSS); } else if (isHFile(info.fileName())) { +#ifdef ENABLE_VCS if (mVCSRepository->isFileInRepository(info)) { if (mVCSRepository->isFileConflicting(info)) icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE_VCS_CONFLICT); @@ -83,8 +98,10 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const else icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE_VCS_NOCHANGE); } else +#endif icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE); } else if (isCppFile(info.fileName())) { +#ifdef ENABLE_VCS if (mVCSRepository->isFileInRepository(info)) { if (mVCSRepository->isFileConflicting(info)) icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE_VCS_CONFLICT); @@ -95,8 +112,10 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const else icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE_VCS_NOCHANGE); } else +#endif icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE); } else if (isCFile(info.fileName())) { +#ifdef ENABLE_VCS if (mVCSRepository->isFileInRepository(info)) { if (mVCSRepository->isFileConflicting(info)) icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE_VCS_CONFLICT); @@ -107,8 +126,10 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const else icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE_VCS_NOCHANGE); } else +#endif icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE); } else if (info.suffix()=="dev") { +#ifdef ENABLE_VCS if (mVCSRepository->isFileInRepository(info)) { if (mVCSRepository->isFileConflicting(info)) icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE_VCS_CONFLICT); @@ -119,8 +140,10 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const else icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE_VCS_NOCHANGE); } else +#endif icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE); } else { +#ifdef ENABLE_VCS if (mVCSRepository->isFileInRepository(info)) { if (mVCSRepository->isFileConflicting(info)) icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FILE_VCS_CONFLICT); @@ -130,7 +153,9 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FILE_VCS_CHANGED); else icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FILE_VCS_NOCHANGE); - } //use default system icon + } +#endif + //use default system icon } if (!icon.isNull()) return icon; diff --git a/RedPandaIDE/customfileiconprovider.h b/RedPandaIDE/customfileiconprovider.h index 308d09d2..77ab1bad 100644 --- a/RedPandaIDE/customfileiconprovider.h +++ b/RedPandaIDE/customfileiconprovider.h @@ -28,12 +28,16 @@ public: void setRootFolder(const QString& folder); void update(); private: +#ifdef ENABLE_VCS GitRepository* mVCSRepository; +#endif // QFileIconProvider interface public: QIcon icon(IconType type) const override; QIcon icon(const QFileInfo &info) const override; +#ifdef ENABLE_VCS GitRepository *VCSRepository() const; +#endif }; #endif // CUSTOMFILEICONPROVIDER_H diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index ebe716a3..09436174 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -365,7 +365,9 @@ int main(int argc, char *argv[]) pSettings->editor().save(); //auto detect git in path +#ifdef ENABLE_VCS pSettings->vcs().detectGitInPath(); +#endif } //Color scheme settings must be loaded after translation ColorManager colorManager; diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 16f98164..0ead2bec 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -40,6 +40,7 @@ #include "iconsmanager.h" #include "widgets/newclassdialog.h" #include "widgets/newheaderdialog.h" +#ifdef ENABLE_VCS #include "vcs/gitmanager.h" #include "vcs/gitrepository.h" #include "vcs/gitbranchdialog.h" @@ -47,6 +48,7 @@ #include "vcs/gitlogdialog.h" #include "vcs/gitremotedialog.h" #include "vcs/gituserconfigdialog.h" +#endif #include "widgets/infomessagebox.h" #include "widgets/newtemplatedialog.h" #include "visithistorymanager.h" @@ -444,9 +446,10 @@ MainWindow::MainWindow(QWidget *parent) this, &MainWindow::on_EditorTabsRight_tabCloseRequested); //git menu +#ifdef ENABLE_VCS connect(ui->menuGit, &QMenu::aboutToShow, this, &MainWindow::updateVCSActions); - +#endif initToolButtons(); buildContextMenus(); updateAppTitle(); @@ -959,9 +962,11 @@ void MainWindow::applySettings() // for (int i=0;icbFilesPath->count();i++) { // ui->cbFilesPath->setItemIcon(i,pIconsManager->getIcon(IconsManager::FILESYSTEM_GIT)); // } - +#ifdef ENABLE_VCS ui->menuGit->menuAction()->setVisible(pSettings->vcs().gitOk()); - +#else + ui->menuGit->menuAction()->setVisible(false); +#endif stretchExplorerPanel(!ui->tabExplorer->isShrinked()); stretchMessagesPanel(!ui->tabMessages->isShrinked()); } @@ -1060,6 +1065,7 @@ void MainWindow::updateDPI(int oldDPI, int /*newDPI*/) void MainWindow::onFileSaved(const QString &path, bool inProject) { +#ifdef ENABLE_VCS if (pSettings->vcs().gitOk()) { QString branch; if (inProject && mProject && mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch)) { @@ -1080,6 +1086,7 @@ void MainWindow::onFileSaved(const QString &path, bool inProject) ui->treeFiles->update(index); } } +#endif //updateForEncodingInfo(); } @@ -3684,12 +3691,14 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) onRoot = true; } } - GitManager vcsManager; - QString branch; - bool hasRepository = vcsManager.hasRepository(mProject->folder(),branch); QMenu menu(this); +#ifdef ENABLE_VCS QMenu vcsMenu(this); + QString branch; + GitManager vcsManager; + bool hasRepository = vcsManager.hasRepository(mProject->folder(),branch); +#endif updateProjectActions(); menu.addAction(ui->actionProject_New_File); menu.addAction(ui->actionNew_Class); @@ -3702,6 +3711,7 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) menu.addAction(mProject_Rename_Unit); } menu.addSeparator(); +#ifdef ENABLE_VCS if (pSettings->vcs().gitOk()) { if (hasRepository) { menu.addMenu(&vcsMenu); @@ -3711,6 +3721,7 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) } menu.addSeparator(); } +#endif if (onFolder && mProject->modelType()==ProjectModelType::Custom) { menu.addAction(mProject_Add_Folder); if (!onRoot) { @@ -3733,6 +3744,7 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) menu.addSeparator(); menu.addAction(ui->actionClose_Project); +#ifdef ENABLE_VCS if (pSettings->vcs().gitOk() && hasRepository) { mProject->model()->iconProvider()->update(); vcsMenu.setTitle(tr("Version Control")); @@ -3771,7 +3783,8 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) vcsMenu.addAction(ui->actionGit_Commit); vcsMenu.addAction(ui->actionGit_Restore); - bool canBranch = !mProject->model()->iconProvider()->VCSRepository()->hasChangedFiles() + bool canBranch = false; + canBranch = !mProject->model()->iconProvider()->VCSRepository()->hasChangedFiles() && !mProject->model()->iconProvider()->VCSRepository()->hasStagedFiles(); ui->actionGit_Branch->setEnabled(canBranch); ui->actionGit_Merge->setEnabled(canBranch); @@ -3785,6 +3798,7 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) // ui->actionGit_Reset->setEnabled(true); // ui->actionGit_Revert->setEnabled(true); } +#endif menu.exec(ui->projectView->mapToGlobal(pos)); } @@ -3849,11 +3863,13 @@ void MainWindow::onFileEncodingContextMenu(const QPoint &pos) void MainWindow::onFilesViewContextMenu(const QPoint &pos) { + QMenu menu(this); +#ifdef ENABLE_VCS GitManager vcsManager; QString branch; bool hasRepository = vcsManager.hasRepository(pSettings->environment().currentFolder(),branch); - QMenu menu(this); QMenu vcsMenu(this); +#endif menu.addAction(ui->actionOpen_Folder); menu.addSeparator(); menu.addAction(mFilesView_CreateFolder); @@ -3861,6 +3877,7 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos) menu.addAction(mFilesView_RemoveFile); menu.addAction(mFilesView_Rename); menu.addSeparator(); +#ifdef ENABLE_VCS if (pSettings->vcs().gitOk()) { if (hasRepository) { menu.addMenu(&vcsMenu); @@ -3870,6 +3887,7 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos) } menu.addSeparator(); } +#endif menu.addAction(mFilesView_Open); menu.addAction(mFilesView_OpenWithExternal); menu.addSeparator(); @@ -3886,6 +3904,7 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos) mFilesView_Rename->setEnabled(!path.isEmpty()); mFilesView_RemoveFile->setEnabled(!path.isEmpty() || !ui->treeFiles->selectionModel()->selectedRows().isEmpty()); +#ifdef ENABLE_VCS if (pSettings->vcs().gitOk() && hasRepository) { mFileSystemModelIconProvider.update(); vcsMenu.setTitle(tr("Version Control")); @@ -3927,6 +3946,7 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos) // ui->actionGit_Reset->setEnabled(true); // ui->actionGit_Revert->setEnabled(true); } +#endif menu.exec(ui->treeFiles->mapToGlobal(pos)); } @@ -7045,6 +7065,7 @@ void MainWindow::on_actionAdd_to_project_triggered() foreach (const QString& filename, dialog.selectedFiles()) { PProjectUnit newUnit = mProject->addUnit(filename,folderNode); mProject->cppParser()->addProjectFile(filename,true); +#ifdef ENABLE_VCS QString branch; if (pSettings->vcs().gitOk() && mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch)) { QString output; @@ -7053,6 +7074,7 @@ void MainWindow::on_actionAdd_to_project_triggered() output ); } +#endif if (newUnit) { QModelIndex index = mProject->model()->getNodeIndex(newUnit->node().get()); index = mProjectProxyModel->mapFromSource(index); @@ -7418,11 +7440,13 @@ void MainWindow::newProjectUnitFile(const QString& suffix) if (editor) editor->activate(); QString branch; +#ifdef ENABLE_VCS if (pSettings->vcs().gitOk() && mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch)) { QString output; mProject->model()->iconProvider()->VCSRepository()->add(newFileName,output); mProject->model()->refreshIcon(newFileName); } +#endif updateProjectView(); } @@ -7761,6 +7785,7 @@ void MainWindow::setDockMessagesToArea(const Qt::DockWidgetArea &area) } } +#ifdef ENABLE_VCS void MainWindow::updateVCSActions() { bool hasRepository = false; @@ -7795,6 +7820,7 @@ void MainWindow::updateVCSActions() ui->actionGit_Restore->setEnabled(hasRepository && shouldEnable); ui->actionGit_Revert->setEnabled(hasRepository && shouldEnable); } +#endif void MainWindow::invalidateProjectProxyModel() { @@ -8958,7 +8984,7 @@ void MainWindow::on_actionNew_Class_triggered() pSettings->ui().setNewHeaderDialogHeight(dialog.height()); } - +#ifdef ENABLE_VCS void MainWindow::on_actionGit_Create_Repository_triggered() { if (ui->treeFiles->isVisible()) { @@ -9131,15 +9157,6 @@ void MainWindow::on_actionGit_Restore_triggered() } -void MainWindow::on_actionWebsite_triggered() -{ - if (pSettings->environment().language()=="zh_CN") { - QDesktopServices::openUrl(QUrl("https://royqh1979.gitee.io/redpandacpp/")); - } else { - QDesktopServices::openUrl(QUrl("https://sourceforge.net/projects/redpanda-cpp/")); - } -} - void MainWindow::on_actionGit_Branch_triggered() { @@ -9162,7 +9179,6 @@ void MainWindow::on_actionGit_Branch_triggered() } } - void MainWindow::on_actionGit_Merge_triggered() { QString folder; @@ -9311,6 +9327,16 @@ void MainWindow::on_actionGit_Push_triggered() } } +#endif + +void MainWindow::on_actionWebsite_triggered() +{ + if (pSettings->environment().language()=="zh_CN") { + QDesktopServices::openUrl(QUrl("https://royqh1979.gitee.io/redpandacpp/")); + } else { + QDesktopServices::openUrl(QUrl("https://sourceforge.net/projects/redpanda-cpp/")); + } +} void MainWindow::on_actionFilesView_Hide_Non_Support_Files_toggled(bool /* arg1 */) { diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index bfd4aa88..8cd509ea 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -338,7 +338,9 @@ private slots: void onProjectViewNodeRenamed(); void setDockExplorerToArea(const Qt::DockWidgetArea &area); void setDockMessagesToArea(const Qt::DockWidgetArea &area); +#ifdef ENABLE_VCS void updateVCSActions(); +#endif void invalidateProjectProxyModel(); void onEditorRenamed(const QString &oldFilename, const QString &newFilename, bool firstSave); void onAutoSaveTimeout(); @@ -702,6 +704,7 @@ private slots: void on_actionNew_Header_triggered(); +#ifdef ENABLE_VCS void on_actionGit_Create_Repository_triggered(); void on_actionGit_Add_Files_triggered(); @@ -710,8 +713,6 @@ private slots: void on_actionGit_Restore_triggered(); - void on_actionWebsite_triggered(); - void on_actionGit_Branch_triggered(); void on_actionGit_Merge_triggered(); @@ -725,6 +726,8 @@ private slots: void on_actionGit_Pull_triggered(); void on_actionGit_Push_triggered(); +#endif + void on_actionWebsite_triggered(); void on_actionFilesView_Hide_Non_Support_Files_toggled(bool arg1); diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp index f14a2693..f3d938ee 100644 --- a/RedPandaIDE/project.cpp +++ b/RedPandaIDE/project.cpp @@ -2627,11 +2627,13 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const if (!p) return QVariant(); if (role == Qt::DisplayRole) { +#ifdef ENABLE_VCS if (p == mProject->rootNode().get()) { QString branch; if (mIconProvider->VCSRepository()->hasRepository(branch)) return QString("%1 [%2]").arg(p->text,branch); } +#endif return p->text; } else if (role==Qt::EditRole) { return p->text; @@ -2643,9 +2645,11 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const icon = mIconProvider->icon(unit->fileName()); } else { if (p == mProject->rootNode().get()) { +#ifdef ENABLE_VCS QString branch; if (mIconProvider->VCSRepository()->hasRepository(branch)) icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_GIT); +#endif } else { switch(p->folderNodeType) { case ProjectModelNodeType::DUMMY_HEADERS_FOLDER: diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index e3091a56..557d06b4 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -48,7 +48,9 @@ Settings::Settings(const QString &filename): mCodeCompletion(this), mCodeFormatter(this), mUI(this), +#ifdef ENABLE_VCS mVCS(this), +#endif mLanguages(this) { //load(); @@ -112,7 +114,9 @@ void Settings::load() mCodeFormatter.load(); mUI.load(); mDirs.load(); +#ifdef ENABLE_VCS mVCS.load(); +#endif mLanguages.load(); } @@ -172,10 +176,12 @@ Settings::UI &Settings::ui() return mUI; } +#ifdef ENABLE_VCS Settings::VCS &Settings::vcs() { return mVCS; } +#endif Settings::Debugger& Settings::debugger() { @@ -5935,6 +5941,7 @@ void Settings::UI::doLoad() mNewHeaderDialogHeight = intValue("new_header_dialog_height", 300*qApp->desktop()->height()/1080); } +#ifdef ENABLE_VCS Settings::VCS::VCS(Settings *settings):_Base(settings,SETTING_VCS), mGitOk(false) { @@ -6010,6 +6017,7 @@ void Settings::VCS::detectGitInPath() } } +#endif Settings::Languages::Languages(Settings *settings): _Base(settings,SETTING_LANGUAGES) diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index 9ba1f7f8..bd0e9937 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -962,7 +962,7 @@ public: void doSave() override; void doLoad() override; }; - +#ifdef ENABLE_VCS class VCS: public _Base { public: explicit VCS(Settings *settings); @@ -979,6 +979,7 @@ public: void doSave() override; void doLoad() override; }; +#endif class Languages: public _Base { public: @@ -1565,7 +1566,9 @@ public: CodeCompletion &codeCompletion(); CodeFormatter &codeFormatter(); UI &ui(); +#ifdef ENABLE_VCS VCS &vcs(); +#endif Languages &languages(); QString filename() const; @@ -1581,7 +1584,9 @@ private: CodeCompletion mCodeCompletion; CodeFormatter mCodeFormatter; UI mUI; +#ifdef ENABLE_VCS VCS mVCS; +#endif Languages mLanguages; }; diff --git a/RedPandaIDE/settingsdialog/settingsdialog.cpp b/RedPandaIDE/settingsdialog/settingsdialog.cpp index b40aa3ba..7bac0908 100644 --- a/RedPandaIDE/settingsdialog/settingsdialog.cpp +++ b/RedPandaIDE/settingsdialog/settingsdialog.cpp @@ -51,7 +51,9 @@ #include "projectmakefilewidget.h" #include "projectdllhostwidget.h" #include "toolsgeneralwidget.h" +#ifdef ENABLE_VCS #include "toolsgitwidget.h" +#endif #ifdef Q_OS_WIN #include "environmentfileassociationwidget.h" #include "projectversioninfowidget.h" @@ -233,9 +235,10 @@ PSettingsDialog SettingsDialog::optionDialog() widget = new ToolsGeneralWidget(tr("General"),tr("Tools")); dialog->addWidget(widget); +#ifdef ENABLE_VCS widget = new ToolsGitWidget(tr("Git"),tr("Tools")); dialog->addWidget(widget); - +#endif dialog->selectFirstWidget(); diff --git a/RedPandaIDE/vcs/gitmanager.cpp b/RedPandaIDE/vcs/gitmanager.cpp index 109ecbdf..c9e5a038 100644 --- a/RedPandaIDE/vcs/gitmanager.cpp +++ b/RedPandaIDE/vcs/gitmanager.cpp @@ -1,4 +1,6 @@ +#ifdef ENABLE_VCS #include "gitmanager.h" +#endif #include "../utils.h" #include "../settings.h" diff --git a/RedPandaIDE/widgets/customfilesystemmodel.cpp b/RedPandaIDE/widgets/customfilesystemmodel.cpp index 08adedf6..2f648f5e 100644 --- a/RedPandaIDE/widgets/customfilesystemmodel.cpp +++ b/RedPandaIDE/widgets/customfilesystemmodel.cpp @@ -15,8 +15,6 @@ * along with this program. If not, see . */ #include "customfilesystemmodel.h" -#include "../vcs/gitmanager.h" -#include "../vcs/gitrepository.h" CustomFileSystemModel::CustomFileSystemModel(QObject *parent) : QFileSystemModel(parent) { diff --git a/RedPandaIDE/widgets/customfilesystemmodel.h b/RedPandaIDE/widgets/customfilesystemmodel.h index 032ba5c5..fae8139c 100644 --- a/RedPandaIDE/widgets/customfilesystemmodel.h +++ b/RedPandaIDE/widgets/customfilesystemmodel.h @@ -20,8 +20,6 @@ #include #include -class GitRepository; -class GitManager; class CustomFileSystemModel : public QFileSystemModel { Q_OBJECT diff --git a/Red_Panda_CPP.pro b/Red_Panda_CPP.pro index 3cb041c9..f50e42a9 100644 --- a/Red_Panda_CPP.pro +++ b/Red_Panda_CPP.pro @@ -31,8 +31,8 @@ RedPandaIDE.depends += redpanda-win-git-askpass unix: { SUBDIRS += \ redpanda-git-askpass -redpanda-git-askpass.subdir = tools/redpanda-git-askpass -RedPandaIDE.depends += redpanda-git-askpass + redpanda-git-askpass.subdir = tools/redpanda-git-askpass + RedPandaIDE.depends += redpanda-git-askpass } linux: {