From 3391236e27938ab1aa973e6f1623ad70a8f18a9b Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 10 May 2015 16:46:46 +0100 Subject: [PATCH 01/60] Remove useless RepoMan tests These tests actually didn't test very much, are in the wrong library and no longer compatible with how the RepoMan will work. We need to investigate further in how to do actually useful testing of the RepoMan. --- testMacGitverCore/CMakeLists.txt | 24 -- testMacGitverCore/Infra/EventCatcher.cpp | 268 ----------------------- testMacGitverCore/Infra/EventCatcher.hpp | 151 ------------- testMacGitverCore/Infra/TempRepo.cpp | 48 ---- testMacGitverCore/Infra/TempRepo.hpp | 77 ------- testMacGitverCore/Test_Branch.cpp | 25 --- testMacGitverCore/Test_Branch.hpp | 27 --- testMacGitverCore/Test_Namespace.cpp | 25 --- testMacGitverCore/Test_Namespace.hpp | 27 --- testMacGitverCore/Test_Ref.cpp | 25 --- testMacGitverCore/Test_Ref.hpp | 27 --- testMacGitverCore/Test_RefLog.cpp | 25 --- testMacGitverCore/Test_RefLog.hpp | 27 --- testMacGitverCore/Test_RefTreeNode.cpp | 25 --- testMacGitverCore/Test_RefTreeNode.hpp | 27 --- testMacGitverCore/Test_Remote.cpp | 25 --- testMacGitverCore/Test_Remote.hpp | 27 --- testMacGitverCore/Test_Repo.cpp | 52 ----- testMacGitverCore/Test_Repo.hpp | 27 --- testMacGitverCore/Test_RepoMan.cpp | 64 ------ testMacGitverCore/Test_RepoMan.hpp | 43 ---- testMacGitverCore/Test_Submodule.cpp | 25 --- testMacGitverCore/Test_Submodule.hpp | 27 --- testMacGitverCore/Test_Tag.cpp | 25 --- testMacGitverCore/Test_Tag.hpp | 27 --- 25 files changed, 1170 deletions(-) delete mode 100644 testMacGitverCore/Infra/EventCatcher.cpp delete mode 100644 testMacGitverCore/Infra/EventCatcher.hpp delete mode 100644 testMacGitverCore/Infra/TempRepo.cpp delete mode 100644 testMacGitverCore/Infra/TempRepo.hpp delete mode 100644 testMacGitverCore/Test_Branch.cpp delete mode 100644 testMacGitverCore/Test_Branch.hpp delete mode 100644 testMacGitverCore/Test_Namespace.cpp delete mode 100644 testMacGitverCore/Test_Namespace.hpp delete mode 100644 testMacGitverCore/Test_Ref.cpp delete mode 100644 testMacGitverCore/Test_Ref.hpp delete mode 100644 testMacGitverCore/Test_RefLog.cpp delete mode 100644 testMacGitverCore/Test_RefLog.hpp delete mode 100644 testMacGitverCore/Test_RefTreeNode.cpp delete mode 100644 testMacGitverCore/Test_RefTreeNode.hpp delete mode 100644 testMacGitverCore/Test_Remote.cpp delete mode 100644 testMacGitverCore/Test_Remote.hpp delete mode 100644 testMacGitverCore/Test_Repo.cpp delete mode 100644 testMacGitverCore/Test_Repo.hpp delete mode 100644 testMacGitverCore/Test_RepoMan.cpp delete mode 100644 testMacGitverCore/Test_RepoMan.hpp delete mode 100644 testMacGitverCore/Test_Submodule.cpp delete mode 100644 testMacGitverCore/Test_Submodule.hpp delete mode 100644 testMacGitverCore/Test_Tag.cpp delete mode 100644 testMacGitverCore/Test_Tag.hpp diff --git a/testMacGitverCore/CMakeLists.txt b/testMacGitverCore/CMakeLists.txt index 721b4d8e..c215b0ba 100644 --- a/testMacGitverCore/CMakeLists.txt +++ b/testMacGitverCore/CMakeLists.txt @@ -21,18 +21,6 @@ SET(SRC_FILES Infra/main.cpp Infra/Fixture.cpp Infra/TempDirProvider.cpp - Infra/TempRepo.cpp - Infra/EventCatcher.cpp - - Test_RepoMan.cpp - Test_Repo.cpp - Test_Tag.cpp - Test_Submodule.cpp - Test_Branch.cpp - Test_Remote.cpp - Test_Namespace.cpp - Test_RefTreeNode.cpp - Test_RefLog.cpp Test_SHMParser.cpp ) @@ -41,18 +29,6 @@ SET(HDR_FILES Infra/Fixture.hpp Infra/TempDirProvider.hpp - Infra/TempRepo.hpp - Infra/EventCatcher.hpp - - Test_RepoMan.hpp - Test_Repo.hpp - Test_Submodule.hpp - Test_Tag.hpp - Test_Branch.hpp - Test_Remote.hpp - Test_Namespace.hpp - Test_RefTreeNode.hpp - Test_RefLog.hpp Test_SHMParser.hpp ) diff --git a/testMacGitverCore/Infra/EventCatcher.cpp b/testMacGitverCore/Infra/EventCatcher.cpp deleted file mode 100644 index 1616bfd7..00000000 --- a/testMacGitverCore/Infra/EventCatcher.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "libMacGitverCore/RepoMan/Repo.hpp" -#include "libMacGitverCore/RepoMan/Remote.hpp" -#include "libMacGitverCore/RepoMan/Ref.hpp" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Tag.hpp" -#include "libMacGitverCore/RepoMan/Branch.hpp" -#include "libMacGitverCore/RepoMan/RefLog.hpp" -#include "libMacGitverCore/RepoMan/Submodule.hpp" -#include "libMacGitverCore/RepoMan/Namespace.hpp" -#include "libMacGitverCore/RepoMan/RefTreeNode.hpp" - -#include "Infra/EventCatcher.hpp" - -EventCatcher::EventCatcher() -{ - RM::Events::addReceiver(this); -} - -EventCatcher::~EventCatcher() -{ - RM::Events::delReceiver(this); -} - -void EventCatcher::clear() -{ - entries.clear(); -} - -EventCatcher::EventLogEntries EventCatcher::allEvents() const -{ - return entries; -} - -int EventCatcher::eventCount() const -{ - return entries.count(); -} - -int EventCatcher::eventCount(EventTypes type) -{ - int count = 0; - - foreach (const EventLogEntry& ele, entries) { - if (ele.type == type) { - count++; - } - } - - return count; -} - -int EventCatcher::eventCount(EventTypes type, RM::Base* p1) const -{ - int count = 0; - - foreach (const EventLogEntry& ele, entries) { - if (ele.type == type && ele.params.count() == 1 && ele.params[0] == p1) { - count++; - } - } - - return count; -} - -int EventCatcher::eventCount(EventTypes type, RM::Base* p1, RM::Base* p2) const -{ - int count = 0; - - foreach (const EventLogEntry& ele, entries) { - if (ele.type == type && ele.params.count() == 2 && ele.params[0] == p1 && - ele.params[1] == p2) { - count++; - } - } - - return count; -} - -void EventCatcher::recordEvent(EventTypes type, RM::Base* p1) -{ - EventLogEntry ele; - ele.type = type; - ele.params << p1; - entries << ele; -} - -void EventCatcher::recordEvent(EventTypes type, RM::Base* p1, RM::Base* p2) -{ - EventLogEntry ele; - ele.type = type; - ele.params << p1 << p2; - entries << ele; -} - -void EventCatcher::repositoryOpened(RM::Repo* repo) -{ - recordEvent(ecRepoOpened, repo); -} - -void EventCatcher::repositoryAboutToClose(RM::Repo* repo) -{ - recordEvent(ecRepoAboutToClose, repo); -} - -void EventCatcher::repositoryActivated(RM::Repo* repo) -{ - recordEvent(ecRepoActivated, repo); -} - -void EventCatcher::repositoryDeactivated(RM::Repo* repo) -{ - recordEvent(ecRepoDeactivated, repo); -} - -void EventCatcher::refTreeNodeCreated(RM::Repo* repo, RM::RefTreeNode* node) -{ - recordEvent(ecRefTreeNodeCreated, repo, node); -} - -void EventCatcher::refTreeNodeAboutToBeDeleted(RM::Repo* repo, RM::RefTreeNode* node) -{ - recordEvent(ecRefTreeNodeAboutToBeRemoved, repo, node); -} - -void EventCatcher::refCreated(RM::Repo* repo, RM::Ref* ref) -{ - recordEvent(ecRefCreated, repo, ref); -} - -void EventCatcher::refAboutToBeDeleted(RM::Repo* repo, RM::Ref* ref) -{ - recordEvent(ecRefAboutToBeRemoved, repo, ref); -} - -void EventCatcher::refMoved(RM::Repo* repo, RM::Ref* ref) -{ - recordEvent(ecRefMoved, repo, ref); -} - -void EventCatcher::refHeadDetached(RM::Repo* repo, RM::Ref* ref) -{ - recordEvent(ecRefHeadDetached, repo, ref); -} - -void EventCatcher::tagCreated(RM::Repo* repo, RM::Tag* tag) -{ - recordEvent(ecTagCreated, repo, tag); -} - -void EventCatcher::tagAboutToBeDeleted(RM::Repo* repo, RM::Tag* tag) -{ - recordEvent(ecTagAboutToBeDeleted, repo, tag); -} - -void EventCatcher::branchCreated(RM::Repo* repo, RM::Branch* branch) -{ - recordEvent(ecBranchCreated, repo, branch); -} - -void EventCatcher::branchAboutToBeDeleted(RM::Repo* repo, RM::Branch* branch) -{ - recordEvent(ecBranchAboutToBeDeleted, repo, branch); -} - -void EventCatcher::branchMoved(RM::Repo* repo, RM::Branch* branch) -{ - recordEvent(ecBranchMoved, repo, branch); -} - -void EventCatcher::branchUpstreamChanged(RM::Repo* repo, RM::Branch* branch) -{ - recordEvent(ecBranchUpstreamChanged, repo, branch); -} - -void EventCatcher::namespaceCreated(RM::Repo* repo, RM::Namespace* nameSpace) -{ - recordEvent(ecNamespaceCreated, repo, nameSpace); -} - -void EventCatcher::namespaceAboutToBeDeleted(RM::Repo* repo, RM::Namespace* nameSpace) -{ - recordEvent(ecNamespaceAboutToBeRemoved, repo, nameSpace); -} - -void EventCatcher::refLogChanged(RM::Repo* repo, RM::RefLog* reflog) -{ - recordEvent(ecRefLogChanged, repo, reflog); -} - -void EventCatcher::refLogNewEntry(RM::Repo* repo, RM::RefLog* reflog) -{ - recordEvent(ecRefLogNewEntry, repo, reflog); -} - -void EventCatcher::stageCreated(RM::Repo* repo, RM::Ref* ref) -{ - recordEvent(ecStageCreated, repo, ref); -} - -void EventCatcher::stageAboutToBeDeleted(RM::Repo* repo, RM::Ref* ref) -{ - recordEvent(ecStageAboutToBeRemoved, repo, ref); -} - -void EventCatcher::remoteCreated(RM::Repo* repo, RM::Remote* remote) -{ - recordEvent(ecRemoteCreated, repo, remote); -} - -void EventCatcher::remoteAboutToBeDeleted(RM::Repo* repo, RM::Remote* remote) -{ - recordEvent(ecRemoteAboutToBeRemoved, repo, remote); -} - -void EventCatcher::remoteModified(RM::Repo* repo, RM::Remote* remote) -{ - recordEvent(ecRemoteModified, repo, remote); -} - -void EventCatcher::submoduleCreated(RM::Repo* repo, RM::Submodule* submodule) -{ - recordEvent(ecSubmoduleCreated, repo, submodule); -} - -void EventCatcher::submoduleAboutToBeDeleted(RM::Repo* repo, RM::Submodule* submodule) -{ - recordEvent(ecSubmoduleAboutToBeDeleted, repo, submodule); -} - -void EventCatcher::submoduleMoved(RM::Repo* repo, RM::Submodule* submodule) -{ - recordEvent(ecSubmoduleMoved, repo, submodule); -} - -void EventCatcher::repositoryStateChanged(RM::Repo* repo) -{ - recordEvent(ecRepoStateChanged, repo); -} - -void EventCatcher::indexUpdated(RM::Repo* repo) -{ - recordEvent(ecIndexUpdated, repo); -} - -void EventCatcher::workTreeUpdated(RM::Repo* repo) -{ - recordEvent(ecWorkTreeUpdated, repo); -} - diff --git a/testMacGitverCore/Infra/EventCatcher.hpp b/testMacGitverCore/Infra/EventCatcher.hpp deleted file mode 100644 index a472e293..00000000 --- a/testMacGitverCore/Infra/EventCatcher.hpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGV_CORE_EVENT_CATCHER_HPP -#define TEST_MGV_CORE_EVENT_CATCHER_HPP - -#include "libMacGitverCore/RepoMan/Base.hpp" -#include "libMacGitverCore/RepoMan/Events.hpp" - -namespace RM -{ - class Repo; -} - -enum EventTypes { - // These are administrative for RepoMan - ecRepoOpened, - ecRepoAboutToClose, - ecRepoActivated, - ecRepoDeactivated, - - // These are more or less virtual events. They are artificially constructed in RepoMan - ecRefTreeNodeCreated, - ecRefTreeNodeAboutToBeRemoved, - - // The following list represent events that actually may occur inside a git repository - ecRefCreated, - ecRefAboutToBeRemoved, - ecRefMoved, - ecRefLinkChanged, // => SymLink target changed (i.e. in HEAD) - ecRefOrphaned, // Additional to ecRefLinkChanged - ecRefHeadDetached, // Additional to ecRefLinkChanged - - ecTagCreated, // Additional to ecRefCreated - ecTagAboutToBeDeleted, // Additional to ecRefDeleted - - ecBranchCreated, // Additional to ecRefCreated - ecBranchAboutToBeDeleted, // Additional to ecRefDeleted - ecBranchMoved, // Additional to ecRefMoved - - ecBranchUpstreamChanged, - - ecNamespaceCreated, - ecNamespaceAboutToBeRemoved, - - ecRefLogChanged, - ecRefLogNewEntry, - - ecStageCreated, // Additional to ecRefLogNewEntry and ecRefLogChanged - ecStageAboutToBeRemoved, // Additional to ecRefLogChanged - - ecRemoteCreated, - ecRemoteAboutToBeRemoved, - ecRemoteModified, - - ecSubmoduleCreated, - ecSubmoduleAboutToBeDeleted, - ecSubmoduleMoved, - - - // These will be very hard to implement: - ecRepoStateChanged, // Normal / Rebasing / Merging etc. - - ecIndexUpdated, // Any modification to the index should trigger this event - ecWorkTreeUpdated, // This cannot be determined relyable everywhere(But I got some idea...) - - ecLast // => to not warn for the ',' in C++98 -}; - -class EventCatcher : public RM::EventsInterface -{ -public: - struct EventLogEntry - { - EventTypes type; - RM::Base::List params; - }; - - typedef QVector EventLogEntries; - -public: - EventCatcher(); - ~EventCatcher(); - -public: - void clear(); - EventLogEntries allEvents() const; - - int eventCount() const; - int eventCount(EventTypes type); - int eventCount(EventTypes type, RM::Base* p1) const; - int eventCount(EventTypes type, RM::Base* p1, RM::Base* p2) const; - -private: - void recordEvent(EventTypes type, RM::Base* p1); - void recordEvent(EventTypes type, RM::Base* p1, RM::Base* p2); - -protected: - void repositoryOpened(RM::Repo* repo); - void repositoryAboutToClose(RM::Repo* repo); - void repositoryActivated(RM::Repo* repo); - void repositoryDeactivated(RM::Repo* repo); - void refTreeNodeCreated(RM::Repo* repo, RM::RefTreeNode* node); - void refTreeNodeAboutToBeDeleted(RM::Repo* repo, RM::RefTreeNode* node); - void refCreated(RM::Repo* repo, RM::Ref* ref); - void refAboutToBeDeleted(RM::Repo* repo, RM::Ref* ref); - void refMoved(RM::Repo* repo, RM::Ref* ref); - void refHeadDetached(RM::Repo* repo, RM::Ref* ref); - void tagCreated(RM::Repo* repo, RM::Tag* tag); - void tagAboutToBeDeleted(RM::Repo* repo, RM::Tag* tag); - void branchCreated(RM::Repo* repo, RM::Branch* branch); - void branchAboutToBeDeleted(RM::Repo* repo, RM::Branch* branch); - void branchMoved(RM::Repo* repo, RM::Branch* branch); - void branchUpstreamChanged(RM::Repo* repo, RM::Branch* branch); - void namespaceCreated(RM::Repo* repo, RM::Namespace* nameSpace); - void namespaceAboutToBeDeleted(RM::Repo* repo, RM::Namespace* nameSpace); - void refLogChanged(RM::Repo* repo, RM::RefLog* reflog); - void refLogNewEntry(RM::Repo* repo, RM::RefLog* reflog); - void stageCreated(RM::Repo* repo, RM::Ref* ref); - void stageAboutToBeDeleted(RM::Repo* repo, RM::Ref* ref); - void remoteCreated(RM::Repo* repo, RM::Remote* remote); - void remoteAboutToBeDeleted(RM::Repo* repo, RM::Remote* remote); - void remoteModified(RM::Repo* repo, RM::Remote* remote); - void submoduleCreated(RM::Repo* repo, RM::Submodule* submodule); - void submoduleAboutToBeDeleted(RM::Repo* repo, RM::Submodule* submodule); - void submoduleMoved(RM::Repo* repo, RM::Submodule* submodule); - void repositoryStateChanged(RM::Repo* repo); - void indexUpdated(RM::Repo* repo); - void workTreeUpdated(RM::Repo* repo); - -private: - EventLogEntries entries; -}; - -#endif diff --git a/testMacGitverCore/Infra/TempRepo.cpp b/testMacGitverCore/Infra/TempRepo.cpp deleted file mode 100644 index 544d51ac..00000000 --- a/testMacGitverCore/Infra/TempRepo.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include - -#include "libMacGitverCore/RepoMan/Repo.hpp" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" - -#include "Infra/Fixture.hpp" -#include "Infra/TempDirProvider.hpp" -#include "Infra/TempRepo.hpp" - -TempRepo::TempRepo(Fixture* fixture, const char* name) -{ - mTempRepoDir = fixture->prepareRepo(name); -} - -TempRepo::~TempRepo() -{ - QDir(mTempRepoDir).rmpath(QStringLiteral(".")); -} - -TempRepoOpener::TempRepoOpener(Fixture* fixture, const char* name) - : mTempRepo(fixture, name) -{ - mRepo = MacGitver::repoMan().open(mTempRepo); -} - -TempRepoOpener::~TempRepoOpener() -{ - mRepo->close(); -} diff --git a/testMacGitverCore/Infra/TempRepo.hpp b/testMacGitverCore/Infra/TempRepo.hpp deleted file mode 100644 index 21a69900..00000000 --- a/testMacGitverCore/Infra/TempRepo.hpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGV_TEMP_REPO_HPP -#define TEST_MGV_TEMP_REPO_HPP - -#include - -class Fixture; - -namespace RM -{ - class Repo; -} - -/** - * @brief Copy a Test-Repository and remove it after usage - */ -class TempRepo -{ -public: - TempRepo(Fixture* fixture, const char* name); - ~TempRepo(); - -public: - operator QString() const - { - return mTempRepoDir; - } - -private: - QString mTempRepoDir; -}; - -/** - * @brief Copy a Test-Repo, remove it after use and keep it opened in RepoMan as long - * as it is in use. - */ -class TempRepoOpener -{ -public: - TempRepoOpener(Fixture* fixture, const char* name); - ~TempRepoOpener(); - -public: - operator RM::Repo*() const - { - return mRepo; - } - - RM::Repo* operator->() const - { - return mRepo; - } - -private: - TempRepo mTempRepo; - RM::Repo* mRepo; -}; - -#endif diff --git a/testMacGitverCore/Test_Branch.cpp b/testMacGitverCore/Test_Branch.cpp deleted file mode 100644 index 45df3185..00000000 --- a/testMacGitverCore/Test_Branch.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "Test_Branch.hpp" - -TEST_F(Branch_Fixture, Trivial) -{ - -} diff --git a/testMacGitverCore/Test_Branch.hpp b/testMacGitverCore/Test_Branch.hpp deleted file mode 100644 index b64e07a2..00000000 --- a/testMacGitverCore/Test_Branch.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGVCORE_BRANCH_HPP -#define TEST_MGVCORE_BRANCH_HPP - -#include "Infra/Fixture.hpp" - -typedef Fixture Branch_Fixture; - -#endif diff --git a/testMacGitverCore/Test_Namespace.cpp b/testMacGitverCore/Test_Namespace.cpp deleted file mode 100644 index 8c7967c5..00000000 --- a/testMacGitverCore/Test_Namespace.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "Test_Namespace.hpp" - -TEST_F(Namespace_Fixture, Trivial) -{ - -} diff --git a/testMacGitverCore/Test_Namespace.hpp b/testMacGitverCore/Test_Namespace.hpp deleted file mode 100644 index 50d65041..00000000 --- a/testMacGitverCore/Test_Namespace.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGVCORE_NAMESPACE_HPP -#define TEST_MGVCORE_NAMESPACE_HPP - -#include "Infra/Fixture.hpp" - -typedef Fixture Namespace_Fixture; - -#endif diff --git a/testMacGitverCore/Test_Ref.cpp b/testMacGitverCore/Test_Ref.cpp deleted file mode 100644 index 1086b1ea..00000000 --- a/testMacGitverCore/Test_Ref.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "Test_Tag.hpp" - -TEST_F(Tag_Fixture, Trivial) -{ - -} diff --git a/testMacGitverCore/Test_Ref.hpp b/testMacGitverCore/Test_Ref.hpp deleted file mode 100644 index c6c96fcb..00000000 --- a/testMacGitverCore/Test_Ref.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGVCORE_REPO_MAN_HPP -#define TEST_MGVCORE_REPO_MAN_HPP - -#include "Fixture.hpp" - -typedef Fixture Repo_Fixture; - -#endif diff --git a/testMacGitverCore/Test_RefLog.cpp b/testMacGitverCore/Test_RefLog.cpp deleted file mode 100644 index 4205b4c5..00000000 --- a/testMacGitverCore/Test_RefLog.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "Test_RefLog.hpp" - -TEST_F(RefLog_Fixture, Trivial) -{ - -} diff --git a/testMacGitverCore/Test_RefLog.hpp b/testMacGitverCore/Test_RefLog.hpp deleted file mode 100644 index 9eada47e..00000000 --- a/testMacGitverCore/Test_RefLog.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGVCORE_REFLOG_HPP -#define TEST_MGVCORE_REFLOG_HPP - -#include "Infra/Fixture.hpp" - -typedef Fixture RefLog_Fixture; - -#endif diff --git a/testMacGitverCore/Test_RefTreeNode.cpp b/testMacGitverCore/Test_RefTreeNode.cpp deleted file mode 100644 index 21597337..00000000 --- a/testMacGitverCore/Test_RefTreeNode.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "Test_RefTreeNode.hpp" - -TEST_F(RefTreeNode_Fixture, Trivial) -{ - -} diff --git a/testMacGitverCore/Test_RefTreeNode.hpp b/testMacGitverCore/Test_RefTreeNode.hpp deleted file mode 100644 index 2bf7112d..00000000 --- a/testMacGitverCore/Test_RefTreeNode.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGVCORE_REF_TREE_NODE_HPP -#define TEST_MGVCORE_REF_TREE_NODE_HPP - -#include "Infra/Fixture.hpp" - -typedef Fixture RefTreeNode_Fixture; - -#endif diff --git a/testMacGitverCore/Test_Remote.cpp b/testMacGitverCore/Test_Remote.cpp deleted file mode 100644 index 1e445529..00000000 --- a/testMacGitverCore/Test_Remote.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "Test_Remote.hpp" - -TEST_F(Remote_Fixture, Trivial) -{ - -} diff --git a/testMacGitverCore/Test_Remote.hpp b/testMacGitverCore/Test_Remote.hpp deleted file mode 100644 index ee057139..00000000 --- a/testMacGitverCore/Test_Remote.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGVCORE_REMOTE_HPP -#define TEST_MGVCORE_REMOTE_HPP - -#include "Infra/Fixture.hpp" - -typedef Fixture Remote_Fixture; - -#endif diff --git a/testMacGitverCore/Test_Repo.cpp b/testMacGitverCore/Test_Repo.cpp deleted file mode 100644 index 509b49a3..00000000 --- a/testMacGitverCore/Test_Repo.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Repo.hpp" - -#include "Infra/TempRepo.hpp" - -#include "Test_Repo.hpp" - -#define RMAN() MacGitver::repoMan() - -TEST_F(Repo_Fixture, CanOpenRepo) -{ - TempRepo tempRepo(this, "SimpleRepo1"); - - RM::Repo* repo = RMAN().open(tempRepo); - ASSERT_TRUE(repo != NULL); - - repo->close(); - ASSERT_EQ(0, RMAN().repositories().count()); -} - -TEST_F(Repo_Fixture, Trivial) -{ - TempRepoOpener repo(this, "SimpleRepo1"); - - ASSERT_TRUE(repo->isA()); - - ASSERT_TRUE(repo->isActive()); - ASSERT_TRUE(repo->isLoaded()); - ASSERT_FALSE(repo->isSubModule()); - ASSERT_FALSE(repo->isBare()); - - qDebug("%s", qPrintable(RMAN().dump())); -} diff --git a/testMacGitverCore/Test_Repo.hpp b/testMacGitverCore/Test_Repo.hpp deleted file mode 100644 index d0e48fd0..00000000 --- a/testMacGitverCore/Test_Repo.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGVCORE_REPO_HPP -#define TEST_MGVCORE_REPO_HPP - -#include "Infra/Fixture.hpp" - -typedef Fixture Repo_Fixture; - -#endif diff --git a/testMacGitverCore/Test_RepoMan.cpp b/testMacGitverCore/Test_RepoMan.cpp deleted file mode 100644 index b5cb6238..00000000 --- a/testMacGitverCore/Test_RepoMan.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "Test_RepoMan.hpp" - -#include "libMacGitverCore/RepoMan/RepoMan.hpp" - -void RepoManFixture::expectSignal(QObject* sender, const char * const signature) -{ - connect(sender, signature, this, SLOT(expectedSignal())); - - expectedSender = sender; - expectedSignature = signature; - gotSignal = false; -} - -bool RepoManFixture::receivedSignal() -{ - bool got = gotSignal; - - disconnect(expectedSender, expectedSignature, this, SLOT(expectedSignal())); - expectedSender = NULL; - expectedSignature = NULL; - - return got; -} - -void RepoManFixture::expectedSignal() -{ - if (sender() == expectedSender) - { - gotSignal = true; - } -} - - -TEST_F(RepoManFixture, Trivial) -{ -#if 0 - // This test is stupid. If RepoMan was implemented correctly, there would be no signal for - // opening an "invalid" repository... - RM::RepoMan* rm = &MacGitver::repoMan(); - expectSignal(rm, SIGNAL(firstRepositoryOpened())); - rm->open(Git::Repository()); - ASSERT_TRUE(receivedSignal()); -#endif -} - diff --git a/testMacGitverCore/Test_RepoMan.hpp b/testMacGitverCore/Test_RepoMan.hpp deleted file mode 100644 index 4c98fe40..00000000 --- a/testMacGitverCore/Test_RepoMan.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGVCORE_REPO_MAN_HPP -#define TEST_MGVCORE_REPO_MAN_HPP - -#include "Infra/Fixture.hpp" - -class RepoManFixture : public Fixture -{ - Q_OBJECT -public: - -protected: - void expectSignal(QObject* sender, const char* const signature); - bool receivedSignal(); - -private slots: - void expectedSignal(); - -protected: - const char* expectedSignature; - QObject* expectedSender; - bool gotSignal; -}; - -#endif diff --git a/testMacGitverCore/Test_Submodule.cpp b/testMacGitverCore/Test_Submodule.cpp deleted file mode 100644 index 47da8cb6..00000000 --- a/testMacGitverCore/Test_Submodule.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "Test_Submodule.hpp" - -TEST_F(Submodule_Fixture, Trivial) -{ - -} diff --git a/testMacGitverCore/Test_Submodule.hpp b/testMacGitverCore/Test_Submodule.hpp deleted file mode 100644 index 1f37473a..00000000 --- a/testMacGitverCore/Test_Submodule.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGVCORE_SUBMODULE_HPP -#define TEST_MGVCORE_SUBMODULE_HPP - -#include "Infra/Fixture.hpp" - -typedef Fixture Submodule_Fixture; - -#endif diff --git a/testMacGitverCore/Test_Tag.cpp b/testMacGitverCore/Test_Tag.cpp deleted file mode 100644 index 1086b1ea..00000000 --- a/testMacGitverCore/Test_Tag.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "Test_Tag.hpp" - -TEST_F(Tag_Fixture, Trivial) -{ - -} diff --git a/testMacGitverCore/Test_Tag.hpp b/testMacGitverCore/Test_Tag.hpp deleted file mode 100644 index 9976af6d..00000000 --- a/testMacGitverCore/Test_Tag.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2013 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#ifndef TEST_MGVCORE_TAG_HPP -#define TEST_MGVCORE_TAG_HPP - -#include "Infra/Fixture.hpp" - -typedef Fixture Tag_Fixture; - -#endif From 4cb1466ae5155db3650221b479128d64c32fd627 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 22 Mar 2015 06:35:02 +0000 Subject: [PATCH 02/60] Remove signals from RM::Repo --- Libs/libMacGitverCore/RepoMan/Repo.cpp | 14 ++++---------- Libs/libMacGitverCore/RepoMan/Repo.hpp | 8 -------- Modules/Repository/RepoInfoModel.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Repo.cpp index d41233fb..0ccdbaed 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.cpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.cpp @@ -198,7 +198,8 @@ namespace RM if (d->mDisplayAlias != alias) { d->mDisplayAlias = alias; - emit aliasChanged(alias); + // ###REPOMAN Create new Event "RepoAliasChanged" + // emit aliasChanged(alias); } } @@ -217,7 +218,6 @@ namespace RM } Events::self()->repositoryAboutToClose(this); - emit aboutToClose(this); foreach (Repo* child, submodules()) { child->close(); @@ -420,13 +420,10 @@ namespace RM mUnloadTimer = NULL; } - Repo* r = pub(); - emit r->aboutToUnload(r); - + // ####REPOMAN Do we really need to send out events for Unload/Load? If yes, create + // real events for that! mIsLoaded = false; mRepo = Git::Repository(); - - emit r->unloaded(r); } @@ -473,10 +470,7 @@ namespace RM subInfo = repoByPath(path, true); if (!subInfo) { - subInfo = new Submodule(subRepo, p); - emit p->childAdded(p, subInfo); - } else { oldSubmodules.remove(subInfo); diff --git a/Libs/libMacGitverCore/RepoMan/Repo.hpp b/Libs/libMacGitverCore/RepoMan/Repo.hpp index 9a68f7b1..6d6e7bef 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.hpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.hpp @@ -97,14 +97,6 @@ namespace RM private slots: void unloadTimer(); - - signals: - void aboutToClose (RM::Repo* repo); - void aboutToUnload (RM::Repo* repo); - void unloaded (RM::Repo* repo); - void loaded (RM::Repo* repo); - void childAdded (RM::Repo* parent, RM::Repo* child); - void aliasChanged (const QString& newAlias); }; } diff --git a/Modules/Repository/RepoInfoModel.cpp b/Modules/Repository/RepoInfoModel.cpp index bcbee721..c9886c7e 100644 --- a/Modules/Repository/RepoInfoModel.cpp +++ b/Modules/Repository/RepoInfoModel.cpp @@ -204,11 +204,13 @@ void RepoInfoModel::repositoryOpened(RM::Repo *info) return; } + // ###REPOMAN Instead of this, listen to SubmoduleCreated events + // This connection is wrong. There could be any children added below the repository (i.e. // HEAD, SubModule, CollectionNode). But the slot will unconditionally reserve a new space // for a submodule... - connect(info, &RM::Repo::childAdded, - this, &RepoInfoModel::repositoryChildAdded); + //connect(info, &RM::Repo::childAdded, + // this, &RepoInfoModel::repositoryChildAdded); // we add a row just at the end of the root. This is stupid. But that's the way it works when // a model actually isn't a model... From 66ff7eb675b3f57ac06b90491fec79626f5cd943 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 10 May 2015 04:39:41 +0100 Subject: [PATCH 03/60] Remove 'open' logic' --- Libs/libMacGitverCore/RepoMan/RepoMan.cpp | 76 +++-------------------- Libs/libMacGitverCore/RepoMan/RepoMan.hpp | 9 ++- 2 files changed, 11 insertions(+), 74 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp index 3c5c1132..4fa77d15 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp +++ b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp @@ -29,6 +29,8 @@ #include "libBlueSky/Application.hpp" +#include + namespace RM { @@ -69,81 +71,17 @@ namespace RM } /** - * @brief Open a repository (By it's path) + * @brief Open a repository * - * Opens a Git::Repository at the @a path and if this is valid, call open() to setup a RepoMan - * repository for it. + * Opens the Repository at @a path * * @param[in] path The path where to look for the repository to open. * - * @return A pointer to a Repo object that represents the repositorty. An existing one will - * be returned if such a Repo object can be found. - * `NULL` will be returned, if the repository cannot be opened. - * - */ - Repo* RepoMan::open(const QString& path) - { - Git::Result result; - Git::Repository repo = Git::Repository::open( result, path ); - if( !result || !repo.isValid() ) - { - return NULL; - } - - return open( repo ); - } - - /** - * @brief Setup a Repo object for a Git::Repository - * - * If there is no Repo object for the git repository at that place in the file system, a new one - * will be created and registered with the repo-manager and the core. - * - * @param[in] gitRepo The Git::Repository object - * - * @return Returns either an existing Repo object or a newly created one. - * */ - Repo* RepoMan::open(const Git::Repository& gitRepo) - { - RM_D(RepoMan); - - Repo* repo = repoByPath(gitRepo.workTreePath(), false); - - if(!repo) { - repo = new Repo(gitRepo, this); - d->repos.append(repo); - - Events::self()->repositoryOpened(repo); - - if (d->repos.count() == 1) { - emit firstRepositoryOpened(); - } - } - - activate( repo ); - return repo; - } - - Repo* RepoMan::repoByPath( const QString& basePath, bool searchSubmodules ) + void RepoMan::open(const QString& path) { - RM_D(RepoMan); - - foreach (Repo* repo, d->repos) { - if (repo->path() == basePath) { - return repo; - } - - if (searchSubmodules) { - if (RepoPrivate* subPriv = Private::dataOf(repo)) { - if (Repo* subSubRepo = subPriv->repoByPath(basePath, true)) { - return subSubRepo; - } - } - } - } - - return NULL; + // ### REPOMAN TODO + qDebug() << "RepoMan::Open is currently not implemented."; } /** diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.hpp b/Libs/libMacGitverCore/RepoMan/RepoMan.hpp index 602298b3..f9f4f980 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.hpp +++ b/Libs/libMacGitverCore/RepoMan/RepoMan.hpp @@ -49,7 +49,7 @@ namespace RM ~RepoMan(); public: - Repo* open(const QString& path); + void open(const QString& path); void closeAll(); @@ -58,12 +58,11 @@ namespace RM Repo::List repositories() const; - Repo* repoByPath(const QString& basePath, bool searchSubmodules); - void internalClosedRepo(Repo* repository); - private: - Repo* open(const Git::Repository& repo); + public: + static RepoMan& instance(); + void terminate(); private slots: void reactivateWorkaround(); From 359c33d457dcbf01006227663627750537ddae83 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 22 Mar 2015 18:43:03 +0000 Subject: [PATCH 04/60] Make the RM::Repo's Git::Repository member private --- .../RepoMan/Private/RepoPrivate.hpp | 8 +++- Libs/libMacGitverCore/RepoMan/Repo.cpp | 40 +++++++++---------- Libs/libMacGitverCore/RepoMan/Repo.hpp | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp index 296229e4..2b16deab 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp @@ -62,13 +62,14 @@ namespace RM public: void load(); void unload(); - bool ensureIsLoaded(); void findAlias(); void scanSubmodules(); Repo* repoByPath(const QString& basePath, bool searchSubmodules); public: - Git::Repository mRepo; //!< GitWrap-Repo, if loaded + Git::Repository gitRepo(bool doLoad = false); + + public: QString mPath; //!< Full, absolute path to this repository QString mDisplayAlias; //!< An alias for display (Default to last path comp.) bool mIsSubModule : 1; //!< This is a submodule of another repo @@ -78,6 +79,9 @@ namespace RM bool mIsInitializing : 1; //!< True, while this repository is initializing QTimer* mUnloadTimer; //!< NULL or a timer to unload this repository Head* mHead; //!< The HEAD + + private: + Git::Repository mRepo; //!< GitWrap-Repo, if loaded }; } diff --git a/Libs/libMacGitverCore/RepoMan/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Repo.cpp index 0ccdbaed..6a62258a 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.cpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.cpp @@ -71,19 +71,13 @@ namespace RM Git::Repository Repo::gitRepo() { RM_D(Repo); - - if (d->ensureIsLoaded()) { - return d->mRepo; - } - - return Git::Repository(); + return d->gitRepo(true); } - Git::Repository Repo::gitLoadedRepo() const + Git::Repository Repo::gitLoadedRepo() { - RM_CD(Repo); - - return d->mIsLoaded ? d->mRepo : Git::Repository(); + RM_D(Repo); + return d->gitRepo(); } QString Repo::path() const @@ -391,15 +385,6 @@ namespace RM MacGitver::repoMan().internalClosedRepo(p); } - bool RepoPrivate::ensureIsLoaded() - { - if (!mIsLoaded) { - load(); - } - - return mIsLoaded; - } - void RepoPrivate::load() { // ### Unimplemented: RepoPrivate::load() @@ -441,12 +426,13 @@ namespace RM { RM_P(Repo); - if (!ensureIsLoaded()) { + Git::Repository repo = gitRepo(true); + if (!repo.isValid()) { return; } Git::Result r; - Git::Submodule::List subs = mRepo.submodules( r ); + Git::Submodule::List subs = repo.submodules( r ); if (!r) { return; } @@ -542,7 +528,7 @@ namespace RM { dumper.addLine(QString(QStringLiteral("Repository 0x%1 - %02")) .arg(quintptr(mPub),0,16) - .arg(mIsLoaded ? pub()->gitLoadedRepo().name() + .arg(mIsLoaded ? mRepo.name() : QStringLiteral(""))); } @@ -759,4 +745,14 @@ namespace RM { return static_cast(mPub); } + + Git::Repository RepoPrivate::gitRepo(bool doLoad) + { + if (!mIsLoaded && doLoad) { + load(); + } + + return mRepo; + } + } diff --git a/Libs/libMacGitverCore/RepoMan/Repo.hpp b/Libs/libMacGitverCore/RepoMan/Repo.hpp index 6d6e7bef..68789b34 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.hpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.hpp @@ -58,7 +58,7 @@ namespace RM public: GW_DEPRECATED Git::Repository gitRepo(); - GW_DEPRECATED Git::Repository gitLoadedRepo() const; + GW_DEPRECATED Git::Repository gitLoadedRepo(); bool isSubModule() const; bool isBare() const; From 2a84e82e822dd2443dd06bc79b3eaf9096b3c640 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sat, 9 May 2015 22:23:22 +0100 Subject: [PATCH 05/60] Keep instance pointer to RepoMan inside itself --- Libs/libMacGitverCore/App/MacGitver.cpp | 10 ++++------ Libs/libMacGitverCore/App/MacGitver.hpp | 1 + Libs/libMacGitverCore/App/MacGitverPrivate.hpp | 1 - Libs/libMacGitverCore/App/MgvPrimaryWindow.cpp | 6 +++--- Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp | 2 +- .../RepoMan/Config/RepoManConfigPage.cpp | 3 ++- Libs/libMacGitverCore/RepoMan/RepoMan.cpp | 14 ++++++++++++++ Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp | 2 +- Modules/Logging/LoggingMode.cpp | 2 +- Modules/Repository/CreateRepositoryDlg.cpp | 2 +- Modules/Repository/RepoTreeView.cpp | 8 ++++---- 11 files changed, 32 insertions(+), 19 deletions(-) diff --git a/Libs/libMacGitverCore/App/MacGitver.cpp b/Libs/libMacGitverCore/App/MacGitver.cpp index da9a3405..b8974e17 100644 --- a/Libs/libMacGitverCore/App/MacGitver.cpp +++ b/Libs/libMacGitverCore/App/MacGitver.cpp @@ -73,7 +73,7 @@ void MacGitverPrivate::init() QApplication::setApplicationName(QStringLiteral("MacGitver_NonGui")); } - sRepoMan = new RM::RepoMan; + RM::RepoMan::instance(); sModules = new Modules; if (isGui) { @@ -86,7 +86,8 @@ MacGitverPrivate::~MacGitverPrivate() { unregisterGlobalConfigPages(); - delete sRepoMan; sRepoMan = NULL; + RM::RepoMan::instance().terminate(); + delete sModules; sModules = NULL; Log::Manager::release(); @@ -104,7 +105,6 @@ void MacGitverPrivate::bootGui() } MacGitver* MacGitverPrivate::sSelf = NULL; -RM::RepoMan* MacGitverPrivate::sRepoMan = NULL; Modules* MacGitverPrivate::sModules = NULL; MacGitver& MacGitver::self() @@ -117,9 +117,7 @@ MacGitver& MacGitver::self() RM::RepoMan& MacGitver::repoMan() { - Q_ASSERT(MacGitverPrivate::sRepoMan); - - return *MacGitverPrivate::sRepoMan; + return RM::RepoMan::instance(); } MacGitver::MacGitver(bool runGui) diff --git a/Libs/libMacGitverCore/App/MacGitver.hpp b/Libs/libMacGitverCore/App/MacGitver.hpp index 46ba1d41..000e8901 100644 --- a/Libs/libMacGitverCore/App/MacGitver.hpp +++ b/Libs/libMacGitverCore/App/MacGitver.hpp @@ -50,6 +50,7 @@ class MGV_CORE_API MacGitver public: static MacGitver& self(); + GW_DEPRECATED static RM::RepoMan& repoMan(); public: diff --git a/Libs/libMacGitverCore/App/MacGitverPrivate.hpp b/Libs/libMacGitverCore/App/MacGitverPrivate.hpp index 36a1d726..3b891404 100644 --- a/Libs/libMacGitverCore/App/MacGitverPrivate.hpp +++ b/Libs/libMacGitverCore/App/MacGitverPrivate.hpp @@ -64,5 +64,4 @@ private slots: MgvApp bsApp; static MacGitver* sSelf; static Modules* sModules; - static RM::RepoMan* sRepoMan; }; diff --git a/Libs/libMacGitverCore/App/MgvPrimaryWindow.cpp b/Libs/libMacGitverCore/App/MgvPrimaryWindow.cpp index c1c85aae..54b77419 100644 --- a/Libs/libMacGitverCore/App/MgvPrimaryWindow.cpp +++ b/Libs/libMacGitverCore/App/MgvPrimaryWindow.cpp @@ -64,10 +64,10 @@ MgvPrimaryWindow::MgvPrimaryWindow() w->show(); #endif - connect(&MacGitver::repoMan(), &RM::RepoMan::firstRepositoryOpened, + connect(&RM::RepoMan::instance(), &RM::RepoMan::firstRepositoryOpened, this, &MgvPrimaryWindow::activateModeForRepo); - connect(&MacGitver::repoMan(), &RM::RepoMan::lastRepositoryClosed, + connect(&RM::RepoMan::instance(), &RM::RepoMan::lastRepositoryClosed, this, &MgvPrimaryWindow::activateModeForRepo); setupFonts(); @@ -157,7 +157,7 @@ void MgvPrimaryWindow::moveToCenter() void MgvPrimaryWindow::activateModeForRepo() { - if (MacGitver::repoMan().repositories().count() > 0) { + if (RM::RepoMan::instance().repositories().count() > 0) { activateMode(QStringLiteral("HistoryMode")); } else { diff --git a/Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp b/Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp index 14545ed6..cb446fff 100644 --- a/Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp +++ b/Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp @@ -194,7 +194,7 @@ namespace RM void AutoRefresher::onRefreshGit() { Log::Manager().addMessage(trUtf8("Refreshing git repositories...")); - MacGitver::repoMan().refresh(); + RM::RepoMan::instance().refresh(); } void AutoRefresher::onRefreshIndex() diff --git a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp b/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp index bd2a5409..6a122fcd 100644 --- a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp +++ b/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp @@ -71,7 +71,8 @@ void RepoManConfigPage::apply() void RepoManConfigPage::init() { - RM::RepoMan* rm = &MacGitver::repoMan(); + RM::RepoMan* rm = &RM::RepoMan::instance(); + RM::Internal::RepoManPrivate* rmp = RM::Internal::BasePrivate::dataOf(rm); refresher = rmp->refresher; diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp index 4fa77d15..279a9612 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp +++ b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp @@ -70,6 +70,20 @@ namespace RM Events::delReceiver(this); } + RepoMan& RepoMan::instance() + { + static QPointer sSelf; + if (!sSelf) { + sSelf = new RepoMan; + } + return *sSelf; + } + + void RepoMan::terminate() + { + delete this; + } + /** * @brief Open a repository * diff --git a/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp b/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp index 063f87a9..4338faec 100644 --- a/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp +++ b/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp @@ -36,7 +36,7 @@ RepoStateWidget::RepoStateWidget() repo = NULL; setupUi(); - RM::RepoMan& rm = MacGitver::repoMan(); + RM::RepoMan& rm = RM::RepoMan::instance(); connect(&rm, &RM::RepoMan::refMoved, this, &RepoStateWidget::onUpdateHEAD); diff --git a/Modules/Logging/LoggingMode.cpp b/Modules/Logging/LoggingMode.cpp index cae33c97..55cdab78 100644 --- a/Modules/Logging/LoggingMode.cpp +++ b/Modules/Logging/LoggingMode.cpp @@ -31,7 +31,7 @@ LoggingMode::LoggingMode(QObject *parent) setEnabled(false); setDisplayOrder(100); - connect(&MacGitver::self().repoMan(), + connect(&RM::RepoMan::instance(), &RM::RepoMan::hasActiveRepositoryChanged, this, &LoggingMode::setEnabled); } diff --git a/Modules/Repository/CreateRepositoryDlg.cpp b/Modules/Repository/CreateRepositoryDlg.cpp index d2d55e52..a60ba1db 100644 --- a/Modules/Repository/CreateRepositoryDlg.cpp +++ b/Modules/Repository/CreateRepositoryDlg.cpp @@ -106,7 +106,7 @@ void CreateRepositoryDlg::accept() MacGitver::log(Log::Normal, trUtf8("Created a new repository at %1").arg(fn)); - MacGitver::repoMan().open(fn); + RM::RepoMan::instance().open(fn); QDialog::accept(); } diff --git a/Modules/Repository/RepoTreeView.cpp b/Modules/Repository/RepoTreeView.cpp index 4e22187c..55b44df5 100644 --- a/Modules/Repository/RepoTreeView.cpp +++ b/Modules/Repository/RepoTreeView.cpp @@ -56,11 +56,11 @@ RepoTreeView::RepoTreeView() connect( mRepos, SIGNAL(contextMenu(QModelIndex,QPoint)), this, SLOT(contextMenu(QModelIndex,QPoint)) ); - connect( &MacGitver::repoMan(), &RM::RepoMan::repositoryActivated, - this, &RepoTreeView::onRepoActivated); + connect(&RM::RepoMan::instance(), &RM::RepoMan::repositoryActivated, + this, &RepoTreeView::onRepoActivated); - connect( &MacGitver::repoMan(), &RM::RepoMan::repositoryDeactivated, - this, &RepoTreeView::onRepoDeactivated); + connect(&RM::RepoMan::instance(), &RM::RepoMan::repositoryDeactivated, + this, &RepoTreeView::onRepoDeactivated); } QModelIndex RepoTreeView::deeplyMapToSource( QModelIndex current ) const From 8287be53392443315b9ab2d2fc3f61157a4a876b Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Tue, 12 May 2015 07:23:59 +0100 Subject: [PATCH 06/60] Be explicit about namespace of Dumper class When we'll move most of Internal to Data, the Dumper class resides where it is. So this'll make things easier later on --- Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/BranchPrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/HeadPrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/NamespacePrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/RefLogPrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/RefPrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/RefTreeNodePrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/RemotePrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/SubmodulePrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Private/TagPrivate.hpp | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp index ea703066..b874d033 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp @@ -108,7 +108,7 @@ namespace RM virtual bool refreshCheckDispensable(); virtual bool inherits(ObjTypes type) const; virtual ObjTypes objType() const = 0; - virtual void dumpSelf(Dumper& dumper) const = 0; + virtual void dumpSelf(Internal::Dumper& dumper) const = 0; }; inline Repo* BasePrivate::repository() diff --git a/Libs/libMacGitverCore/RepoMan/Private/BranchPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/BranchPrivate.hpp index ad7f54bb..8a503a7a 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/BranchPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/BranchPrivate.hpp @@ -40,7 +40,7 @@ namespace RM void preTerminate(); bool refreshDetails(const Git::Reference& ref); void emitMoved(); - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; diff --git a/Libs/libMacGitverCore/RepoMan/Private/HeadPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/HeadPrivate.hpp index 2b67f393..e555157f 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/HeadPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/HeadPrivate.hpp @@ -38,7 +38,7 @@ namespace RM ObjTypes objType() const; bool refreshSelf(); QString displayName() const; - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; diff --git a/Libs/libMacGitverCore/RepoMan/Private/NamespacePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/NamespacePrivate.hpp index 8af0ae3b..7f1e5905 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/NamespacePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/NamespacePrivate.hpp @@ -40,7 +40,7 @@ namespace RM void postCreation(); void preTerminate(); QString displayName() const; - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; diff --git a/Libs/libMacGitverCore/RepoMan/Private/RefLogPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/RefLogPrivate.hpp index f5945d2a..756cb5b2 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RefLogPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/RefLogPrivate.hpp @@ -39,7 +39,7 @@ namespace RM bool refreshSelf(); void postCreation(); void preTerminate(); - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; }; diff --git a/Libs/libMacGitverCore/RepoMan/Private/RefPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/RefPrivate.hpp index 377b79d5..6ec1c426 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RefPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/RefPrivate.hpp @@ -42,7 +42,7 @@ namespace RM void preTerminate(); virtual bool refreshDetails(const Git::Reference& ref); virtual void emitMoved(); - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; diff --git a/Libs/libMacGitverCore/RepoMan/Private/RefTreeNodePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/RefTreeNodePrivate.hpp index fa60c315..77aa1011 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RefTreeNodePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/RefTreeNodePrivate.hpp @@ -41,7 +41,7 @@ namespace RM void preTerminate(); bool refreshCheckDispensable(); QString displayName() const; - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; diff --git a/Libs/libMacGitverCore/RepoMan/Private/RemotePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/RemotePrivate.hpp index 0c8b2fec..b89cfb90 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RemotePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/RemotePrivate.hpp @@ -42,7 +42,7 @@ namespace RM void postCreation(); void preTerminate(); QString displayName() const; - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; diff --git a/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp index 2095cb9f..3214c9e3 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp @@ -42,7 +42,7 @@ namespace RM bool refreshSelf(); void preTerminate(); QString displayName() const; - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; Heaven::Menu* contextMenuFor(Base* object); diff --git a/Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp index 2b16deab..abd40ada 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp @@ -43,7 +43,7 @@ namespace RM void preTerminate(); void postRefreshChildren(); QString displayName() const; - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; Repo* searchRepository(); diff --git a/Libs/libMacGitverCore/RepoMan/Private/SubmodulePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/SubmodulePrivate.hpp index 38bb9e65..61eeec81 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/SubmodulePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/SubmodulePrivate.hpp @@ -38,7 +38,7 @@ namespace RM ObjTypes objType() const; void postCreation(); void preTerminate(); - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; }; diff --git a/Libs/libMacGitverCore/RepoMan/Private/TagPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/TagPrivate.hpp index 896da3b1..eea7e885 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/TagPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/TagPrivate.hpp @@ -38,7 +38,7 @@ namespace RM ObjTypes objType() const; void postCreation(); void preTerminate(); - void dumpSelf(Dumper& dumper) const; + void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; }; From 9fd2d5957ee324b234c5ff4df42aab66fd026b02 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 10 May 2015 01:54:50 +0100 Subject: [PATCH 07/60] Move AutoRefresher out of RM-namespace --- .../RepoMan/AutoRefresher.cpp | 279 +++++++++--------- .../RepoMan/AutoRefresher.hpp | 74 +++-- .../RepoMan/Config/RepoManConfigPage.hpp | 7 +- 3 files changed, 174 insertions(+), 186 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp b/Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp index cb446fff..87ee1d77 100644 --- a/Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp +++ b/Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp @@ -26,183 +26,178 @@ #include "AutoRefresherCfg.hpp" -namespace RM +AutoRefresher::AutoRefresher(QObject* parent) + : QObject(parent) + , refreshGitTimer(NULL) + , refreshIndexTimer(NULL) + , refreshWorktreeTimer(NULL) { + new AutoRefresherCfg(this); - AutoRefresher::AutoRefresher(QObject* parent) - : QObject(parent) - , refreshGitTimer(NULL) - , refreshIndexTimer(NULL) - , refreshWorktreeTimer(NULL) - { - new AutoRefresherCfg(this); + forcedUpdate(); +} - forcedUpdate(); - } +AutoRefresher::~AutoRefresher() +{ +} - AutoRefresher::~AutoRefresher() - { - } +bool AutoRefresher::refreshEnabled() const +{ + return AutoRefresherCfg::refreshEnabled(); +} - bool AutoRefresher::refreshEnabled() const - { - return AutoRefresherCfg::refreshEnabled(); - } +bool AutoRefresher::refreshGitEnabled() const +{ + return AutoRefresherCfg::gitInterval() != 0; +} - bool AutoRefresher::refreshGitEnabled() const - { - return AutoRefresherCfg::gitInterval() != 0; - } +bool AutoRefresher::refreshIndexEnabled() const +{ + return AutoRefresherCfg::indexInterval() != 0; +} - bool AutoRefresher::refreshIndexEnabled() const - { - return AutoRefresherCfg::indexInterval() != 0; - } +bool AutoRefresher::refreshWorktreeEnabled() const +{ + return AutoRefresherCfg::worktreeInterval() != 0; +} - bool AutoRefresher::refreshWorktreeEnabled() const - { - return AutoRefresherCfg::worktreeInterval() != 0; - } +void AutoRefresher::setRefreshEnabled(bool enabled) +{ + AutoRefresherCfg::setRefreshEnabled(enabled); + forcedUpdate(); +} - void AutoRefresher::setRefreshEnabled(bool enabled) - { - AutoRefresherCfg::setRefreshEnabled(enabled); - forcedUpdate(); - } +void AutoRefresher::forcedUpdate() +{ + setRefreshGitInterval(AutoRefresherCfg::gitInterval(), true); + setRefreshIndexInterval(AutoRefresherCfg::indexInterval(), true); + setRefreshWorktreeInterval(AutoRefresherCfg::worktreeInterval(), true); +} - void AutoRefresher::forcedUpdate() - { - setRefreshGitInterval(AutoRefresherCfg::gitInterval(), true); - setRefreshIndexInterval(AutoRefresherCfg::indexInterval(), true); - setRefreshWorktreeInterval(AutoRefresherCfg::worktreeInterval(), true); +void AutoRefresher::setRefreshGitInterval(int interval, bool force) +{ + if (interval < 15) { + interval = 0; } - void AutoRefresher::setRefreshGitInterval(int interval, bool force) - { - if (interval < 15) { - interval = 0; - } - - if (interval == AutoRefresherCfg::gitInterval() ) { - if (!force) { - return; - } - } - else { - AutoRefresherCfg::setGitInterval(interval); + if (interval == AutoRefresherCfg::gitInterval() ) { + if (!force) { + return; } + } + else { + AutoRefresherCfg::setGitInterval(interval); + } - if (interval) { - if (!refreshGitTimer) { - refreshGitTimer = new QTimer(this); - connect(refreshGitTimer, SIGNAL(timeout()), - this, SLOT(onRefreshGit())); - } - refreshGitTimer->setInterval(interval * 1000); - refreshGitTimer->start(); + if (interval) { + if (!refreshGitTimer) { + refreshGitTimer = new QTimer(this); + connect(refreshGitTimer, SIGNAL(timeout()), + this, SLOT(onRefreshGit())); } - else { - if (refreshGitTimer) { - refreshGitTimer->stop(); - refreshGitTimer->deleteLater(); - refreshGitTimer = NULL; - } + refreshGitTimer->setInterval(interval * 1000); + refreshGitTimer->start(); + } + else { + if (refreshGitTimer) { + refreshGitTimer->stop(); + refreshGitTimer->deleteLater(); + refreshGitTimer = NULL; } } +} - void AutoRefresher::setRefreshIndexInterval(int interval, bool force) - { - if (interval < 30) { - interval = 0; - } +void AutoRefresher::setRefreshIndexInterval(int interval, bool force) +{ + if (interval < 30) { + interval = 0; + } - if (interval == AutoRefresherCfg::indexInterval() ) { - if (!force) { - return; - } - } - else { - AutoRefresherCfg::setIndexInterval(interval); + if (interval == AutoRefresherCfg::indexInterval() ) { + if (!force) { + return; } + } + else { + AutoRefresherCfg::setIndexInterval(interval); + } - if (interval) { - if (!refreshIndexTimer) { - refreshIndexTimer = new QTimer(this); - connect(refreshIndexTimer, SIGNAL(timeout()), - this, SLOT(onRefreshIndex())); - } - refreshIndexTimer->setInterval(interval * 1000); - refreshIndexTimer->start(); + if (interval) { + if (!refreshIndexTimer) { + refreshIndexTimer = new QTimer(this); + connect(refreshIndexTimer, SIGNAL(timeout()), + this, SLOT(onRefreshIndex())); } - else { - if (refreshIndexTimer) { - refreshIndexTimer->stop(); - refreshIndexTimer->deleteLater(); - refreshIndexTimer = NULL; - } + refreshIndexTimer->setInterval(interval * 1000); + refreshIndexTimer->start(); + } + else { + if (refreshIndexTimer) { + refreshIndexTimer->stop(); + refreshIndexTimer->deleteLater(); + refreshIndexTimer = NULL; } } +} - void AutoRefresher::setRefreshWorktreeInterval(int interval, bool force) - { - if (interval < 120) { - interval = 0; - } +void AutoRefresher::setRefreshWorktreeInterval(int interval, bool force) +{ + if (interval < 120) { + interval = 0; + } - if (interval == AutoRefresherCfg::worktreeInterval() ) { - if (!force) { - return; - } - } - else { - AutoRefresherCfg::setWorktreeInterval(interval); + if (interval == AutoRefresherCfg::worktreeInterval() ) { + if (!force) { + return; } + } + else { + AutoRefresherCfg::setWorktreeInterval(interval); + } - if (interval) { - if (!refreshWorktreeTimer) { - refreshWorktreeTimer = new QTimer(this); - connect(refreshWorktreeTimer, SIGNAL(timeout()), - this, SLOT(onRefreshWorktree())); - } - refreshWorktreeTimer->setInterval(interval * 1000); - refreshWorktreeTimer->start(); + if (interval) { + if (!refreshWorktreeTimer) { + refreshWorktreeTimer = new QTimer(this); + connect(refreshWorktreeTimer, SIGNAL(timeout()), + this, SLOT(onRefreshWorktree())); } - else { - if (refreshWorktreeTimer) { - refreshWorktreeTimer->stop(); - refreshWorktreeTimer->deleteLater(); - refreshWorktreeTimer = NULL; - } + refreshWorktreeTimer->setInterval(interval * 1000); + refreshWorktreeTimer->start(); + } + else { + if (refreshWorktreeTimer) { + refreshWorktreeTimer->stop(); + refreshWorktreeTimer->deleteLater(); + refreshWorktreeTimer = NULL; } } +} - int AutoRefresher::gitRefreshInterval() const - { - return AutoRefresherCfg::gitInterval(); - } - - int AutoRefresher::indexRefreshInterval() const - { - return AutoRefresherCfg::indexInterval(); - } +int AutoRefresher::gitRefreshInterval() const +{ + return AutoRefresherCfg::gitInterval(); +} - int AutoRefresher::worktreeRefreshInterval() const - { - return AutoRefresherCfg::worktreeInterval(); - } +int AutoRefresher::indexRefreshInterval() const +{ + return AutoRefresherCfg::indexInterval(); +} - void AutoRefresher::onRefreshGit() - { - Log::Manager().addMessage(trUtf8("Refreshing git repositories...")); - RM::RepoMan::instance().refresh(); - } +int AutoRefresher::worktreeRefreshInterval() const +{ + return AutoRefresherCfg::worktreeInterval(); +} - void AutoRefresher::onRefreshIndex() - { - } +void AutoRefresher::onRefreshGit() +{ + Log::Manager().addMessage(trUtf8("Refreshing git repositories...")); + RM::RepoMan::instance().refresh(); +} - void AutoRefresher::onRefreshWorktree() - { - } +void AutoRefresher::onRefreshIndex() +{ +} +void AutoRefresher::onRefreshWorktree() +{ } diff --git a/Libs/libMacGitverCore/RepoMan/AutoRefresher.hpp b/Libs/libMacGitverCore/RepoMan/AutoRefresher.hpp index 6d3de627..f5b79868 100644 --- a/Libs/libMacGitverCore/RepoMan/AutoRefresher.hpp +++ b/Libs/libMacGitverCore/RepoMan/AutoRefresher.hpp @@ -25,43 +25,39 @@ class QTimer; #include "libMacGitverCore/Config/ConfigUser.h" -namespace RM +class AutoRefresher + : public QObject { - - class AutoRefresher : public QObject - { - Q_OBJECT - public: - AutoRefresher(QObject* parent); - ~AutoRefresher(); - - public: - bool refreshEnabled() const; - bool refreshGitEnabled() const; - bool refreshIndexEnabled() const; - bool refreshWorktreeEnabled() const; - - int gitRefreshInterval() const; - int indexRefreshInterval() const; - int worktreeRefreshInterval() const; - - void setRefreshEnabled(bool enabled); - void setRefreshGitInterval(int interval, bool force = false); - void setRefreshIndexInterval(int interval, bool force = false); - void setRefreshWorktreeInterval(int interval, bool force = false); - - private slots: - void onRefreshGit(); - void onRefreshIndex(); - void onRefreshWorktree(); - - private: - void forcedUpdate(); - - private: - QTimer* refreshGitTimer; - QTimer* refreshIndexTimer; - QTimer* refreshWorktreeTimer; - }; - -} + Q_OBJECT +public: + AutoRefresher(QObject* parent); + ~AutoRefresher(); + +public: + bool refreshEnabled() const; + bool refreshGitEnabled() const; + bool refreshIndexEnabled() const; + bool refreshWorktreeEnabled() const; + + int gitRefreshInterval() const; + int indexRefreshInterval() const; + int worktreeRefreshInterval() const; + + void setRefreshEnabled(bool enabled); + void setRefreshGitInterval(int interval, bool force = false); + void setRefreshIndexInterval(int interval, bool force = false); + void setRefreshWorktreeInterval(int interval, bool force = false); + +private slots: + void onRefreshGit(); + void onRefreshIndex(); + void onRefreshWorktree(); + +private: + void forcedUpdate(); + +private: + QTimer* refreshGitTimer; + QTimer* refreshIndexTimer; + QTimer* refreshWorktreeTimer; +}; diff --git a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.hpp b/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.hpp index 979536bf..c3661d9b 100644 --- a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.hpp +++ b/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.hpp @@ -25,10 +25,7 @@ #include "ui_RepoManConfigPage.h" -namespace RM -{ - class AutoRefresher; -} +class AutoRefresher; class RepoManConfigPage : public ConfigPage @@ -55,5 +52,5 @@ private slots: QWidget* widget(); private: - RM::AutoRefresher* refresher; + AutoRefresher* refresher; }; From 049591813e60f3ba0be1f8ec53b8c2bb3574d373 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 22 Mar 2015 05:18:38 +0000 Subject: [PATCH 08/60] Make AutoRefresher internal --- Libs/libMacGitverCore/CMakeLists.txt | 8 ++++---- .../{RepoMan => MacGitver}/AutoRefresher.cpp | 2 +- .../{RepoMan => MacGitver}/AutoRefresher.hpp | 0 .../{RepoMan => MacGitver}/AutoRefresherCfg.ccfg | 0 .../libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp | 3 ++- Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp | 3 ++- 6 files changed, 9 insertions(+), 7 deletions(-) rename Libs/libMacGitverCore/{RepoMan => MacGitver}/AutoRefresher.cpp (98%) rename Libs/libMacGitverCore/{RepoMan => MacGitver}/AutoRefresher.hpp (100%) rename Libs/libMacGitverCore/{RepoMan => MacGitver}/AutoRefresherCfg.ccfg (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index b95cfac2..14aca99c 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -24,8 +24,8 @@ SET( SRC_FILES MacGitver/Module.cpp MacGitver/Modules.cpp MacGitver/GitPatchConsumer.cpp + MacGitver/AutoRefresher.cpp - RepoMan/AutoRefresher.cpp RepoMan/Base.cpp RepoMan/Ref.cpp RepoMan/Branch.cpp @@ -112,11 +112,11 @@ SET( PRI_HDR_FILES App/MacGitverPrivate.hpp App/MgvPrimaryWindowPrivate.hpp + MacGitver/AutoRefresher.hpp + Config/Ui/ConfigDialog.hpp Config/Ui/GeneralConfigPage.hpp - RepoMan/AutoRefresher.hpp - RepoMan/Private/BasePrivate.hpp RepoMan/Private/BranchPrivate.hpp RepoMan/Private/CollectionNodePrivate.hpp @@ -165,7 +165,7 @@ SET(RCC_FILES SET( HDR_FILES ${PRI_HDR_FILES} ${PUB_HDR_FILES} ) SET(CCFG_FILES - RepoMan/AutoRefresherCfg.ccfg + MacGitver/AutoRefresherCfg.ccfg ) CFGCOMP(CFG_FILES ${CCFG_FILES}) diff --git a/Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp b/Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp similarity index 98% rename from Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp rename to Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp index 87ee1d77..511748d6 100644 --- a/Libs/libMacGitverCore/RepoMan/AutoRefresher.cpp +++ b/Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp @@ -21,9 +21,9 @@ #include "libMacGitverCore/App/MacGitver.hpp" -#include "libMacGitverCore/RepoMan/AutoRefresher.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" +#include "MacGitver/AutoRefresher.hpp" #include "AutoRefresherCfg.hpp" AutoRefresher::AutoRefresher(QObject* parent) diff --git a/Libs/libMacGitverCore/RepoMan/AutoRefresher.hpp b/Libs/libMacGitverCore/MacGitver/AutoRefresher.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/AutoRefresher.hpp rename to Libs/libMacGitverCore/MacGitver/AutoRefresher.hpp diff --git a/Libs/libMacGitverCore/RepoMan/AutoRefresherCfg.ccfg b/Libs/libMacGitverCore/MacGitver/AutoRefresherCfg.ccfg similarity index 100% rename from Libs/libMacGitverCore/RepoMan/AutoRefresherCfg.ccfg rename to Libs/libMacGitverCore/MacGitver/AutoRefresherCfg.ccfg diff --git a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp b/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp index 6a122fcd..29ae2497 100644 --- a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp +++ b/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp @@ -18,10 +18,11 @@ */ #include "libMacGitverCore/RepoMan/Config/RepoManConfigPage.hpp" + #include "libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp" -#include "libMacGitverCore/RepoMan/AutoRefresher.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" +#include "libMacGitverCore/MacGitver/AutoRefresher.hpp" #include "libMacGitverCore/App/MacGitver.hpp" IMPLEMENT_NESTED_PAGE_CREATOR(RepoManConfigPage, 210) diff --git a/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp index 3214c9e3..a20525d2 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp @@ -22,7 +22,8 @@ #include "libMacGitverCore/RepoMan/Private/BasePrivate.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/AutoRefresher.hpp" + +#include "libMacGitverCore/MacGitver/AutoRefresher.hpp" #include "hic_RepoManActions.h" From 6dbb19d5fa79996ed2aa69afe22c15e77c0ea3e0 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 17 Apr 2015 02:10:33 +0100 Subject: [PATCH 09/60] Move refresher instance into MacGitver --- Libs/libMacGitverCore/App/MacGitver.cpp | 10 ++++++++ Libs/libMacGitverCore/App/MacGitver.hpp | 3 +++ .../libMacGitverCore/App/MacGitverPrivate.hpp | 2 ++ .../MacGitver/AutoRefresher.cpp | 24 +++++++++---------- .../MacGitver/AutoRefresher.hpp | 2 +- .../RepoMan/Config/RepoManConfigPage.cpp | 7 ++---- .../RepoMan/Private/RepoManPrivate.hpp | 1 - Libs/libMacGitverCore/RepoMan/RepoMan.cpp | 8 +------ 8 files changed, 31 insertions(+), 26 deletions(-) diff --git a/Libs/libMacGitverCore/App/MacGitver.cpp b/Libs/libMacGitverCore/App/MacGitver.cpp index b8974e17..3eb12aad 100644 --- a/Libs/libMacGitverCore/App/MacGitver.cpp +++ b/Libs/libMacGitverCore/App/MacGitver.cpp @@ -35,6 +35,7 @@ #include "libMacGitverCore/MacGitver/Modules.h" #include "libMacGitverCore/RepoMan/RepoMan.hpp" #include "libMacGitverCore/RepoMan/Config/RepoManConfigPage.hpp" +#include "libMacGitverCore/MacGitver/AutoRefresher.hpp" /** * @class MacGitver @@ -55,6 +56,7 @@ MacGitverPrivate::MacGitverPrivate(MacGitver* owner, bool runGui) : isGui(runGui) + , refresher(nullptr) { sSelf = owner; } @@ -67,6 +69,9 @@ void MacGitverPrivate::init() QApplication::setOrganizationName(QStringLiteral("MacGitver")); QApplication::setApplicationName(QStringLiteral("MacGitver")); + // only start the auto refresher if we're running a GUI + refresher = new AutoRefresher; + Heaven::IconManager::self().defaultProvider()->addSearchPath(QStringLiteral(":/Images")); } else { QApplication::setOrganizationName(QStringLiteral("MacGitver")); @@ -207,3 +212,8 @@ bool MacGitver::isRunningGui() const { return d->isGui; } + +AutoRefresher* MacGitver::refresher() const +{ + return d->refresher; +} diff --git a/Libs/libMacGitverCore/App/MacGitver.hpp b/Libs/libMacGitverCore/App/MacGitver.hpp index 000e8901..276be1ee 100644 --- a/Libs/libMacGitverCore/App/MacGitver.hpp +++ b/Libs/libMacGitverCore/App/MacGitver.hpp @@ -38,6 +38,7 @@ namespace RM typedef BlueSky::ViewDescriptor::CreatorFunc MgvViewCreator; +class AutoRefresher; class MacGitverPrivate; class MGV_CORE_API MacGitver @@ -67,6 +68,8 @@ class MGV_CORE_API MacGitver MgvViewCreator creator); void unregisterView(const BlueSky::ViewIdentifier& identifier); + AutoRefresher *refresher() const; + static void log(Log::Type type, const QString& logMessage); static void log(Log::Type type, const char* logMessage); static void log(Log::Type type, const Git::Result& r, const char* logMessage = nullptr); diff --git a/Libs/libMacGitverCore/App/MacGitverPrivate.hpp b/Libs/libMacGitverCore/App/MacGitverPrivate.hpp index 3b891404..6516c2e9 100644 --- a/Libs/libMacGitverCore/App/MacGitverPrivate.hpp +++ b/Libs/libMacGitverCore/App/MacGitverPrivate.hpp @@ -27,6 +27,7 @@ class QDir; class Modules; +class AutoRefresher; struct MgvViewInfo { @@ -62,6 +63,7 @@ private slots: Git::GitWrap mGitWrap; bool isGui; MgvApp bsApp; + AutoRefresher* refresher; static MacGitver* sSelf; static Modules* sModules; }; diff --git a/Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp b/Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp index 511748d6..49a89c22 100644 --- a/Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp +++ b/Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp @@ -17,20 +17,19 @@ * */ -#include - -#include "libMacGitverCore/App/MacGitver.hpp" +#include "libMacGitverCore/MacGitver/AutoRefresher.hpp" +#include "AutoRefresherCfg.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "MacGitver/AutoRefresher.hpp" -#include "AutoRefresherCfg.hpp" +#include +#include -AutoRefresher::AutoRefresher(QObject* parent) - : QObject(parent) - , refreshGitTimer(NULL) - , refreshIndexTimer(NULL) - , refreshWorktreeTimer(NULL) +AutoRefresher::AutoRefresher() + : QObject() + , refreshGitTimer(nullptr) + , refreshIndexTimer(nullptr) + , refreshWorktreeTimer(nullptr) { new AutoRefresherCfg(this); @@ -190,14 +189,15 @@ int AutoRefresher::worktreeRefreshInterval() const void AutoRefresher::onRefreshGit() { - Log::Manager().addMessage(trUtf8("Refreshing git repositories...")); - RM::RepoMan::instance().refresh(); + qDebug() << "Refresh Repository currently not implemented."; } void AutoRefresher::onRefreshIndex() { + qDebug() << "Refresh Index currently not implemented."; } void AutoRefresher::onRefreshWorktree() { + qDebug() << "Refresh Worktree currently not implemented."; } diff --git a/Libs/libMacGitverCore/MacGitver/AutoRefresher.hpp b/Libs/libMacGitverCore/MacGitver/AutoRefresher.hpp index f5b79868..c7d42d9c 100644 --- a/Libs/libMacGitverCore/MacGitver/AutoRefresher.hpp +++ b/Libs/libMacGitverCore/MacGitver/AutoRefresher.hpp @@ -30,7 +30,7 @@ class AutoRefresher { Q_OBJECT public: - AutoRefresher(QObject* parent); + AutoRefresher(); ~AutoRefresher(); public: diff --git a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp b/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp index 29ae2497..998d7910 100644 --- a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp +++ b/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp @@ -29,7 +29,7 @@ IMPLEMENT_NESTED_PAGE_CREATOR(RepoManConfigPage, 210) RepoManConfigPage::RepoManConfigPage(ConfigDialog* dlg) : ConfigPage(dlg) - , refresher(NULL) + , refresher(MacGitver::self().refresher()) { setupUi(this); @@ -72,10 +72,7 @@ void RepoManConfigPage::apply() void RepoManConfigPage::init() { - RM::RepoMan* rm = &RM::RepoMan::instance(); - - RM::Internal::RepoManPrivate* rmp = RM::Internal::BasePrivate::dataOf(rm); - refresher = rmp->refresher; + Q_ASSERT(refresher); grpEnableAutoRefresh->setChecked(refresher->refreshEnabled()); diff --git a/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp index a20525d2..a6afb7e5 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp @@ -51,7 +51,6 @@ namespace RM public: Repo::List repos; Repo* activeRepo; - AutoRefresher* refresher; }; } diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp index 279a9612..b4db3d4a 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp +++ b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp @@ -186,14 +186,8 @@ namespace RM RepoManPrivate::RepoManPrivate(RepoMan* _pub) : BasePrivate(_pub) , activeRepo(NULL) - , refresher(NULL) { setupActions(_pub); - - // only start the auto refresher if we're running a GUI - if (MacGitver::self().isRunningGui()) { - refresher = new AutoRefresher(_pub); - } } bool RepoManPrivate::refreshSelf() @@ -257,7 +251,7 @@ namespace RM break; } - return NULL; + return nullptr; } } From f1bba00c11e93d11831c5a5960672025e9d47342 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 22 Mar 2015 18:04:23 +0000 Subject: [PATCH 10/60] Change RepoMan's "Set" to "List" everywhere --- Libs/libMacGitverCore/RepoMan/Base.cpp | 14 +++++------ Libs/libMacGitverCore/RepoMan/Base.hpp | 24 +++++-------------- Libs/libMacGitverCore/RepoMan/Branch.hpp | 1 - .../RepoMan/CollectionNode.hpp | 1 - Libs/libMacGitverCore/RepoMan/Head.hpp | 1 - Libs/libMacGitverCore/RepoMan/Namespace.hpp | 1 - .../RepoMan/Private/BasePrivate.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Ref.hpp | 1 - Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp | 1 - Libs/libMacGitverCore/RepoMan/Remote.hpp | 1 - Libs/libMacGitverCore/RepoMan/Repo.cpp | 6 ++--- Libs/libMacGitverCore/RepoMan/Repo.hpp | 3 +-- Libs/libMacGitverCore/RepoMan/Tag.hpp | 1 - Modules/Repository/RepoInfoModel.cpp | 7 ++---- 14 files changed, 20 insertions(+), 44 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Base.cpp b/Libs/libMacGitverCore/RepoMan/Base.cpp index c8d7e53e..e4d57692 100644 --- a/Libs/libMacGitverCore/RepoMan/Base.cpp +++ b/Libs/libMacGitverCore/RepoMan/Base.cpp @@ -117,7 +117,7 @@ namespace RM * * @return A set of all children of this object (unfiltered). */ - Base::Set Base::childObjects() const + Base::List Base::childObjects() const { RM_CD(Base); @@ -132,15 +132,15 @@ namespace RM * @return A set of children of this object filtered by object type. * */ - Base::Set Base::childObjects(ObjTypes type) const + Base::List Base::childObjects(ObjTypes type) const { RM_CD(Base); - Set children; + List children; foreach(Base* child, d->mChildren) { if (child->objType() == type) { - children.insert(child); + children.append(child); } } @@ -354,7 +354,7 @@ namespace RM { Q_ASSERT(object); Q_ASSERT(!mChildren.contains(object)); - mChildren.insert(object); + mChildren.append(object); } /** @@ -366,7 +366,7 @@ namespace RM void BasePrivate::removeChildObject(Base* object) { Q_ASSERT(mChildren.contains(object)); - mChildren.remove(object); + mChildren.removeOne(object); } /** @@ -597,7 +597,7 @@ namespace RM Base* current = mPub; foreach (QString scope, scopes) { - RefTreeNode::Set nodes = current->childObjects(); + RefTreeNode::List nodes = current->childObjects(); RefTreeNode* next = NULL; foreach(RefTreeNode* child, nodes) { diff --git a/Libs/libMacGitverCore/RepoMan/Base.hpp b/Libs/libMacGitverCore/RepoMan/Base.hpp index 888212b8..206db8c4 100644 --- a/Libs/libMacGitverCore/RepoMan/Base.hpp +++ b/Libs/libMacGitverCore/RepoMan/Base.hpp @@ -89,7 +89,6 @@ namespace RM public: typedef QVector< Base* > List; - typedef QSet< Base* > Set; protected: Base(Internal::BasePrivate& _d); @@ -106,11 +105,11 @@ namespace RM Base* parentObject() const; - Set childObjects() const; - Set childObjects(ObjTypes type) const; + List childObjects() const; + List childObjects(ObjTypes type) const; template< class T > - typename T::Set childObjects() const; + typename T::List childObjects() const; template< class T > bool isA() const; @@ -149,24 +148,13 @@ namespace RM } template< class T > - inline typename T::Set Base::childObjects() const + inline typename T::List Base::childObjects() const { - /* - Set children = childObjects(T::StaticObjType); - typename T::Set typedChildren; - - foreach(Base* child, children) { - typedChildren.insert(static_cast(child)); - } - - return typedChildren; - */ - // Equivalent, but faster: - typename T::Set children; + typename T::List children; foreach(Base* child, childObjects()) { if (child->inheritsRepoManType()) { - children.insert(static_cast(child)); + children.append(static_cast(child)); } } diff --git a/Libs/libMacGitverCore/RepoMan/Branch.hpp b/Libs/libMacGitverCore/RepoMan/Branch.hpp index f511f537..4c768a04 100644 --- a/Libs/libMacGitverCore/RepoMan/Branch.hpp +++ b/Libs/libMacGitverCore/RepoMan/Branch.hpp @@ -29,7 +29,6 @@ namespace RM public: enum { StaticObjectType = BranchObject }; typedef QVector< Branch* > List; - typedef QSet< Branch* > Set; public: Branch(Base* parent, const Git::Reference& ref); diff --git a/Libs/libMacGitverCore/RepoMan/CollectionNode.hpp b/Libs/libMacGitverCore/RepoMan/CollectionNode.hpp index b0ea932d..98ac869a 100644 --- a/Libs/libMacGitverCore/RepoMan/CollectionNode.hpp +++ b/Libs/libMacGitverCore/RepoMan/CollectionNode.hpp @@ -38,7 +38,6 @@ namespace RM public: enum { StaticObjectType = CollectionNodeObject }; typedef Internal::CollectionNodePrivate Private; - typedef QSet< CollectionNode* > Set; typedef QVector< CollectionNode* > List; public: diff --git a/Libs/libMacGitverCore/RepoMan/Head.hpp b/Libs/libMacGitverCore/RepoMan/Head.hpp index 5e26d838..4e6eccc8 100644 --- a/Libs/libMacGitverCore/RepoMan/Head.hpp +++ b/Libs/libMacGitverCore/RepoMan/Head.hpp @@ -36,7 +36,6 @@ namespace RM public: enum { StaticObjectType = HeadObject }; typedef Internal::HeadPrivate Private; - typedef QSet< Head* > Set; typedef QVector< Head* > List; public: diff --git a/Libs/libMacGitverCore/RepoMan/Namespace.hpp b/Libs/libMacGitverCore/RepoMan/Namespace.hpp index 2a0d986e..cacc4060 100644 --- a/Libs/libMacGitverCore/RepoMan/Namespace.hpp +++ b/Libs/libMacGitverCore/RepoMan/Namespace.hpp @@ -35,7 +35,6 @@ namespace RM public: enum { StaticObjectType = NamespaceObject }; typedef Internal::NamespacePrivate Private; - typedef QSet< Namespace* > Set; typedef QVector< Namespace* > List; public: diff --git a/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp index b874d033..84ff9b7b 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp @@ -53,7 +53,7 @@ namespace RM Base* mPub; Repo* mRepo; BasePrivate* mParentObj; - Base::Set mChildren; + Base::List mChildren; public: template< class T > T* pub() diff --git a/Libs/libMacGitverCore/RepoMan/Ref.hpp b/Libs/libMacGitverCore/RepoMan/Ref.hpp index ada176ce..e5a55c6f 100644 --- a/Libs/libMacGitverCore/RepoMan/Ref.hpp +++ b/Libs/libMacGitverCore/RepoMan/Ref.hpp @@ -42,7 +42,6 @@ namespace RM public: enum { StaticObjectType = RefObject }; - typedef QSet< Ref* > Set; typedef QList< Ref* > List; protected: diff --git a/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp b/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp index be0f5455..c49210d4 100644 --- a/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp +++ b/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp @@ -36,7 +36,6 @@ namespace RM public: enum { StaticObjectType = RefTreeNodeObject }; typedef Internal::RefTreeNodePrivate Private; - typedef QSet< RefTreeNode* > Set; typedef QList< RefTreeNode* > List; public: diff --git a/Libs/libMacGitverCore/RepoMan/Remote.hpp b/Libs/libMacGitverCore/RepoMan/Remote.hpp index d47d5e6c..2392bb7e 100644 --- a/Libs/libMacGitverCore/RepoMan/Remote.hpp +++ b/Libs/libMacGitverCore/RepoMan/Remote.hpp @@ -36,7 +36,6 @@ namespace RM public: enum { StaticObjectType = RemoteObject }; typedef Internal::RemotePrivate Private; - typedef QSet< Remote* > Set; typedef QVector< Remote* > List; public: diff --git a/Libs/libMacGitverCore/RepoMan/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Repo.cpp index 6a62258a..ea148a0b 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.cpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.cpp @@ -144,7 +144,7 @@ namespace RM return NULL; } - Repo::Set Repo::submodules() const + Repo::List Repo::submodules() const { return childObjects(); } @@ -437,7 +437,7 @@ namespace RM return; } - Repo::Set oldSubmodules = pub()->submodules(); + Repo::List oldSubmodules = pub()->submodules(); foreach (Git::Submodule sub, subs) { Git::Result child; @@ -459,7 +459,7 @@ namespace RM subInfo = new Submodule(subRepo, p); } else { - oldSubmodules.remove(subInfo); + oldSubmodules.removeOne(subInfo); } } diff --git a/Libs/libMacGitverCore/RepoMan/Repo.hpp b/Libs/libMacGitverCore/RepoMan/Repo.hpp index 68789b34..203be87b 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.hpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.hpp @@ -46,7 +46,6 @@ namespace RM public: enum { StaticObjectType = RepoObject }; typedef Internal::RepoPrivate Private; - typedef QSet< Repo* > Set; typedef QVector< Repo* > List; protected: @@ -67,7 +66,7 @@ namespace RM bool isInitializing() const; Repo* parentRepository(); - Set submodules() const; + List submodules() const; QString path() const; diff --git a/Libs/libMacGitverCore/RepoMan/Tag.hpp b/Libs/libMacGitverCore/RepoMan/Tag.hpp index e40064d8..f5d57e10 100644 --- a/Libs/libMacGitverCore/RepoMan/Tag.hpp +++ b/Libs/libMacGitverCore/RepoMan/Tag.hpp @@ -29,7 +29,6 @@ namespace RM public: enum { StaticObjectType = TagObject }; typedef QVector< Tag* > List; - typedef QSet< Tag* > Set; public: Tag(Base* _parent, const Git::Reference& _ref); diff --git a/Modules/Repository/RepoInfoModel.cpp b/Modules/Repository/RepoInfoModel.cpp index c9886c7e..eb512740 100644 --- a/Modules/Repository/RepoInfoModel.cpp +++ b/Modules/Repository/RepoInfoModel.cpp @@ -170,11 +170,8 @@ QModelIndex RepoInfoModel::info2Index(RM::Repo* info) const if( info->parentRepository() ) { - RM::Repo::Set sms = info->parentRepository()->submodules(); - RM::Repo::List list; - foreach (RM::Repo* r, sms) { - list.append(r); - } + RM::Repo::List list = info->parentRepository()->submodules(); + // ###REPOMAN Shouldn't this be sorted? row = list.indexOf(info); } else From 32705f552845993f5f5780a6d63f9754aea18ae7 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 10 May 2015 19:42:33 +0100 Subject: [PATCH 11/60] Move RepoMan Config Page to Config-Area --- Libs/libMacGitverCore/App/MacGitver.cpp | 2 +- Libs/libMacGitverCore/CMakeLists.txt | 9 +++------ .../{RepoMan/Config => Config/Ui}/RepoManConfigPage.cpp | 5 +---- .../{RepoMan/Config => Config/Ui}/RepoManConfigPage.hpp | 0 .../{RepoMan/Config => Config/Ui}/RepoManConfigPage.ui | 0 5 files changed, 5 insertions(+), 11 deletions(-) rename Libs/libMacGitverCore/{RepoMan/Config => Config/Ui}/RepoManConfigPage.cpp (95%) rename Libs/libMacGitverCore/{RepoMan/Config => Config/Ui}/RepoManConfigPage.hpp (100%) rename Libs/libMacGitverCore/{RepoMan/Config => Config/Ui}/RepoManConfigPage.ui (100%) diff --git a/Libs/libMacGitverCore/App/MacGitver.cpp b/Libs/libMacGitverCore/App/MacGitver.cpp index 3eb12aad..cbbc8594 100644 --- a/Libs/libMacGitverCore/App/MacGitver.cpp +++ b/Libs/libMacGitverCore/App/MacGitver.cpp @@ -32,9 +32,9 @@ #include "libMacGitverCore/App/MgvPrimaryWindow.hpp" #include "libMacGitverCore/Config/Config.h" #include "libMacGitverCore/Config/Ui/GeneralConfigPage.hpp" +#include "libMacGitverCore/Config/Ui//RepoManConfigPage.hpp" #include "libMacGitverCore/MacGitver/Modules.h" #include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Config/RepoManConfigPage.hpp" #include "libMacGitverCore/MacGitver/AutoRefresher.hpp" /** diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 14aca99c..ba431836 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -20,6 +20,7 @@ SET( SRC_FILES Config/Ui/ConfigPage.cpp Config/Ui/GeneralConfigPage.cpp Config/Ui/ConfigPageProvider.cpp + Config/Ui/RepoManConfigPage.cpp MacGitver/Module.cpp MacGitver/Modules.cpp @@ -43,8 +44,6 @@ SET( SRC_FILES RepoMan/Private/Dumper.cpp - RepoMan/Config/RepoManConfigPage.cpp - SHMParser/ShellExpand.cpp Widgets/ExpandableDlg.cpp @@ -116,6 +115,7 @@ SET( PRI_HDR_FILES Config/Ui/ConfigDialog.hpp Config/Ui/GeneralConfigPage.hpp + Config/Ui/RepoManConfigPage.hpp RepoMan/Private/BasePrivate.hpp RepoMan/Private/BranchPrivate.hpp @@ -132,8 +132,6 @@ SET( PRI_HDR_FILES RepoMan/Private/Dumper.hpp RepoMan/Private/HeadPrivate.hpp - RepoMan/Config/RepoManConfigPage.hpp - Widgets/StringSelectorWidgetPrivate.h Widgets/FlatTreeModelPrivate.h Widgets/RepoStateWidget.hpp @@ -145,8 +143,7 @@ SET( UI_FILES Config/Ui/ConfigDialog.ui Config/Ui/GeneralConfigPage.ui - - RepoMan/Config/RepoManConfigPage.ui + Config/Ui/RepoManConfigPage.ui Widgets/ExpandableDlg.ui ) diff --git a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp b/Libs/libMacGitverCore/Config/Ui/RepoManConfigPage.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp rename to Libs/libMacGitverCore/Config/Ui/RepoManConfigPage.cpp index 998d7910..e3a82093 100644 --- a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.cpp +++ b/Libs/libMacGitverCore/Config/Ui/RepoManConfigPage.cpp @@ -17,10 +17,7 @@ * */ -#include "libMacGitverCore/RepoMan/Config/RepoManConfigPage.hpp" - -#include "libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" +#include "libMacGitverCore/Config/Ui/RepoManConfigPage.hpp" #include "libMacGitverCore/MacGitver/AutoRefresher.hpp" #include "libMacGitverCore/App/MacGitver.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.hpp b/Libs/libMacGitverCore/Config/Ui/RepoManConfigPage.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.hpp rename to Libs/libMacGitverCore/Config/Ui/RepoManConfigPage.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.ui b/Libs/libMacGitverCore/Config/Ui/RepoManConfigPage.ui similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Config/RepoManConfigPage.ui rename to Libs/libMacGitverCore/Config/Ui/RepoManConfigPage.ui From 57ac741b981d65a51e5d14e5cdbd775cf694c616 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Wed, 13 May 2015 22:13:43 +0100 Subject: [PATCH 12/60] Remove all occurence of CollectionNode* --- Libs/libMacGitverCore/CMakeLists.txt | 3 - Libs/libMacGitverCore/RepoMan/Base.cpp | 15 -- Libs/libMacGitverCore/RepoMan/Base.hpp | 10 -- .../RepoMan/CollectionNode.cpp | 127 ------------- .../RepoMan/CollectionNode.hpp | 51 ------ Libs/libMacGitverCore/RepoMan/Head.hpp | 1 - Libs/libMacGitverCore/RepoMan/Namespace.cpp | 27 --- Libs/libMacGitverCore/RepoMan/Namespace.hpp | 7 - .../RepoMan/Private/BasePrivate.hpp | 2 - .../RepoMan/Private/CollectionNodePrivate.hpp | 54 ------ Libs/libMacGitverCore/RepoMan/Remote.cpp | 10 -- Libs/libMacGitverCore/RepoMan/Remote.hpp | 1 - Libs/libMacGitverCore/RepoMan/Repo.cpp | 169 +----------------- Libs/libMacGitverCore/RepoMan/Repo.hpp | 4 - Libs/libMacGitverCore/RepoMan/RepoMan.cpp | 13 -- 15 files changed, 3 insertions(+), 491 deletions(-) delete mode 100644 Libs/libMacGitverCore/RepoMan/CollectionNode.cpp delete mode 100644 Libs/libMacGitverCore/RepoMan/CollectionNode.hpp delete mode 100644 Libs/libMacGitverCore/RepoMan/Private/CollectionNodePrivate.hpp diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index ba431836..4ee6c1c1 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -30,7 +30,6 @@ SET( SRC_FILES RepoMan/Base.cpp RepoMan/Ref.cpp RepoMan/Branch.cpp - RepoMan/CollectionNode.cpp RepoMan/Events.cpp RepoMan/Repo.cpp RepoMan/RepoMan.cpp @@ -78,7 +77,6 @@ SET( PUB_HDR_FILES RepoMan/Base.hpp RepoMan/Events.hpp - RepoMan/CollectionNode.hpp RepoMan/Ref.hpp RepoMan/Repo.hpp RepoMan/RepoMan.hpp @@ -119,7 +117,6 @@ SET( PRI_HDR_FILES RepoMan/Private/BasePrivate.hpp RepoMan/Private/BranchPrivate.hpp - RepoMan/Private/CollectionNodePrivate.hpp RepoMan/Private/NamespacePrivate.hpp RepoMan/Private/RefPrivate.hpp RepoMan/Private/RefLogPrivate.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Base.cpp b/Libs/libMacGitverCore/RepoMan/Base.cpp index e4d57692..dd3937ea 100644 --- a/Libs/libMacGitverCore/RepoMan/Base.cpp +++ b/Libs/libMacGitverCore/RepoMan/Base.cpp @@ -28,7 +28,6 @@ #include "Repo.hpp" #include "RepoMan.hpp" #include "RefTreeNode.hpp" -#include "CollectionNode.hpp" #include "Events.hpp" #include "Private/RepoManPrivate.hpp" @@ -623,20 +622,6 @@ namespace RM return static_cast< RefTreeNode* >(current); } - - CollectionNode* BasePrivate::getOrCreateCollection(CollectionTypes ctype) - { - CollectionNode* cn; - - foreach (cn, mPub->childObjects()) { - if (cn->collectionType() == ctype) { - return cn; - } - } - - return new CollectionNode(ctype, mPub); - } - Repo* BasePrivate::searchRepository() { if (!mRepo) { diff --git a/Libs/libMacGitverCore/RepoMan/Base.hpp b/Libs/libMacGitverCore/RepoMan/Base.hpp index 206db8c4..0e880239 100644 --- a/Libs/libMacGitverCore/RepoMan/Base.hpp +++ b/Libs/libMacGitverCore/RepoMan/Base.hpp @@ -39,7 +39,6 @@ namespace RM { InvalidObject, - CollectionNodeObject, NamespaceObject, RepoManagerObject, @@ -58,17 +57,8 @@ namespace RM RefLogObject }; - enum CollectionTypes - { - ctBranches, - ctNamespaces, - ctNotes, - ctTags - }; - class Repo; class RefTreeNode; - class CollectionNode; class Namespace; class Ref; class Remote; diff --git a/Libs/libMacGitverCore/RepoMan/CollectionNode.cpp b/Libs/libMacGitverCore/RepoMan/CollectionNode.cpp deleted file mode 100644 index 8f703ffb..00000000 --- a/Libs/libMacGitverCore/RepoMan/CollectionNode.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2015 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include - -#include "libHeavenIcons/IconRef.hpp" - -#include "CollectionNode.hpp" - -#include "Private/Dumper.hpp" -#include "Private/CollectionNodePrivate.hpp" - -namespace RM -{ - - using namespace Internal; - - CollectionNode::CollectionNode(CollectionTypes _ctype, Base* _parent) - : Base(*new CollectionNodePrivate(this, _ctype)) - { - RM_D(CollectionNode); - d->linkToParent(_parent); - } - - - CollectionTypes CollectionNode::collectionType() const - { - RM_CD(CollectionNode); - return d->ctype; - } - - QString CollectionNode::collectionTypeName() const - { - RM_CD(CollectionNode); - - switch (d->ctype) { - case ctBranches: return tr("Branches"); - case ctTags: return tr("Tags"); - case ctNamespaces: return tr("Namespaces"); - case ctNotes: return tr("Notes"); - default: return QString(); - } - } - - //-- CollectionNodePrivate --------------------------------------------------------------------- - - CollectionNodePrivate::CollectionNodePrivate(CollectionNode* _pub, CollectionTypes _ctype) - : BasePrivate(_pub) - , ctype(_ctype) - { - } - - ObjTypes CollectionNodePrivate::objType() const - { - return CollectionNodeObject; - } - - QString CollectionNodePrivate::displayName() const - { - return pub()->collectionTypeName(); - } - - void CollectionNodePrivate::dumpSelf(Internal::Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("Collection '%2' 0x%1")) - .arg(quintptr(mPub),0,16) - .arg(displayName())); - } - - bool CollectionNodePrivate::refreshSelf() - { - return true; - } - - void CollectionNodePrivate::postCreation() - { - BasePrivate::postCreation(); - } - - void CollectionNodePrivate::preTerminate() - { - BasePrivate::preTerminate(); - } - - QString CollectionNodePrivate::objectTypeName() const - { - return QStringLiteral("CollectionNode"); - } - - Heaven::IconRef CollectionNodePrivate::icon(bool small) const - { - QString size = small ? QStringLiteral("@16") : QStringLiteral("@24"); - QString s; - - switch (ctype) { - case ctBranches: s = QStringLiteral("Branches"); break; - case ctTags: s = QStringLiteral("Tags"); break; - case ctNotes: s = QStringLiteral("Notes"); break; - case ctNamespaces: s = QStringLiteral("Namespaces"); break; - default: return Heaven::IconRef(); - } - - return Heaven::IconRef::fromString(QChar(L'#') % s % size); - } - - bool CollectionNodePrivate::inherits(ObjTypes type) const - { - return type == CollectionNodeObject || BasePrivate::inherits(type); - } - -} diff --git a/Libs/libMacGitverCore/RepoMan/CollectionNode.hpp b/Libs/libMacGitverCore/RepoMan/CollectionNode.hpp deleted file mode 100644 index 98ac869a..00000000 --- a/Libs/libMacGitverCore/RepoMan/CollectionNode.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2015 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#pragma once - -#include - -#include "Base.hpp" - -namespace RM -{ - - namespace Internal - { - class CollectionNodePrivate; - } - - class MGV_CORE_API CollectionNode : public Base - { - Q_DECLARE_TR_FUNCTIONS(RM_CollectionNode) - - public: - enum { StaticObjectType = CollectionNodeObject }; - typedef Internal::CollectionNodePrivate Private; - typedef QVector< CollectionNode* > List; - - public: - CollectionNode(CollectionTypes _ctype, Base* parent); - - public: - CollectionTypes collectionType() const; - QString collectionTypeName() const; - }; - -} diff --git a/Libs/libMacGitverCore/RepoMan/Head.hpp b/Libs/libMacGitverCore/RepoMan/Head.hpp index 4e6eccc8..23524667 100644 --- a/Libs/libMacGitverCore/RepoMan/Head.hpp +++ b/Libs/libMacGitverCore/RepoMan/Head.hpp @@ -20,7 +20,6 @@ #pragma once #include "RepoMan/Base.hpp" -#include "RepoMan/CollectionNode.hpp" #include "RepoMan/Branch.hpp" namespace RM diff --git a/Libs/libMacGitverCore/RepoMan/Namespace.cpp b/Libs/libMacGitverCore/RepoMan/Namespace.cpp index 19ba0b7e..c84a0401 100644 --- a/Libs/libMacGitverCore/RepoMan/Namespace.cpp +++ b/Libs/libMacGitverCore/RepoMan/Namespace.cpp @@ -35,33 +35,6 @@ namespace RM d->linkToParent(_parent); } - CollectionNode* Namespace::branches() - { - RM_D(Namespace); - - return d->getOrCreateCollection( ctBranches ); - } - - CollectionNode* Namespace::tags() - { - RM_D(Namespace); - return d->getOrCreateCollection( ctTags ); - } - - CollectionNode* Namespace::namespaces() - { - RM_D(Namespace); - - return d->getOrCreateCollection( ctNamespaces ); - } - - CollectionNode* Namespace::notes() - { - RM_D(Namespace); - - return d->getOrCreateCollection( ctNotes ); - } - QString Namespace::name() const { RM_D(Namespace); diff --git a/Libs/libMacGitverCore/RepoMan/Namespace.hpp b/Libs/libMacGitverCore/RepoMan/Namespace.hpp index cacc4060..6be8c612 100644 --- a/Libs/libMacGitverCore/RepoMan/Namespace.hpp +++ b/Libs/libMacGitverCore/RepoMan/Namespace.hpp @@ -20,7 +20,6 @@ #pragma once #include "Base.hpp" -#include "CollectionNode.hpp" namespace RM { @@ -42,12 +41,6 @@ namespace RM public: QString name() const; - - public: - CollectionNode* branches(); - CollectionNode* namespaces(); - CollectionNode* notes(); - CollectionNode* tags(); }; } diff --git a/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp index 84ff9b7b..678fa1b8 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp @@ -84,8 +84,6 @@ namespace RM Base* findRefParent(const QStringList& scopes, bool create); RefTreeNode* findRefTreeNode(const QStringList& scopes, bool create); - CollectionNode* getOrCreateCollection(CollectionTypes ctype); - template< class T > static typename T::Private* dataOf(Base* b) { BasePrivate* p = b->mData; diff --git a/Libs/libMacGitverCore/RepoMan/Private/CollectionNodePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/CollectionNodePrivate.hpp deleted file mode 100644 index ca4fd49d..00000000 --- a/Libs/libMacGitverCore/RepoMan/Private/CollectionNodePrivate.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2015 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#pragma once - -#include "RepoMan/Private/BasePrivate.hpp" - -#include "RepoMan/CollectionNode.hpp" - -namespace RM -{ - - namespace Internal - { - - class CollectionNodePrivate : public BasePrivate - { - public: - CollectionNodePrivate(CollectionNode* _pub, CollectionTypes _ctype); - - public: - ObjTypes objType() const; - bool refreshSelf(); - void postCreation(); - void preTerminate(); - QString displayName() const; - void dumpSelf(Dumper& dumper) const; - QString objectTypeName() const; - Heaven::IconRef icon(bool small) const; - bool inherits(ObjTypes type) const; - - public: - CollectionTypes ctype; - }; - - } - -} diff --git a/Libs/libMacGitverCore/RepoMan/Remote.cpp b/Libs/libMacGitverCore/RepoMan/Remote.cpp index 7a402400..4d2cf303 100644 --- a/Libs/libMacGitverCore/RepoMan/Remote.cpp +++ b/Libs/libMacGitverCore/RepoMan/Remote.cpp @@ -22,7 +22,6 @@ #include "Repo.hpp" #include "Remote.hpp" #include "Events.hpp" -#include "CollectionNode.hpp" #include "RepoMan/Private/Dumper.hpp" #include "RepoMan/Private/RemotePrivate.hpp" @@ -53,15 +52,6 @@ namespace RM return d->name; } - CollectionNode* Remote::branches() - { - RM_D(Remote); - - - // ### We don't use this when filling up the branches, yet. - return d->getOrCreateCollection(ctBranches); - } - //-- RemotePrivate ----------------------------------------------------------------------------- RemotePrivate::RemotePrivate(Remote* _pub, const Git::Remote& _obj) diff --git a/Libs/libMacGitverCore/RepoMan/Remote.hpp b/Libs/libMacGitverCore/RepoMan/Remote.hpp index 2392bb7e..1bbb8ade 100644 --- a/Libs/libMacGitverCore/RepoMan/Remote.hpp +++ b/Libs/libMacGitverCore/RepoMan/Remote.hpp @@ -45,7 +45,6 @@ namespace RM GW_DEPRECATED Git::Remote gitObject(); QString name() const; - CollectionNode* branches(); }; } diff --git a/Libs/libMacGitverCore/RepoMan/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Repo.cpp index ea148a0b..1020543f 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.cpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.cpp @@ -41,7 +41,6 @@ #include "RepoMan/Private/Dumper.hpp" #include "RepoMan/Private/RepoPrivate.hpp" #include "RepoMan/Private/RemotePrivate.hpp" -#include "RepoMan/Private/CollectionNodePrivate.hpp" namespace RM { @@ -283,64 +282,6 @@ namespace RM return d->mHead; } - /** - * @brief Get this repository's collection of branches - * - * @return A CollectionNode whose children are the branches included in this repository. - * - * Branches are references matching the regular expression `^refs/heads/.*$`. Branches may be - * scoped in which case they are subdivided into RefTreeNode objects. - * - */ - CollectionNode* Repo::branches() - { - RM_D( Repo ); - return d->getOrCreateCollection( ctBranches ); - } - - /** - * @brief Get this repository's collection of tags - * - * @return A CollectionNode whose children are the tags included in this repository. - * - * Tags are references matching the regular expression `^refs/tags/.*$`. Tags may be scoped in - * which case they are subdivided into RefTreeNode objects. - * - */ - CollectionNode* Repo::tags() - { - RM_D( Repo ); - return d->getOrCreateCollection( ctTags ); - } - - /** - * @brief Get this repository's collection of namespaces - * - * @return A CollectionNode whose children are the 1st level namespaces included in this - * repository. - * - */ - CollectionNode* Repo::namespaces() - { - RM_D(Repo); - return d->getOrCreateCollection(ctNamespaces); - } - - /** - * @brief Get this repository's collection of notes - * - * @return A CollectionNode object whose children are the notes included in this repository. - * - * Notes are refs matching the regular expression `^refs/notes/.*$`. Notes may be scoped, in - * which case they are subdivided into RefTreeNode objects. - * - */ - CollectionNode* Repo::notes() - { - RM_D(Repo); - return d->getOrCreateCollection(ctNotes); - } - //-- RepoPrivate ------------------------------------------------------------------------------- RepoPrivate::RepoPrivate(Repo* pub, const Git::Repository& repo) @@ -547,85 +488,6 @@ namespace RM Ref* RepoPrivate::findReference(Git::RefName& rn, Git::Reference ref, bool create) { - Base* parent = NULL; - CollectionNode* cn = NULL; - - if (rn.isRemote() && rn.isBranch()) { - Remote* rm = findRemote(rn.remote(), create); - - if (!rm) { - return NULL; - } - - RemotePrivate* rmp = dataOf(rm); - if (!rmp) { - return NULL; - } - - parent = rmp->findRefParent(rn.scopes(), create); - } - else if (rn.isNamespaced()) { - Namespace* ns = findNamespace(rn.namespaces(), create); - - if (!ns) { - return NULL; - } - - if (rn.isBranch()) { - cn = ns->branches(); - } - else if (rn.isTag()) { - cn = ns->tags(); - } - else { - return NULL; - } - - CollectionNodePrivate* cnp = dataOf(cn); - if (!cnp) { - return NULL; - } - - parent = cnp->findRefParent(rn.scopes(), create); - } - else { - if (rn.isBranch()) { - cn = getOrCreateCollection(ctBranches); - } - else if (rn.isTag()) { - cn = getOrCreateCollection(ctTags); - } - else { - return NULL; - } - - CollectionNodePrivate* cnp = dataOf(cn); - if (!cnp) { - return NULL; - } - - parent = cnp->findRefParent(rn.scopes(), create); - } - - foreach (Ref* rmRef, parent->childObjects()) { - if (rmRef->fullName() == rn.fullName()) { - return rmRef; - } - } - - if (create) { - if ( rn.isBranch() ) { - return new Branch( parent, ref ); - } - else if( rn.isTag() ) { - return new Tag( parent, ref ); - } - else { - qDebug() << "Do not know how to deal with reference:" << rn.fullName(); - return NULL; - } - } - return NULL; } @@ -675,34 +537,9 @@ namespace RM return NULL; } - Namespace* RepoPrivate::findNamespace(const QStringList& _namespaces, bool create) { - - Base* par = getOrCreateCollection(ctNamespaces); - Namespace* child = NULL; - - foreach (QString nsName, _namespaces) { - child = NULL; - - foreach (Namespace* ns, par->childObjects()) { - if (ns->name() == nsName) { - child = ns; - break; - } - } - - if (!child) { - if (create) { - child = new Namespace(par, nsName); - } - else { - return NULL; - } - } - - par = child; - } - - return child; + Namespace* RepoPrivate::findNamespace(const QStringList& _namespaces, bool create) + { + return NULL; } Namespace* RepoPrivate::findNamespace(const QString& nsFullName, bool create) { diff --git a/Libs/libMacGitverCore/RepoMan/Repo.hpp b/Libs/libMacGitverCore/RepoMan/Repo.hpp index 203be87b..50631deb 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.hpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.hpp @@ -84,10 +84,6 @@ namespace RM Namespace* findNamespace( const QStringList& namespaces); Namespace* findNamespace( const QString& nsFullName); - CollectionNode* branches(); - CollectionNode* namespaces(); - CollectionNode* notes(); - CollectionNode* tags(); Head* head() const; private: diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp index b4db3d4a..7b81f402 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp +++ b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp @@ -20,7 +20,6 @@ #include "libMacGitverCore/App/MacGitver.hpp" #include "RepoMan/RepoMan.hpp" -#include "RepoMan/CollectionNode.hpp" #include "RepoMan/Events.hpp" #include "RepoMan/Private/Dumper.hpp" @@ -235,18 +234,6 @@ namespace RM //case RefObject: return menuCtxRef; //case RefTreeNodeObject: return menuCtxRefTreeNode; - case CollectionNodeObject: - switch (static_cast(object)->collectionType()) { - - case ctBranches: return menuCtxBranches; - case ctTags: return menuCtxTags; - case ctNotes: return menuCtxNotes; - case ctNamespaces: return menuCtxNamespaces; - - default: break; - } - break; - default: break; } From a8d1387cf61d5c6d2661b53d264ea51513ea4830 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Mon, 11 May 2015 02:26:29 +0100 Subject: [PATCH 13/60] Turn RM::ObjType into an Enum Class --- Libs/libMacGitverCore/CMakeLists.txt | 1 + Libs/libMacGitverCore/RepoMan/Base.hpp | 35 +----------- Libs/libMacGitverCore/RepoMan/Branch.cpp | 4 +- Libs/libMacGitverCore/RepoMan/Branch.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Core.hpp | 56 +++++++++++++++++++ Libs/libMacGitverCore/RepoMan/Head.cpp | 4 +- Libs/libMacGitverCore/RepoMan/Head.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Namespace.cpp | 4 +- Libs/libMacGitverCore/RepoMan/Namespace.hpp | 2 +- .../RepoMan/Private/BasePrivate.hpp | 11 +++- Libs/libMacGitverCore/RepoMan/Ref.cpp | 4 +- Libs/libMacGitverCore/RepoMan/Ref.hpp | 2 +- Libs/libMacGitverCore/RepoMan/RefLog.cpp | 4 +- Libs/libMacGitverCore/RepoMan/RefLog.hpp | 2 +- Libs/libMacGitverCore/RepoMan/RefTreeNode.cpp | 4 +- Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Remote.cpp | 4 +- Libs/libMacGitverCore/RepoMan/Remote.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Repo.cpp | 8 +-- Libs/libMacGitverCore/RepoMan/Repo.hpp | 2 +- Libs/libMacGitverCore/RepoMan/RepoMan.cpp | 20 +++---- Libs/libMacGitverCore/RepoMan/RepoMan.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Submodule.cpp | 4 +- Libs/libMacGitverCore/RepoMan/Submodule.hpp | 2 +- Libs/libMacGitverCore/RepoMan/Tag.cpp | 4 +- Libs/libMacGitverCore/RepoMan/Tag.hpp | 2 +- Modules/RefsViews/Branches/BranchesModel.cpp | 14 ++--- 27 files changed, 118 insertions(+), 85 deletions(-) create mode 100644 Libs/libMacGitverCore/RepoMan/Core.hpp diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 4ee6c1c1..ee23e1cb 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -75,6 +75,7 @@ SET( PUB_HDR_FILES MacGitver/GitPatchConsumer.hpp MacGitver/IRepositoryContext.hpp + RepoMan/Core.hpp RepoMan/Base.hpp RepoMan/Events.hpp RepoMan/Ref.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Base.hpp b/Libs/libMacGitverCore/RepoMan/Base.hpp index 0e880239..09005305 100644 --- a/Libs/libMacGitverCore/RepoMan/Base.hpp +++ b/Libs/libMacGitverCore/RepoMan/Base.hpp @@ -19,44 +19,11 @@ #pragma once -#include -#include -#include - -#include "libMacGitverCore/MacGitverApi.hpp" - -namespace Heaven { - - class Menu; - class IconRef; - -} +#include "libMacGitverCore/RepoMan/Core.hpp" namespace RM { - enum ObjTypes - { - InvalidObject, - - NamespaceObject, - RepoManagerObject, - - // repositories - RepoObject, - RemoteObject, - SubmoduleObject, - HeadObject, - - // references - BranchObject, - RefObject, - RefTreeNodeObject, - TagObject, - - RefLogObject - }; - class Repo; class RefTreeNode; class Namespace; diff --git a/Libs/libMacGitverCore/RepoMan/Branch.cpp b/Libs/libMacGitverCore/RepoMan/Branch.cpp index dd0115ae..42108116 100644 --- a/Libs/libMacGitverCore/RepoMan/Branch.cpp +++ b/Libs/libMacGitverCore/RepoMan/Branch.cpp @@ -85,7 +85,7 @@ namespace RM ObjTypes BranchPrivate::objType() const { - return BranchObject; + return ObjTypes::Branch; } void BranchPrivate::postCreation() @@ -134,7 +134,7 @@ namespace RM bool BranchPrivate::inherits(ObjTypes type) const { - return type == BranchObject || RefPrivate::inherits(type); + return type == ObjTypes::Branch || RefPrivate::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/Branch.hpp b/Libs/libMacGitverCore/RepoMan/Branch.hpp index 4c768a04..7452299f 100644 --- a/Libs/libMacGitverCore/RepoMan/Branch.hpp +++ b/Libs/libMacGitverCore/RepoMan/Branch.hpp @@ -27,7 +27,7 @@ namespace RM class MGV_CORE_API Branch : public Ref { public: - enum { StaticObjectType = BranchObject }; + static const ObjTypes StaticObjectType = ObjTypes::Branch; typedef QVector< Branch* > List; public: diff --git a/Libs/libMacGitverCore/RepoMan/Core.hpp b/Libs/libMacGitverCore/RepoMan/Core.hpp new file mode 100644 index 00000000..f2967aa3 --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Core.hpp @@ -0,0 +1,56 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include +#include +#include +#include + +#include "libMacGitverCore/MacGitverApi.hpp" + +namespace Heaven { + + class Menu; + class IconRef; + +} + +namespace RM +{ + + enum class ObjTypes + { + Invalid, + + Namespace, + RepoManager, + Repo, + Remote, + Submodule, + Head, + Branch, + Reference, + RefTreeNode, + Tag, + RefLog + }; + +} diff --git a/Libs/libMacGitverCore/RepoMan/Head.cpp b/Libs/libMacGitverCore/RepoMan/Head.cpp index 0a312cda..fb47ab80 100644 --- a/Libs/libMacGitverCore/RepoMan/Head.cpp +++ b/Libs/libMacGitverCore/RepoMan/Head.cpp @@ -54,7 +54,7 @@ namespace RM ObjTypes HeadPrivate::objType() const { - return HeadObject; + return ObjTypes::Head; } void HeadPrivate::dumpSelf(Internal::Dumper& dumper) const @@ -93,7 +93,7 @@ namespace RM bool HeadPrivate::inherits(ObjTypes type) const { - return type == HeadObject || BasePrivate::inherits(type); + return type == ObjTypes::Head || BasePrivate::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/Head.hpp b/Libs/libMacGitverCore/RepoMan/Head.hpp index 23524667..950b64d1 100644 --- a/Libs/libMacGitverCore/RepoMan/Head.hpp +++ b/Libs/libMacGitverCore/RepoMan/Head.hpp @@ -33,7 +33,7 @@ namespace RM class MGV_CORE_API Head : public Base { public: - enum { StaticObjectType = HeadObject }; + static const ObjTypes StaticObjectType = ObjTypes::Head; typedef Internal::HeadPrivate Private; typedef QVector< Head* > List; diff --git a/Libs/libMacGitverCore/RepoMan/Namespace.cpp b/Libs/libMacGitverCore/RepoMan/Namespace.cpp index c84a0401..acbc820c 100644 --- a/Libs/libMacGitverCore/RepoMan/Namespace.cpp +++ b/Libs/libMacGitverCore/RepoMan/Namespace.cpp @@ -52,7 +52,7 @@ namespace RM ObjTypes NamespacePrivate::objType() const { - return NamespaceObject; + return ObjTypes::Namespace; } void NamespacePrivate::dumpSelf(Internal::Dumper& dumper) const @@ -97,7 +97,7 @@ namespace RM bool NamespacePrivate::inherits(ObjTypes type) const { - return type == NamespaceObject || BasePrivate::inherits(type); + return type == ObjTypes::Namespace || BasePrivate::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/Namespace.hpp b/Libs/libMacGitverCore/RepoMan/Namespace.hpp index 6be8c612..0f43f732 100644 --- a/Libs/libMacGitverCore/RepoMan/Namespace.hpp +++ b/Libs/libMacGitverCore/RepoMan/Namespace.hpp @@ -32,7 +32,7 @@ namespace RM class MGV_CORE_API Namespace : public Base { public: - enum { StaticObjectType = NamespaceObject }; + static const ObjTypes StaticObjectType = ObjTypes::Namespace; typedef Internal::NamespacePrivate Private; typedef QVector< Namespace* > List; diff --git a/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp index 678fa1b8..c0fe627c 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp @@ -33,13 +33,22 @@ #define RM_CP(CLASS) const CLASS* p = \ static_cast(mPub) +#ifdef _MSVC +#define const_or_constexpr const +#else +#define const_or_constexpr constexpr +#endif + namespace RM { namespace Internal { - class Dumper; + } + + namespace Internal + { class BasePrivate { diff --git a/Libs/libMacGitverCore/RepoMan/Ref.cpp b/Libs/libMacGitverCore/RepoMan/Ref.cpp index 4bcdd5dd..291670dd 100644 --- a/Libs/libMacGitverCore/RepoMan/Ref.cpp +++ b/Libs/libMacGitverCore/RepoMan/Ref.cpp @@ -108,7 +108,7 @@ namespace RM ObjTypes RefPrivate::objType() const { - return RefObject; + return ObjTypes::Reference; } QString RefPrivate::displayName() const @@ -123,7 +123,7 @@ namespace RM bool RefPrivate::inherits(ObjTypes type) const { - return type == RefObject || BasePrivate::inherits(type); + return type == ObjTypes::Reference || BasePrivate::inherits(type); } void RefPrivate::postCreation() diff --git a/Libs/libMacGitverCore/RepoMan/Ref.hpp b/Libs/libMacGitverCore/RepoMan/Ref.hpp index e5a55c6f..1970a4ef 100644 --- a/Libs/libMacGitverCore/RepoMan/Ref.hpp +++ b/Libs/libMacGitverCore/RepoMan/Ref.hpp @@ -40,7 +40,7 @@ namespace RM class MGV_CORE_API Ref : public Base { public: - enum { StaticObjectType = RefObject }; + static const ObjTypes StaticObjectType = ObjTypes::Reference; typedef QList< Ref* > List; diff --git a/Libs/libMacGitverCore/RepoMan/RefLog.cpp b/Libs/libMacGitverCore/RepoMan/RefLog.cpp index 443fbc5e..ea3937b0 100644 --- a/Libs/libMacGitverCore/RepoMan/RefLog.cpp +++ b/Libs/libMacGitverCore/RepoMan/RefLog.cpp @@ -43,7 +43,7 @@ namespace RM ObjTypes RefLogPrivate::objType() const { - return RefLogObject; + return ObjTypes::RefLog; } void RefLogPrivate::dumpSelf(Internal::Dumper& dumper) const @@ -75,7 +75,7 @@ namespace RM bool RefLogPrivate::inherits(ObjTypes type) const { - return type == RefLogObject || BasePrivate::inherits(type); + return type == ObjTypes::RefLog || BasePrivate::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/RefLog.hpp b/Libs/libMacGitverCore/RepoMan/RefLog.hpp index 45bcab0f..0879a024 100644 --- a/Libs/libMacGitverCore/RepoMan/RefLog.hpp +++ b/Libs/libMacGitverCore/RepoMan/RefLog.hpp @@ -32,7 +32,7 @@ namespace RM class MGV_CORE_API RefLog : public Base { public: - enum { StaticObjectType = RefLogObject }; + static const ObjTypes StaticObjectType = ObjTypes::RefLog; typedef Internal::RefLogPrivate Private; public: diff --git a/Libs/libMacGitverCore/RepoMan/RefTreeNode.cpp b/Libs/libMacGitverCore/RepoMan/RefTreeNode.cpp index 4fae6a5a..bef2211d 100644 --- a/Libs/libMacGitverCore/RepoMan/RefTreeNode.cpp +++ b/Libs/libMacGitverCore/RepoMan/RefTreeNode.cpp @@ -51,7 +51,7 @@ namespace RM ObjTypes RefTreeNodePrivate::objType() const { - return RefTreeNodeObject; + return ObjTypes::RefTreeNode; } void RefTreeNodePrivate::dumpSelf(Dumper& dumper) const @@ -102,7 +102,7 @@ namespace RM bool RefTreeNodePrivate::inherits(ObjTypes type) const { - return type == RefTreeNodeObject || BasePrivate::inherits(type); + return type == ObjTypes::RefTreeNode || BasePrivate::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp b/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp index c49210d4..1084fc7f 100644 --- a/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp +++ b/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp @@ -34,7 +34,7 @@ namespace RM class MGV_CORE_API RefTreeNode : public Base { public: - enum { StaticObjectType = RefTreeNodeObject }; + static const ObjTypes StaticObjectType = ObjTypes::RefTreeNode; typedef Internal::RefTreeNodePrivate Private; typedef QList< RefTreeNode* > List; diff --git a/Libs/libMacGitverCore/RepoMan/Remote.cpp b/Libs/libMacGitverCore/RepoMan/Remote.cpp index 4d2cf303..fdf668a0 100644 --- a/Libs/libMacGitverCore/RepoMan/Remote.cpp +++ b/Libs/libMacGitverCore/RepoMan/Remote.cpp @@ -62,7 +62,7 @@ namespace RM ObjTypes RemotePrivate::objType() const { - return RemoteObject; + return ObjTypes::Remote; } void RemotePrivate::dumpSelf(Internal::Dumper& dumper) const @@ -108,7 +108,7 @@ namespace RM bool RemotePrivate::inherits(ObjTypes type) const { - return type == RemoteObject || BasePrivate::inherits(type); + return type == ObjTypes::Remote || BasePrivate::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/Remote.hpp b/Libs/libMacGitverCore/RepoMan/Remote.hpp index 1bbb8ade..8fab5f74 100644 --- a/Libs/libMacGitverCore/RepoMan/Remote.hpp +++ b/Libs/libMacGitverCore/RepoMan/Remote.hpp @@ -34,7 +34,7 @@ namespace RM class MGV_CORE_API Remote : public Base { public: - enum { StaticObjectType = RemoteObject }; + static const ObjTypes StaticObjectType = ObjTypes::Remote; typedef Internal::RemotePrivate Private; typedef QVector< Remote* > List; diff --git a/Libs/libMacGitverCore/RepoMan/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Repo.cpp index 1020543f..f4ef6980 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.cpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.cpp @@ -136,7 +136,7 @@ namespace RM return NULL; } - if (p->inheritsRepoManType(RepoObject)) { + if (p->inheritsRepoManType(ObjTypes::Repo)) { return static_cast(p); } @@ -457,12 +457,12 @@ namespace RM /** * @brief Get this object's type * - * @return always RepoObject. + * @return always ObjTypes::Repo. * */ ObjTypes RepoPrivate::objType() const { - return RepoObject; + return ObjTypes::Repo; } void RepoPrivate::dumpSelf(Internal::Dumper& dumper) const @@ -575,7 +575,7 @@ namespace RM bool RepoPrivate::inherits(ObjTypes type) const { - return type == RepoObject || BasePrivate::inherits(type); + return type == ObjTypes::Repo || BasePrivate::inherits(type); } Repo* RepoPrivate::searchRepository() diff --git a/Libs/libMacGitverCore/RepoMan/Repo.hpp b/Libs/libMacGitverCore/RepoMan/Repo.hpp index 50631deb..c5ccab67 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.hpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.hpp @@ -44,7 +44,7 @@ namespace RM Q_OBJECT public: - enum { StaticObjectType = RepoObject }; + static const ObjTypes StaticObjectType = ObjTypes::Repo; typedef Internal::RepoPrivate Private; typedef QVector< Repo* > List; diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp index 7b81f402..b09edee9 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp +++ b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp @@ -196,7 +196,7 @@ namespace RM ObjTypes RepoManPrivate::objType() const { - return RepoManagerObject; + return ObjTypes::RepoManager; } void RepoManPrivate::dumpSelf(Internal::Dumper& dumper) const @@ -223,16 +223,16 @@ namespace RM { switch (object->objType()) { - case BranchObject: return menuCtxBranch; - case TagObject: return menuCtxTag; - case RepoObject: return menuCtxRepo; - case SubmoduleObject: return menuCtxSubmodule; - case NamespaceObject: return menuCtxNamespace; - case RefLogObject: return menuCtxRefLog; - case RemoteObject: return menuCtxRemote; + case ObjTypes::Branch: return menuCtxBranch; + case ObjTypes::Tag: return menuCtxTag; + case ObjTypes::Repo: return menuCtxRepo; + case ObjTypes::Submodule: return menuCtxSubmodule; + case ObjTypes::Namespace: return menuCtxNamespace; + case ObjTypes::RefLog: return menuCtxRefLog; + case ObjTypes::Remote: return menuCtxRemote; - //case RefObject: return menuCtxRef; - //case RefTreeNodeObject: return menuCtxRefTreeNode; + //case ObjTypes::Reference: return menuCtxRef; + //case ObjTypes::RefTreeNode: return menuCtxRefTreeNode; default: break; diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.hpp b/Libs/libMacGitverCore/RepoMan/RepoMan.hpp index f9f4f980..2b214ae7 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.hpp +++ b/Libs/libMacGitverCore/RepoMan/RepoMan.hpp @@ -41,7 +41,7 @@ namespace RM { Q_OBJECT public: - enum { StaticObjectType = RepoManagerObject }; + static const ObjTypes StaticObjectType = ObjTypes::RepoManager; typedef Internal::RepoManPrivate Private; public: diff --git a/Libs/libMacGitverCore/RepoMan/Submodule.cpp b/Libs/libMacGitverCore/RepoMan/Submodule.cpp index 4f5e148e..8c131768 100644 --- a/Libs/libMacGitverCore/RepoMan/Submodule.cpp +++ b/Libs/libMacGitverCore/RepoMan/Submodule.cpp @@ -51,7 +51,7 @@ namespace RM ObjTypes SubmodulePrivate::objType() const { - return SubmoduleObject; + return ObjTypes::Submodule; } void SubmodulePrivate::dumpSelf(Dumper& dumper) const @@ -85,7 +85,7 @@ namespace RM bool SubmodulePrivate::inherits(ObjTypes type) const { - return type == SubmoduleObject || RepoPrivate::inherits(type); + return type == ObjTypes::Submodule || RepoPrivate::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/Submodule.hpp b/Libs/libMacGitverCore/RepoMan/Submodule.hpp index 2d366d7d..4c26cd6d 100644 --- a/Libs/libMacGitverCore/RepoMan/Submodule.hpp +++ b/Libs/libMacGitverCore/RepoMan/Submodule.hpp @@ -27,7 +27,7 @@ namespace RM class MGV_CORE_API Submodule : public Repo { public: - enum { StaticObjectType = SubmoduleObject }; + static const ObjTypes StaticObjectType = ObjTypes::Submodule; public: Submodule(const Git::Repository& repo, Repo* parent); diff --git a/Libs/libMacGitverCore/RepoMan/Tag.cpp b/Libs/libMacGitverCore/RepoMan/Tag.cpp index a530ef13..0efd4f72 100644 --- a/Libs/libMacGitverCore/RepoMan/Tag.cpp +++ b/Libs/libMacGitverCore/RepoMan/Tag.cpp @@ -44,7 +44,7 @@ namespace RM ObjTypes TagPrivate::objType() const { - return TagObject; + return ObjTypes::Tag; } void TagPrivate::postCreation() @@ -79,7 +79,7 @@ namespace RM bool TagPrivate::inherits(ObjTypes type) const { - return type == TagObject || RefPrivate::inherits(type); + return type == ObjTypes::Tag || RefPrivate::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/Tag.hpp b/Libs/libMacGitverCore/RepoMan/Tag.hpp index f5d57e10..951b71a3 100644 --- a/Libs/libMacGitverCore/RepoMan/Tag.hpp +++ b/Libs/libMacGitverCore/RepoMan/Tag.hpp @@ -27,7 +27,7 @@ namespace RM class MGV_CORE_API Tag : public Ref { public: - enum { StaticObjectType = TagObject }; + static const ObjTypes StaticObjectType = ObjTypes::Tag; typedef QVector< Tag* > List; public: diff --git a/Modules/RefsViews/Branches/BranchesModel.cpp b/Modules/RefsViews/Branches/BranchesModel.cpp index c94576e1..8cd44d53 100644 --- a/Modules/RefsViews/Branches/BranchesModel.cpp +++ b/Modules/RefsViews/Branches/BranchesModel.cpp @@ -184,7 +184,7 @@ RefItem* BranchesModel::createBranchItem(bool notify, RefItem* parent, RM::Branc return NULL; } - if (!parent && obj->parentObject()->objType() != RM::CollectionNodeObject) { + if (!parent && obj->parentObject()->objType() != RM::ObjTypes::CollectionNode) { parent = insertObject(notify, obj->parentObject()); return NULL; } @@ -198,7 +198,7 @@ RefItem* BranchesModel::createBranchItem(bool notify, RefItem* parent, RM::Branc RefItem* BranchesModel::createTagItem(bool notify, RefItem* parent, RM::Tag* obj) { - if (!parent && obj->parentObject()->objType() != RM::CollectionNodeObject) { + if (!parent && obj->parentObject()->objType() != RM::ObjTypes::CollectionNode) { parent = insertObject(notify, obj->parentObject()); return NULL; } @@ -215,7 +215,7 @@ RefItem* BranchesModel::createScopeItem(bool notify, RefItem* parent, RM::RefTre if (!parent) { RM::Base* parObj = obj->parentObject(); - if (parObj->objType() != RM::CollectionNodeObject) { + if (parObj->objType() != RM::ObjTypes::CollectionNode) { parent = insertObject(notify, parObj); return NULL; } @@ -262,20 +262,20 @@ RefItem* BranchesModel::insertObject(bool notify, RM::Base* obj) if (!it) { switch (obj->objType()) { - case RM::BranchObject: + case RM::ObjTypes::Branch: it = createBranchItem(notify, parent, static_cast(obj)); break; - case RM::TagObject: + case RM::ObjTypes::Tag: it = createTagItem(notify, parent, static_cast(obj)); break; - case RM::RefTreeNodeObject: + case RM::ObjTypes::RefTreeNode: it = createScopeItem(notify, parent, static_cast(obj)); doChildren = true; break; - case RM::RemoteObject: + case RM::ObjTypes::Remote: it = createRemoteItem(notify, parent, static_cast(obj)); doChildren = true; break; From 3df8c761a3e0e32df584775a23a4683e5fbf4867 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sat, 21 Mar 2015 20:32:11 +0000 Subject: [PATCH 14/60] Move some RepoMan code around --- Libs/libMacGitverCore/CMakeLists.txt | 49 ++++++++++--------- .../BasePrivate.hpp => Data/BaseData.hpp} | 0 .../BranchPrivate.hpp => Data/BranchData.hpp} | 2 +- .../HeadPrivate.hpp => Data/HeadData.hpp} | 2 +- .../NamespaceData.hpp} | 2 +- .../RefPrivate.hpp => Data/RefData.hpp} | 2 +- .../RefLogPrivate.hpp => Data/RefLogData.hpp} | 2 +- .../RefTreeNodeData.hpp} | 2 +- .../RemotePrivate.hpp => Data/RemoteData.hpp} | 2 +- .../RepoPrivate.hpp => Data/RepoData.hpp} | 2 +- .../RepoManData.hpp} | 2 +- .../SubmoduleData.hpp} | 2 +- .../TagPrivate.hpp => Data/TagData.hpp} | 2 +- .../RepoMan/{ => Frontend}/Base.cpp | 19 +++---- .../RepoMan/{ => Frontend}/Branch.cpp | 3 +- .../RepoMan/{ => Frontend}/Head.cpp | 9 ++-- .../RepoMan/{ => Frontend}/Namespace.cpp | 7 +-- .../RepoMan/{ => Frontend}/Ref.cpp | 11 +++-- .../RepoMan/{ => Frontend}/RefLog.cpp | 4 +- .../RepoMan/{ => Frontend}/RefTreeNode.cpp | 9 ++-- .../RepoMan/{ => Frontend}/Remote.cpp | 10 ++-- .../RepoMan/{ => Frontend}/Repo.cpp | 5 +- .../RepoMan/{ => Frontend}/Submodule.cpp | 7 +-- .../RepoMan/{ => Frontend}/Tag.cpp | 8 +-- Libs/libMacGitverCore/RepoMan/RepoMan.cpp | 5 +- 25 files changed, 94 insertions(+), 74 deletions(-) rename Libs/libMacGitverCore/RepoMan/{Private/BasePrivate.hpp => Data/BaseData.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/{Private/BranchPrivate.hpp => Data/BranchData.hpp} (97%) rename Libs/libMacGitverCore/RepoMan/{Private/HeadPrivate.hpp => Data/HeadData.hpp} (97%) rename Libs/libMacGitverCore/RepoMan/{Private/NamespacePrivate.hpp => Data/NamespaceData.hpp} (96%) rename Libs/libMacGitverCore/RepoMan/{Private/RefPrivate.hpp => Data/RefData.hpp} (97%) rename Libs/libMacGitverCore/RepoMan/{Private/RefLogPrivate.hpp => Data/RefLogData.hpp} (96%) rename Libs/libMacGitverCore/RepoMan/{Private/RefTreeNodePrivate.hpp => Data/RefTreeNodeData.hpp} (97%) rename Libs/libMacGitverCore/RepoMan/{Private/RemotePrivate.hpp => Data/RemoteData.hpp} (97%) rename Libs/libMacGitverCore/RepoMan/{Private/RepoPrivate.hpp => Data/RepoData.hpp} (98%) rename Libs/libMacGitverCore/RepoMan/{Private/RepoManPrivate.hpp => Data/RepoManData.hpp} (96%) rename Libs/libMacGitverCore/RepoMan/{Private/SubmodulePrivate.hpp => Data/SubmoduleData.hpp} (96%) rename Libs/libMacGitverCore/RepoMan/{Private/TagPrivate.hpp => Data/TagData.hpp} (96%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Base.cpp (98%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Branch.cpp (98%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Head.cpp (97%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Namespace.cpp (96%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Ref.cpp (96%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/RefLog.cpp (96%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/RefTreeNode.cpp (96%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Remote.cpp (95%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Repo.cpp (99%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Submodule.cpp (95%) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Tag.cpp (95%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index ee23e1cb..1c47f787 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -27,19 +27,20 @@ SET( SRC_FILES MacGitver/GitPatchConsumer.cpp MacGitver/AutoRefresher.cpp - RepoMan/Base.cpp - RepoMan/Ref.cpp - RepoMan/Branch.cpp RepoMan/Events.cpp - RepoMan/Repo.cpp RepoMan/RepoMan.cpp - RepoMan/Remote.cpp - RepoMan/Tag.cpp - RepoMan/RefLog.cpp - RepoMan/Submodule.cpp - RepoMan/RefTreeNode.cpp - RepoMan/Namespace.cpp - RepoMan/Head.cpp + + RepoMan/Frontend/Base.cpp + RepoMan/Frontend/Branch.cpp + RepoMan/Frontend/Namespace.cpp + RepoMan/Frontend/Ref.cpp + RepoMan/Frontend/RefLog.cpp + RepoMan/Frontend/RefTreeNode.cpp + RepoMan/Frontend/Remote.cpp + RepoMan/Frontend/Repo.cpp + RepoMan/Frontend/Submodule.cpp + RepoMan/Frontend/Tag.cpp + RepoMan/Frontend/Head.cpp RepoMan/Private/Dumper.cpp @@ -116,19 +117,21 @@ SET( PRI_HDR_FILES Config/Ui/GeneralConfigPage.hpp Config/Ui/RepoManConfigPage.hpp - RepoMan/Private/BasePrivate.hpp - RepoMan/Private/BranchPrivate.hpp - RepoMan/Private/NamespacePrivate.hpp - RepoMan/Private/RefPrivate.hpp - RepoMan/Private/RefLogPrivate.hpp - RepoMan/Private/RefTreeNodePrivate.hpp - RepoMan/Private/RemotePrivate.hpp - RepoMan/Private/RepoPrivate.hpp - RepoMan/Private/RepoManPrivate.hpp - RepoMan/Private/SubmodulePrivate.hpp - RepoMan/Private/TagPrivate.hpp RepoMan/Private/Dumper.hpp - RepoMan/Private/HeadPrivate.hpp + + RepoMan/Data/BaseData.hpp + RepoMan/Data/BranchData.hpp + RepoMan/Data/NamespaceData.hpp + RepoMan/Data/RefData.hpp + RepoMan/Data/RefLogData.hpp + RepoMan/Data/RefTreeNodeData.hpp + RepoMan/Data/RemoteData.hpp + RepoMan/Data/RepoData.hpp + RepoMan/Data/RepoManData.hpp + RepoMan/Data/SubmoduleData.hpp + RepoMan/Data/TagData.hpp + RepoMan/Data/HeadData.hpp + Widgets/StringSelectorWidgetPrivate.h Widgets/FlatTreeModelPrivate.h diff --git a/Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/BaseData.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Private/BasePrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/BaseData.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Private/BranchPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/BranchData.hpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/Private/BranchPrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/BranchData.hpp index 8a503a7a..97dda34e 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/BranchPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/BranchData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Private/RefPrivate.hpp" +#include "RepoMan/Data/RefData.hpp" #include "RepoMan/Branch.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Private/HeadPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/HeadData.hpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/Private/HeadPrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/HeadData.hpp index e555157f..92f09ddb 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/HeadPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/HeadData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Private/BasePrivate.hpp" +#include "RepoMan/Data/BaseData.hpp" #include "RepoMan/Head.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Private/NamespacePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/NamespaceData.hpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/Private/NamespacePrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/NamespaceData.hpp index 7f1e5905..d7b77fb2 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/NamespacePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/NamespaceData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Private/BasePrivate.hpp" +#include "RepoMan/Data/BaseData.hpp" #include "RepoMan/Namespace.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Private/RefPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/RefData.hpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/Private/RefPrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/RefData.hpp index 6ec1c426..62afb6b0 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RefPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RefData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Private/BasePrivate.hpp" +#include "RepoMan/Data/BaseData.hpp" #include "RepoMan/Ref.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Private/RefLogPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/RefLogData.hpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/Private/RefLogPrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/RefLogData.hpp index 756cb5b2..7724c619 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RefLogPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RefLogData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Private/BasePrivate.hpp" +#include "RepoMan/Data/BaseData.hpp" #include "RepoMan/RefLog.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Private/RefTreeNodePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/RefTreeNodeData.hpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/Private/RefTreeNodePrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/RefTreeNodeData.hpp index 77aa1011..d4eef6bd 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RefTreeNodePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RefTreeNodeData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Private/BasePrivate.hpp" +#include "RepoMan/Data/BaseData.hpp" #include "RepoMan/RefTreeNode.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Private/RemotePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/RemoteData.hpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/Private/RemotePrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/RemoteData.hpp index b89cfb90..54c55b17 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RemotePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RemoteData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Private/BasePrivate.hpp" +#include "RepoMan/Data/BaseData.hpp" #include "RepoMan/Remote.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/RepoData.hpp similarity index 98% rename from Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/RepoData.hpp index abd40ada..9fb42eeb 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RepoPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RepoData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Private/BasePrivate.hpp" +#include "RepoMan/Data/BaseData.hpp" #include "RepoMan/Repo.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/RepoManData.hpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/RepoManData.hpp index a6afb7e5..5c637c27 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/RepoManPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RepoManData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "libMacGitverCore/RepoMan/Private/BasePrivate.hpp" +#include "libMacGitverCore/RepoMan/Data/BaseData.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Private/SubmodulePrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/SubmoduleData.hpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/Private/SubmodulePrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/SubmoduleData.hpp index 61eeec81..2f454210 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/SubmodulePrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/SubmoduleData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Private/RepoPrivate.hpp" +#include "RepoMan/Data/RepoData.hpp" #include "RepoMan/Submodule.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Private/TagPrivate.hpp b/Libs/libMacGitverCore/RepoMan/Data/TagData.hpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/Private/TagPrivate.hpp rename to Libs/libMacGitverCore/RepoMan/Data/TagData.hpp index eea7e885..8bb62db9 100644 --- a/Libs/libMacGitverCore/RepoMan/Private/TagPrivate.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/TagData.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Private/RefPrivate.hpp" +#include "RepoMan/Data/RefData.hpp" #include "RepoMan/Tag.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Base.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp similarity index 98% rename from Libs/libMacGitverCore/RepoMan/Base.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp index dd3937ea..9208d6dd 100644 --- a/Libs/libMacGitverCore/RepoMan/Base.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp @@ -24,15 +24,16 @@ #include "App/MacGitver.hpp" -#include "Base.hpp" -#include "Repo.hpp" -#include "RepoMan.hpp" -#include "RefTreeNode.hpp" -#include "Events.hpp" - -#include "Private/RepoManPrivate.hpp" -#include "Private/Dumper.hpp" -#include "Private/BasePrivate.hpp" +#include "RepoMan/Base.hpp" +#include "RepoMan/Repo.hpp" +#include "RepoMan/RepoMan.hpp" +#include "RepoMan/RefTreeNode.hpp" +#include "RepoMan/Events.hpp" + +#include "RepoMan/Data/RepoManData.hpp" +#include "RepoMan/Data/BaseData.hpp" + +#include "RepoMan/Private/Dumper.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Branch.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp similarity index 98% rename from Libs/libMacGitverCore/RepoMan/Branch.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp index 42108116..02a3909a 100644 --- a/Libs/libMacGitverCore/RepoMan/Branch.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp @@ -23,7 +23,8 @@ #include "RepoMan/Head.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/BranchPrivate.hpp" + +#include "RepoMan/Data/BranchData.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Head.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/Head.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp index fb47ab80..b956460b 100644 --- a/Libs/libMacGitverCore/RepoMan/Head.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp @@ -17,11 +17,14 @@ * */ -#include "Head.hpp" -#include "Events.hpp" +#include "RepoMan/Events.hpp" + +#include "RepoMan/Head.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/HeadPrivate.hpp" + +#include "RepoMan/Data/HeadData.hpp" + #include "RepoMan/Branch.hpp" #include "RepoMan/Repo.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Namespace.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/Namespace.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp index acbc820c..c90aeaac 100644 --- a/Libs/libMacGitverCore/RepoMan/Namespace.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp @@ -17,11 +17,12 @@ * */ -#include "Namespace.hpp" -#include "Events.hpp" +#include "RepoMan/Events.hpp" + +#include "RepoMan/Namespace.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/NamespacePrivate.hpp" +#include "RepoMan/Data/NamespaceData.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Ref.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/Ref.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp index 291670dd..708d8966 100644 --- a/Libs/libMacGitverCore/RepoMan/Ref.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp @@ -21,12 +21,13 @@ #include "libGitWrap/Reference.hpp" #include "libGitWrap/RefName.hpp" -#include "Ref.hpp" -#include "Repo.hpp" -#include "Events.hpp" +#include "RepoMan/Events.hpp" -#include "Private/Dumper.hpp" -#include "Private/RefPrivate.hpp" +#include "RepoMan/Ref.hpp" +#include "RepoMan/Repo.hpp" + +#include "RepoMan/Private/Dumper.hpp" +#include "RepoMan/Data/RefData.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/RefLog.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/RefLog.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp index ea3937b0..e5c6b79f 100644 --- a/Libs/libMacGitverCore/RepoMan/RefLog.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp @@ -17,10 +17,10 @@ * */ -#include "RefLog.hpp" +#include "RepoMan/RefLog.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/RefLogPrivate.hpp" +#include "RepoMan/Data/RefLogData.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/RefTreeNode.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/RefTreeNode.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp index bef2211d..5171f49d 100644 --- a/Libs/libMacGitverCore/RepoMan/RefTreeNode.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp @@ -17,10 +17,13 @@ * */ -#include "RefTreeNode.hpp" -#include "Events.hpp" +#include "RepoMan/Events.hpp" + +#include "RepoMan/RefTreeNode.hpp" + #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/RefTreeNodePrivate.hpp" + +#include "RepoMan/Data/RefTreeNodeData.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Remote.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Remote.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp index fdf668a0..5a7a7885 100644 --- a/Libs/libMacGitverCore/RepoMan/Remote.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp @@ -19,12 +19,14 @@ #include "libGitWrap/Result.hpp" -#include "Repo.hpp" -#include "Remote.hpp" -#include "Events.hpp" +#include "RepoMan/Events.hpp" + +#include "RepoMan/Repo.hpp" +#include "RepoMan/Remote.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/RemotePrivate.hpp" + +#include "RepoMan/Data/RemoteData.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp similarity index 99% rename from Libs/libMacGitverCore/RepoMan/Repo.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp index f4ef6980..a3b76267 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp @@ -39,8 +39,9 @@ #include "RepoMan/Submodule.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/RepoPrivate.hpp" -#include "RepoMan/Private/RemotePrivate.hpp" + +#include "RepoMan/Data/RepoData.hpp" +#include "RepoMan/Data/RemoteData.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Submodule.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Submodule.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp index 8c131768..e8969375 100644 --- a/Libs/libMacGitverCore/RepoMan/Submodule.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp @@ -17,11 +17,12 @@ * */ -#include "Submodule.hpp" -#include "Events.hpp" +#include "RepoMan/Events.hpp" + +#include "RepoMan/Submodule.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/SubmodulePrivate.hpp" +#include "RepoMan/Data/SubmoduleData.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Tag.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Tag.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp index 0efd4f72..f98e4ce2 100644 --- a/Libs/libMacGitverCore/RepoMan/Tag.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp @@ -17,11 +17,13 @@ * */ -#include "Tag.hpp" -#include "Events.hpp" +#include "RepoMan/Events.hpp" + +#include "RepoMan/Tag.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/TagPrivate.hpp" + +#include "RepoMan/Data/TagData.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp index b09edee9..dbe59535 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp +++ b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp @@ -23,8 +23,9 @@ #include "RepoMan/Events.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/RepoManPrivate.hpp" -#include "RepoMan/Private/RepoPrivate.hpp" + +#include "RepoMan/Data/RepoManData.hpp" +#include "RepoMan/Data/RepoData.hpp" #include "libBlueSky/Application.hpp" From 03ecab6e0904d6a0d2c145f77da14dddda32e1db Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Thu, 14 May 2015 20:55:11 +0100 Subject: [PATCH 15/60] Remove "Data" part of the Data/XzyData.cpp filenames --- Libs/libMacGitverCore/CMakeLists.txt | 23 +++++++++---------- .../RepoMan/Data/{BaseData.hpp => Base.hpp} | 0 .../Data/{BranchData.hpp => Branch.hpp} | 0 .../RepoMan/Data/{HeadData.hpp => Head.hpp} | 0 .../Data/{NamespaceData.hpp => Namespace.hpp} | 0 .../RepoMan/Data/{RefData.hpp => Ref.hpp} | 0 .../Data/{RefLogData.hpp => RefLog.hpp} | 0 .../{RefTreeNodeData.hpp => RefTreeNode.hpp} | 0 .../Data/{RemoteData.hpp => Remote.hpp} | 0 .../RepoMan/Data/{RepoData.hpp => Repo.hpp} | 0 .../Data/{SubmoduleData.hpp => Submodule.hpp} | 0 .../RepoMan/Data/{TagData.hpp => Tag.hpp} | 0 12 files changed, 11 insertions(+), 12 deletions(-) rename Libs/libMacGitverCore/RepoMan/Data/{BaseData.hpp => Base.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/Data/{BranchData.hpp => Branch.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/Data/{HeadData.hpp => Head.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/Data/{NamespaceData.hpp => Namespace.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/Data/{RefData.hpp => Ref.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/Data/{RefLogData.hpp => RefLog.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/Data/{RefTreeNodeData.hpp => RefTreeNode.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/Data/{RemoteData.hpp => Remote.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/Data/{RepoData.hpp => Repo.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/Data/{SubmoduleData.hpp => Submodule.hpp} (100%) rename Libs/libMacGitverCore/RepoMan/Data/{TagData.hpp => Tag.hpp} (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 1c47f787..a0afd889 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -119,19 +119,18 @@ SET( PRI_HDR_FILES RepoMan/Private/Dumper.hpp - RepoMan/Data/BaseData.hpp - RepoMan/Data/BranchData.hpp - RepoMan/Data/NamespaceData.hpp - RepoMan/Data/RefData.hpp - RepoMan/Data/RefLogData.hpp - RepoMan/Data/RefTreeNodeData.hpp - RepoMan/Data/RemoteData.hpp - RepoMan/Data/RepoData.hpp + RepoMan/Data/Base.hpp + RepoMan/Data/Branch.hpp + RepoMan/Data/Head.hpp + RepoMan/Data/Namespace.hpp + RepoMan/Data/Ref.hpp + RepoMan/Data/RefLog.hpp + RepoMan/Data/RefTreeNode.hpp + RepoMan/Data/Remote.hpp + RepoMan/Data/Repo.hpp RepoMan/Data/RepoManData.hpp - RepoMan/Data/SubmoduleData.hpp - RepoMan/Data/TagData.hpp - RepoMan/Data/HeadData.hpp - + RepoMan/Data/Submodule.hpp + RepoMan/Data/Tag.hpp Widgets/StringSelectorWidgetPrivate.h Widgets/FlatTreeModelPrivate.h diff --git a/Libs/libMacGitverCore/RepoMan/Data/BaseData.hpp b/Libs/libMacGitverCore/RepoMan/Data/Base.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/BaseData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/Base.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/BranchData.hpp b/Libs/libMacGitverCore/RepoMan/Data/Branch.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/BranchData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/Branch.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/HeadData.hpp b/Libs/libMacGitverCore/RepoMan/Data/Head.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/HeadData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/Head.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/NamespaceData.hpp b/Libs/libMacGitverCore/RepoMan/Data/Namespace.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/NamespaceData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/Namespace.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefData.hpp b/Libs/libMacGitverCore/RepoMan/Data/Ref.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/RefData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/Ref.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefLogData.hpp b/Libs/libMacGitverCore/RepoMan/Data/RefLog.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/RefLogData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/RefLog.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefTreeNodeData.hpp b/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/RefTreeNodeData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/RemoteData.hpp b/Libs/libMacGitverCore/RepoMan/Data/Remote.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/RemoteData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/Remote.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/RepoData.hpp b/Libs/libMacGitverCore/RepoMan/Data/Repo.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/RepoData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/Repo.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/SubmoduleData.hpp b/Libs/libMacGitverCore/RepoMan/Data/Submodule.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/SubmoduleData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/Submodule.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/TagData.hpp b/Libs/libMacGitverCore/RepoMan/Data/Tag.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Data/TagData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/Tag.hpp From ae9fc06101cab8a6c7f3488b7eba381f48855f06 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Mon, 11 May 2015 18:43:04 +0100 Subject: [PATCH 16/60] Move Private class implementation into own CPP file (Base) --- Libs/libMacGitverCore/CMakeLists.txt | 2 + Libs/libMacGitverCore/RepoMan/Data/Base.cpp | 413 ++++++++++++++++++ .../RepoMan/Frontend/Base.cpp | 394 +---------------- 3 files changed, 432 insertions(+), 377 deletions(-) create mode 100644 Libs/libMacGitverCore/RepoMan/Data/Base.cpp diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index a0afd889..2a19fcbc 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -42,6 +42,8 @@ SET( SRC_FILES RepoMan/Frontend/Tag.cpp RepoMan/Frontend/Head.cpp + RepoMan/Data/Base.cpp + RepoMan/Private/Dumper.cpp SHMParser/ShellExpand.cpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/Base.cpp b/Libs/libMacGitverCore/RepoMan/Data/Base.cpp new file mode 100644 index 00000000..a5655074 --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/Base.cpp @@ -0,0 +1,413 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Data/BaseData.hpp" +#include "RepoMan/Data/RefTreeNodeData.hpp" +#include "RepoMan/Data/CollectionNodeData.hpp" + +#include "RepoMan/Base.hpp" +#include "RepoMan/Repo.hpp" + +#include "RepoMan/Events.hpp" +#include "RepoMan/Private/Dumper.hpp" + +#include "libHeavenIcons/IconRef.hpp" + +namespace RM +{ + + namespace Internal + { + + BasePrivate::BasePrivate(Base* pub) + : mPub(pub) + , mRepo(NULL) + , mParentObj(NULL) + { + Q_ASSERT(mPub); + } + + BasePrivate::~BasePrivate() + { + // THIS _IS_ IMPORTANT + // We forbid by definition that any RM::* object may be destroyed _before_ it is unlinked + // from its parent. Otherwise, events cannot be triggered correctly. + Q_ASSERT(mChildren.count() == 0); + Q_ASSERT(mParentObj == NULL); + Q_ASSERT(mRepo == NULL); + } + + /** + * @brief Child-part of linking into the tree + * + * @param[in] parent The parent to link into + * + * This method is called directly from the constructor. It establishes a relationship with the + * parent object. This relationship can never be altered. + * + */ + void BasePrivate::linkToParent(Base* parent) + { + if (parent) { + mParentObj = parent->mData; + mParentObj->addChildObject(mPub); + mRepo = searchRepository(); + refreshSelf(); + postCreation(); + } + } + + /** + * @internal + * @brief Child-Part of unlinking from the tree + * + * Invokes the parent part on the parent side and then cleans up the reference to the parent. + */ + void BasePrivate::unlinkFromParent() + { + if (mParentObj) { + mParentObj->removeChildObject(mPub); + mParentObj = NULL; + mRepo = NULL; + } + } + + /** + * @internal + * @brief Parent-part of linking a new child + * + * We cannot do any special processing, since the child object is not yet fully constructed. We + * just fill the internal structure. + * + * @param[in] object The new child object that shall be linked in. + */ + void BasePrivate::addChildObject(Base* object) + { + Q_ASSERT(object); + Q_ASSERT(!mChildren.contains(object)); + mChildren.append(object); + } + + /** + * @internal + * @brief Parent-part of unlinking a child from the parent + * + * @param[in] object The child that is to be removed from the parent + */ + void BasePrivate::removeChildObject(Base* object) + { + Q_ASSERT(mChildren.contains(object)); + mChildren.removeOne(object); + } + + /** + * @internal + * @brief Recursively dump this object into a dumper + * + * All children will be dumped recursively. + * + * @param[in] dumper The dumper to output to + * + */ + void BasePrivate::dumpRecursive(Dumper& dumper) const + { + dumpSelf(dumper); + + dumper.indent(); + foreach(Base* child, mChildren) { + child->mData->dumpRecursive(dumper); + } + dumper.dedent(); + } + + QString BasePrivate::displayName() const + { + return QStringLiteral(""); + } + + /** + * @brief Refresh this object + * + * Refreshes this object and all its children. First calls to refreshSelf() expecting it to + * update this object and send out events. If refreshSelf() returns `false`, this object is + * removed from the tree. In this case all children should already have been removed from the + * tree. + * + * If refreshSelf() returned `true`, preRefreshChildren() is called. It should remove children + * that are no longer part of the tree. After that for each child, refresh() is called + * recursively. Finally, postRefreshChildren() is invoked, which should search for new objects + * and link them into the tree. + * + * If preRefreshChildren() is implemented correctly on all objects, refreshSelf() should + * probably never have to return `false`. + * + */ + void BasePrivate::refresh() + { + if (!refreshSelf()) { + // If refresh self returned false, we are no longer valid and will now destroy + // ourselves. We just terminateObject(). + terminateObject(); + return; + } + + postRefresh(); + preRefreshChildren(); + + foreach(Base* child, mChildren) { + child->mData->refresh(); + } + + postRefreshChildren(); + + if (refreshCheckDispensable()) { + terminateObject(); + } + } + + void BasePrivate::postRefresh() + { + } + + /** + * @brief Check if this object is dispensable + * + * @return @c true to dispense this object + * + * During the refresh cycle, this is the last method called for each object. If it returns + * @c true, the object will be terminated. + * + * This can be used for container objects that shall actually get dispensed once they have no + * more children (i.e. RefTreeNode). + * + */ + bool BasePrivate::refreshCheckDispensable() + { + return false; + } + + /** + * @brief First step in refreshing the children + * + * This method is called directly after the object refreshed itself (refreshSelf()) but before + * any of its children are refreshed. + * + * It shall be used to figure out which children do no longer exist. + * + * The base implementation simply does nothing. + * + */ + void BasePrivate::preRefreshChildren() + { + } + + /** + * @brief Last step in refreshing the children + * + * This method is called as last step in the refreshing process. It shall be used to find + * objects and add them to the tree. + * + * The base implementation simply does nothing. + * + */ + void BasePrivate::postRefreshChildren() + { + } + + /** + * @brief Terminates the lifetime of this object + * + * This method MUST be used to destroy an object. Don't just delete an repoman object. + * + * 1. For all children, terminateObject() gets invoked. + * 2. preTerminate() is called, whose objective is to send an event if required. + * 3. the object is unlinkedFromParent() + * 4. finally it deletes itself. Deleting is not defered; the object is gone immediately. + * + */ + void BasePrivate::terminateObject() + { + foreach (Base* child, mChildren) { + child->mData->terminateObject(); + } + + preTerminate(); + unlinkFromParent(); + delete this; + } + + /** + * @brief Are Events blocked for the repository this object belongs to? + * + * @return `true` if any events for this repository shall be suppressed. `false` in normal + * operation. + * + * During the construction of a repository and its initial seeding with objects, no events will + * be send to any listeners. This method must be used to query whether we're currently in that + * phase or not. + * + */ + bool BasePrivate::repoEventsBlocked() + { + Q_ASSERT(mRepo); + return mRepo->isInitializing(); + } + + /** + * @brief Pre-Termination call + * + * This method is called prior to doing the actual object termination. Its objective is to send + * out any required events to listeners, unless this repository is still initializing. + * + * The base implementation will send out a objectAboutToDelete() event. + */ + void BasePrivate::preTerminate() + { + if (!repoEventsBlocked()) { + Events::self()->objectAboutToBeDeleted(repository(), mPub); + } + } + + /** + * @brief Post-Construction call + * + * This method is called just before the last constructor is finished. The call actually will + * come from linkToParent(). + * + * The purpose of this method is to send a creation event. The base implementation will send a + * objectCreated() event. + * + * Note that no events should be sent out, if repoEventsBlocked() returns `true`. + * + */ + void BasePrivate::postCreation() + { + if (!repoEventsBlocked()) { + Events::self()->objectCreated(repository(), mPub); + } + } + + /** + * @brief Find the parent for a Ref. + * + * @param[in] scopes List of scopes to search for or to create. + * + * @param[in] create If `true` and @a path is not empty, a reference tree node will be + * created, if none is found. If `false`, `NULL` will be returned. + * + * @return If @a scopes is empty, `this` is returned. Otherwise findRefTreeNode() is called + * to either find or create a RefTreeNode, which will be returned. + */ + Base* BasePrivate::findRefParent(const QStringList& scopes, bool create) + { + if (scopes.isEmpty()) { + return mPub; + } + return findRefTreeNode(scopes, create); + } + + /** + * @brief Search for or create a ref tree node + * + * Searches for a RefTreeNode for path. + * + * @param[in] scopes List of scopes to search for or to create. Must not be empty. + * + * @param[in] create If `true` and a part of the tree node cannot be found, it will be + * created. If `false`, `NULL` will be returned in that case. + * + * @return If @a create is `true`, a valid RefTreeNode is returned. If @a create is + * `false`, `NULL` will be returned in case the path cannot be found. + */ + RefTreeNode* BasePrivate::findRefTreeNode(const QStringList &scopes, bool create) + { + if (scopes.isEmpty()) { + return NULL; + } + + Base* current = mPub; + + foreach (QString scope, scopes) { + RefTreeNode::List nodes = current->childObjects(); + RefTreeNode* next = NULL; + + foreach(RefTreeNode* child, nodes) { + if (child->name() == scope) { + next = child; + break; + } + } + + if (!next) { + if (create) { + // Note: We don't need to roll this back. Either we go all the way or nowhere. + next = new RefTreeNode(current, scope); + } + else { + return NULL; + } + } + + current = next; + } + + return static_cast< RefTreeNode* >(current); + } + + + CollectionNode* BasePrivate::getOrCreateCollection(CollectionTypes ctype) + { + CollectionNode* cn; + + foreach (cn, mPub->childObjects()) { + if (cn->collectionType() == ctype) { + return cn; + } + } + + return new CollectionNode(ctype, mPub); + } + + Repo* BasePrivate::searchRepository() + { + if (!mRepo) { + if (mParentObj) { + mRepo = mParentObj->repository(); + } + else { + return NULL; + } + } + return mRepo; + } + + Heaven::IconRef BasePrivate::icon(bool small) const + { + QString size = small ? QStringLiteral("@16") : QStringLiteral("@24"); + return Heaven::IconRef::fromString(QChar(L'#') % objectTypeName() % size); + } + + bool BasePrivate::inherits(ObjTypes type) const + { + return false; + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp index 9208d6dd..7c0846fc 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp @@ -35,27 +35,27 @@ #include "RepoMan/Private/Dumper.hpp" +/** + * @class Base + * @brief Base class for all RepoMan objects + * + * This base class takes care of a unified linking between a parent and its children. Children + * are always created with a pointer to their parent. Children may never be reparented. Only a + * parent is allowed to create children for itself. + * + * Further, the Base class takes care of keeping the strict logic of the refresh process. For + * details on how to implement the refresh logic, see refresh(). + * + * Finally, this base class allows to dump a partial subtree of RepoMan objects into a textual + * hierarchy. See dump() on advanced information. + * + */ + namespace RM { using namespace Internal; - /** - * @class Base - * @brief Base class for all RepoMan objects - * - * This base class takes care of a unified linking between a parent and its children. Children - * are always created with a pointer to their parent. Children may never be reparented. Only a - * parent is allowed to create children for itself. - * - * Further, the Base class takes care of keeping the strict logic of the refresh process. For - * details on how to implement the refresh logic, see refresh(). - * - * Finally, this base class allows to dump a partial subtree of RepoMan objects into a textual - * hierarchy. See dump() on advanced information. - * - */ - /** * @fn bool Base::refreshSelf() * @brief Refresh this object's data and sent events @@ -286,365 +286,5 @@ namespace RM return d->inherits(type); } - //-- BasePrivate ---------------------------------------------------------------------------- >8 - - BasePrivate::BasePrivate(Base* pub) - : mPub(pub) - , mRepo(NULL) - , mParentObj(NULL) - { - Q_ASSERT(mPub); - } - - BasePrivate::~BasePrivate() - { - // THIS _IS_ IMPORTANT - // We forbid by definition that any RM::* object may be destroyed _before_ it is unlinked - // from its parent. Otherwise, events cannot be triggered correctly. - Q_ASSERT(mChildren.count() == 0); - Q_ASSERT(mParentObj == NULL); - Q_ASSERT(mRepo == NULL); - } - - /** - * @brief Child-part of linking into the tree - * - * @param[in] parent The parent to link into - * - * This method is called directly from the constructor. It establishes a relationship with the - * parent object. This relationship can never be altered. - * - */ - void BasePrivate::linkToParent(Base* parent) - { - if (parent) { - mParentObj = parent->mData; - mParentObj->addChildObject(mPub); - mRepo = searchRepository(); - refreshSelf(); - postCreation(); - } - } - - /** - * @internal - * @brief Child-Part of unlinking from the tree - * - * Invokes the parent part on the parent side and then cleans up the reference to the parent. - */ - void BasePrivate::unlinkFromParent() - { - if (mParentObj) { - mParentObj->removeChildObject(mPub); - mParentObj = NULL; - mRepo = NULL; - } - } - - /** - * @internal - * @brief Parent-part of linking a new child - * - * We cannot do any special processing, since the child object is not yet fully constructed. We - * just fill the internal structure. - * - * @param[in] object The new child object that shall be linked in. - */ - void BasePrivate::addChildObject(Base* object) - { - Q_ASSERT(object); - Q_ASSERT(!mChildren.contains(object)); - mChildren.append(object); - } - - /** - * @internal - * @brief Parent-part of unlinking a child from the parent - * - * @param[in] object The child that is to be removed from the parent - */ - void BasePrivate::removeChildObject(Base* object) - { - Q_ASSERT(mChildren.contains(object)); - mChildren.removeOne(object); - } - - /** - * @internal - * @brief Recursively dump this object into a dumper - * - * All children will be dumped recursively. - * - * @param[in] dumper The dumper to output to - * - */ - void BasePrivate::dumpRecursive(Dumper& dumper) const - { - dumpSelf(dumper); - - dumper.indent(); - foreach(Base* child, mChildren) { - child->mData->dumpRecursive(dumper); - } - dumper.dedent(); - } - - QString BasePrivate::displayName() const - { - return QStringLiteral(""); - } - - /** - * @brief Refresh this object - * - * Refreshes this object and all its children. First calls to refreshSelf() expecting it to - * update this object and send out events. If refreshSelf() returns `false`, this object is - * removed from the tree. In this case all children should already have been removed from the - * tree. - * - * If refreshSelf() returned `true`, preRefreshChildren() is called. It should remove children - * that are no longer part of the tree. After that for each child, refresh() is called - * recursively. Finally, postRefreshChildren() is invoked, which should search for new objects - * and link them into the tree. - * - * If preRefreshChildren() is implemented correctly on all objects, refreshSelf() should - * probably never have to return `false`. - * - */ - void BasePrivate::refresh() - { - if (!refreshSelf()) { - // If refresh self returned false, we are no longer valid and will now destroy - // ourselves. We just terminateObject(). - terminateObject(); - return; - } - - postRefresh(); - preRefreshChildren(); - - foreach(Base* child, mChildren) { - child->mData->refresh(); - } - - postRefreshChildren(); - - if (refreshCheckDispensable()) { - terminateObject(); - } - } - - void BasePrivate::postRefresh() - { - } - - /** - * @brief Check if this object is dispensable - * - * @return @c true to dispense this object - * - * During the refresh cycle, this is the last method called for each object. If it returns - * @c true, the object will be terminated. - * - * This can be used for container objects that shall actually get dispensed once they have no - * more children (i.e. RefTreeNode). - * - */ - bool BasePrivate::refreshCheckDispensable() - { - return false; - } - - /** - * @brief First step in refreshing the children - * - * This method is called directly after the object refreshed itself (refreshSelf()) but before - * any of its children are refreshed. - * - * It shall be used to figure out which children do no longer exist. - * - * The base implementation simply does nothing. - * - */ - void BasePrivate::preRefreshChildren() - { - } - - /** - * @brief Last step in refreshing the children - * - * This method is called as last step in the refreshing process. It shall be used to find - * objects and add them to the tree. - * - * The base implementation simply does nothing. - * - */ - void BasePrivate::postRefreshChildren() - { - } - - /** - * @brief Terminates the lifetime of this object - * - * This method MUST be used to destroy an object. Don't just delete an repoman object. - * - * 1. For all children, terminateObject() gets invoked. - * 2. preTerminate() is called, whose objective is to send an event if required. - * 3. the object is unlinkedFromParent() - * 4. finally it deletes itself. Deleting is not defered; the object is gone immediately. - * - */ - void BasePrivate::terminateObject() - { - foreach (Base* child, mChildren) { - child->mData->terminateObject(); - } - - preTerminate(); - unlinkFromParent(); - delete this; - } - - /** - * @brief Are Events blocked for the repository this object belongs to? - * - * @return `true` if any events for this repository shall be suppressed. `false` in normal - * operation. - * - * During the construction of a repository and its initial seeding with objects, no events will - * be send to any listeners. This method must be used to query whether we're currently in that - * phase or not. - * - */ - bool BasePrivate::repoEventsBlocked() - { - Q_ASSERT(mRepo); - return mRepo->isInitializing(); - } - - /** - * @brief Pre-Termination call - * - * This method is called prior to doing the actual object termination. Its objective is to send - * out any required events to listeners, unless this repository is still initializing. - * - * The base implementation will send out a objectAboutToDelete() event. - */ - void BasePrivate::preTerminate() - { - if (!repoEventsBlocked()) { - Events::self()->objectAboutToBeDeleted(repository(), mPub); - } - } - - /** - * @brief Post-Construction call - * - * This method is called just before the last constructor is finished. The call actually will - * come from linkToParent(). - * - * The purpose of this method is to send a creation event. The base implementation will send a - * objectCreated() event. - * - * Note that no events should be sent out, if repoEventsBlocked() returns `true`. - * - */ - void BasePrivate::postCreation() - { - if (!repoEventsBlocked()) { - Events::self()->objectCreated(repository(), mPub); - } - } - - /** - * @brief Find the parent for a Ref. - * - * @param[in] scopes List of scopes to search for or to create. - * - * @param[in] create If `true` and @a path is not empty, a reference tree node will be - * created, if none is found. If `false`, `NULL` will be returned. - * - * @return If @a scopes is empty, `this` is returned. Otherwise findRefTreeNode() is called - * to either find or create a RefTreeNode, which will be returned. - */ - Base* BasePrivate::findRefParent(const QStringList& scopes, bool create) - { - if (scopes.isEmpty()) { - return mPub; - } - return findRefTreeNode(scopes, create); - } - - /** - * @brief Search for or create a ref tree node - * - * Searches for a RefTreeNode for path. - * - * @param[in] scopes List of scopes to search for or to create. Must not be empty. - * - * @param[in] create If `true` and a part of the tree node cannot be found, it will be - * created. If `false`, `NULL` will be returned in that case. - * - * @return If @a create is `true`, a valid RefTreeNode is returned. If @a create is - * `false`, `NULL` will be returned in case the path cannot be found. - */ - RefTreeNode* BasePrivate::findRefTreeNode(const QStringList &scopes, bool create) - { - if (scopes.isEmpty()) { - return NULL; - } - - Base* current = mPub; - - foreach (QString scope, scopes) { - RefTreeNode::List nodes = current->childObjects(); - RefTreeNode* next = NULL; - - foreach(RefTreeNode* child, nodes) { - if (child->name() == scope) { - next = child; - break; - } - } - - if (!next) { - if (create) { - // Note: We don't need to roll this back. Either we go all the way or nowhere. - next = new RefTreeNode(current, scope); - } - else { - return NULL; - } - } - - current = next; - } - - return static_cast< RefTreeNode* >(current); - } - - Repo* BasePrivate::searchRepository() - { - if (!mRepo) { - if (mParentObj) { - mRepo = mParentObj->repository(); - } - else { - return NULL; - } - } - return mRepo; - } - - Heaven::IconRef BasePrivate::icon(bool small) const - { - QString size = small ? QStringLiteral("@16") : QStringLiteral("@24"); - return Heaven::IconRef::fromString(QChar(L'#') % objectTypeName() % size); - } - - bool BasePrivate::inherits(ObjTypes type) const - { - return false; - } - } + From 4620084c59e07c468870f66d0d89cbd350ebd132 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Tue, 12 May 2015 09:19:36 +0100 Subject: [PATCH 17/60] Move Private class implementation into own CPP file (Tag) --- Libs/libMacGitverCore/CMakeLists.txt | 1 + Libs/libMacGitverCore/RepoMan/Data/Tag.cpp | 79 +++++++++++++++++++ .../libMacGitverCore/RepoMan/Frontend/Tag.cpp | 51 +----------- 3 files changed, 81 insertions(+), 50 deletions(-) create mode 100644 Libs/libMacGitverCore/RepoMan/Data/Tag.cpp diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 2a19fcbc..827fe62d 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -43,6 +43,7 @@ SET( SRC_FILES RepoMan/Frontend/Head.cpp RepoMan/Data/Base.cpp + RepoMan/Data/Tag.cpp RepoMan/Private/Dumper.cpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/Tag.cpp b/Libs/libMacGitverCore/RepoMan/Data/Tag.cpp new file mode 100644 index 00000000..9c87eb97 --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/Tag.cpp @@ -0,0 +1,79 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Data/TagData.hpp" + +#include "RepoMan/Events.hpp" + +#include "RepoMan/Private/Dumper.hpp" + +namespace RM +{ + + namespace Internal + { + + TagPrivate::TagPrivate(Tag* _pub, const Git::Reference& _ref) + : RefPrivate(_pub, TagType, _ref) + { + } + + ObjTypes TagPrivate::objType() const + { + return ObjTypes::Tag; + } + + void TagPrivate::postCreation() + { + if (!repoEventsBlocked()) { + Events::self()->tagCreated(repository(), pub()); + } + + RefPrivate::postCreation(); + } + + void TagPrivate::preTerminate() + { + if (!repoEventsBlocked()) { + Events::self()->tagAboutToBeDeleted(repository(), pub()); + } + + RefPrivate::preTerminate(); + } + + void TagPrivate::dumpSelf(Internal::Dumper& dumper) const + { + dumper.addLine(QString(QStringLiteral("Tag 0x%1 - %2")) + .arg(quintptr(mPub),0,16) + .arg(mName)); + } + + QString TagPrivate::objectTypeName() const + { + return QStringLiteral("Tag"); + } + + bool TagPrivate::inherits(ObjTypes type) const + { + return type == ObjTypes::Tag || RefPrivate::inherits(type); + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp index f98e4ce2..518db64e 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp @@ -28,60 +28,11 @@ namespace RM { - using namespace Internal; - Tag::Tag(Base* _parent, const Git::Reference& _ref) - : Ref(*new TagPrivate(this, _ref)) + : Ref(*new Internal::TagPrivate(this, _ref)) { RM_D(Tag); d->linkToParent(_parent); } - //-- TagPrivate -------------------------------------------------------------------------------- - - TagPrivate::TagPrivate(Tag* _pub, const Git::Reference& _ref) - : RefPrivate(_pub, TagType, _ref) - { - } - - ObjTypes TagPrivate::objType() const - { - return ObjTypes::Tag; - } - - void TagPrivate::postCreation() - { - if (!repoEventsBlocked()) { - Events::self()->tagCreated(repository(), pub()); - } - - RefPrivate::postCreation(); - } - - void TagPrivate::preTerminate() - { - if (!repoEventsBlocked()) { - Events::self()->tagAboutToBeDeleted(repository(), pub()); - } - - RefPrivate::preTerminate(); - } - - void TagPrivate::dumpSelf(Internal::Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("Tag 0x%1 - %2")) - .arg(quintptr(mPub),0,16) - .arg(mName)); - } - - QString TagPrivate::objectTypeName() const - { - return QStringLiteral("Tag"); - } - - bool TagPrivate::inherits(ObjTypes type) const - { - return type == ObjTypes::Tag || RefPrivate::inherits(type); - } - } From 82c0947039216acda0ddfc60f0ea87efafda7816 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Tue, 12 May 2015 18:15:30 +0100 Subject: [PATCH 18/60] Move Private class implementation into own CPP file (Ref) --- Libs/libMacGitverCore/CMakeLists.txt | 1 + .../RepoMan/Data/Reference.cpp | 137 ++++++++++++++++++ .../libMacGitverCore/RepoMan/Frontend/Ref.cpp | 104 ------------- 3 files changed, 138 insertions(+), 104 deletions(-) create mode 100644 Libs/libMacGitverCore/RepoMan/Data/Reference.cpp diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 827fe62d..9c0ff4ce 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -43,6 +43,7 @@ SET( SRC_FILES RepoMan/Frontend/Head.cpp RepoMan/Data/Base.cpp + RepoMan/Data/Reference.cpp RepoMan/Data/Tag.cpp RepoMan/Private/Dumper.cpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/Reference.cpp b/Libs/libMacGitverCore/RepoMan/Data/Reference.cpp new file mode 100644 index 00000000..b8acad6f --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/Reference.cpp @@ -0,0 +1,137 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Data/RefData.hpp" + +#include "RepoMan/Repo.hpp" + +#include "RepoMan/Events.hpp" + +#include "RepoMan/Private/Dumper.hpp" + +#include "libGitWrap/Result.hpp" +#include "libGitWrap/Reference.hpp" +#include "libGitWrap/RefName.hpp" + +namespace RM +{ + + namespace Internal + { + + RefPrivate::RefPrivate(Ref* pub, RefTypes type, const Git::Reference& ref) + : BasePrivate( pub ) + , mType( type ) + , mFullQualifiedName( ref.name() ) + , mName( ref.nameAnalyzer().name() ) + , mId( ref.objectId() ) + { + } + + void RefPrivate::dumpSelf(Internal::Dumper& dumper) const + { + dumper.addLine(QString(QStringLiteral("Ref 0x%1 [%2]")) + .arg(quintptr(mPub),0,16) + .arg(mName)); + } + + ObjTypes RefPrivate::objType() const + { + return ObjTypes::Reference; + } + + QString RefPrivate::displayName() const + { + return mName; + } + + QString RefPrivate::objectTypeName() const + { + return QStringLiteral("Ref"); + } + + bool RefPrivate::inherits(ObjTypes type) const + { + return type == ObjTypes::Reference || BasePrivate::inherits(type); + } + + void RefPrivate::postCreation() + { + RM_P(Ref); + + if (!repoEventsBlocked()) { + Events::self()->refCreated(repository(), p); + } + + BasePrivate::postCreation(); + } + + void RefPrivate::preTerminate() + { + RM_P(Ref); + + if ( !repoEventsBlocked() ) { + Events::self()->refAboutToBeDeleted(repository(), p); + } + + BasePrivate::preTerminate(); + } + + void RefPrivate::emitMoved() + { + if (!repoEventsBlocked()) { + Events::self()->refMoved(repository(), pub()); + } + } + + bool RefPrivate::refreshDetails(const Git::Reference& ref) + { + Git::ObjectId id = ref.objectId(); + + if (id != mId) { + mId = id; + if (!repoEventsBlocked()) { + emitMoved(); + } + } + + return true; + } + + bool RefPrivate::refreshSelf() + { + Git::Result r; + Repo* repo = repository(); Q_ASSERT( repo ); + Git::Repository gr = repo->gitLoadedRepo(); + Git::Reference ref = gr.reference(r, mFullQualifiedName); + + if (!ref.isValid() || ref.wasDestroyed()) { + return false; + } + + if (!refreshDetails(ref)) { + return false; + } + + return true; + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp index 708d8966..ea4ae9ae 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp @@ -32,8 +32,6 @@ namespace RM { - //-- Ref --8> - Ref::Ref(Internal::RefPrivate& data) : Base( data ) { @@ -88,106 +86,4 @@ namespace RM return gitRef; } - namespace Internal - { - - RefPrivate::RefPrivate(Ref* pub, RefTypes type, const Git::Reference& ref) - : BasePrivate( pub ) - , mType( type ) - , mFullQualifiedName( ref.name() ) - , mName( ref.nameAnalyzer().name() ) - , mId( ref.objectId() ) - { - } - - void RefPrivate::dumpSelf(Internal::Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("Ref 0x%1 [%2]")) - .arg(quintptr(mPub),0,16) - .arg(mName)); - } - - ObjTypes RefPrivate::objType() const - { - return ObjTypes::Reference; - } - - QString RefPrivate::displayName() const - { - return mName; - } - - QString RefPrivate::objectTypeName() const - { - return QStringLiteral("Ref"); - } - - bool RefPrivate::inherits(ObjTypes type) const - { - return type == ObjTypes::Reference || BasePrivate::inherits(type); - } - - void RefPrivate::postCreation() - { - RM_P(Ref); - - if (!repoEventsBlocked()) { - Events::self()->refCreated(repository(), p); - } - - BasePrivate::postCreation(); - } - - void RefPrivate::preTerminate() - { - RM_P(Ref); - - if ( !repoEventsBlocked() ) { - Events::self()->refAboutToBeDeleted(repository(), p); - } - - BasePrivate::preTerminate(); - } - - void RefPrivate::emitMoved() - { - if (!repoEventsBlocked()) { - Events::self()->refMoved(repository(), pub()); - } - } - - bool RefPrivate::refreshDetails(const Git::Reference& ref) - { - Git::ObjectId id = ref.objectId(); - - if (id != mId) { - mId = id; - if (!repoEventsBlocked()) { - emitMoved(); - } - } - - return true; - } - - bool RefPrivate::refreshSelf() - { - Git::Result r; - Repo* repo = repository(); Q_ASSERT( repo ); - Git::Repository gr = repo->gitLoadedRepo(); - Git::Reference ref = gr.reference(r, mFullQualifiedName); - - if (!ref.isValid() || ref.wasDestroyed()) { - return false; - } - - if (!refreshDetails(ref)) { - return false; - } - - return true; - } - - } - } From a35a14b9cf949bdf39b8ab530a8748233bfd40f8 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Tue, 12 May 2015 18:17:40 +0100 Subject: [PATCH 19/60] Move Private class implementation into own CPP file (Branch) --- Libs/libMacGitverCore/CMakeLists.txt | 1 + Libs/libMacGitverCore/RepoMan/Data/Branch.cpp | 95 +++++++++++++++++++ .../RepoMan/Frontend/Branch.cpp | 64 ------------- 3 files changed, 96 insertions(+), 64 deletions(-) create mode 100644 Libs/libMacGitverCore/RepoMan/Data/Branch.cpp diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 9c0ff4ce..05adc5fe 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -44,6 +44,7 @@ SET( SRC_FILES RepoMan/Data/Base.cpp RepoMan/Data/Reference.cpp + RepoMan/Data/Branch.cpp RepoMan/Data/Tag.cpp RepoMan/Private/Dumper.cpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/Branch.cpp b/Libs/libMacGitverCore/RepoMan/Data/Branch.cpp new file mode 100644 index 00000000..3b59faac --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/Branch.cpp @@ -0,0 +1,95 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Data/BranchData.hpp" +#include "RepoMan/Events.hpp" + +#include "RepoMan/Private/Dumper.hpp" + +namespace RM +{ + + namespace Internal + { + + BranchPrivate::BranchPrivate(Branch* pub, const Git::Reference& ref) + : RefPrivate(pub, BranchType, ref) + , mHasUpstream(false) + , mAheadCount(0) + , mBehindCount(0) + { + } + + ObjTypes BranchPrivate::objType() const + { + return ObjTypes::Branch; + } + + void BranchPrivate::postCreation() + { + if (!repoEventsBlocked()) { + Events::self()->branchCreated(repository(), pub()); + } + + RefPrivate::postCreation(); + } + + void BranchPrivate::preTerminate() + { + if (!repoEventsBlocked()) { + Events::self()->branchAboutToBeDeleted(repository(), pub()); + } + + RefPrivate::preTerminate(); + } + + void BranchPrivate::dumpSelf(Internal::Dumper& dumper) const + { + dumper.addLine(QString(QStringLiteral("Branch 0x%1 - %2")) + .arg(quintptr(mPub),0,16) + .arg(mName)); + } + + QString BranchPrivate::objectTypeName() const + { + return QStringLiteral("Branch"); + } + + void BranchPrivate::emitMoved() + { + if (!repoEventsBlocked()) { + Events::self()->refMoved(mRepo, pub()); + Events::self()->branchMoved(mRepo, pub()); + } + } + + bool BranchPrivate::refreshDetails(const Git::Reference& ref) + { + + return RefPrivate::refreshDetails(ref); + } + + bool BranchPrivate::inherits(ObjTypes type) const + { + return type == ObjTypes::Branch || RefPrivate::inherits(type); + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp index 02a3909a..2da6af24 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp @@ -74,68 +74,4 @@ namespace RM return h && h->is(this); } - //-- BranchPrivate ----------------------------------------------------------------------------- - - BranchPrivate::BranchPrivate(Branch* pub, const Git::Reference& ref) - : RefPrivate(pub, BranchType, ref) - , mHasUpstream(false) - , mAheadCount(0) - , mBehindCount(0) - { - } - - ObjTypes BranchPrivate::objType() const - { - return ObjTypes::Branch; - } - - void BranchPrivate::postCreation() - { - if (!repoEventsBlocked()) { - Events::self()->branchCreated(repository(), pub()); - } - - RefPrivate::postCreation(); - } - - void BranchPrivate::preTerminate() - { - if (!repoEventsBlocked()) { - Events::self()->branchAboutToBeDeleted(repository(), pub()); - } - - RefPrivate::preTerminate(); - } - - void BranchPrivate::dumpSelf(Internal::Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("Branch 0x%1 - %2")) - .arg(quintptr(mPub),0,16) - .arg(mName)); - } - - QString BranchPrivate::objectTypeName() const - { - return QStringLiteral("Branch"); - } - - void BranchPrivate::emitMoved() - { - if (!repoEventsBlocked()) { - Events::self()->refMoved(mRepo, pub()); - Events::self()->branchMoved(mRepo, pub()); - } - } - - bool BranchPrivate::refreshDetails(const Git::Reference& ref) - { - - return RefPrivate::refreshDetails(ref); - } - - bool BranchPrivate::inherits(ObjTypes type) const - { - return type == ObjTypes::Branch || RefPrivate::inherits(type); - } - } From 48f62850d5e821fb5abb66743c43c32f938051d0 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Tue, 12 May 2015 07:25:13 +0100 Subject: [PATCH 20/60] Move Private class implementation into own CPP file (Head) --- Libs/libMacGitverCore/CMakeLists.txt | 1 + Libs/libMacGitverCore/RepoMan/Data/Head.cpp | 102 ++++++++++++++++++ .../RepoMan/Frontend/Head.cpp | 76 +------------ 3 files changed, 105 insertions(+), 74 deletions(-) create mode 100644 Libs/libMacGitverCore/RepoMan/Data/Head.cpp diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 05adc5fe..b50213a5 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -45,6 +45,7 @@ SET( SRC_FILES RepoMan/Data/Base.cpp RepoMan/Data/Reference.cpp RepoMan/Data/Branch.cpp + RepoMan/Data/Head.cpp RepoMan/Data/Tag.cpp RepoMan/Private/Dumper.cpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/Head.cpp b/Libs/libMacGitverCore/RepoMan/Data/Head.cpp new file mode 100644 index 00000000..fa1a354b --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/Head.cpp @@ -0,0 +1,102 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Events.hpp" + +#include "RepoMan/Head.hpp" + +#include "RepoMan/Private/Dumper.hpp" + +#include "RepoMan/Data/HeadData.hpp" + +#include "RepoMan/Branch.hpp" +#include "RepoMan/Repo.hpp" + +#include "libGitWrap/Repository.hpp" +#include "libGitWrap/BranchRef.hpp" + +namespace RM +{ + + namespace Internal + { + + HeadPrivate::HeadPrivate(Head* _pub, const Git::Repository& repo) + : BasePrivate(_pub) + , symbolicName() + , isDetached(repo.isHeadDetached()) + , isUnborn(repo.isHeadUnborn()) + { + Git::Result r; + + if (isDetached) { + detachedId = repo.HEAD(r).objectId(); + } + else { + symbolicName = repo.headBranchName(r); + } + } + + ObjTypes HeadPrivate::objType() const + { + return ObjTypes::Head; + } + + void HeadPrivate::dumpSelf(Internal::Dumper& dumper) const + { + dumper.addLine(QString(QStringLiteral("Head 0x%1 - %2")) + .arg(quintptr(mPub),0,16) + .arg(symbolicName)); + } + + bool HeadPrivate::refreshSelf() + { + Git::Repository repo = repository()->gitLoadedRepo(); + Git::Result r; + + isUnborn = repo.isHeadUnborn(); + isDetached = repo.isHeadDetached(); + + if (isDetached) { + detachedId = repo.HEAD(r).objectId(); + } + else { + symbolicName = repo.headBranchName(r); + } + return true; + } + + QString HeadPrivate::displayName() const + { + return symbolicName; + } + + QString HeadPrivate::objectTypeName() const + { + return QStringLiteral("Head"); + } + + bool HeadPrivate::inherits(ObjTypes type) const + { + return type == ObjTypes::Head || BasePrivate::inherits(type); + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp index b956460b..baeaef74 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp @@ -21,90 +21,18 @@ #include "RepoMan/Head.hpp" -#include "RepoMan/Private/Dumper.hpp" - #include "RepoMan/Data/HeadData.hpp" #include "RepoMan/Branch.hpp" #include "RepoMan/Repo.hpp" #include "libGitWrap/Repository.hpp" -#include "libGitWrap/BranchRef.hpp" namespace RM { - namespace Internal - { - - // -- HeadPrivate ----------------------------------------------------------------------- >8 - - HeadPrivate::HeadPrivate(Head* _pub, const Git::Repository& repo) - : BasePrivate(_pub) - , symbolicName() - , isDetached(repo.isHeadDetached()) - , isUnborn(repo.isHeadUnborn()) - { - Git::Result r; - - if (isDetached) { - detachedId = repo.HEAD(r).objectId(); - } - else { - symbolicName = repo.headBranchName(r); - } - } - - ObjTypes HeadPrivate::objType() const - { - return ObjTypes::Head; - } - - void HeadPrivate::dumpSelf(Internal::Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("Head 0x%1 - %2")) - .arg(quintptr(mPub),0,16) - .arg(symbolicName)); - } - - bool HeadPrivate::refreshSelf() - { - Git::Repository repo = repository()->gitLoadedRepo(); - Git::Result r; - - isUnborn = repo.isHeadUnborn(); - isDetached = repo.isHeadDetached(); - - if (isDetached) { - detachedId = repo.HEAD(r).objectId(); - } - else { - symbolicName = repo.headBranchName(r); - } - return true; - } - - QString HeadPrivate::displayName() const - { - return symbolicName; - } - - QString HeadPrivate::objectTypeName() const - { - return QStringLiteral("Head"); - } - - bool HeadPrivate::inherits(ObjTypes type) const - { - return type == ObjTypes::Head || BasePrivate::inherits(type); - } - - } - - // -- Head ---------------------------------------------------------------------------------- >8 - - Head::Head(const Git::Repository& ref, Base* parent) - : Base(*new Internal::HeadPrivate(this, ref)) + Head::Head(const Git::Repository& repo, Base* parent) + : Base(*new Internal::HeadPrivate(this, repo)) { RM_D(Head); d->linkToParent(parent); From 88094bd28128f86e5473886d2657b86217a0292f Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Wed, 13 May 2015 18:56:42 +0100 Subject: [PATCH 21/60] Move Private class implementation into own CPP file (Repo) --- Libs/libMacGitverCore/CMakeLists.txt | 1 + Libs/libMacGitverCore/RepoMan/Data/Repo.cpp | 357 ++++++++++++++++++ .../RepoMan/Frontend/Repo.cpp | 324 +--------------- 3 files changed, 361 insertions(+), 321 deletions(-) create mode 100644 Libs/libMacGitverCore/RepoMan/Data/Repo.cpp diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index b50213a5..daba903d 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -44,6 +44,7 @@ SET( SRC_FILES RepoMan/Data/Base.cpp RepoMan/Data/Reference.cpp + RepoMan/Data/Repo.cpp RepoMan/Data/Branch.cpp RepoMan/Data/Head.cpp RepoMan/Data/Tag.cpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Data/Repo.cpp new file mode 100644 index 00000000..107a8de7 --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/Repo.cpp @@ -0,0 +1,357 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Data/RepoData.hpp" +#include "RepoMan/Data/RemoteData.hpp" + +#include "RepoMan/RepoMan.hpp" +#include "RepoMan/Submodule.hpp" +#include "RepoMan/Head.hpp" +#include "RepoMan/Namespace.hpp" +#include "RepoMan/Tag.hpp" + +#include "RepoMan/Private/Dumper.hpp" + +#include "libMacGitverCore/App/MacGitver.hpp" + +#include "libGitWrap/Reference.hpp" +#include "libGitWrap/ObjectId.hpp" +#include "libGitWrap/RefName.hpp" +#include "libGitWrap/Submodule.hpp" + +#include +#include + +namespace RM +{ + + namespace Internal + { + + RepoPrivate::RepoPrivate(Repo* pub, const Git::Repository& repo) + : BasePrivate( pub ) + { + mRepo = repo; + mHead = NULL; + mPath = mRepo.workTreePath(); + mIsLoaded = mRepo.isValid(); + mIsActive = false; + mIsBare = mRepo.isValid() && mRepo.isBare(); + mIsSubModule = false; + mIsInitializing = true; + mDisplayAlias = QString(); + mUnloadTimer = NULL; + + if (mPath.endsWith(L'/')) { + mPath = mPath.left(mPath.length() - 1); + } + + findAlias(); + + if (mDisplayAlias.isEmpty()) { + if (mPath.isEmpty()) { + mDisplayAlias = Repo::tr("Unknown Repository"); + } + else { + QStringList sl = mPath.split(QChar(L'/'), QString::SkipEmptyParts); + mDisplayAlias = sl.last(); + } + } + } + + RepoPrivate::~RepoPrivate() + { + RM_P(Repo); + + if (mIsLoaded) { + unload(); + } + + MacGitver::repoMan().internalClosedRepo(p); + } + + void RepoPrivate::load() + { + // ### Unimplemented: RepoPrivate::load() + Q_ASSERT(!mIsLoaded); + } + + void RepoPrivate::unload() + { + if (mIsActive) { + qDebug() << "Unloading active RepoInfo. Will deactivate it first."; + MacGitver::repoMan().activate(NULL); + } + Q_ASSERT(!mIsActive); + + if (mUnloadTimer) { + mUnloadTimer->stop(); + mUnloadTimer->deleteLater(); + mUnloadTimer = NULL; + } + + // ####REPOMAN Do we really need to send out events for Unload/Load? If yes, create + // real events for that! + mIsLoaded = false; + mRepo = Git::Repository(); + } + + + QString RepoPrivate::displayName() const + { + return mDisplayAlias; + } + + void RepoPrivate::preTerminate() + { + // Do we need to do smth? + } + + void RepoPrivate::scanSubmodules() + { + RM_P(Repo); + + Git::Repository repo = gitRepo(true); + if (!repo.isValid()) { + return; + } + + Git::Result r; + Git::Submodule::List subs = repo.submodules( r ); + if (!r) { + return; + } + + Repo::List oldSubmodules = pub()->submodules(); + + foreach (Git::Submodule sub, subs) { + Git::Result child; + Git::Repository subRepo = sub.subRepository(child); + if (!child) { + continue; + } + Q_ASSERT(subRepo.isValid()); + + Repo* subInfo = NULL; + QString path = subRepo.workTreePath(); + + if (path.endsWith(L'/')) { + path = path.left(path.length() - 1); + } + + subInfo = repoByPath(path, true); + if (!subInfo) { + subInfo = new Submodule(subRepo, p); + } + else { + oldSubmodules.removeOne(subInfo); + } + } + + foreach(Repo* repo, oldSubmodules) { + dataOf(repo)->terminateObject(); + } + } + + void RepoPrivate::findAlias() + { + // ### Unimplemented: RepoPrivate::findAlias() + } + + bool RepoPrivate::refreshSelf() + { + if (!mIsLoaded) { + // In case we're not loaded, just return and do nothing. + return true; + } + + if (!mHead) { + RM_P(Repo); + mHead = new Head(mRepo, p); + } + + return true; + } + + void RepoPrivate::postRefreshChildren() + { + if (!mIsLoaded) { + // In case we're not loaded, just return and do nothing. + return; + } + + Git::Result r; + Git::Remote::List remotes = mRepo.allRemotes(r); + if (r) { + foreach (const Git::Remote& remote, remotes) { + findRemote(remote, true); + } + } + + Git::ReferenceList refs = mRepo.allReferences(r); + if (r) { + foreach (Git::Reference ref, refs) { + findReference(ref, true); + } + } + + scanSubmodules(); + } + + /** + * @brief Get this object's type + * + * @return always ObjTypes::Repo. + * + */ + ObjTypes RepoPrivate::objType() const + { + return ObjTypes::Repo; + } + + void RepoPrivate::dumpSelf(Internal::Dumper& dumper) const + { + dumper.addLine(QString(QStringLiteral("Repository 0x%1 - %02")) + .arg(quintptr(mPub),0,16) + .arg(mIsLoaded ? mRepo.name() + : QStringLiteral(""))); + } + + + Ref* RepoPrivate::findReference(const Git::Reference& ref, bool create) + { + Git::RefName rn = ref.nameAnalyzer(); + return findReference(rn, ref, create); + } + + Ref* RepoPrivate::findReference(const QString& fqrn, bool create) + { + Git::RefName rn(fqrn); + return findReference(rn, Git::Reference(), create); + } + + Ref* RepoPrivate::findReference(Git::RefName& rn, Git::Reference ref, bool create) + { + return NULL; + } + + Remote* RepoPrivate::findRemote(const QString &remoteName, bool create) + { + RM_P(Repo); + + foreach (Remote* remote, p->childObjects()) { + if (remote->name() == remoteName) { + return remote; + } + } + + if (create) { + Git::Result r; + Git::Remote gr = p->gitRepo().remote(r, remoteName); + + if (r && gr.isValid()) { + Remote* remote = new Remote(gr, p); + return remote; + } + } + + return NULL; + } + + Remote* RepoPrivate::findRemote(const Git::Remote &remote, bool create) + { + RM_P( Repo ); + + if (!remote.isValid()) { + return NULL; + } + + QString remoteName = remote.name(); + foreach (Remote* rmRemote, p->childObjects()) { + if (rmRemote->name() == remoteName) { + return rmRemote; + } + } + + if (create) { + Remote* rmRemote = new Remote(remote, p); + return rmRemote; + } + + return NULL; + } + + Namespace* RepoPrivate::findNamespace(const QStringList& _namespaces, bool create) + { + return NULL; + } + + Namespace* RepoPrivate::findNamespace(const QString& nsFullName, bool create) { + + QStringList nsNames = nsFullName.split(QChar(L'/')); + return findNamespace(nsNames, create); + } + + Repo* RepoPrivate::repoByPath(const QString& basePath, bool searchSubmodules) + { + foreach (Repo* subRepo, mPub->childObjects()) { + + if (subRepo->path() == basePath) { + return subRepo; + } + + if (searchSubmodules) { + if (RepoPrivate* subRepoPriv = dataOf(subRepo)) { + if (Repo* subsubRepo = subRepoPriv->repoByPath(basePath, true)) { + return subsubRepo; + } + } + } + } + + return NULL; + } + + QString RepoPrivate::objectTypeName() const + { + return QStringLiteral("Repo"); + } + + bool RepoPrivate::inherits(ObjTypes type) const + { + return type == ObjTypes::Repo || BasePrivate::inherits(type); + } + + Repo* RepoPrivate::searchRepository() + { + return static_cast(mPub); + } + + Git::Repository RepoPrivate::gitRepo(bool doLoad) + { + if (!mIsLoaded && doLoad) { + load(); + } + + return mRepo; + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp index a3b76267..193f7023 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp @@ -20,11 +20,6 @@ #include #include -#include "libGitWrap/Reference.hpp" -#include "libGitWrap/ObjectId.hpp" -#include "libGitWrap/RefName.hpp" -#include "libGitWrap/Submodule.hpp" - #include "libMacGitverCore/App/MacGitver.hpp" #include "RepoMan/Events.hpp" @@ -38,23 +33,19 @@ #include "RepoMan/Branch.hpp" #include "RepoMan/Submodule.hpp" -#include "RepoMan/Private/Dumper.hpp" - #include "RepoMan/Data/RepoData.hpp" #include "RepoMan/Data/RemoteData.hpp" namespace RM { - using namespace Internal; - - Repo::Repo(RepoPrivate& _d) + Repo::Repo(Internal::RepoPrivate& _d) : Base(_d) { } Repo::Repo(const Git::Repository& repo, Base* parent) - : Base( *new RepoPrivate(this, repo) ) + : Base( *new Internal::RepoPrivate(this, repo) ) { RM_D(Repo); @@ -283,314 +274,5 @@ namespace RM return d->mHead; } - //-- RepoPrivate ------------------------------------------------------------------------------- - - RepoPrivate::RepoPrivate(Repo* pub, const Git::Repository& repo) - : BasePrivate( pub ) - { - mRepo = repo; - mHead = NULL; - mPath = mRepo.workTreePath(); - mIsLoaded = mRepo.isValid(); - mIsActive = false; - mIsBare = mRepo.isValid() && mRepo.isBare(); - mIsSubModule = false; - mIsInitializing = true; - mDisplayAlias = QString(); - mUnloadTimer = NULL; - - if (mPath.endsWith(L'/')) { - mPath = mPath.left(mPath.length() - 1); - } - - findAlias(); - - if (mDisplayAlias.isEmpty()) { - if (mPath.isEmpty()) { - mDisplayAlias = Repo::tr("Unknown Repository"); - } - else { - QStringList sl = mPath.split(QChar(L'/'), QString::SkipEmptyParts); - mDisplayAlias = sl.last(); - } - } - } - - RepoPrivate::~RepoPrivate() - { - RM_P(Repo); - - if (mIsLoaded) { - unload(); - } - - MacGitver::repoMan().internalClosedRepo(p); - } - - void RepoPrivate::load() - { - // ### Unimplemented: RepoPrivate::load() - Q_ASSERT(!mIsLoaded); - } - - void RepoPrivate::unload() - { - if (mIsActive) { - qDebug() << "Unloading active RepoInfo. Will deactivate it first."; - MacGitver::repoMan().activate(NULL); - } - Q_ASSERT(!mIsActive); - - if (mUnloadTimer) { - mUnloadTimer->stop(); - mUnloadTimer->deleteLater(); - mUnloadTimer = NULL; - } - - // ####REPOMAN Do we really need to send out events for Unload/Load? If yes, create - // real events for that! - mIsLoaded = false; - mRepo = Git::Repository(); - } - - - QString RepoPrivate::displayName() const - { - return mDisplayAlias; - } - - void RepoPrivate::preTerminate() - { - // Do we need to do smth? - } - - void RepoPrivate::scanSubmodules() - { - RM_P(Repo); - - Git::Repository repo = gitRepo(true); - if (!repo.isValid()) { - return; - } - - Git::Result r; - Git::Submodule::List subs = repo.submodules( r ); - if (!r) { - return; - } - - Repo::List oldSubmodules = pub()->submodules(); - - foreach (Git::Submodule sub, subs) { - Git::Result child; - Git::Repository subRepo = sub.subRepository(child); - if (!child) { - continue; - } - Q_ASSERT(subRepo.isValid()); - - Repo* subInfo = NULL; - QString path = subRepo.workTreePath(); - - if (path.endsWith(L'/')) { - path = path.left(path.length() - 1); - } - - subInfo = repoByPath(path, true); - if (!subInfo) { - subInfo = new Submodule(subRepo, p); - } - else { - oldSubmodules.removeOne(subInfo); - } - } - - foreach(Repo* repo, oldSubmodules) { - dataOf(repo)->terminateObject(); - } - } - - void RepoPrivate::findAlias() - { - // ### Unimplemented: RepoPrivate::findAlias() - } - - bool RepoPrivate::refreshSelf() - { - if (!mIsLoaded) { - // In case we're not loaded, just return and do nothing. - return true; - } - - if (!mHead) { - RM_P(Repo); - mHead = new Head(mRepo, p); - } - - return true; - } - - void RepoPrivate::postRefreshChildren() - { - if (!mIsLoaded) { - // In case we're not loaded, just return and do nothing. - return; - } - - Git::Result r; - Git::Remote::List remotes = mRepo.allRemotes(r); - if (r) { - foreach (const Git::Remote& remote, remotes) { - findRemote(remote, true); - } - } - - Git::ReferenceList refs = mRepo.allReferences(r); - if (r) { - foreach (Git::Reference ref, refs) { - findReference(ref, true); - } - } - - scanSubmodules(); - } - - /** - * @brief Get this object's type - * - * @return always ObjTypes::Repo. - * - */ - ObjTypes RepoPrivate::objType() const - { - return ObjTypes::Repo; - } - - void RepoPrivate::dumpSelf(Internal::Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("Repository 0x%1 - %02")) - .arg(quintptr(mPub),0,16) - .arg(mIsLoaded ? mRepo.name() - : QStringLiteral(""))); - } - - - Ref* RepoPrivate::findReference(const Git::Reference& ref, bool create) - { - Git::RefName rn = ref.nameAnalyzer(); - return findReference(rn, ref, create); - } - - Ref* RepoPrivate::findReference(const QString& fqrn, bool create) - { - Git::RefName rn(fqrn); - return findReference(rn, Git::Reference(), create); - } - - Ref* RepoPrivate::findReference(Git::RefName& rn, Git::Reference ref, bool create) - { - return NULL; - } - - Remote* RepoPrivate::findRemote(const QString &remoteName, bool create) - { - RM_P(Repo); - - foreach (Remote* remote, p->childObjects()) { - if (remote->name() == remoteName) { - return remote; - } - } - - if (create) { - Git::Result r; - Git::Remote gr = p->gitRepo().remote(r, remoteName); - - if (r && gr.isValid()) { - Remote* remote = new Remote(gr, p); - return remote; - } - } - - return NULL; - } - - Remote* RepoPrivate::findRemote(const Git::Remote &remote, bool create) - { - RM_P( Repo ); - - if (!remote.isValid()) { - return NULL; - } - - QString remoteName = remote.name(); - foreach (Remote* rmRemote, p->childObjects()) { - if (rmRemote->name() == remoteName) { - return rmRemote; - } - } - - if (create) { - Remote* rmRemote = new Remote(remote, p); - return rmRemote; - } - - return NULL; - } - - Namespace* RepoPrivate::findNamespace(const QStringList& _namespaces, bool create) - { - return NULL; - } - - Namespace* RepoPrivate::findNamespace(const QString& nsFullName, bool create) { - - QStringList nsNames = nsFullName.split(QChar(L'/')); - return findNamespace(nsNames, create); - } - - Repo* RepoPrivate::repoByPath(const QString& basePath, bool searchSubmodules) - { - foreach (Repo* subRepo, mPub->childObjects()) { - - if (subRepo->path() == basePath) { - return subRepo; - } - - if (searchSubmodules) { - if (RepoPrivate* subRepoPriv = dataOf(subRepo)) { - if (Repo* subsubRepo = subRepoPriv->repoByPath(basePath, true)) { - return subsubRepo; - } - } - } - } - - return NULL; - } - - QString RepoPrivate::objectTypeName() const - { - return QStringLiteral("Repo"); - } - - bool RepoPrivate::inherits(ObjTypes type) const - { - return type == ObjTypes::Repo || BasePrivate::inherits(type); - } - - Repo* RepoPrivate::searchRepository() - { - return static_cast(mPub); - } - - Git::Repository RepoPrivate::gitRepo(bool doLoad) - { - if (!mIsLoaded && doLoad) { - load(); - } - - return mRepo; - } - } + From 08490c415a86d198f46c78de4fa7caffa38defc3 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Wed, 13 May 2015 19:06:32 +0100 Subject: [PATCH 22/60] Move Private class implementation into own CPP file (remainder) --- Libs/libMacGitverCore/CMakeLists.txt | 9 +- .../RepoMan/Data/Namespace.cpp | 90 +++++++++++++++++ Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp | 76 +++++++++++++++ .../RepoMan/Data/RefTreeNode.cpp | 96 +++++++++++++++++++ Libs/libMacGitverCore/RepoMan/Data/Remote.cpp | 91 ++++++++++++++++++ .../RepoMan/Data/Submodule.cpp | 78 +++++++++++++++ .../RepoMan/Frontend/Namespace.cpp | 58 ----------- .../RepoMan/Frontend/RefLog.cpp | 44 --------- .../RepoMan/Frontend/RefTreeNode.cpp | 64 ------------- .../RepoMan/Frontend/Remote.cpp | 60 +----------- .../RepoMan/Frontend/Submodule.cpp | 46 --------- 11 files changed, 439 insertions(+), 273 deletions(-) create mode 100644 Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp create mode 100644 Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp create mode 100644 Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp create mode 100644 Libs/libMacGitverCore/RepoMan/Data/Remote.cpp create mode 100644 Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index daba903d..d881d89c 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -43,11 +43,16 @@ SET( SRC_FILES RepoMan/Frontend/Head.cpp RepoMan/Data/Base.cpp + RepoMan/Data/Branch.cpp RepoMan/Data/Reference.cpp + RepoMan/Data/Namespace.cpp + RepoMan/Data/RefLog.cpp + RepoMan/Data/RefTreeNode.cpp + RepoMan/Data/Remote.cpp RepoMan/Data/Repo.cpp - RepoMan/Data/Branch.cpp - RepoMan/Data/Head.cpp + RepoMan/Data/Submodule.cpp RepoMan/Data/Tag.cpp + RepoMan/Data/Head.cpp RepoMan/Private/Dumper.cpp diff --git a/Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp b/Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp new file mode 100644 index 00000000..a05b7ae6 --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp @@ -0,0 +1,90 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Data/NamespaceData.hpp" + +#include "RepoMan/Private/Dumper.hpp" + +#include "RepoMan/Events.hpp" + +namespace RM +{ + + namespace Internal + { + + NamespacePrivate::NamespacePrivate(Namespace* _pub, const QString& _name) + : BasePrivate(_pub) + , name(_name) + { + } + + ObjTypes NamespacePrivate::objType() const + { + return ObjTypes::Namespace; + } + + void NamespacePrivate::dumpSelf(Internal::Dumper& dumper) const + { + dumper.addLine(QString(QStringLiteral("Namespace 0x%1 - %2")) + .arg(quintptr(mPub),0,16) + .arg(name)); + } + + void NamespacePrivate::postCreation() + { + if (!repoEventsBlocked()) { + Events::self()->namespaceCreated(repository(), pub()); + } + + BasePrivate::postCreation(); + } + + void NamespacePrivate::preTerminate() + { + if (!repoEventsBlocked()) { + Events::self()->namespaceAboutToBeDeleted(repository(), pub()); + } + + BasePrivate::preTerminate(); + } + + bool NamespacePrivate::refreshSelf() + { + return true; + } + + QString NamespacePrivate::displayName() const + { + return name; + } + + QString NamespacePrivate::objectTypeName() const + { + return QStringLiteral("Namespace"); + } + + bool NamespacePrivate::inherits(ObjTypes type) const + { + return type == ObjTypes::Namespace || BasePrivate::inherits(type); + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp b/Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp new file mode 100644 index 00000000..e41f5ecc --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp @@ -0,0 +1,76 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Data/RefLogData.hpp" + +#include "RepoMan/Private/Dumper.hpp" + +#include "RepoMan/Events.hpp" + +namespace RM +{ + + namespace Internal + { + + RefLogPrivate::RefLogPrivate(RefLog* _pub) + : BasePrivate(_pub) + { + } + + ObjTypes RefLogPrivate::objType() const + { + return ObjTypes::RefLog; + } + + void RefLogPrivate::dumpSelf(Internal::Dumper& dumper) const + { + dumper.addLine(QString(QStringLiteral("RefLog 0x%1")) + .arg(quintptr(mPub),0,16)); + } + + void RefLogPrivate::postCreation() + { + BasePrivate::postCreation(); + } + + void RefLogPrivate::preTerminate() + { + // What to do? We don't send Ref-Log-Deleted events + BasePrivate::preTerminate(); + } + + bool RefLogPrivate::refreshSelf() + { + return true; + } + + QString RefLogPrivate::objectTypeName() const + { + return QStringLiteral("RefLog"); + } + + bool RefLogPrivate::inherits(ObjTypes type) const + { + return type == ObjTypes::RefLog || BasePrivate::inherits(type); + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp b/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp new file mode 100644 index 00000000..799475f5 --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp @@ -0,0 +1,96 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Data/RefTreeNodeData.hpp" + +#include "RepoMan/Private/Dumper.hpp" + +#include "RepoMan/Events.hpp" + +namespace RM +{ + + namespace Internal + { + + RefTreeNodePrivate::RefTreeNodePrivate(RefTreeNode* _pub, const QString& _name) + : BasePrivate(_pub) + , name(_name) + { + } + + ObjTypes RefTreeNodePrivate::objType() const + { + return ObjTypes::RefTreeNode; + } + + void RefTreeNodePrivate::dumpSelf(Dumper& dumper) const + { + dumper.addLine(QString(QStringLiteral("RefTreeNode 0x%1 [%2]")) + .arg(quintptr(mPub),0,16) + .arg(name)); + } + + void RefTreeNodePrivate::postCreation() + { + if (!repoEventsBlocked()) { + Events::self()->refTreeNodeCreated(repository(), pub()); + } + + BasePrivate::postCreation(); + } + + void RefTreeNodePrivate::preTerminate() + { + if (!repoEventsBlocked()) { + Events::self()->refTreeNodeAboutToBeDeleted(repository(), pub()); + } + + BasePrivate::preTerminate(); + } + + QString RefTreeNodePrivate::displayName() const + { + return name; + } + + bool RefTreeNodePrivate::refreshSelf() + { + // We don't have anything to refresh - we're purely virutual + return true; + } + + bool RefTreeNodePrivate::refreshCheckDispensable() + { + return mChildren.isEmpty(); + } + + QString RefTreeNodePrivate::objectTypeName() const + { + return QStringLiteral("RefTreeNode"); + } + + bool RefTreeNodePrivate::inherits(ObjTypes type) const + { + return type == ObjTypes::RefTreeNode || BasePrivate::inherits(type); + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Data/Remote.cpp b/Libs/libMacGitverCore/RepoMan/Data/Remote.cpp new file mode 100644 index 00000000..22216cd7 --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/Remote.cpp @@ -0,0 +1,91 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Data/RemoteData.hpp" + +#include "RepoMan/Private/Dumper.hpp" + +#include "RepoMan/Events.hpp" + +namespace RM +{ + + namespace Internal + { + + RemotePrivate::RemotePrivate(Remote* _pub, const Git::Remote& _obj) + : BasePrivate(_pub) + { + name = _obj.name(); + } + + ObjTypes RemotePrivate::objType() const + { + return ObjTypes::Remote; + } + + void RemotePrivate::dumpSelf(Internal::Dumper& dumper) const + { + dumper.addLine(QString(QStringLiteral("Remote %2 0x%1")) + .arg(quintptr(mPub),0,16) + .arg(name)); + } + + void RemotePrivate::postCreation() + { + if (!repoEventsBlocked()) { + Events::self()->remoteCreated(repository(), pub()); + } + + BasePrivate::postCreation(); + } + + void RemotePrivate::preTerminate() + { + if (!repoEventsBlocked()) { + Events::self()->remoteAboutToBeDeleted(repository(), pub()); + } + + BasePrivate::preTerminate(); + } + + QString RemotePrivate::displayName() const + { + return name; + } + + + bool RemotePrivate::refreshSelf() + { + return true; + } + + QString RemotePrivate::objectTypeName() const + { + return QStringLiteral("Remote"); + } + + bool RemotePrivate::inherits(ObjTypes type) const + { + return type == ObjTypes::Remote || BasePrivate::inherits(type); + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp b/Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp new file mode 100644 index 00000000..27a5e37d --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp @@ -0,0 +1,78 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "RepoMan/Data/SubmoduleData.hpp" + +#include "RepoMan/Private/Dumper.hpp" + +#include "RepoMan/Events.hpp" + +namespace RM +{ + + namespace Internal + { + + SubmodulePrivate::SubmodulePrivate(Submodule* pub, const Git::Repository& repo) + : RepoPrivate( pub, repo ) + { + } + + ObjTypes SubmodulePrivate::objType() const + { + return ObjTypes::Submodule; + } + + void SubmodulePrivate::dumpSelf(Dumper& dumper) const + { + dumper.addLine(QString(QStringLiteral("Submodule 0x%1")) + .arg(quintptr(mPub),0,16)); + } + + void SubmodulePrivate::postCreation() + { + if (!repoEventsBlocked()) { + Events::self()->submoduleCreated(repository(), pub()); + } + + RepoPrivate::postCreation(); + } + + void SubmodulePrivate::preTerminate() + { + if (!repoEventsBlocked()) { + Events::self()->submoduleAboutToBeDeleted(repository(), pub()); + } + + RepoPrivate::preTerminate(); + } + + QString SubmodulePrivate::objectTypeName() const + { + return QStringLiteral("Submodule"); + } + + bool SubmodulePrivate::inherits(ObjTypes type) const + { + return type == ObjTypes::Submodule || RepoPrivate::inherits(type); + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp index c90aeaac..7302a700 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp @@ -43,62 +43,4 @@ namespace RM return d->name; } - //-- NamespacePrivate -------------------------------------------------------------------------- - - NamespacePrivate::NamespacePrivate(Namespace* _pub, const QString& _name) - : BasePrivate(_pub) - , name(_name) - { - } - - ObjTypes NamespacePrivate::objType() const - { - return ObjTypes::Namespace; - } - - void NamespacePrivate::dumpSelf(Internal::Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("Namespace 0x%1 - %2")) - .arg(quintptr(mPub),0,16) - .arg(name)); - } - - void NamespacePrivate::postCreation() - { - if (!repoEventsBlocked()) { - Events::self()->namespaceCreated(repository(), pub()); - } - - BasePrivate::postCreation(); - } - - void NamespacePrivate::preTerminate() - { - if (!repoEventsBlocked()) { - Events::self()->namespaceAboutToBeDeleted(repository(), pub()); - } - - BasePrivate::preTerminate(); - } - - bool NamespacePrivate::refreshSelf() - { - return true; - } - - QString NamespacePrivate::displayName() const - { - return name; - } - - QString NamespacePrivate::objectTypeName() const - { - return QStringLiteral("Namespace"); - } - - bool NamespacePrivate::inherits(ObjTypes type) const - { - return type == ObjTypes::Namespace || BasePrivate::inherits(type); - } - } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp index e5c6b79f..2c394da6 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp @@ -34,48 +34,4 @@ namespace RM d->linkToParent(_parent); } - //-- RefLogPrivate ----------------------------------------------------------------------------- - - RefLogPrivate::RefLogPrivate(RefLog* _pub) - : BasePrivate(_pub) - { - } - - ObjTypes RefLogPrivate::objType() const - { - return ObjTypes::RefLog; - } - - void RefLogPrivate::dumpSelf(Internal::Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("RefLog 0x%1")) - .arg(quintptr(mPub),0,16)); - } - - void RefLogPrivate::postCreation() - { - BasePrivate::postCreation(); - } - - void RefLogPrivate::preTerminate() - { - // What to do? We don't send Ref-Log-Deleted events - BasePrivate::preTerminate(); - } - - bool RefLogPrivate::refreshSelf() - { - return true; - } - - QString RefLogPrivate::objectTypeName() const - { - return QStringLiteral("RefLog"); - } - - bool RefLogPrivate::inherits(ObjTypes type) const - { - return type == ObjTypes::RefLog || BasePrivate::inherits(type); - } - } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp index 5171f49d..5321ec94 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp @@ -44,68 +44,4 @@ namespace RM return d->name; } - //-- RefTreeNodePrivate ------------------------------------------------------------------------ - - RefTreeNodePrivate::RefTreeNodePrivate(RefTreeNode* _pub, const QString& _name) - : BasePrivate(_pub) - , name(_name) - { - } - - ObjTypes RefTreeNodePrivate::objType() const - { - return ObjTypes::RefTreeNode; - } - - void RefTreeNodePrivate::dumpSelf(Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("RefTreeNode 0x%1 [%2]")) - .arg(quintptr(mPub),0,16) - .arg(name)); - } - - void RefTreeNodePrivate::postCreation() - { - if (!repoEventsBlocked()) { - Events::self()->refTreeNodeCreated(repository(), pub()); - } - - BasePrivate::postCreation(); - } - - void RefTreeNodePrivate::preTerminate() - { - if (!repoEventsBlocked()) { - Events::self()->refTreeNodeAboutToBeDeleted(repository(), pub()); - } - - BasePrivate::preTerminate(); - } - - QString RefTreeNodePrivate::displayName() const - { - return name; - } - - bool RefTreeNodePrivate::refreshSelf() - { - // We don't have anything to refresh - we're purely virutual - return true; - } - - bool RefTreeNodePrivate::refreshCheckDispensable() - { - return mChildren.isEmpty(); - } - - QString RefTreeNodePrivate::objectTypeName() const - { - return QStringLiteral("RefTreeNode"); - } - - bool RefTreeNodePrivate::inherits(ObjTypes type) const - { - return type == ObjTypes::RefTreeNode || BasePrivate::inherits(type); - } - } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp index 5a7a7885..f2a8f192 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp @@ -54,63 +54,5 @@ namespace RM return d->name; } - //-- RemotePrivate ----------------------------------------------------------------------------- - - RemotePrivate::RemotePrivate(Remote* _pub, const Git::Remote& _obj) - : BasePrivate(_pub) - { - name = _obj.name(); - } - - ObjTypes RemotePrivate::objType() const - { - return ObjTypes::Remote; - } - - void RemotePrivate::dumpSelf(Internal::Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("Remote %2 0x%1")) - .arg(quintptr(mPub),0,16) - .arg(name)); - } - - void RemotePrivate::postCreation() - { - if (!repoEventsBlocked()) { - Events::self()->remoteCreated(repository(), pub()); - } - - BasePrivate::postCreation(); - } - - void RemotePrivate::preTerminate() - { - if (!repoEventsBlocked()) { - Events::self()->remoteAboutToBeDeleted(repository(), pub()); - } - - BasePrivate::preTerminate(); - } - - QString RemotePrivate::displayName() const - { - return name; - } - - - bool RemotePrivate::refreshSelf() - { - return true; - } - - QString RemotePrivate::objectTypeName() const - { - return QStringLiteral("Remote"); - } - - bool RemotePrivate::inherits(ObjTypes type) const - { - return type == ObjTypes::Remote || BasePrivate::inherits(type); - } - } + diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp index e8969375..87af3caf 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp @@ -43,50 +43,4 @@ namespace RM d->mIsInitializing = false; } - //-- SubmodulePrivate -------------------------------------------------------------------------- - - SubmodulePrivate::SubmodulePrivate(Submodule* pub, const Git::Repository& repo) - : RepoPrivate( pub, repo ) - { - } - - ObjTypes SubmodulePrivate::objType() const - { - return ObjTypes::Submodule; - } - - void SubmodulePrivate::dumpSelf(Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("Submodule 0x%1")) - .arg(quintptr(mPub),0,16)); - } - - void SubmodulePrivate::postCreation() - { - if (!repoEventsBlocked()) { - Events::self()->submoduleCreated(repository(), pub()); - } - - RepoPrivate::postCreation(); - } - - void SubmodulePrivate::preTerminate() - { - if (!repoEventsBlocked()) { - Events::self()->submoduleAboutToBeDeleted(repository(), pub()); - } - - RepoPrivate::preTerminate(); - } - - QString SubmodulePrivate::objectTypeName() const - { - return QStringLiteral("Submodule"); - } - - bool SubmodulePrivate::inherits(ObjTypes type) const - { - return type == ObjTypes::Submodule || RepoPrivate::inherits(type); - } - } From 84c1666100e4dc36e2408b1d3804592b27cf6ec4 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Wed, 13 May 2015 18:56:53 +0100 Subject: [PATCH 23/60] Move Frontend implementation into Frontend namespace (Head) --- .../RepoMan/Frontend/Head.cpp | 73 ++++++++++--------- Libs/libMacGitverCore/RepoMan/Head.hpp | 43 ++++++----- 2 files changed, 64 insertions(+), 52 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp index baeaef74..e5965dc9 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp @@ -31,50 +31,55 @@ namespace RM { - Head::Head(const Git::Repository& repo, Base* parent) - : Base(*new Internal::HeadPrivate(this, repo)) + namespace Frontend { - RM_D(Head); - d->linkToParent(parent); - } - QString Head::symbolicName() const - { - RM_CD(Head); - if (d->isDetached) { - return QString(); + Head::Head(const Git::Repository& repo, Base* parent) + : Base(*new Internal::HeadPrivate(this, repo)) + { + RM_D(Head); + d->linkToParent(parent); } - return d->symbolicName; - } - bool Head::isDetached() const - { - RM_CD(Head); - return d->isDetached; - } + QString Head::symbolicName() const + { + RM_CD(Head); + if (d->isDetached) { + return QString(); + } + return d->symbolicName; + } - bool Head::isUnborn() const - { - RM_CD(Head); - return d->isUnborn; - } + bool Head::isDetached() const + { + RM_CD(Head); + return d->isDetached; + } - Git::ObjectId Head::detachedId() const - { - RM_CD(Head); - return d->detachedId; - } + bool Head::isUnborn() const + { + RM_CD(Head); + return d->isUnborn; + } - bool Head::is(const Branch* ref) const - { - RM_CD(Head); + Git::ObjectId Head::detachedId() const + { + RM_CD(Head); + return d->detachedId; + } + + bool Head::is(const Branch* ref) const + { + RM_CD(Head); + + if (d->isDetached || d->isUnborn) { + /* If it's unborn, it cannot match an existing branch anyway */ + return false; + } - if (d->isDetached || d->isUnborn) { - /* If it's unborn, it cannot match an existing branch anyway */ - return false; + return ref && d->symbolicName == ref->fullName(); } - return ref && d->symbolicName == ref->fullName(); } } diff --git a/Libs/libMacGitverCore/RepoMan/Head.hpp b/Libs/libMacGitverCore/RepoMan/Head.hpp index 950b64d1..55adad10 100644 --- a/Libs/libMacGitverCore/RepoMan/Head.hpp +++ b/Libs/libMacGitverCore/RepoMan/Head.hpp @@ -30,24 +30,31 @@ namespace RM class HeadPrivate; } - class MGV_CORE_API Head : public Base + namespace Frontend { - public: - static const ObjTypes StaticObjectType = ObjTypes::Head; - typedef Internal::HeadPrivate Private; - typedef QVector< Head* > List; - - public: - Head(const Git::Repository& repo, Base* parent); - - public: - bool isDetached() const; - bool isUnborn() const; - Git::ObjectId detachedId() const; - QString symbolicName() const; - - public: - bool is(const Branch* ref) const; - }; + + class MGV_CORE_API Head : public Base + { + public: + static const ObjTypes StaticObjectType = ObjTypes::Head; + typedef Internal::HeadPrivate Private; + typedef QVector< Head* > List; + + public: + Head(const Git::Repository& repo, Base* parent); + + public: + bool isDetached() const; + bool isUnborn() const; + Git::ObjectId detachedId() const; + QString symbolicName() const; + + public: + bool is(const Branch* ref) const; + }; + + } + + using Head = Frontend::Head; } From 9c98a7e3a024a8773fa680d0ff716d1f7915a6cb Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Wed, 13 May 2015 21:48:01 +0100 Subject: [PATCH 24/60] Move Frontend implementation into Frontend namespace (Tag) --- .../libMacGitverCore/RepoMan/Frontend/Tag.cpp | 13 +++++--- Libs/libMacGitverCore/RepoMan/Tag.hpp | 31 +++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp index 518db64e..f2df5b8e 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp @@ -28,11 +28,16 @@ namespace RM { - Tag::Tag(Base* _parent, const Git::Reference& _ref) - : Ref(*new Internal::TagPrivate(this, _ref)) + namespace Frontend { - RM_D(Tag); - d->linkToParent(_parent); + + Tag::Tag(Base* _parent, const Git::Reference& _ref) + : Ref(*new Internal::TagPrivate(this, _ref)) + { + RM_D(Tag); + d->linkToParent(_parent); + } + } } diff --git a/Libs/libMacGitverCore/RepoMan/Tag.hpp b/Libs/libMacGitverCore/RepoMan/Tag.hpp index 951b71a3..44e2c942 100644 --- a/Libs/libMacGitverCore/RepoMan/Tag.hpp +++ b/Libs/libMacGitverCore/RepoMan/Tag.hpp @@ -24,23 +24,28 @@ namespace RM { - class MGV_CORE_API Tag : public Ref + namespace Frontend { - public: - static const ObjTypes StaticObjectType = ObjTypes::Tag; - typedef QVector< Tag* > List; - public: - Tag(Base* _parent, const Git::Reference& _ref); + class MGV_CORE_API Tag : public Ref + { + public: + static const ObjTypes StaticObjectType = ObjTypes::Tag; + typedef QVector< Tag* > List; - public: + public: + Tag(Base* _parent, const Git::Reference& _ref); - private: - ObjTypes objType() const; - void preTerminate(); - void dumpSelf(Internal::Dumper& dumper) const; + public: - private: - }; + private: + ObjTypes objType() const; + void preTerminate(); + void dumpSelf(Internal::Dumper& dumper) const; + + private: + }; + + } } From 92af47d2237bbf24d3f9c8cba4dfa708d90e0b97 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Wed, 13 May 2015 23:03:16 +0100 Subject: [PATCH 25/60] Move Frontend implementation into Frontend namespace (Repo) --- .../RepoMan/Frontend/Repo.cpp | 353 +++++++++--------- Libs/libMacGitverCore/RepoMan/Repo.hpp | 87 +++-- 2 files changed, 226 insertions(+), 214 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp index 193f7023..1b9756cc 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp @@ -39,239 +39,244 @@ namespace RM { - Repo::Repo(Internal::RepoPrivate& _d) - : Base(_d) + namespace Frontend { - } - Repo::Repo(const Git::Repository& repo, Base* parent) - : Base( *new Internal::RepoPrivate(this, repo) ) - { - RM_D(Repo); + Repo::Repo(Internal::RepoPrivate& _d) + : Base(_d) + { + } - d->linkToParent(parent); - d->refresh(); + Repo::Repo(const Git::Repository& repo, Base* parent) + : Base( *new Internal::RepoPrivate(this, repo) ) + { + RM_D(Repo); - d->mIsInitializing = false; - } + d->linkToParent(parent); + d->refresh(); - Repo::~Repo() - { - } + d->mIsInitializing = false; + } - Git::Repository Repo::gitRepo() - { - RM_D(Repo); - return d->gitRepo(true); - } + Repo::~Repo() + { + } - Git::Repository Repo::gitLoadedRepo() - { - RM_D(Repo); - return d->gitRepo(); - } + Git::Repository Repo::gitRepo() + { + RM_D(Repo); + return d->gitRepo(true); + } - QString Repo::path() const - { - RM_CD(Repo); + Git::Repository Repo::gitLoadedRepo() + { + RM_D(Repo); + return d->gitRepo(); + } - return d->mPath; - } + QString Repo::path() const + { + RM_CD(Repo); - bool Repo::isSubModule() const - { - RM_CD(Repo); + return d->mPath; + } - return d->mIsSubModule; - } + bool Repo::isSubModule() const + { + RM_CD(Repo); - bool Repo::isBare() const - { - RM_CD(Repo); + return d->mIsSubModule; + } - return d->mIsBare; - } + bool Repo::isBare() const + { + RM_CD(Repo); - bool Repo::isLoaded() const - { - RM_CD(Repo); + return d->mIsBare; + } - return d->mIsLoaded; - } + bool Repo::isLoaded() const + { + RM_CD(Repo); - bool Repo::isActive() const - { - RM_CD(Repo); + return d->mIsLoaded; + } - return d->mIsActive; - } + bool Repo::isActive() const + { + RM_CD(Repo); - /** - * @brief Are we in initialization phase? - * - * @return `true` if we're still doing an initial seed with repository objects. In this - * case no events for new or changed objects shall be sent out to any listeners. - * - */ - bool Repo::isInitializing() const - { - RM_CD(Repo); + return d->mIsActive; + } - return d->mIsInitializing; - } + /** + * @brief Are we in initialization phase? + * + * @return `true` if we're still doing an initial seed with repository objects. In this + * case no events for new or changed objects shall be sent out to any listeners. + * + */ + bool Repo::isInitializing() const + { + RM_CD(Repo); + + return d->mIsInitializing; + } - Repo* Repo::parentRepository() - { - Base* p = parentObject(); + Repo* Repo::parentRepository() + { + Base* p = parentObject(); + + if (!p) { + return NULL; + } + + if (p->inheritsRepoManType(ObjTypes::Repo)) { + return static_cast(p); + } - if (!p) { return NULL; } - if (p->inheritsRepoManType(ObjTypes::Repo)) { - return static_cast(p); + Repo::List Repo::submodules() const + { + return childObjects(); } - return NULL; - } + void Repo::activated() + { + // ### Should be very private + RM_D(Repo); + Q_ASSERT(!d->mIsActive); - Repo::List Repo::submodules() const - { - return childObjects(); - } + if (d->mUnloadTimer) { + d->mUnloadTimer->stop(); + d->mUnloadTimer->deleteLater(); + d->mUnloadTimer = NULL; + } - void Repo::activated() - { - // ### Should be very private - RM_D(Repo); - Q_ASSERT(!d->mIsActive); - - if (d->mUnloadTimer) { - d->mUnloadTimer->stop(); - d->mUnloadTimer->deleteLater(); - d->mUnloadTimer = NULL; + d->mIsActive = true; } - d->mIsActive = true; - } + void Repo::deactivated() + { + // ### Should be very private + RM_D(Repo); + Q_ASSERT(d->mIsActive); - void Repo::deactivated() - { - // ### Should be very private - RM_D(Repo); - Q_ASSERT(d->mIsActive); + Q_ASSERT(!d->mUnloadTimer); + d->mUnloadTimer = new QTimer(this); + connect(d->mUnloadTimer, SIGNAL(timeout()), this, SLOT(unloadTimer())); + d->mUnloadTimer->setInterval(15 * 60 * 1000); // quarter of an hour + d->mUnloadTimer->start(); - Q_ASSERT(!d->mUnloadTimer); - d->mUnloadTimer = new QTimer(this); - connect(d->mUnloadTimer, SIGNAL(timeout()), this, SLOT(unloadTimer())); - d->mUnloadTimer->setInterval(15 * 60 * 1000); // quarter of an hour - d->mUnloadTimer->start(); + d->mIsActive = false; + } - d->mIsActive = false; - } + QString Repo::displayAlias() const + { + RM_CD(Repo); - QString Repo::displayAlias() const - { - RM_CD(Repo); + return d->mDisplayAlias; + } - return d->mDisplayAlias; - } + void Repo::setDisplayAlias(const QString& alias) + { + RM_D(Repo); - void Repo::setDisplayAlias(const QString& alias) - { - RM_D(Repo); + if (d->mDisplayAlias != alias) { + d->mDisplayAlias = alias; + // ###REPOMAN Create new Event "RepoAliasChanged" + // emit aliasChanged(alias); + } + } - if (d->mDisplayAlias != alias) { - d->mDisplayAlias = alias; - // ###REPOMAN Create new Event "RepoAliasChanged" - // emit aliasChanged(alias); + void Repo::unloadTimer() + { + RM_D(Repo); + d->unload(); } - } - void Repo::unloadTimer() - { - RM_D(Repo); - d->unload(); - } + void Repo::close() + { + RM_D(Repo); - void Repo::close() - { - RM_D(Repo); + if (d->mIsActive) { + MacGitver::repoMan().activate(NULL); + } - if (d->mIsActive) { - MacGitver::repoMan().activate(NULL); - } + Events::self()->repositoryAboutToClose(this); - Events::self()->repositoryAboutToClose(this); + foreach (Repo* child, submodules()) { + child->close(); + } - foreach (Repo* child, submodules()) { - child->close(); + d->terminateObject(); } - d->terminateObject(); - } + QString Repo::branchDisplay() const + { + // TODO: This method is totally wrong placed here + RM_D(Repo); - QString Repo::branchDisplay() const - { - // TODO: This method is totally wrong placed here - RM_D(Repo); + if (d->mIsLoaded && d->mHead) { - if (d->mIsLoaded && d->mHead) { + if (d->mHead->isDetached()) { + return tr("detached at %1" ).arg(d->mHead->detachedId().toString()); + } - if (d->mHead->isDetached()) { - return tr("detached at %1" ).arg(d->mHead->detachedId().toString()); - } + if (d->mHead->isUnborn()) { + return tr("Branch yet to be born"); + } - if (d->mHead->isUnborn()) { - return tr("Branch yet to be born"); + return tr("%1" ).arg(d->mHead->symbolicName().mid(11)); } + return tr("<unknown>"); + } - return tr("%1" ).arg(d->mHead->symbolicName().mid(11)); + Ref* Repo::findReference(const Git::Reference& ref) + { + RM_D(Repo); + return d->findReference(ref, false); } - return tr("<unknown>"); - } - Ref* Repo::findReference(const Git::Reference& ref) - { - RM_D(Repo); - return d->findReference(ref, false); - } + Ref* Repo::findReference(const QString &fqrn) + { + RM_D(Repo); + return d->findReference(fqrn, false); + } - Ref* Repo::findReference(const QString &fqrn) - { - RM_D(Repo); - return d->findReference(fqrn, false); - } + Remote* Repo::findRemote(const Git::Remote& remote) + { + RM_D(Repo); + return d->findRemote(remote, false); + } - Remote* Repo::findRemote(const Git::Remote& remote) - { - RM_D(Repo); - return d->findRemote(remote, false); - } + Remote* Repo::findRemote(const QString& remoteName) + { + RM_D(Repo); + return d->findRemote(remoteName, false); + } - Remote* Repo::findRemote(const QString& remoteName) - { - RM_D(Repo); - return d->findRemote(remoteName, false); - } + Namespace* Repo::findNamespace(const QStringList& namespaces) + { + RM_D( Repo ); + return d->findNamespace(namespaces); + } - Namespace* Repo::findNamespace(const QStringList& namespaces) - { - RM_D( Repo ); - return d->findNamespace(namespaces); - } + Namespace* Repo::findNamespace(const QString& nsFullName) + { + RM_D( Repo ); + return d->findNamespace(nsFullName); + } - Namespace* Repo::findNamespace(const QString& nsFullName) - { - RM_D( Repo ); - return d->findNamespace(nsFullName); - } + Head* Repo::head() const + { + RM_CD(Repo); + return d->mHead; + } - Head* Repo::head() const - { - RM_CD(Repo); - return d->mHead; } } diff --git a/Libs/libMacGitverCore/RepoMan/Repo.hpp b/Libs/libMacGitverCore/RepoMan/Repo.hpp index c5ccab67..aa3ea4b3 100644 --- a/Libs/libMacGitverCore/RepoMan/Repo.hpp +++ b/Libs/libMacGitverCore/RepoMan/Repo.hpp @@ -38,60 +38,67 @@ namespace RM class RepoPrivate; } - class MGV_CORE_API Repo : public QObject, public Base + namespace Frontend { - friend class RepoMan; - Q_OBJECT - public: - static const ObjTypes StaticObjectType = ObjTypes::Repo; - typedef Internal::RepoPrivate Private; - typedef QVector< Repo* > List; + class MGV_CORE_API Repo + : public QObject + , public Base + { + friend class RepoMan; - protected: - Repo(Internal::RepoPrivate& _d); + Q_OBJECT + public: + static const ObjTypes StaticObjectType = ObjTypes::Repo; + typedef Internal::RepoPrivate Private; + typedef QVector< Repo* > List; - public: - Repo(const Git::Repository& repo, Base* parent); - ~Repo(); + protected: + Repo(Internal::RepoPrivate& _d); - public: - GW_DEPRECATED Git::Repository gitRepo(); - GW_DEPRECATED Git::Repository gitLoadedRepo(); + public: + Repo(const Git::Repository& repo, Base* parent); + ~Repo(); - bool isSubModule() const; - bool isBare() const; - bool isLoaded() const; - bool isActive() const; - bool isInitializing() const; + public: + GW_DEPRECATED Git::Repository gitRepo(); + GW_DEPRECATED Git::Repository gitLoadedRepo(); - Repo* parentRepository(); - List submodules() const; + bool isSubModule() const; + bool isBare() const; + bool isLoaded() const; + bool isActive() const; + bool isInitializing() const; - QString path() const; + Repo* parentRepository(); + List submodules() const; - QString displayAlias() const; - void setDisplayAlias( const QString& alias ); + QString path() const; - QString branchDisplay() const; + QString displayAlias() const; + void setDisplayAlias( const QString& alias ); - void close(); + QString branchDisplay() const; - Ref* findReference( const Git::Reference& ref); - Ref* findReference( const QString& fqrn); - Remote* findRemote( const Git::Remote& remote); - Remote* findRemote( const QString& remoteName); - Namespace* findNamespace( const QStringList& namespaces); - Namespace* findNamespace( const QString& nsFullName); + void close(); - Head* head() const; + Ref* findReference( const Git::Reference& ref); + Ref* findReference( const QString& fqrn); + Remote* findRemote( const Git::Remote& remote); + Remote* findRemote( const QString& remoteName); + Namespace* findNamespace( const QStringList& namespaces); + Namespace* findNamespace( const QString& nsFullName); - private: - void activated(); - void deactivated(); + Head* head() const; - private slots: - void unloadTimer(); - }; + private: + void activated(); + void deactivated(); + + private slots: + void unloadTimer(); + }; + + } } From 5558774ed8e0b1ed786d9fb15fc64a25380687ab Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Thu, 14 May 2015 20:45:32 +0100 Subject: [PATCH 26/60] Move Frontend implementation into Frontend namespace (Submodule) --- .../RepoMan/Frontend/Submodule.cpp | 22 ++++++++------ Libs/libMacGitverCore/RepoMan/Submodule.hpp | 30 +++++++++++-------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp index 87af3caf..393d7ab8 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp @@ -26,21 +26,25 @@ namespace RM { - using namespace Internal; - Submodule::Submodule(const Git::Repository& repo, Repo* parent) - : Repo( *new SubmodulePrivate( this, repo ) ) + namespace Frontend { - RM_D(Submodule); - d->mIsSubModule = true; + Submodule::Submodule(const Git::Repository& repo, Repo* parent) + : Repo( *new Internal::SubmodulePrivate( this, repo ) ) + { + RM_D(Submodule); - setDisplayAlias( repo.name() ); + d->mIsSubModule = true; - d->linkToParent( parent ); - d->refresh(); + setDisplayAlias( repo.name() ); + + d->linkToParent( parent ); + d->refresh(); + + d->mIsInitializing = false; + } - d->mIsInitializing = false; } } diff --git a/Libs/libMacGitverCore/RepoMan/Submodule.hpp b/Libs/libMacGitverCore/RepoMan/Submodule.hpp index 4c26cd6d..b0508274 100644 --- a/Libs/libMacGitverCore/RepoMan/Submodule.hpp +++ b/Libs/libMacGitverCore/RepoMan/Submodule.hpp @@ -24,22 +24,28 @@ namespace RM { - class MGV_CORE_API Submodule : public Repo + namespace Frontend { - public: - static const ObjTypes StaticObjectType = ObjTypes::Submodule; - public: - Submodule(const Git::Repository& repo, Repo* parent); + class MGV_CORE_API Submodule + : public Repo + { + public: + static const ObjTypes StaticObjectType = ObjTypes::Submodule; - public: + public: + Submodule(const Git::Repository& repo, Repo* parent); - private: - ObjTypes objType() const; - void preTerminate(); - void dumpSelf(Internal::Dumper& dumper) const; + public: - private: - }; + private: + ObjTypes objType() const; + void preTerminate(); + void dumpSelf(Internal::Dumper& dumper) const; + + private: + }; + + } } From df8e6114ac8b5518b049a0084700850d43263776 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 00:34:05 +0100 Subject: [PATCH 27/60] Move Frontend implementation into Frontend namespace (Remote) --- .../RepoMan/Frontend/Remote.cpp | 35 ++++++++++--------- Libs/libMacGitverCore/RepoMan/Remote.hpp | 34 ++++++++++-------- 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp index f2a8f192..189b7a2f 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp @@ -31,27 +31,30 @@ namespace RM { - using namespace Internal; - - Remote::Remote(const Git::Remote& gitObj, Base* _parent) - : Base(*new RemotePrivate(this, gitObj)) + namespace Frontend { - RM_D(Remote); - d->linkToParent(_parent); - } + Remote::Remote(const Git::Remote& gitObj, Base* _parent) + : Base(*new Internal::RemotePrivate(this, gitObj)) + { + RM_D(Remote); - Git::Remote Remote::gitObject() - { - Git::Result r; - return repository()->gitRepo().remote(r, name()); - } + d->linkToParent(_parent); + } - QString Remote::name() const - { - RM_D(Remote); + Git::Remote Remote::gitObject() + { + Git::Result r; + return repository()->gitRepo().remote(r, name()); + } + + QString Remote::name() const + { + RM_D(Remote); + + return d->name; + } - return d->name; } } diff --git a/Libs/libMacGitverCore/RepoMan/Remote.hpp b/Libs/libMacGitverCore/RepoMan/Remote.hpp index 8fab5f74..a94f4c54 100644 --- a/Libs/libMacGitverCore/RepoMan/Remote.hpp +++ b/Libs/libMacGitverCore/RepoMan/Remote.hpp @@ -31,20 +31,26 @@ namespace RM class RemotePrivate; } - class MGV_CORE_API Remote : public Base + namespace Frontend { - public: - static const ObjTypes StaticObjectType = ObjTypes::Remote; - typedef Internal::RemotePrivate Private; - typedef QVector< Remote* > List; - - public: - Remote(const Git::Remote& gitObj, Base* parent); - - public: - GW_DEPRECATED - Git::Remote gitObject(); - QString name() const; - }; + + class MGV_CORE_API Remote + : public Base + { + public: + static const ObjTypes StaticObjectType = ObjTypes::Remote; + typedef Internal::RemotePrivate Private; + typedef QVector< Remote* > List; + + public: + Remote(const Git::Remote& gitObj, Base* parent); + + public: + GW_DEPRECATED + Git::Remote gitObject(); + QString name() const; + }; + + } } From da32edfb11ff101c9d34e38440c64632ddcf7a9e Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 00:36:28 +0100 Subject: [PATCH 28/60] Move Frontend implementation into Frontend namespace (Ref) --- .../libMacGitverCore/RepoMan/Frontend/Ref.cpp | 87 ++++++++++--------- Libs/libMacGitverCore/RepoMan/Ref.hpp | 50 ++++++----- 2 files changed, 74 insertions(+), 63 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp index ea4ae9ae..0c693eee 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp @@ -32,58 +32,63 @@ namespace RM { - Ref::Ref(Internal::RefPrivate& data) - : Base( data ) + namespace Frontend { - } - Ref::Ref(Base* parent, RefTypes type, const Git::Reference& ref) - : Base( *new Internal::RefPrivate( this, type, ref ) ) - { - RM_D( Ref ); - d->linkToParent( parent ); - } + Ref::Ref(Internal::RefPrivate& data) + : Base( data ) + { + } - RefTypes Ref::type() const - { - RM_CD(Ref); - return d->mType; - } + Ref::Ref(Base* parent, RefTypes type, const Git::Reference& ref) + : Base( *new Internal::RefPrivate( this, type, ref ) ) + { + RM_D( Ref ); + d->linkToParent( parent ); + } - QString Ref::name() const - { - RM_CD(Ref); - return d->mName; - } + RefTypes Ref::type() const + { + RM_CD(Ref); + return d->mType; + } - QString Ref::fullName() const - { - RM_CD(Ref); - return d->mFullQualifiedName; - } + QString Ref::name() const + { + RM_CD(Ref); + return d->mName; + } - Git::ObjectId Ref::id() const - { - RM_CD(Ref); - return d->mId; - } + QString Ref::fullName() const + { + RM_CD(Ref); + return d->mFullQualifiedName; + } - QString Ref::displaySha1() const - { - return id().toString(8); - } + Git::ObjectId Ref::id() const + { + RM_CD(Ref); + return d->mId; + } - Git::Reference Ref::load(Git::Result& r) - { - RM_D(Ref); - Git::Reference gitRef; + QString Ref::displaySha1() const + { + return id().toString(8); + } + + Git::Reference Ref::load(Git::Result& r) + { + RM_D(Ref); + Git::Reference gitRef; + + if (r) { + Git::Repository repo = repository()->gitRepo(); + gitRef = repo.reference(r, d->mFullQualifiedName); + } - if (r) { - Git::Repository repo = repository()->gitRepo(); - gitRef = repo.reference(r, d->mFullQualifiedName); + return gitRef; } - return gitRef; } } diff --git a/Libs/libMacGitverCore/RepoMan/Ref.hpp b/Libs/libMacGitverCore/RepoMan/Ref.hpp index 1970a4ef..6d777295 100644 --- a/Libs/libMacGitverCore/RepoMan/Ref.hpp +++ b/Libs/libMacGitverCore/RepoMan/Ref.hpp @@ -31,34 +31,40 @@ namespace RM class RefPrivate; } - enum RefTypes + namespace Frontend { - BranchType, - TagType - }; - class MGV_CORE_API Ref : public Base - { - public: - static const ObjTypes StaticObjectType = ObjTypes::Reference; + enum RefTypes + { + BranchType, + TagType + }; + + class MGV_CORE_API Ref + : public Base + { + public: + static const ObjTypes StaticObjectType = ObjTypes::Reference; - typedef QList< Ref* > List; + typedef QList< Ref* > List; - protected: - Ref(Internal::RefPrivate& data); + protected: + Ref(Internal::RefPrivate& data); - public: - Ref(Base* parent, RefTypes type, const Git::Reference& ref); + public: + Ref(Base* parent, RefTypes type, const Git::Reference& ref); - GW_DEPRECATED - Git::Reference load(Git::Result& r); + GW_DEPRECATED + Git::Reference load(Git::Result& r); - public: - RefTypes type() const; - QString name() const; - QString fullName() const; - Git::ObjectId id() const; - QString displaySha1() const; - }; + public: + RefTypes type() const; + QString name() const; + QString fullName() const; + Git::ObjectId id() const; + QString displaySha1() const; + }; + + } } From c4320297851c98bd6a7e61038c40642b876eae2b Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 01:16:05 +0100 Subject: [PATCH 29/60] Move Frontend implementation into Frontend namespace (Namespace) --- .../RepoMan/Frontend/Namespace.cpp | 25 ++++++++++-------- Libs/libMacGitverCore/RepoMan/Namespace.hpp | 26 ++++++++++++------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp index 7302a700..daac92a6 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp @@ -27,20 +27,23 @@ namespace RM { - using namespace Internal; - - Namespace::Namespace(Base* _parent, const QString& _name) - : Base(*new NamespacePrivate(this, _name)) + namespace Frontend { - RM_D(Namespace); - d->linkToParent(_parent); - } - QString Namespace::name() const - { - RM_D(Namespace); + Namespace::Namespace(Base* _parent, const QString& _name) + : Base(*new Internal::NamespacePrivate(this, _name)) + { + RM_D(Namespace); + d->linkToParent(_parent); + } + + QString Namespace::name() const + { + RM_D(Namespace); + + return d->name; + } - return d->name; } } diff --git a/Libs/libMacGitverCore/RepoMan/Namespace.hpp b/Libs/libMacGitverCore/RepoMan/Namespace.hpp index 0f43f732..d6906b08 100644 --- a/Libs/libMacGitverCore/RepoMan/Namespace.hpp +++ b/Libs/libMacGitverCore/RepoMan/Namespace.hpp @@ -29,18 +29,24 @@ namespace RM class NamespacePrivate; } - class MGV_CORE_API Namespace : public Base + namespace Frontend { - public: - static const ObjTypes StaticObjectType = ObjTypes::Namespace; - typedef Internal::NamespacePrivate Private; - typedef QVector< Namespace* > List; - public: - Namespace(Base* parent, const QString& _name); + class MGV_CORE_API Namespace + : public Base + { + public: + static const ObjTypes StaticObjectType = ObjTypes::Namespace; + typedef Internal::NamespacePrivate Private; + typedef QVector< Namespace* > List; - public: - QString name() const; - }; + public: + Namespace(Base* parent, const QString& _name); + + public: + QString name() const; + }; + + } } From eefe86d6b192997476c4b131ff155706a1439025 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 02:02:39 +0100 Subject: [PATCH 30/60] Move Frontend implementation into Frontend namespace (RefTreeNode) --- .../RepoMan/Frontend/RefTreeNode.cpp | 25 ++++++++++-------- Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp | 26 ++++++++++++------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp index 5321ec94..21ca9b58 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp @@ -28,20 +28,23 @@ namespace RM { - using namespace Internal; - - RefTreeNode::RefTreeNode(Base* _parent, const QString& _name) - : Base(*new RefTreeNodePrivate(this, _name)) + namespace Frontend { - RM_D(RefTreeNode); - d->linkToParent(_parent); - } - QString RefTreeNode::name() const - { - RM_D(RefTreeNode); + RefTreeNode::RefTreeNode(Base* _parent, const QString& _name) + : Base(*new Internal::RefTreeNodePrivate(this, _name)) + { + RM_D(RefTreeNode); + d->linkToParent(_parent); + } + + QString RefTreeNode::name() const + { + RM_D(RefTreeNode); + + return d->name; + } - return d->name; } } diff --git a/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp b/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp index 1084fc7f..4e2f65b7 100644 --- a/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp +++ b/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp @@ -31,18 +31,24 @@ namespace RM class RefTreeNodePrivate; } - class MGV_CORE_API RefTreeNode : public Base + namespace Frontend { - public: - static const ObjTypes StaticObjectType = ObjTypes::RefTreeNode; - typedef Internal::RefTreeNodePrivate Private; - typedef QList< RefTreeNode* > List; - public: - RefTreeNode(Base* _parent, const QString& _name); + class MGV_CORE_API RefTreeNode + : public Base + { + public: + static const ObjTypes StaticObjectType = ObjTypes::RefTreeNode; + typedef Internal::RefTreeNodePrivate Private; + typedef QList< RefTreeNode* > List; - public: - QString name() const; - }; + public: + RefTreeNode(Base* _parent, const QString& _name); + + public: + QString name() const; + }; + + } } From 9c653d8facc8280caa15a7b9aaa5d5e44103f108 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 02:03:29 +0100 Subject: [PATCH 31/60] Move Frontend implementation into Frontend namespace (RefLog) --- .../RepoMan/Frontend/RefLog.cpp | 15 ++++++++------ Libs/libMacGitverCore/RepoMan/RefLog.hpp | 20 ++++++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp index 2c394da6..11c0715b 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp @@ -25,13 +25,16 @@ namespace RM { - using namespace Internal; - - RefLog::RefLog(Base* _parent) - : Base(*new RefLogPrivate(this)) + namespace Frontend { - RM_D(RefLog); - d->linkToParent(_parent); + + RefLog::RefLog(Base* _parent) + : Base(*new Internal::RefLogPrivate(this)) + { + RM_D(RefLog); + d->linkToParent(_parent); + } + } } diff --git a/Libs/libMacGitverCore/RepoMan/RefLog.hpp b/Libs/libMacGitverCore/RepoMan/RefLog.hpp index 0879a024..267dea54 100644 --- a/Libs/libMacGitverCore/RepoMan/RefLog.hpp +++ b/Libs/libMacGitverCore/RepoMan/RefLog.hpp @@ -29,14 +29,20 @@ namespace RM class RefLogPrivate; } - class MGV_CORE_API RefLog : public Base + namespace Frontend { - public: - static const ObjTypes StaticObjectType = ObjTypes::RefLog; - typedef Internal::RefLogPrivate Private; - public: - RefLog(Base* _parent); - }; + class MGV_CORE_API RefLog + : public Base + { + public: + static const ObjTypes StaticObjectType = ObjTypes::RefLog; + typedef Internal::RefLogPrivate Private; + + public: + RefLog(Base* _parent); + }; + + } } From d733d60e7363739ba928c87b3a921f648c7f8bad Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 02:04:46 +0100 Subject: [PATCH 32/60] Move Frontend implementation into Frontend namespace (Branch) --- Libs/libMacGitverCore/RepoMan/Branch.hpp | 38 ++++++---- .../RepoMan/Frontend/Branch.cpp | 75 ++++++++++--------- 2 files changed, 61 insertions(+), 52 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Branch.hpp b/Libs/libMacGitverCore/RepoMan/Branch.hpp index 7452299f..72f073c1 100644 --- a/Libs/libMacGitverCore/RepoMan/Branch.hpp +++ b/Libs/libMacGitverCore/RepoMan/Branch.hpp @@ -24,22 +24,28 @@ namespace RM { - class MGV_CORE_API Branch : public Ref + namespace Frontend { - public: - static const ObjTypes StaticObjectType = ObjTypes::Branch; - typedef QVector< Branch* > List; - - public: - Branch(Base* parent, const Git::Reference& ref); - - public: - bool hasUpstream() const; - QString upstreamRefName() const; - Ref* upstream(); - int aheadCount() const; - int behindCount() const; - bool isHead() const; - }; + + class MGV_CORE_API Branch + : public Ref + { + public: + static const ObjTypes StaticObjectType = ObjTypes::Branch; + typedef QVector< Branch* > List; + + public: + Branch(Base* parent, const Git::Reference& ref); + + public: + bool hasUpstream() const; + QString upstreamRefName() const; + Ref* upstream(); + int aheadCount() const; + int behindCount() const; + bool isHead() const; + }; + + } } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp index 2da6af24..afbba9d8 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp @@ -29,49 +29,52 @@ namespace RM { - using namespace Internal; - - Branch::Branch(Base* parent, const Git::Reference &ref) - : Ref( *new BranchPrivate(this, ref) ) + namespace Frontend { - RM_D(Branch); - d->linkToParent( parent ); - } - QString Branch::upstreamRefName() const - { - RM_CD(Branch); - return d->mUpstreamRefName; - } + Branch::Branch(Base* parent, const Git::Reference &ref) + : Ref( *new Internal::BranchPrivate(this, ref) ) + { + RM_D(Branch); + d->linkToParent( parent ); + } - Ref* Branch::upstream() - { - return repository()->findReference(upstreamRefName()); - } + QString Branch::upstreamRefName() const + { + RM_CD(Branch); + return d->mUpstreamRefName; + } - bool Branch::hasUpstream() const - { - RM_CD(Branch); - return d->mHasUpstream; - } + Ref* Branch::upstream() + { + return repository()->findReference(upstreamRefName()); + } - int Branch::aheadCount() const - { - RM_CD(Branch); - return d->mAheadCount; - } + bool Branch::hasUpstream() const + { + RM_CD(Branch); + return d->mHasUpstream; + } - int Branch::behindCount() const - { - RM_CD(Branch); - return d->mBehindCount; - } + int Branch::aheadCount() const + { + RM_CD(Branch); + return d->mAheadCount; + } + + int Branch::behindCount() const + { + RM_CD(Branch); + return d->mBehindCount; + } + + bool Branch::isHead() const + { + const Repo* r = repository(); + const Head* h = r ? r->head() : NULL; + return h && h->is(this); + } - bool Branch::isHead() const - { - const Repo* r = repository(); - const Head* h = r ? r->head() : NULL; - return h && h->is(this); } } From ddd39372c78a605e3b13cb5ab651af7502a42d6f Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 19:34:26 +0100 Subject: [PATCH 33/60] Move Frontend implementation into Frontend namespace (Base) --- Libs/libMacGitverCore/RepoMan/Base.hpp | 111 ++--- .../RepoMan/Frontend/Base.cpp | 423 +++++++++--------- 2 files changed, 271 insertions(+), 263 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Base.hpp b/Libs/libMacGitverCore/RepoMan/Base.hpp index 09005305..f5ca7db0 100644 --- a/Libs/libMacGitverCore/RepoMan/Base.hpp +++ b/Libs/libMacGitverCore/RepoMan/Base.hpp @@ -39,83 +39,88 @@ namespace RM class BasePrivate; } - class MGV_CORE_API Base + namespace Frontend { - friend class Repo; - friend class Internal::BasePrivate; - public: - typedef QVector< Base* > List; + class MGV_CORE_API Base + { + friend class Repo; + friend class Internal::BasePrivate; - protected: - Base(Internal::BasePrivate& _d); - virtual ~Base(); + public: + typedef QVector< Base* > List; - public: - ObjTypes objType() const; + protected: + Base(Internal::BasePrivate& _d); + virtual ~Base(); - public: - void refresh(); + public: + ObjTypes objType() const; - const Repo* repository() const; - Repo* repository(); + public: + void refresh(); - Base* parentObject() const; + const Repo* repository() const; + Repo* repository(); - List childObjects() const; - List childObjects(ObjTypes type) const; + Base* parentObject() const; - template< class T > - typename T::List childObjects() const; + List childObjects() const; + List childObjects(ObjTypes type) const; - template< class T > - bool isA() const; + template< class T > + typename T::List childObjects() const; - template< class T > - bool inheritsRepoManType() const; + template< class T > + bool isA() const; - bool inheritsRepoManType(ObjTypes type) const; + template< class T > + bool inheritsRepoManType() const; - Heaven::IconRef icon(bool small = false) const; + bool inheritsRepoManType(ObjTypes type) const; - QString typeName() const; - QString displayName() const; - QString dump() const; + Heaven::IconRef icon(bool small = false) const; - Heaven::Menu* contextMenu(); + QString typeName() const; + QString displayName() const; + QString dump() const; - protected: - Internal::BasePrivate* mData; + Heaven::Menu* contextMenu(); - private: - Base(const Base& other); - Base& operator=(const Base& other); - }; + protected: + Internal::BasePrivate* mData; - template< class T > - inline bool Base::isA() const - { - return objType() == ObjTypes(T::StaticObjectType); - } + private: + Base(const Base& other); + Base& operator=(const Base& other); + }; - template< class T > - inline bool Base::inheritsRepoManType() const - { - return inheritsRepoManType(ObjTypes(T::StaticObjectType)); - } + template< class T > + inline bool Base::isA() const + { + return objType() == ObjTypes(T::StaticObjectType); + } - template< class T > - inline typename T::List Base::childObjects() const - { - typename T::List children; + template< class T > + inline bool Base::inheritsRepoManType() const + { + return inheritsRepoManType(ObjTypes(T::StaticObjectType)); + } - foreach(Base* child, childObjects()) { - if (child->inheritsRepoManType()) { - children.append(static_cast(child)); + template< class T > + inline typename T::List Base::childObjects() const + { + typename T::List children; + + foreach(Base* child, childObjects()) { + if (child->inheritsRepoManType()) { + children.append(static_cast(child)); + } } + + return children; } - return children; } } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp index 7c0846fc..daf3f876 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp @@ -54,236 +54,239 @@ namespace RM { - using namespace Internal; - - /** - * @fn bool Base::refreshSelf() - * @brief Refresh this object's data and sent events - * - * This method is called during the refreshing mechanism. It is the first step and can determine - * that the object itself does no longer exist. However, if this happens, the child refreshing - * logic of the parent is most probably broken. - * - * Implementations should _only_ refresh the object itself and not the children. See refresh() - * for details on how exactly the refreshing process works. - */ - - /** - * @fn bool Base::isA() - * @brief Check this object's type - * - * @tparam T Type to check against - * - * @return `true`, if this is an object of type @a T. `false` otherwise. - */ - - /*-* // Keep this comment away from doxygen: https://bugzilla.gnome.org/show_bug.cgi?id=709052 - * @fn T::Set Base::childObjects() const - * @brief Find (existing) children filtered by a given type - * - * @tparam T Type to check the children against - * - * @return A set of children of type @a T. - */ - - /** - * @brief Constructor - * - * Creates a new RepoMan object and links it into the parent. Because at this point the new - * child is not yet fully constructed, no further action is taken. - * - * @param[in] parent The parent to whom we shall link this new child to. - * - */ - Base::Base(BasePrivate& _d) - : mData(&_d) + namespace Frontend { - } - - /** - * @brief Destructor - * - * At the point where the destructor is called, all children should have been unlinked from the - * tree and this object has to be unlinked too. - * - */ - Base::~Base() - { - delete mData; - } - - /** - * @brief Find (existing) children - * - * @return A set of all children of this object (unfiltered). - */ - Base::List Base::childObjects() const - { - RM_CD(Base); - return d->mChildren; - } + /** + * @fn bool Base::refreshSelf() + * @brief Refresh this object's data and sent events + * + * This method is called during the refreshing mechanism. It is the first step and can determine + * that the object itself does no longer exist. However, if this happens, the child refreshing + * logic of the parent is most probably broken. + * + * Implementations should _only_ refresh the object itself and not the children. See refresh() + * for details on how exactly the refreshing process works. + */ + + /** + * @fn bool Base::isA() + * @brief Check this object's type + * + * @tparam T Type to check against + * + * @return `true`, if this is an object of type @a T. `false` otherwise. + */ + + /*-* // Keep this comment away from doxygen: https://bugzilla.gnome.org/show_bug.cgi?id=709052 + * @fn T::Set Base::childObjects() const + * @brief Find (existing) children filtered by a given type + * + * @tparam T Type to check the children against + * + * @return A set of children of type @a T. + */ + + /** + * @brief Constructor + * + * Creates a new RepoMan object and links it into the parent. Because at this point the new + * child is not yet fully constructed, no further action is taken. + * + * @param[in] parent The parent to whom we shall link this new child to. + * + */ + Base::Base(BasePrivate& _d) + : mData(&_d) + { + } - /** - * @brief Find (existing) children of a specific type - * - * @param[in] type The object type of the children to find. - * - * @return A set of children of this object filtered by object type. - * - */ - Base::List Base::childObjects(ObjTypes type) const - { - RM_CD(Base); + /** + * @brief Destructor + * + * At the point where the destructor is called, all children should have been unlinked from the + * tree and this object has to be unlinked too. + * + */ + Base::~Base() + { + delete mData; + } - List children; + /** + * @brief Find (existing) children + * + * @return A set of all children of this object (unfiltered). + */ + Base::List Base::childObjects() const + { + RM_CD(Base); - foreach(Base* child, d->mChildren) { - if (child->objType() == type) { - children.append(child); - } + return d->mChildren; } - return children; - } + /** + * @brief Find (existing) children of a specific type + * + * @param[in] type The object type of the children to find. + * + * @return A set of children of this object filtered by object type. + * + */ + Base::List Base::childObjects(ObjTypes type) const + { + RM_CD(Base); + + List children; + + foreach(Base* child, d->mChildren) { + if (child->objType() == type) { + children.append(child); + } + } - /** - * @brief Get the direct parent object - * - * The direct parent object is specified during construction and can never be changed. - * - * @return The direct parent object. - * - */ - Base* Base::parentObject() const - { - RM_CD(Base); + return children; + } - return d->mParentObj->mPub; - } + /** + * @brief Get the direct parent object + * + * The direct parent object is specified during construction and can never be changed. + * + * @return The direct parent object. + * + */ + Base* Base::parentObject() const + { + RM_CD(Base); + + return d->mParentObj->mPub; + } - /** - * @brief Refresh this object - * - * Refreshs this object and all its children. - * - */ - void Base::refresh() - { - RM_D(Base); - d->refresh(); - } + /** + * @brief Refresh this object + * + * Refreshs this object and all its children. + * + */ + void Base::refresh() + { + RM_D(Base); + d->refresh(); + } - /** - * @brief Find the repository for this object - * - * @return The first repository in hierarchy (Repo or Submodule) - * - */ - const Repo* Base::repository() const - { - RM_CD(Base); - return d->mRepo; - } + /** + * @brief Find the repository for this object + * + * @return The first repository in hierarchy (Repo or Submodule) + * + */ + const Repo* Base::repository() const + { + RM_CD(Base); + return d->mRepo; + } - /** - * @brief find the repository for this object - * - * Walks up the hierarchy of objects to find the repository. Since objects can never be - * reparented, the result of this method never changes. - * - * @return The first repository in hierarchy that is found - * - */ - Repo* Base::repository() - { - RM_D(Base); - return d->mRepo; - } + /** + * @brief find the repository for this object + * + * Walks up the hierarchy of objects to find the repository. Since objects can never be + * reparented, the result of this method never changes. + * + * @return The first repository in hierarchy that is found + * + */ + Repo* Base::repository() + { + RM_D(Base); + return d->mRepo; + } - /** - * @brief Get a string that can be used to display this object - * - * @return Always ``. Reimplementations should return something more meaningful. - * - */ - QString Base::displayName() const - { - RM_CD(Base); - return d->displayName(); - } + /** + * @brief Get a string that can be used to display this object + * + * @return Always ``. Reimplementations should return something more meaningful. + * + */ + QString Base::displayName() const + { + RM_CD(Base); + return d->displayName(); + } - /** - * @brief Get the type of this object - * - * This method must be implemented by all derivats of Base. They must simply return the correct - * value from the ObjTypes enum. - * - * @return Type of this object - * - */ - ObjTypes Base::objType() const - { - RM_CD(Base); - return d->objType(); - } + /** + * @brief Get the type of this object + * + * This method must be implemented by all derivats of Base. They must simply return the correct + * value from the ObjTypes enum. + * + * @return Type of this object + * + */ + ObjTypes Base::objType() const + { + RM_CD(Base); + return d->objType(); + } - /** - * @brief Creates a textual dump of this object and its children - * - * @return Textual dump. - * - */ - QString Base::dump() const - { - RM_CD(Base); + /** + * @brief Creates a textual dump of this object and its children + * + * @return Textual dump. + * + */ + QString Base::dump() const + { + RM_CD(Base); + + Dumper dumper; + d->dumpRecursive(dumper); + return dumper.output(); + } - Dumper dumper; - d->dumpRecursive(dumper); - return dumper.output(); - } + /** + * @brief Get the name of this object type + * + * @return The name + * + */ + QString Base::typeName() const + { + RM_CD(Base); + return d->objectTypeName(); + } - /** - * @brief Get the name of this object type - * - * @return The name - * - */ - QString Base::typeName() const - { - RM_CD(Base); - return d->objectTypeName(); - } + /** + * @brief Get a context menu for this object + * + * @return A Heaven::Menu that can be used as context menu for this object. + * + */ + Heaven::Menu* Base::contextMenu() + { + RepoMan* rm = &MacGitver::repoMan(); + RepoMan::Private* rmp = BasePrivate::dataOf(rm); + return rmp->contextMenuFor(this); + } - /** - * @brief Get a context menu for this object - * - * @return A Heaven::Menu that can be used as context menu for this object. - * - */ - Heaven::Menu* Base::contextMenu() - { - RepoMan* rm = &MacGitver::repoMan(); - RepoMan::Private* rmp = BasePrivate::dataOf(rm); - return rmp->contextMenuFor(this); - } + /** + * @brief Get an icon for this object + * + * @return A iconRef for this object + * + */ + Heaven::IconRef Base::icon(bool small) const + { + RM_D(Base); + return d->icon(small); + } - /** - * @brief Get an icon for this object - * - * @return A iconRef for this object - * - */ - Heaven::IconRef Base::icon(bool small) const - { - RM_D(Base); - return d->icon(small); - } + bool Base::inheritsRepoManType(ObjTypes type) const + { + RM_CD(Base); + return d->inherits(type); + } - bool Base::inheritsRepoManType(ObjTypes type) const - { - RM_CD(Base); - return d->inherits(type); } } From db3828ba64350aba6f89a5dce48fafdd24f82209 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 19:35:27 +0100 Subject: [PATCH 34/60] Move Frontend file into Frontend directory (Base) --- Libs/libMacGitverCore/CMakeLists.txt | 2 +- Libs/libMacGitverCore/RepoMan/{ => Frontend}/Base.hpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Base.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index d881d89c..d9f5fe5c 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -89,8 +89,8 @@ SET( PUB_HDR_FILES MacGitver/IRepositoryContext.hpp RepoMan/Core.hpp - RepoMan/Base.hpp RepoMan/Events.hpp + RepoMan/Frontend/Base.hpp RepoMan/Ref.hpp RepoMan/Repo.hpp RepoMan/RepoMan.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Base.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Base.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Base.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Base.hpp From 7404621cd371cbb41433fed5d540352328757dc0 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 02:06:55 +0100 Subject: [PATCH 35/60] Move Frontend file into Frontend directory (Branch) --- Libs/libMacGitverCore/CMakeLists.txt | 13 +++++++------ .../RepoMan/{ => Frontend}/Branch.hpp | 0 2 files changed, 7 insertions(+), 6 deletions(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Branch.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index d9f5fe5c..5f32375f 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -90,18 +90,19 @@ SET( PUB_HDR_FILES RepoMan/Core.hpp RepoMan/Events.hpp + RepoMan/RepoMan.hpp + RepoMan/Frontend/Base.hpp + RepoMan/Frontend/Branch.hpp + RepoMan/Head.hpp + RepoMan/Namespace.hpp RepoMan/Ref.hpp RepoMan/Repo.hpp - RepoMan/RepoMan.hpp RepoMan/Remote.hpp - RepoMan/Tag.hpp - RepoMan/Branch.hpp RepoMan/RefLog.hpp - RepoMan/Submodule.hpp RepoMan/RefTreeNode.hpp - RepoMan/Namespace.hpp - RepoMan/Head.hpp + RepoMan/Submodule.hpp + RepoMan/Tag.hpp SHMParser/ShellExpand.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Branch.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Branch.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Branch.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Branch.hpp From ed19ff3a60d57c857ccdda2de77322f426703920 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 02:07:33 +0100 Subject: [PATCH 36/60] Move Frontend file into Frontend directory (RefLog) --- Libs/libMacGitverCore/CMakeLists.txt | 2 +- Libs/libMacGitverCore/RepoMan/{ => Frontend}/RefLog.hpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/RefLog.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 5f32375f..7c41fc41 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -99,7 +99,7 @@ SET( PUB_HDR_FILES RepoMan/Ref.hpp RepoMan/Repo.hpp RepoMan/Remote.hpp - RepoMan/RefLog.hpp + RepoMan/Frontend/RefLog.hpp RepoMan/RefTreeNode.hpp RepoMan/Submodule.hpp RepoMan/Tag.hpp diff --git a/Libs/libMacGitverCore/RepoMan/RefLog.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/RefLog.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/RefLog.hpp From 478e7ea7ace201ca54b846661a423f3548af646b Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 02:08:03 +0100 Subject: [PATCH 37/60] Move Frontend file into Frontend directory (RefTreeNode) --- Libs/libMacGitverCore/CMakeLists.txt | 2 +- Libs/libMacGitverCore/RepoMan/{ => Frontend}/RefTreeNode.hpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/RefTreeNode.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 7c41fc41..f3291ad4 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -100,7 +100,7 @@ SET( PUB_HDR_FILES RepoMan/Repo.hpp RepoMan/Remote.hpp RepoMan/Frontend/RefLog.hpp - RepoMan/RefTreeNode.hpp + RepoMan/Frontend/RefTreeNode.hpp RepoMan/Submodule.hpp RepoMan/Tag.hpp diff --git a/Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/RefTreeNode.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp From d7f015b4cbf70d7ba378dd3e03239991b308f7d4 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 01:17:03 +0100 Subject: [PATCH 38/60] Move Frontend file into Frontend directory (Namespace) --- Libs/libMacGitverCore/CMakeLists.txt | 2 +- Libs/libMacGitverCore/RepoMan/{ => Frontend}/Namespace.hpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Namespace.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index f3291ad4..6c0a3df1 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -95,7 +95,7 @@ SET( PUB_HDR_FILES RepoMan/Frontend/Base.hpp RepoMan/Frontend/Branch.hpp RepoMan/Head.hpp - RepoMan/Namespace.hpp + RepoMan/Frontend/Namespace.hpp RepoMan/Ref.hpp RepoMan/Repo.hpp RepoMan/Remote.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Namespace.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Namespace.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Namespace.hpp From ad9500dad6c5c4864bf6e28971ce31b6158b372d Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Wed, 13 May 2015 21:30:08 +0100 Subject: [PATCH 39/60] Move Frontend file into Frontend directory (Head) --- Libs/libMacGitverCore/CMakeLists.txt | 6 +++--- Libs/libMacGitverCore/RepoMan/{ => Frontend}/Head.hpp | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Head.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 6c0a3df1..0f07f2be 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -44,15 +44,15 @@ SET( SRC_FILES RepoMan/Data/Base.cpp RepoMan/Data/Branch.cpp - RepoMan/Data/Reference.cpp + RepoMan/Data/Head.cpp RepoMan/Data/Namespace.cpp + RepoMan/Data/Reference.cpp RepoMan/Data/RefLog.cpp RepoMan/Data/RefTreeNode.cpp RepoMan/Data/Remote.cpp RepoMan/Data/Repo.cpp RepoMan/Data/Submodule.cpp RepoMan/Data/Tag.cpp - RepoMan/Data/Head.cpp RepoMan/Private/Dumper.cpp @@ -94,7 +94,7 @@ SET( PUB_HDR_FILES RepoMan/Frontend/Base.hpp RepoMan/Frontend/Branch.hpp - RepoMan/Head.hpp + RepoMan/Frontend/Head.hpp RepoMan/Frontend/Namespace.hpp RepoMan/Ref.hpp RepoMan/Repo.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Head.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Head.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Head.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Head.hpp From aca744e2196ac2e1bf03f5cd79e8c280c7b2cbeb Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Wed, 13 May 2015 21:33:25 +0100 Subject: [PATCH 40/60] Move Frontend file into Frontend directory (Tag) --- Libs/libMacGitverCore/CMakeLists.txt | 2 +- Libs/libMacGitverCore/RepoMan/{ => Frontend}/Tag.hpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Tag.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 0f07f2be..eccc9b13 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -102,7 +102,7 @@ SET( PUB_HDR_FILES RepoMan/Frontend/RefLog.hpp RepoMan/Frontend/RefTreeNode.hpp RepoMan/Submodule.hpp - RepoMan/Tag.hpp + RepoMan/Frontend/Tag.hpp SHMParser/ShellExpand.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Tag.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Tag.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Tag.hpp From 63c16a4ac3cd93188a02f74f23f87c2b76e33039 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Thu, 14 May 2015 20:45:58 +0100 Subject: [PATCH 41/60] Move Frontend file into Frontend directory (Submodule) --- Libs/libMacGitverCore/CMakeLists.txt | 2 +- Libs/libMacGitverCore/RepoMan/{ => Frontend}/Submodule.hpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Submodule.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index eccc9b13..4bfddd43 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -101,7 +101,7 @@ SET( PUB_HDR_FILES RepoMan/Remote.hpp RepoMan/Frontend/RefLog.hpp RepoMan/Frontend/RefTreeNode.hpp - RepoMan/Submodule.hpp + RepoMan/Frontend/Submodule.hpp RepoMan/Frontend/Tag.hpp SHMParser/ShellExpand.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Submodule.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Submodule.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Submodule.hpp From 4a0e678d007d62b665ec60a83140b199c5b02bb0 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Thu, 14 May 2015 20:41:39 +0100 Subject: [PATCH 42/60] Move Frontend file into Frontend directory (Repo) --- Libs/libMacGitverCore/CMakeLists.txt | 2 +- Libs/libMacGitverCore/RepoMan/{ => Frontend}/Repo.hpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Repo.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 4bfddd43..b2c74473 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -97,7 +97,7 @@ SET( PUB_HDR_FILES RepoMan/Frontend/Head.hpp RepoMan/Frontend/Namespace.hpp RepoMan/Ref.hpp - RepoMan/Repo.hpp + RepoMan/Frontend/Repo.hpp RepoMan/Remote.hpp RepoMan/Frontend/RefLog.hpp RepoMan/Frontend/RefTreeNode.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Repo.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Repo.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Repo.hpp From f2d918173d5ac5c8eff5a696d584134dfecb0ca1 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 00:35:15 +0100 Subject: [PATCH 43/60] Move Frontend file into Frontend directory (Remote) --- Libs/libMacGitverCore/CMakeLists.txt | 2 +- Libs/libMacGitverCore/RepoMan/{ => Frontend}/Remote.hpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Remote.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index b2c74473..a3dde71c 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -98,7 +98,7 @@ SET( PUB_HDR_FILES RepoMan/Frontend/Namespace.hpp RepoMan/Ref.hpp RepoMan/Frontend/Repo.hpp - RepoMan/Remote.hpp + RepoMan/Frontend/Remote.hpp RepoMan/Frontend/RefLog.hpp RepoMan/Frontend/RefTreeNode.hpp RepoMan/Frontend/Submodule.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Remote.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Remote.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Remote.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Remote.hpp From 478058564ff8a83dda8aed901cdb1792c1d31699 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 00:37:09 +0100 Subject: [PATCH 44/60] Move Frontend file into Frontend directory (Ref) --- Libs/libMacGitverCore/CMakeLists.txt | 2 +- Libs/libMacGitverCore/RepoMan/{ => Frontend}/Ref.hpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Libs/libMacGitverCore/RepoMan/{ => Frontend}/Ref.hpp (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index a3dde71c..1cd44690 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -96,7 +96,7 @@ SET( PUB_HDR_FILES RepoMan/Frontend/Branch.hpp RepoMan/Frontend/Head.hpp RepoMan/Frontend/Namespace.hpp - RepoMan/Ref.hpp + RepoMan/Frontend/Ref.hpp RepoMan/Frontend/Repo.hpp RepoMan/Frontend/Remote.hpp RepoMan/Frontend/RefLog.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Ref.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Ref.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Ref.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Ref.hpp From 88869127e45ff9075bae9ada18de9cd79c7fb1dc Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 00:47:02 +0100 Subject: [PATCH 45/60] Rename Ref to Reference (File) --- Libs/libMacGitverCore/CMakeLists.txt | 4 ++-- .../RepoMan/Frontend/{Ref.cpp => Reference.cpp} | 0 .../RepoMan/Frontend/{Ref.hpp => Reference.hpp} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename Libs/libMacGitverCore/RepoMan/Frontend/{Ref.cpp => Reference.cpp} (100%) rename Libs/libMacGitverCore/RepoMan/Frontend/{Ref.hpp => Reference.hpp} (100%) diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 1cd44690..1f9e59fa 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -33,7 +33,7 @@ SET( SRC_FILES RepoMan/Frontend/Base.cpp RepoMan/Frontend/Branch.cpp RepoMan/Frontend/Namespace.cpp - RepoMan/Frontend/Ref.cpp + RepoMan/Frontend/Reference.cpp RepoMan/Frontend/RefLog.cpp RepoMan/Frontend/RefTreeNode.cpp RepoMan/Frontend/Remote.cpp @@ -96,7 +96,7 @@ SET( PUB_HDR_FILES RepoMan/Frontend/Branch.hpp RepoMan/Frontend/Head.hpp RepoMan/Frontend/Namespace.hpp - RepoMan/Frontend/Ref.hpp + RepoMan/Frontend/Reference.hpp RepoMan/Frontend/Repo.hpp RepoMan/Frontend/Remote.hpp RepoMan/Frontend/RefLog.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Frontend/Ref.cpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Ref.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Frontend/Ref.hpp rename to Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp From c3c7a32628c8692f666ec3b1c10c7ed0bb323375 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Fri, 15 May 2015 00:53:07 +0100 Subject: [PATCH 46/60] Rename Ref class to Reference --- .../RepoMan/Frontend/Reference.cpp | 38 +++++++++---------- .../RepoMan/Frontend/Reference.hpp | 6 +-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp index 0c693eee..28a380b8 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp @@ -23,7 +23,7 @@ #include "RepoMan/Events.hpp" -#include "RepoMan/Ref.hpp" +#include "RepoMan/Frontend/Reference.hpp" #include "RepoMan/Repo.hpp" #include "RepoMan/Private/Dumper.hpp" @@ -35,58 +35,58 @@ namespace RM namespace Frontend { - Ref::Ref(Internal::RefPrivate& data) + Reference::Reference(Internal::ReferencePrivate& data) : Base( data ) { } - Ref::Ref(Base* parent, RefTypes type, const Git::Reference& ref) - : Base( *new Internal::RefPrivate( this, type, ref ) ) + Reference::Reference(Base* parent, ReferenceTypes type, const Git::Reference& Reference) + : Base( *new Internal::ReferencePrivate( this, type, Reference ) ) { - RM_D( Ref ); + RM_D( Reference ); d->linkToParent( parent ); } - RefTypes Ref::type() const + ReferenceTypes Reference::type() const { - RM_CD(Ref); + RM_CD(Reference); return d->mType; } - QString Ref::name() const + QString Reference::name() const { - RM_CD(Ref); + RM_CD(Reference); return d->mName; } - QString Ref::fullName() const + QString Reference::fullName() const { - RM_CD(Ref); + RM_CD(Reference); return d->mFullQualifiedName; } - Git::ObjectId Ref::id() const + Git::ObjectId Reference::id() const { - RM_CD(Ref); + RM_CD(Reference); return d->mId; } - QString Ref::displaySha1() const + QString Reference::displaySha1() const { return id().toString(8); } - Git::Reference Ref::load(Git::Result& r) + Git::Reference Reference::load(Git::Result& r) { - RM_D(Ref); - Git::Reference gitRef; + RM_D(Reference); + Git::Reference gitReference; if (r) { Git::Repository repo = repository()->gitRepo(); - gitRef = repo.reference(r, d->mFullQualifiedName); + gitReference = repo.Reference(r, d->mFullQualifiedName); } - return gitRef; + return gitReference; } } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp index 6d777295..c7c9f5b6 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp @@ -40,7 +40,7 @@ namespace RM TagType }; - class MGV_CORE_API Ref + class MGV_CORE_API Reference : public Base { public: @@ -49,10 +49,10 @@ namespace RM typedef QList< Ref* > List; protected: - Ref(Internal::RefPrivate& data); + Reference(Internal::RefPrivate& data); public: - Ref(Base* parent, RefTypes type, const Git::Reference& ref); + Reference(Base* parent, RefTypes type, const Git::Reference& ref); GW_DEPRECATED Git::Reference load(Git::Result& r); From 27a3a4ab605054f2c9fa49d09233bbf9fa73b2f4 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Tue, 21 Apr 2015 23:55:59 +0100 Subject: [PATCH 47/60] Temporary code --- Libs/libMacGitverCore/CMakeLists.txt | 17 +- Libs/libMacGitverCore/RepoMan/Core.hpp | 13 +- Libs/libMacGitverCore/RepoMan/Data/Base.cpp | 177 ++++------ Libs/libMacGitverCore/RepoMan/Data/Base.hpp | 142 ++++---- Libs/libMacGitverCore/RepoMan/Data/Branch.cpp | 34 +- Libs/libMacGitverCore/RepoMan/Data/Branch.hpp | 13 +- Libs/libMacGitverCore/RepoMan/Data/Head.cpp | 31 +- Libs/libMacGitverCore/RepoMan/Data/Head.hpp | 48 ++- .../RepoMan/Data/Namespace.cpp | 6 +- .../RepoMan/Data/Namespace.hpp | 14 +- Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp | 6 +- Libs/libMacGitverCore/RepoMan/Data/RefLog.hpp | 14 +- .../RepoMan/Data/RefTreeNode.cpp | 6 +- .../RepoMan/Data/RefTreeNode.hpp | 14 +- .../RepoMan/Data/Reference.cpp | 32 +- .../RepoMan/Data/{Ref.hpp => Reference.hpp} | 17 +- Libs/libMacGitverCore/RepoMan/Data/Remote.cpp | 6 +- Libs/libMacGitverCore/RepoMan/Data/Remote.hpp | 18 +- Libs/libMacGitverCore/RepoMan/Data/Repo.cpp | 311 ++---------------- Libs/libMacGitverCore/RepoMan/Data/Repo.hpp | 74 +++-- .../Data/{RepoManData.hpp => RepoMan.hpp} | 20 +- .../RepoMan/Data/Submodule.cpp | 6 +- .../RepoMan/Data/Submodule.hpp | 14 +- Libs/libMacGitverCore/RepoMan/Data/Tag.cpp | 22 +- Libs/libMacGitverCore/RepoMan/Data/Tag.hpp | 14 +- Libs/libMacGitverCore/RepoMan/Events.cpp | 66 ++-- Libs/libMacGitverCore/RepoMan/Events.hpp | 161 ++++----- .../RepoMan/Frontend/Base.cpp | 224 +++++-------- .../RepoMan/Frontend/Base.hpp | 106 +++--- .../RepoMan/Frontend/BaseInternal.hpp | 121 +++++++ .../RepoMan/Frontend/Branch.cpp | 17 +- .../RepoMan/Frontend/Head.cpp | 11 +- .../RepoMan/Frontend/Head.hpp | 14 +- .../RepoMan/Frontend/Namespace.cpp | 8 +- .../RepoMan/Frontend/Namespace.hpp | 10 +- .../RepoMan/Frontend/RefLog.cpp | 9 +- .../RepoMan/Frontend/RefLog.hpp | 10 +- .../RepoMan/Frontend/RefTreeNode.cpp | 8 +- .../RepoMan/Frontend/RefTreeNode.hpp | 4 +- .../RepoMan/Frontend/Reference.cpp | 32 +- .../RepoMan/Frontend/Reference.hpp | 35 +- .../RepoMan/Frontend/Remote.cpp | 10 +- .../RepoMan/Frontend/Repo.cpp | 140 ++++---- .../RepoMan/Frontend/Repo.hpp | 58 ++-- .../RepoMan/Frontend/Submodule.cpp | 9 +- .../RepoMan/Frontend/Submodule.hpp | 7 +- .../libMacGitverCore/RepoMan/Frontend/Tag.cpp | 8 +- .../libMacGitverCore/RepoMan/Frontend/Tag.hpp | 7 +- Libs/libMacGitverCore/RepoMan/RepoMan.cpp | 52 +-- Libs/libMacGitverCore/RepoMan/RepoMan.hpp | 94 +++--- .../Widgets/RepoStateWidget.cpp | 32 +- .../Widgets/RepoStateWidget.hpp | 22 +- 52 files changed, 1119 insertions(+), 1225 deletions(-) rename Libs/libMacGitverCore/RepoMan/Data/{Ref.hpp => Reference.hpp} (78%) rename Libs/libMacGitverCore/RepoMan/Data/{RepoManData.hpp => RepoMan.hpp} (70%) create mode 100644 Libs/libMacGitverCore/RepoMan/Frontend/BaseInternal.hpp diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 1f9e59fa..76b15eff 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -43,6 +43,15 @@ SET( SRC_FILES RepoMan/Frontend/Head.cpp RepoMan/Data/Base.cpp + RepoMan/Data/Branch.cpp + RepoMan/Data/Head.cpp + RepoMan/Data/Namespace.cpp + RepoMan/Data/Reference.cpp + RepoMan/Data/RefLog.cpp + RepoMan/Data/RefTreeNode.cpp + RepoMan/Data/Remote.cpp + RepoMan/Data/Repo.cpp + RepoMan/Data/Branch.cpp RepoMan/Data/Head.cpp RepoMan/Data/Namespace.cpp @@ -136,14 +145,16 @@ SET( PRI_HDR_FILES RepoMan/Data/Branch.hpp RepoMan/Data/Head.hpp RepoMan/Data/Namespace.hpp - RepoMan/Data/Ref.hpp + RepoMan/Data/Reference.hpp RepoMan/Data/RefLog.hpp RepoMan/Data/RefTreeNode.hpp RepoMan/Data/Remote.hpp RepoMan/Data/Repo.hpp - RepoMan/Data/RepoManData.hpp - RepoMan/Data/Submodule.hpp + RepoMan/Data/RepoMan.hpp RepoMan/Data/Tag.hpp + RepoMan/Data/Submodule.hpp + + RepoMan/Frontend/BaseInternal.hpp Widgets/StringSelectorWidgetPrivate.h Widgets/FlatTreeModelPrivate.h diff --git a/Libs/libMacGitverCore/RepoMan/Core.hpp b/Libs/libMacGitverCore/RepoMan/Core.hpp index f2967aa3..575d0115 100644 --- a/Libs/libMacGitverCore/RepoMan/Core.hpp +++ b/Libs/libMacGitverCore/RepoMan/Core.hpp @@ -41,7 +41,6 @@ namespace RM Invalid, Namespace, - RepoManager, Repo, Remote, Submodule, @@ -53,4 +52,16 @@ namespace RM RefLog }; + namespace Frontend + { + class Repo; + class RefTreeNode; + class Namespace; + class Reference; + class Remote; + class RefLog; + class Submodule; + class Tag; + } + } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Base.cpp b/Libs/libMacGitverCore/RepoMan/Data/Base.cpp index a5655074..ebdb735f 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Base.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Base.cpp @@ -17,14 +17,11 @@ * */ -#include "RepoMan/Data/BaseData.hpp" -#include "RepoMan/Data/RefTreeNodeData.hpp" -#include "RepoMan/Data/CollectionNodeData.hpp" +#include "RepoMan/Data/Base.hpp" -#include "RepoMan/Base.hpp" -#include "RepoMan/Repo.hpp" +#include "RepoMan/Frontend/Base.hpp" +#include "RepoMan/Frontend/Repo.hpp" -#include "RepoMan/Events.hpp" #include "RepoMan/Private/Dumper.hpp" #include "libHeavenIcons/IconRef.hpp" @@ -32,88 +29,17 @@ namespace RM { - namespace Internal + namespace Data { - BasePrivate::BasePrivate(Base* pub) - : mPub(pub) - , mRepo(NULL) - , mParentObj(NULL) + Base::Base() + : mRepo() + , mParent() { - Q_ASSERT(mPub); } - BasePrivate::~BasePrivate() + Base::~Base() { - // THIS _IS_ IMPORTANT - // We forbid by definition that any RM::* object may be destroyed _before_ it is unlinked - // from its parent. Otherwise, events cannot be triggered correctly. - Q_ASSERT(mChildren.count() == 0); - Q_ASSERT(mParentObj == NULL); - Q_ASSERT(mRepo == NULL); - } - - /** - * @brief Child-part of linking into the tree - * - * @param[in] parent The parent to link into - * - * This method is called directly from the constructor. It establishes a relationship with the - * parent object. This relationship can never be altered. - * - */ - void BasePrivate::linkToParent(Base* parent) - { - if (parent) { - mParentObj = parent->mData; - mParentObj->addChildObject(mPub); - mRepo = searchRepository(); - refreshSelf(); - postCreation(); - } - } - - /** - * @internal - * @brief Child-Part of unlinking from the tree - * - * Invokes the parent part on the parent side and then cleans up the reference to the parent. - */ - void BasePrivate::unlinkFromParent() - { - if (mParentObj) { - mParentObj->removeChildObject(mPub); - mParentObj = NULL; - mRepo = NULL; - } - } - - /** - * @internal - * @brief Parent-part of linking a new child - * - * We cannot do any special processing, since the child object is not yet fully constructed. We - * just fill the internal structure. - * - * @param[in] object The new child object that shall be linked in. - */ - void BasePrivate::addChildObject(Base* object) - { - Q_ASSERT(object); - Q_ASSERT(!mChildren.contains(object)); - mChildren.append(object); - } - - /** - * @internal - * @brief Parent-part of unlinking a child from the parent - * - * @param[in] object The child that is to be removed from the parent - */ - void BasePrivate::removeChildObject(Base* object) - { - Q_ASSERT(mChildren.contains(object)); - mChildren.removeOne(object); } /** @@ -125,22 +51,27 @@ namespace RM * @param[in] dumper The dumper to output to * */ - void BasePrivate::dumpRecursive(Dumper& dumper) const + void Base::dumpRecursive(Internal::Dumper& dumper) const { dumpSelf(dumper); dumper.indent(); - foreach(Base* child, mChildren) { - child->mData->dumpRecursive(dumper); - } + dumpChildren(dumper); dumper.dedent(); } - QString BasePrivate::displayName() const + void Base::dumpChildren(Internal::Dumper& dumper) const + { + Q_UNUSED(dumper); + /* Nothinng to do for base class */ + } + + QString Base::displayName() const { return QStringLiteral(""); } + #if 0 // ###REPOMAN /** * @brief Refresh this object * @@ -158,7 +89,7 @@ namespace RM * probably never have to return `false`. * */ - void BasePrivate::refresh() + void Base::refresh() { if (!refreshSelf()) { // If refresh self returned false, we are no longer valid and will now destroy @@ -181,7 +112,7 @@ namespace RM } } - void BasePrivate::postRefresh() + void Base::postRefresh() { } @@ -197,7 +128,7 @@ namespace RM * more children (i.e. RefTreeNode). * */ - bool BasePrivate::refreshCheckDispensable() + bool Base::refreshCheckDispensable() { return false; } @@ -213,7 +144,7 @@ namespace RM * The base implementation simply does nothing. * */ - void BasePrivate::preRefreshChildren() + void Base::preRefreshChildren() { } @@ -226,7 +157,7 @@ namespace RM * The base implementation simply does nothing. * */ - void BasePrivate::postRefreshChildren() + void Base::postRefreshChildren() { } @@ -241,7 +172,7 @@ namespace RM * 4. finally it deletes itself. Deleting is not defered; the object is gone immediately. * */ - void BasePrivate::terminateObject() + void Base::terminateObject() { foreach (Base* child, mChildren) { child->mData->terminateObject(); @@ -263,7 +194,7 @@ namespace RM * phase or not. * */ - bool BasePrivate::repoEventsBlocked() + bool Base::repoEventsBlocked() { Q_ASSERT(mRepo); return mRepo->isInitializing(); @@ -277,7 +208,7 @@ namespace RM * * The base implementation will send out a objectAboutToDelete() event. */ - void BasePrivate::preTerminate() + void Base::preTerminate() { if (!repoEventsBlocked()) { Events::self()->objectAboutToBeDeleted(repository(), mPub); @@ -296,25 +227,27 @@ namespace RM * Note that no events should be sent out, if repoEventsBlocked() returns `true`. * */ - void BasePrivate::postCreation() + void Base::postCreation() { if (!repoEventsBlocked()) { Events::self()->objectCreated(repository(), mPub); } } + #endif + #if 0 // ###REPOMAN move to RefreshService /** * @brief Find the parent for a Ref. * * @param[in] scopes List of scopes to search for or to create. * * @param[in] create If `true` and @a path is not empty, a reference tree node will be - * created, if none is found. If `false`, `NULL` will be returned. + * created, if none is found. If `false`, `nullptr` will be returned. * * @return If @a scopes is empty, `this` is returned. Otherwise findRefTreeNode() is called * to either find or create a RefTreeNode, which will be returned. */ - Base* BasePrivate::findRefParent(const QStringList& scopes, bool create) + Base* Base::findRefParent(const QStringList& scopes, bool create) { if (scopes.isEmpty()) { return mPub; @@ -330,22 +263,22 @@ namespace RM * @param[in] scopes List of scopes to search for or to create. Must not be empty. * * @param[in] create If `true` and a part of the tree node cannot be found, it will be - * created. If `false`, `NULL` will be returned in that case. + * created. If `false`, `nullptr` will be returned in that case. * * @return If @a create is `true`, a valid RefTreeNode is returned. If @a create is - * `false`, `NULL` will be returned in case the path cannot be found. + * `false`, `nullptr` will be returned in case the path cannot be found. */ - RefTreeNode* BasePrivate::findRefTreeNode(const QStringList &scopes, bool create) + RefTreeNode* Base::findRefTreeNode(const QStringList &scopes, bool create) { if (scopes.isEmpty()) { - return NULL; + return nullptr; } Base* current = mPub; foreach (QString scope, scopes) { RefTreeNode::List nodes = current->childObjects(); - RefTreeNode* next = NULL; + RefTreeNode* next = nullptr; foreach(RefTreeNode* child, nodes) { if (child->name() == scope) { @@ -360,7 +293,7 @@ namespace RM next = new RefTreeNode(current, scope); } else { - return NULL; + return nullptr; } } @@ -370,8 +303,7 @@ namespace RM return static_cast< RefTreeNode* >(current); } - - CollectionNode* BasePrivate::getOrCreateCollection(CollectionTypes ctype) + CollectionNode* Base::getOrCreateCollection(CollectionTypes ctype) { CollectionNode* cn; @@ -383,31 +315,34 @@ namespace RM return new CollectionNode(ctype, mPub); } + #endif - Repo* BasePrivate::searchRepository() - { - if (!mRepo) { - if (mParentObj) { - mRepo = mParentObj->repository(); - } - else { - return NULL; - } - } - return mRepo; - } - - Heaven::IconRef BasePrivate::icon(bool small) const + Heaven::IconRef Base::icon(bool small) const { QString size = small ? QStringLiteral("@16") : QStringLiteral("@24"); return Heaven::IconRef::fromString(QChar(L'#') % objectTypeName() % size); } - bool BasePrivate::inherits(ObjTypes type) const + bool Base::inherits(ObjTypes type) const { return false; } + Base::WList Base::children() const + { + return Base::WList(); + } + + std::weak_ptr Base::repository() const + { + return mRepo; + } + + std::shared_ptr Base::parent() const + { + return mParent.lock(); + } + } } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Base.hpp b/Libs/libMacGitverCore/RepoMan/Data/Base.hpp index c0fe627c..c7506e5b 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Base.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Base.hpp @@ -19,19 +19,11 @@ #pragma once -#include "RepoMan/Base.hpp" +#include "RepoMan/Core.hpp" -#define RM_D(CLASS) Internal::CLASS##Private* d = \ - static_cast(mData) - -#define RM_CD(CLASS) const Internal::CLASS##Private* d = \ - static_cast(mData) - -#define RM_P(CLASS) CLASS* p = \ - static_cast(mPub) - -#define RM_CP(CLASS) const CLASS* p = \ - static_cast(mPub) +#include +#include +#include #ifdef _MSVC #define const_or_constexpr const @@ -47,80 +39,102 @@ namespace RM class Dumper; } - namespace Internal + namespace Frontend { + class Base; + } - class BasePrivate - { - protected: - BasePrivate(Base* pub); + namespace Data + { - public: - virtual ~BasePrivate(); + class Repo; + class Base + : public std::enable_shared_from_this + { public: - Base* mPub; - Repo* mRepo; - BasePrivate* mParentObj; - Base::List mChildren; + using FrontendT = Frontend::Base; + using SPtr = std::shared_ptr; + using WPtr = std::weak_ptr; + using SList = std::vector; + using WList = std::vector; - public: - template< class T > T* pub() - { - return static_cast(mPub); - } + private: + Base(const Base&) = delete; + Base& operator=(const Base&) = delete; - template< class T > const T* pub() const - { - return static_cast(mPub); - } + protected: + Base(); public: - void dumpRecursive(Dumper& dumper) const; - - void terminateObject(); - void linkToParent(Base* parent); - void unlinkFromParent(); - void addChildObject(Base *object); - void removeChildObject(Base* object); - Repo* repository(); + virtual ~Base(); - virtual Repo* searchRepository(); - - void refresh(); - bool repoEventsBlocked(); - - Base* findRefParent(const QStringList& scopes, bool create); - RefTreeNode* findRefTreeNode(const QStringList& scopes, bool create); + public: + void dumpRecursive(Internal::Dumper& dumper) const; - template< class T > static typename T::Private* dataOf(Base* b) - { - BasePrivate* p = b->mData; - if (p->objType() != ObjTypes(T::StaticObjectType)) { - return NULL; - } - return static_cast(p); - } + std::weak_ptr repository() const; + SPtr parent() const; public: virtual QString displayName() const; virtual QString objectTypeName() const = 0; virtual Heaven::IconRef icon(bool small) const; - virtual bool refreshSelf() = 0; - virtual void postRefresh(); - virtual void preRefreshChildren(); - virtual void postRefreshChildren(); - virtual void postCreation(); - virtual void preTerminate(); - virtual bool refreshCheckDispensable(); virtual bool inherits(ObjTypes type) const; virtual ObjTypes objType() const = 0; virtual void dumpSelf(Internal::Dumper& dumper) const = 0; + void dumpChildren(Internal::Dumper& dumper) const; + + virtual WList children() const; + + template + std::shared_ptr as() const; + + template + std::shared_ptr as(); + + private: + std::weak_ptr mRepo; + std::weak_ptr mParent; }; - inline Repo* BasePrivate::repository() + template + inline std::shared_ptr Base::as() const { - return mRepo; + if (inherits(T::StaticObjectType)) { + return std::shared_ptr(static_cast(this)); + } + return std::shared_ptr(); + } + + template + inline std::shared_ptr Base::as() + { + if (inherits(T::StaticObjectType)) { + return std::shared_ptr(static_cast(this)); + } + return std::shared_ptr(); + } + + template + typename T::SList sharedFromWeakList(const typename T::WList& wlist) + { + typename T::SList slist; + for (const typename T::WPtr& wptr : wlist) { + if (auto sptr = wptr.lock()) { + slist.push_back(sptr); + } + } + return slist; + } + + template + typename T::WList weakFromSharedList(const typename T::SList& slist) + { + typename T::WList wlist; + for (const typename T::SPtr& sptr : slist) { + wlist.push_back(sptr); + } + return wlist; } } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Branch.cpp b/Libs/libMacGitverCore/RepoMan/Data/Branch.cpp index 3b59faac..f159fdc6 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Branch.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Branch.cpp @@ -17,40 +17,42 @@ * */ -#include "RepoMan/Data/BranchData.hpp" #include "RepoMan/Events.hpp" +#include "RepoMan/Data/Branch.hpp" + #include "RepoMan/Private/Dumper.hpp" namespace RM { - namespace Internal + namespace Data { - BranchPrivate::BranchPrivate(Branch* pub, const Git::Reference& ref) - : RefPrivate(pub, BranchType, ref) + Branch::Branch(Frontend::Branch* pub, const Git::Reference& ref) + : Reference(pub, BranchType, ref) , mHasUpstream(false) , mAheadCount(0) , mBehindCount(0) { } - ObjTypes BranchPrivate::objType() const + ObjTypes Branch::objType() const { return ObjTypes::Branch; } - void BranchPrivate::postCreation() + #if 0 // ###DEAD + void Branch::postCreation() { - if (!repoEventsBlocked()) { + jif (!repoEventsBlocked()) { Events::self()->branchCreated(repository(), pub()); } RefPrivate::postCreation(); } - void BranchPrivate::preTerminate() + void Branch::preTerminate() { if (!repoEventsBlocked()) { Events::self()->branchAboutToBeDeleted(repository(), pub()); @@ -59,35 +61,35 @@ namespace RM RefPrivate::preTerminate(); } - void BranchPrivate::dumpSelf(Internal::Dumper& dumper) const + void Branch::dumpSelf(Internal::Dumper& dumper) const { dumper.addLine(QString(QStringLiteral("Branch 0x%1 - %2")) .arg(quintptr(mPub),0,16) .arg(mName)); } - QString BranchPrivate::objectTypeName() const + QString Branch::objectTypeName() const { return QStringLiteral("Branch"); } - void BranchPrivate::emitMoved() + void Branch::emitMoved() { if (!repoEventsBlocked()) { Events::self()->refMoved(mRepo, pub()); Events::self()->branchMoved(mRepo, pub()); } } + #endif - bool BranchPrivate::refreshDetails(const Git::Reference& ref) + bool Branch::refreshDetails(const Git::Reference& ref) { - - return RefPrivate::refreshDetails(ref); + return Reference::refreshDetails(ref); } - bool BranchPrivate::inherits(ObjTypes type) const + bool Branch::inherits(ObjTypes type) const { - return type == ObjTypes::Branch || RefPrivate::inherits(type); + return type == ObjTypes::Branch || Reference::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Branch.hpp b/Libs/libMacGitverCore/RepoMan/Data/Branch.hpp index 97dda34e..5435afcf 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Branch.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Branch.hpp @@ -19,20 +19,23 @@ #pragma once -#include "RepoMan/Data/RefData.hpp" +#include "RepoMan/Data/Reference.hpp" -#include "RepoMan/Branch.hpp" +#include "RepoMan/Frontend/Branch.hpp" namespace RM { - namespace Internal + namespace Data { - class BranchPrivate : public RefPrivate + class Branch + : public Reference { public: - BranchPrivate(Branch* pub, const Git::Reference& ref); + static const_or_constexpr ObjTypes StaticObjectType = ObjTypes::Branch; + public: + Branch(Frontend::Branch* pub, const Git::Reference& ref); public: ObjTypes objType() const; diff --git a/Libs/libMacGitverCore/RepoMan/Data/Head.cpp b/Libs/libMacGitverCore/RepoMan/Data/Head.cpp index fa1a354b..a446c4d4 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Head.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Head.cpp @@ -19,26 +19,22 @@ #include "RepoMan/Events.hpp" -#include "RepoMan/Head.hpp" +#include "RepoMan/Data/Head.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/HeadData.hpp" - -#include "RepoMan/Branch.hpp" -#include "RepoMan/Repo.hpp" - #include "libGitWrap/Repository.hpp" #include "libGitWrap/BranchRef.hpp" namespace RM { - namespace Internal + namespace Data { - HeadPrivate::HeadPrivate(Head* _pub, const Git::Repository& repo) - : BasePrivate(_pub) + #if 0 + Head::Head(Frontend::Head* _pub, const Git::Repository& repo) + : Base(_pub) , symbolicName() , isDetached(repo.isHeadDetached()) , isUnborn(repo.isHeadUnborn()) @@ -53,19 +49,19 @@ namespace RM } } - ObjTypes HeadPrivate::objType() const + ObjTypes Head::objType() const { return ObjTypes::Head; } - void HeadPrivate::dumpSelf(Internal::Dumper& dumper) const + void Head::dumpSelf(Internal::Dumper& dumper) const { dumper.addLine(QString(QStringLiteral("Head 0x%1 - %2")) .arg(quintptr(mPub),0,16) .arg(symbolicName)); } - bool HeadPrivate::refreshSelf() + bool Head::refreshSelf() { Git::Repository repo = repository()->gitLoadedRepo(); Git::Result r; @@ -81,20 +77,21 @@ namespace RM } return true; } + #endif - QString HeadPrivate::displayName() const + QString Head::displayName() const { - return symbolicName; + return mSymbolicName; } - QString HeadPrivate::objectTypeName() const + QString Head::objectTypeName() const { return QStringLiteral("Head"); } - bool HeadPrivate::inherits(ObjTypes type) const + bool Head::inherits(ObjTypes type) const { - return type == ObjTypes::Head || BasePrivate::inherits(type); + return type == ObjTypes::Head || Base::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Head.hpp b/Libs/libMacGitverCore/RepoMan/Data/Head.hpp index 92f09ddb..e4fcf189 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Head.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Head.hpp @@ -19,20 +19,24 @@ #pragma once -#include "RepoMan/Data/BaseData.hpp" +#include "RepoMan/Data/Base.hpp" -#include "RepoMan/Head.hpp" +#include "RepoMan/Frontend/Head.hpp" namespace RM { - namespace Internal + namespace Data { - class HeadPrivate : public BasePrivate + class Head + : public Base { public: - HeadPrivate(Head* pub, const Git::Repository& ref); + static const_or_constexpr ObjTypes StaticObjectType = ObjTypes::Head; + + public: + Head(Frontend::Head* pub, const Git::Repository& ref); public: ObjTypes objType() const; @@ -43,12 +47,38 @@ namespace RM bool inherits(ObjTypes type) const; public: - QString symbolicName; - Git::ObjectId detachedId; - bool isDetached : 1; - bool isUnborn : 1; + bool isDetached() const; + bool isUnborn() const; + Git::ObjectId detachedId() const; + QString symbolicName() const; + + private: + QString mSymbolicName; + Git::ObjectId mDetachedId; + bool mIsDetached : 1; + bool mIsUnborn : 1; }; + inline bool Head::isDetached() const + { + return mIsDetached; + } + + inline bool Head::isUnborn() const + { + return mIsUnborn; + } + + inline Git::ObjectId Head::detachedId() const + { + return mDetachedId; + } + + inline QString Head::symbolicName() const + { + return mSymbolicName; + } + } } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp b/Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp index a05b7ae6..9f7cf1c0 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp @@ -17,7 +17,7 @@ * */ -#include "RepoMan/Data/NamespaceData.hpp" +#include "RepoMan/Data/Namespace.hpp" #include "RepoMan/Private/Dumper.hpp" @@ -26,9 +26,10 @@ namespace RM { - namespace Internal + namespace Data { + #if 0 NamespacePrivate::NamespacePrivate(Namespace* _pub, const QString& _name) : BasePrivate(_pub) , name(_name) @@ -84,6 +85,7 @@ namespace RM { return type == ObjTypes::Namespace || BasePrivate::inherits(type); } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Namespace.hpp b/Libs/libMacGitverCore/RepoMan/Data/Namespace.hpp index d7b77fb2..6db03dfc 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Namespace.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Namespace.hpp @@ -19,20 +19,24 @@ #pragma once -#include "RepoMan/Data/BaseData.hpp" +#include "RepoMan/Data/Base.hpp" -#include "RepoMan/Namespace.hpp" +#include "RepoMan/Frontend/Namespace.hpp" namespace RM { - namespace Internal + namespace Data { - class NamespacePrivate : public BasePrivate + class Namespace + : public Base { public: - NamespacePrivate(Namespace* _pub, const QString& _name); + static const_or_constexpr ObjTypes StaticObjectType = ObjTypes::Namespace; + + public: + Namespace(Namespace* _pub, const QString& _name); public: ObjTypes objType() const; diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp b/Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp index e41f5ecc..5a5a2d0d 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp @@ -17,7 +17,7 @@ * */ -#include "RepoMan/Data/RefLogData.hpp" +#include "RepoMan/Data/RefLog.hpp" #include "RepoMan/Private/Dumper.hpp" @@ -26,9 +26,10 @@ namespace RM { - namespace Internal + namespace Data { + #if 0 RefLogPrivate::RefLogPrivate(RefLog* _pub) : BasePrivate(_pub) { @@ -70,6 +71,7 @@ namespace RM { return type == ObjTypes::RefLog || BasePrivate::inherits(type); } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefLog.hpp b/Libs/libMacGitverCore/RepoMan/Data/RefLog.hpp index 7724c619..322fc62a 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/RefLog.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RefLog.hpp @@ -19,20 +19,24 @@ #pragma once -#include "RepoMan/Data/BaseData.hpp" +#include "RepoMan/Data/Base.hpp" -#include "RepoMan/RefLog.hpp" +#include "RepoMan/Frontend/RefLog.hpp" namespace RM { - namespace Internal + namespace Data { - class RefLogPrivate : public BasePrivate + class RefLog + : public Base { public: - RefLogPrivate(RefLog* _pub); + static const_or_constexpr ObjTypes StaticObjectType = ObjTypes::RefLog; + + public: + RefLog(RefLog* _pub); public: ObjTypes objType() const; diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp b/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp index 799475f5..d16ddba5 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp @@ -17,7 +17,7 @@ * */ -#include "RepoMan/Data/RefTreeNodeData.hpp" +#include "RepoMan/Data/RefTreeNode.hpp" #include "RepoMan/Private/Dumper.hpp" @@ -26,9 +26,10 @@ namespace RM { - namespace Internal + namespace Data { + #if 0 RefTreeNodePrivate::RefTreeNodePrivate(RefTreeNode* _pub, const QString& _name) : BasePrivate(_pub) , name(_name) @@ -90,6 +91,7 @@ namespace RM { return type == ObjTypes::RefTreeNode || BasePrivate::inherits(type); } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.hpp b/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.hpp index d4eef6bd..759e4eac 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.hpp @@ -19,20 +19,24 @@ #pragma once -#include "RepoMan/Data/BaseData.hpp" +#include "RepoMan/Data/Base.hpp" -#include "RepoMan/RefTreeNode.hpp" +#include "RepoMan/Frontend/RefTreeNode.hpp" namespace RM { - namespace Internal + namespace Data { - class RefTreeNodePrivate : public BasePrivate + class RefTreeNode + : public Base { public: - RefTreeNodePrivate(RefTreeNode* _pub, const QString& _name); + static const_or_constexpr ObjTypes StaticObjectType = ObjTypes::RefTreeNode; + + public: + RefTreeNode(RefTreeNode* _pub, const QString& _name); public: ObjTypes objType() const; diff --git a/Libs/libMacGitverCore/RepoMan/Data/Reference.cpp b/Libs/libMacGitverCore/RepoMan/Data/Reference.cpp index b8acad6f..c0187c1f 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Reference.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Reference.cpp @@ -17,9 +17,9 @@ * */ -#include "RepoMan/Data/RefData.hpp" +#include "RepoMan/Data/Reference.hpp" -#include "RepoMan/Repo.hpp" +#include "RepoMan/Frontend/Repo.hpp" #include "RepoMan/Events.hpp" @@ -32,11 +32,12 @@ namespace RM { - namespace Internal + namespace Data { - RefPrivate::RefPrivate(Ref* pub, RefTypes type, const Git::Reference& ref) - : BasePrivate( pub ) + #if 0 + Reference::Reference(Ref* pub, RefTypes type, const Git::Reference& ref) + : Base( pub ) , mType( type ) , mFullQualifiedName( ref.name() ) , mName( ref.nameAnalyzer().name() ) @@ -44,34 +45,34 @@ namespace RM { } - void RefPrivate::dumpSelf(Internal::Dumper& dumper) const + void Reference::dumpSelf(Internal::Dumper& dumper) const { dumper.addLine(QString(QStringLiteral("Ref 0x%1 [%2]")) .arg(quintptr(mPub),0,16) .arg(mName)); } - ObjTypes RefPrivate::objType() const + ObjTypes Reference::objType() const { return ObjTypes::Reference; } - QString RefPrivate::displayName() const + QString Reference::displayName() const { return mName; } - QString RefPrivate::objectTypeName() const + QString Reference::objectTypeName() const { return QStringLiteral("Ref"); } - bool RefPrivate::inherits(ObjTypes type) const + bool Reference::inherits(ObjTypes type) const { return type == ObjTypes::Reference || BasePrivate::inherits(type); } - void RefPrivate::postCreation() + void Reference::postCreation() { RM_P(Ref); @@ -82,7 +83,7 @@ namespace RM BasePrivate::postCreation(); } - void RefPrivate::preTerminate() + void Reference::preTerminate() { RM_P(Ref); @@ -93,14 +94,14 @@ namespace RM BasePrivate::preTerminate(); } - void RefPrivate::emitMoved() + void Reference::emitMoved() { if (!repoEventsBlocked()) { Events::self()->refMoved(repository(), pub()); } } - bool RefPrivate::refreshDetails(const Git::Reference& ref) + bool Reference::refreshDetails(const Git::Reference& ref) { Git::ObjectId id = ref.objectId(); @@ -114,7 +115,7 @@ namespace RM return true; } - bool RefPrivate::refreshSelf() + bool Reference::refreshSelf() { Git::Result r; Repo* repo = repository(); Q_ASSERT( repo ); @@ -131,6 +132,7 @@ namespace RM return true; } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Ref.hpp b/Libs/libMacGitverCore/RepoMan/Data/Reference.hpp similarity index 78% rename from Libs/libMacGitverCore/RepoMan/Data/Ref.hpp rename to Libs/libMacGitverCore/RepoMan/Data/Reference.hpp index 62afb6b0..8e1dac3d 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Ref.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Reference.hpp @@ -19,20 +19,24 @@ #pragma once -#include "RepoMan/Data/BaseData.hpp" +#include "RepoMan/Data/Base.hpp" -#include "RepoMan/Ref.hpp" +#include "RepoMan/Frontend/Reference.hpp" namespace RM { - namespace Internal + namespace Data { - class RefPrivate : public BasePrivate + class Reference + : public Base { public: - RefPrivate(Ref* pub, RefTypes type, const Git::Reference& ref); + static const_or_constexpr ObjTypes StaticObjectType = ObjTypes::Reference; + + public: + Reference(Frontend::Reference* pub, RefTypes type, const Git::Reference& ref); public: ObjTypes objType() const; @@ -53,6 +57,9 @@ namespace RM Git::ObjectId mId; }; + GW_DEPRECATED + typedef Reference Ref; + } } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Remote.cpp b/Libs/libMacGitverCore/RepoMan/Data/Remote.cpp index 22216cd7..f002322b 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Remote.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Remote.cpp @@ -17,7 +17,7 @@ * */ -#include "RepoMan/Data/RemoteData.hpp" +#include "RepoMan/Data/Remote.hpp" #include "RepoMan/Private/Dumper.hpp" @@ -26,9 +26,10 @@ namespace RM { - namespace Internal + namespace Data { + #if 0 RemotePrivate::RemotePrivate(Remote* _pub, const Git::Remote& _obj) : BasePrivate(_pub) { @@ -85,6 +86,7 @@ namespace RM { return type == ObjTypes::Remote || BasePrivate::inherits(type); } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Remote.hpp b/Libs/libMacGitverCore/RepoMan/Data/Remote.hpp index 54c55b17..78f96b95 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Remote.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Remote.hpp @@ -19,22 +19,26 @@ #pragma once -#include "RepoMan/Data/BaseData.hpp" +#include "RepoMan/Data/Base.hpp" -#include "RepoMan/Remote.hpp" +#include "RepoMan/Frontend/Remote.hpp" namespace RM { - class Head; - - namespace Internal + namespace Data { - class RemotePrivate : public BasePrivate + class Head; + + class Remote + : public Base { public: - RemotePrivate(Remote* _pub, const Git::Remote& _obj); + static const_or_constexpr ObjTypes StaticObjectType = ObjTypes::Remote; + + public: + Remote(Remote* _pub, const Git::Remote& _obj); public: ObjTypes objType() const; diff --git a/Libs/libMacGitverCore/RepoMan/Data/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Data/Repo.cpp index 107a8de7..d2e7ebbc 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Repo.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Repo.cpp @@ -17,201 +17,33 @@ * */ -#include "RepoMan/Data/RepoData.hpp" -#include "RepoMan/Data/RemoteData.hpp" - -#include "RepoMan/RepoMan.hpp" -#include "RepoMan/Submodule.hpp" -#include "RepoMan/Head.hpp" -#include "RepoMan/Namespace.hpp" -#include "RepoMan/Tag.hpp" +#include "RepoMan/Data/Repo.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "libMacGitverCore/App/MacGitver.hpp" - -#include "libGitWrap/Reference.hpp" -#include "libGitWrap/ObjectId.hpp" -#include "libGitWrap/RefName.hpp" -#include "libGitWrap/Submodule.hpp" - -#include -#include - namespace RM { - namespace Internal + namespace Data { - RepoPrivate::RepoPrivate(Repo* pub, const Git::Repository& repo) - : BasePrivate( pub ) - { - mRepo = repo; - mHead = NULL; - mPath = mRepo.workTreePath(); - mIsLoaded = mRepo.isValid(); - mIsActive = false; - mIsBare = mRepo.isValid() && mRepo.isBare(); - mIsSubModule = false; - mIsInitializing = true; - mDisplayAlias = QString(); - mUnloadTimer = NULL; - - if (mPath.endsWith(L'/')) { - mPath = mPath.left(mPath.length() - 1); - } - - findAlias(); - - if (mDisplayAlias.isEmpty()) { - if (mPath.isEmpty()) { - mDisplayAlias = Repo::tr("Unknown Repository"); - } - else { - QStringList sl = mPath.split(QChar(L'/'), QString::SkipEmptyParts); - mDisplayAlias = sl.last(); - } - } - } - - RepoPrivate::~RepoPrivate() - { - RM_P(Repo); - - if (mIsLoaded) { - unload(); - } - - MacGitver::repoMan().internalClosedRepo(p); - } - - void RepoPrivate::load() - { - // ### Unimplemented: RepoPrivate::load() - Q_ASSERT(!mIsLoaded); - } - - void RepoPrivate::unload() - { - if (mIsActive) { - qDebug() << "Unloading active RepoInfo. Will deactivate it first."; - MacGitver::repoMan().activate(NULL); - } - Q_ASSERT(!mIsActive); - - if (mUnloadTimer) { - mUnloadTimer->stop(); - mUnloadTimer->deleteLater(); - mUnloadTimer = NULL; - } - - // ####REPOMAN Do we really need to send out events for Unload/Load? If yes, create - // real events for that! - mIsLoaded = false; - mRepo = Git::Repository(); - } - - - QString RepoPrivate::displayName() const + Repo::Repo(const Git::Repository& repo) + : mHead(nullptr) + , mRepo(repo) { - return mDisplayAlias; } - void RepoPrivate::preTerminate() + Repo::~Repo() { - // Do we need to do smth? } - void RepoPrivate::scanSubmodules() + Git::Repository Repo::gitRepo(bool doLoad) { - RM_P(Repo); - - Git::Repository repo = gitRepo(true); - if (!repo.isValid()) { - return; - } - - Git::Result r; - Git::Submodule::List subs = repo.submodules( r ); - if (!r) { - return; - } - - Repo::List oldSubmodules = pub()->submodules(); - - foreach (Git::Submodule sub, subs) { - Git::Result child; - Git::Repository subRepo = sub.subRepository(child); - if (!child) { - continue; - } - Q_ASSERT(subRepo.isValid()); - - Repo* subInfo = NULL; - QString path = subRepo.workTreePath(); - - if (path.endsWith(L'/')) { - path = path.left(path.length() - 1); - } - - subInfo = repoByPath(path, true); - if (!subInfo) { - subInfo = new Submodule(subRepo, p); - } - else { - oldSubmodules.removeOne(subInfo); - } + if (!mRepo && doLoad) { + Q_ASSERT(false); // ###REPOMAN - Not sure if we still want to support this... } - foreach(Repo* repo, oldSubmodules) { - dataOf(repo)->terminateObject(); - } - } - - void RepoPrivate::findAlias() - { - // ### Unimplemented: RepoPrivate::findAlias() - } - - bool RepoPrivate::refreshSelf() - { - if (!mIsLoaded) { - // In case we're not loaded, just return and do nothing. - return true; - } - - if (!mHead) { - RM_P(Repo); - mHead = new Head(mRepo, p); - } - - return true; - } - - void RepoPrivate::postRefreshChildren() - { - if (!mIsLoaded) { - // In case we're not loaded, just return and do nothing. - return; - } - - Git::Result r; - Git::Remote::List remotes = mRepo.allRemotes(r); - if (r) { - foreach (const Git::Remote& remote, remotes) { - findRemote(remote, true); - } - } - - Git::ReferenceList refs = mRepo.allReferences(r); - if (r) { - foreach (Git::Reference ref, refs) { - findReference(ref, true); - } - } - - scanSubmodules(); + return mRepo; } /** @@ -220,136 +52,49 @@ namespace RM * @return always ObjTypes::Repo. * */ - ObjTypes RepoPrivate::objType() const + ObjTypes Repo::objType() const { return ObjTypes::Repo; } - void RepoPrivate::dumpSelf(Internal::Dumper& dumper) const - { - dumper.addLine(QString(QStringLiteral("Repository 0x%1 - %02")) - .arg(quintptr(mPub),0,16) - .arg(mIsLoaded ? mRepo.name() - : QStringLiteral(""))); - } - - - Ref* RepoPrivate::findReference(const Git::Reference& ref, bool create) - { - Git::RefName rn = ref.nameAnalyzer(); - return findReference(rn, ref, create); - } - - Ref* RepoPrivate::findReference(const QString& fqrn, bool create) + Repo::SPtr Repo::repoByPath(const QString& basePath, bool searchSubmodules) { - Git::RefName rn(fqrn); - return findReference(rn, Git::Reference(), create); - } - - Ref* RepoPrivate::findReference(Git::RefName& rn, Git::Reference ref, bool create) - { - return NULL; - } - - Remote* RepoPrivate::findRemote(const QString &remoteName, bool create) - { - RM_P(Repo); - - foreach (Remote* remote, p->childObjects()) { - if (remote->name() == remoteName) { - return remote; - } - } - - if (create) { - Git::Result r; - Git::Remote gr = p->gitRepo().remote(r, remoteName); - - if (r && gr.isValid()) { - Remote* remote = new Remote(gr, p); - return remote; - } - } - - return NULL; - } - - Remote* RepoPrivate::findRemote(const Git::Remote &remote, bool create) - { - RM_P( Repo ); - - if (!remote.isValid()) { - return NULL; - } - - QString remoteName = remote.name(); - foreach (Remote* rmRemote, p->childObjects()) { - if (rmRemote->name() == remoteName) { - return rmRemote; - } - } - - if (create) { - Remote* rmRemote = new Remote(remote, p); - return rmRemote; - } - - return NULL; - } - - Namespace* RepoPrivate::findNamespace(const QStringList& _namespaces, bool create) - { - return NULL; - } - - Namespace* RepoPrivate::findNamespace(const QString& nsFullName, bool create) { - - QStringList nsNames = nsFullName.split(QChar(L'/')); - return findNamespace(nsNames, create); - } - - Repo* RepoPrivate::repoByPath(const QString& basePath, bool searchSubmodules) - { - foreach (Repo* subRepo, mPub->childObjects()) { - + for (const Repo::SPtr& subRepo : mSubmodules) { if (subRepo->path() == basePath) { return subRepo; } if (searchSubmodules) { - if (RepoPrivate* subRepoPriv = dataOf(subRepo)) { - if (Repo* subsubRepo = subRepoPriv->repoByPath(basePath, true)) { - return subsubRepo; - } + Repo::SPtr found = subRepo->repoByPath(basePath, true); + if (found) { + return found; } } } - - return NULL; + return Repo::SPtr(); } - QString RepoPrivate::objectTypeName() const + QString Repo::displayName() const { - return QStringLiteral("Repo"); + return mDisplayAlias; } - bool RepoPrivate::inherits(ObjTypes type) const + void Repo::dumpSelf(Internal::Dumper& dumper) const { - return type == ObjTypes::Repo || BasePrivate::inherits(type); + dumper.addLine(QString(QStringLiteral("Repository 0x%1 - %02")) + .arg(quintptr(this),0,16) + .arg(mIsLoaded ? mRepo.name() + : QStringLiteral(""))); } - Repo* RepoPrivate::searchRepository() + QString Repo::objectTypeName() const { - return static_cast(mPub); + return QStringLiteral("Repo"); } - Git::Repository RepoPrivate::gitRepo(bool doLoad) + bool Repo::inherits(ObjTypes type) const { - if (!mIsLoaded && doLoad) { - load(); - } - - return mRepo; + return type == ObjTypes::Repo || Base::inherits(type); } } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Repo.hpp b/Libs/libMacGitverCore/RepoMan/Data/Repo.hpp index 9fb42eeb..3d0152ba 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Repo.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Repo.hpp @@ -19,23 +19,39 @@ #pragma once -#include "RepoMan/Data/BaseData.hpp" +#include "RepoMan/Data/Base.hpp" -#include "RepoMan/Repo.hpp" +#include "RepoMan/Frontend/Repo.hpp" + +class QTimer; namespace RM { - class Head; - - namespace Internal + namespace Data { - class RepoPrivate : public BasePrivate + class Reference; + class Remote; + class Namespace; + class Head; + + class Repo + : public Base { public: - RepoPrivate(Repo* pub, const Git::Repository& repo); - ~RepoPrivate(); + static const_or_constexpr ObjTypes StaticObjectType = ObjTypes::Repo; + + public: + using FrontendT = Frontend::Repo; + using SPtr = std::shared_ptr; + using WPtr = std::weak_ptr; + using SList = std::vector; + using WList = std::vector; + + public: + Repo(const Git::Repository& repo); + ~Repo(); public: ObjTypes objType() const; @@ -46,44 +62,60 @@ namespace RM void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; bool inherits(ObjTypes type) const; - Repo* searchRepository(); public: - Ref* findReference( const Git::Reference& ref, bool create = false); - Ref* findReference( const QString& fqrn, bool create = false); - Remote* findRemote( const Git::Remote& remote, bool create = false); + Reference* findReference( const QString& fqrn, bool create = false); + Remote* findRemote( const QString& remoteName, bool create = false); + Namespace* findNamespace( const QStringList& _namespaces, bool create = false); Namespace* findNamespace( const QString& nsFullName, bool create = false); private: - Ref* findReference(Git::RefName &rn, Git::Reference ref, bool create); + GW_DEPRECATED + Reference* findReference(Git::RefName &rn, Git::Reference ref, bool create); public: - void load(); - void unload(); - void findAlias(); - void scanSubmodules(); - Repo* repoByPath(const QString& basePath, bool searchSubmodules); + SPtr repoByPath(const QString& basePath, bool searchSubmodules); + WList submodules() const; public: + QMutex& mutex() const; + QString path() const; Git::Repository gitRepo(bool doLoad = false); public: - QString mPath; //!< Full, absolute path to this repository QString mDisplayAlias; //!< An alias for display (Default to last path comp.) bool mIsSubModule : 1; //!< This is a submodule of another repo bool mIsBare : 1; //!< This is a bare repo bool mIsLoaded : 1; //!< This repo is currently loaded (by gitWrap) bool mIsActive : 1; //!< This is MGV's current active repo? - bool mIsInitializing : 1; //!< True, while this repository is initializing - QTimer* mUnloadTimer; //!< NULL or a timer to unload this repository + //bool mIsInitializing : 1; //!< True, while this repository is initializing + //QTimer* mUnloadTimer; //!< NULL or a timer to unload this repository Head* mHead; //!< The HEAD private: Git::Repository mRepo; //!< GitWrap-Repo, if loaded + QString mPath; //!< Full, absolute path to this repository + mutable QMutex mMutex; //!< One mutex to protect them all (inside this Repo) + SList mSubmodules; }; + inline QMutex& Repo::mutex() const + { + return mMutex; + } + + inline Repo::WList Repo::submodules() const + { + return weakFromSharedList(mSubmodules); + } + + inline QString Repo::path() const + { + return mPath; + } + } } diff --git a/Libs/libMacGitverCore/RepoMan/Data/RepoManData.hpp b/Libs/libMacGitverCore/RepoMan/Data/RepoMan.hpp similarity index 70% rename from Libs/libMacGitverCore/RepoMan/Data/RepoManData.hpp rename to Libs/libMacGitverCore/RepoMan/Data/RepoMan.hpp index 5c637c27..f3c0cc1e 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/RepoManData.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/RepoMan.hpp @@ -19,7 +19,7 @@ #pragma once -#include "libMacGitverCore/RepoMan/Data/BaseData.hpp" +#include "libMacGitverCore/RepoMan/Data/Base.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" @@ -27,25 +27,18 @@ #include "hic_RepoManActions.h" +#if 0 // ###DEAD namespace RM { - namespace Internal + namespace Data { - class RepoManPrivate : public BasePrivate, private RepoManActions + class RepoMan : private RepoManActions { public: - RepoManPrivate(RepoMan* _pub); - - public: - ObjTypes objType() const; - bool refreshSelf(); - void preTerminate(); - QString displayName() const; - void dumpSelf(Internal::Dumper& dumper) const; - QString objectTypeName() const; - + RepoMan(RepoMan* _pub); + Heaven::Menu* contextMenuFor(Base* object); public: @@ -56,3 +49,4 @@ namespace RM } } +#endif diff --git a/Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp b/Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp index 27a5e37d..af67c870 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp @@ -17,7 +17,7 @@ * */ -#include "RepoMan/Data/SubmoduleData.hpp" +#include "RepoMan/Data/Submodule.hpp" #include "RepoMan/Private/Dumper.hpp" @@ -26,9 +26,10 @@ namespace RM { - namespace Internal + namespace Data { + #if 0 SubmodulePrivate::SubmodulePrivate(Submodule* pub, const Git::Repository& repo) : RepoPrivate( pub, repo ) { @@ -72,6 +73,7 @@ namespace RM { return type == ObjTypes::Submodule || RepoPrivate::inherits(type); } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Submodule.hpp b/Libs/libMacGitverCore/RepoMan/Data/Submodule.hpp index 2f454210..d89f30ef 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Submodule.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Submodule.hpp @@ -19,20 +19,24 @@ #pragma once -#include "RepoMan/Data/RepoData.hpp" +#include "RepoMan/Data/Repo.hpp" -#include "RepoMan/Submodule.hpp" +#include "RepoMan/Frontend/Submodule.hpp" namespace RM { - namespace Internal + namespace Data { - class SubmodulePrivate : public RepoPrivate + class Submodule + : public Repo { public: - SubmodulePrivate(Submodule* pub, const Git::Repository& repo); + static const_or_constexpr ObjTypes StaticObjectType = ObjTypes::Submodule; + + public: + Submodule(Submodule* pub, const Git::Repository& repo); public: ObjTypes objType() const; diff --git a/Libs/libMacGitverCore/RepoMan/Data/Tag.cpp b/Libs/libMacGitverCore/RepoMan/Data/Tag.cpp index 9c87eb97..19266ef3 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Tag.cpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Tag.cpp @@ -17,7 +17,7 @@ * */ -#include "RepoMan/Data/TagData.hpp" +#include "RepoMan/Data/Tag.hpp" #include "RepoMan/Events.hpp" @@ -26,20 +26,21 @@ namespace RM { - namespace Internal + namespace Data { - TagPrivate::TagPrivate(Tag* _pub, const Git::Reference& _ref) - : RefPrivate(_pub, TagType, _ref) + #if 0 + Tag::Tag(Frontend::Tag* _pub, const Git::Reference& _ref) + : Reference(_pub, TagType, _ref) { } - ObjTypes TagPrivate::objType() const + ObjTypes Tag::objType() const { return ObjTypes::Tag; } - void TagPrivate::postCreation() + void Tag::postCreation() { if (!repoEventsBlocked()) { Events::self()->tagCreated(repository(), pub()); @@ -48,7 +49,7 @@ namespace RM RefPrivate::postCreation(); } - void TagPrivate::preTerminate() + void Tag::preTerminate() { if (!repoEventsBlocked()) { Events::self()->tagAboutToBeDeleted(repository(), pub()); @@ -57,22 +58,23 @@ namespace RM RefPrivate::preTerminate(); } - void TagPrivate::dumpSelf(Internal::Dumper& dumper) const + void Tag::dumpSelf(Internal::Dumper& dumper) const { dumper.addLine(QString(QStringLiteral("Tag 0x%1 - %2")) .arg(quintptr(mPub),0,16) .arg(mName)); } - QString TagPrivate::objectTypeName() const + QString Tag::objectTypeName() const { return QStringLiteral("Tag"); } - bool TagPrivate::inherits(ObjTypes type) const + bool Tag::inherits(ObjTypes type) const { return type == ObjTypes::Tag || RefPrivate::inherits(type); } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Data/Tag.hpp b/Libs/libMacGitverCore/RepoMan/Data/Tag.hpp index 8bb62db9..3f4b367e 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Tag.hpp +++ b/Libs/libMacGitverCore/RepoMan/Data/Tag.hpp @@ -19,20 +19,24 @@ #pragma once -#include "RepoMan/Data/RefData.hpp" +#include "RepoMan/Data/Reference.hpp" -#include "RepoMan/Tag.hpp" +#include "RepoMan/Frontend/Tag.hpp" namespace RM { - namespace Internal + namespace Data { - class TagPrivate : public RefPrivate + class Tag + : public Reference { public: - TagPrivate(Tag* pub, const Git::Reference& _ref); + static const_or_constexpr ObjTypes StaticObjectType = ObjTypes::Tag; + + public: + Tag(Tag* pub, const Git::Reference& _ref); public: ObjTypes objType() const; diff --git a/Libs/libMacGitverCore/RepoMan/Events.cpp b/Libs/libMacGitverCore/RepoMan/Events.cpp index 9a96bb03..f208fd68 100644 --- a/Libs/libMacGitverCore/RepoMan/Events.cpp +++ b/Libs/libMacGitverCore/RepoMan/Events.cpp @@ -156,231 +156,231 @@ namespace RM self()->mEvents.remove(ev); } - void Events::repositoryOpened(Repo* repo) + void Events::repositoryOpened(const RM::Frontend::Repo& repo) { foreach (EventsInterface* ei, mEvents) { ei->repositoryOpened(repo); } } - void Events::repositoryAboutToClose(Repo* repo) + void Events::repositoryAboutToClose(const RM::Frontend::Repo& repo) { foreach (EventsInterface* ei, mEvents) { ei->repositoryAboutToClose(repo); } } - void Events::repositoryActivated(Repo* repo) + void Events::repositoryActivated(const RM::Frontend::Repo& repo) { foreach (EventsInterface* ei, mEvents) { ei->repositoryActivated(repo); } } - void Events::repositoryDeactivated(Repo* repo) + void Events::repositoryDeactivated(const RM::Frontend::Repo& repo) { foreach (EventsInterface* ei, mEvents) { ei->repositoryDeactivated(repo); } } - void Events::objectCreated(Repo* repo, Base* object) + void Events::objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) { foreach (EventsInterface* ei, mEvents) { ei->objectCreated(repo, object); } } - void Events::objectAboutToBeDeleted(Repo* repo, Base* object) + void Events::objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) { foreach (EventsInterface* ei, mEvents) { ei->objectAboutToBeDeleted(repo, object); } } - void Events::refTreeNodeCreated(Repo* repo, RefTreeNode* node) + void Events::refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) { foreach (EventsInterface* ei, mEvents) { ei->refTreeNodeCreated(repo, node); } } - void Events::refTreeNodeAboutToBeDeleted(Repo* repo, RefTreeNode* node) + void Events::refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) { foreach (EventsInterface* ei, mEvents) { ei->refTreeNodeAboutToBeDeleted(repo, node); } } - void Events::refCreated(Repo* repo, Ref* ref) + void Events::refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { foreach (EventsInterface* ei, mEvents) { ei->refCreated(repo, ref); } } - void Events::refAboutToBeDeleted(Repo* repo, Ref* ref) + void Events::refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { foreach (EventsInterface* ei, mEvents) { ei->refAboutToBeDeleted(repo, ref); } } - void Events::refMoved(Repo* repo, Ref* ref) + void Events::refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { foreach (EventsInterface* ei, mEvents) { ei->refMoved(repo, ref); } } - void Events::refHeadDetached(Repo* repo, Ref* ref) + void Events::refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { foreach (EventsInterface* ei, mEvents) { ei->refHeadDetached(repo, ref); } } - void Events::tagCreated(Repo* repo, Tag* tag) + void Events::tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) { foreach (EventsInterface* ei, mEvents) { ei->tagCreated(repo, tag); } } - void Events::tagAboutToBeDeleted(Repo* repo, Tag* tag) + void Events::tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) { foreach (EventsInterface* ei, mEvents) { ei->tagAboutToBeDeleted(repo, tag); } } - void Events::branchCreated(Repo* repo, Branch* branch) + void Events::branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) { foreach (EventsInterface* ei, mEvents) { ei->branchCreated(repo, branch); } } - void Events::branchAboutToBeDeleted(Repo* repo, Branch* branch) + void Events::branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) { foreach (EventsInterface* ei, mEvents) { ei->branchAboutToBeDeleted(repo, branch); } } - void Events::branchMoved(Repo* repo, Branch* branch) + void Events::branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) { foreach (EventsInterface* ei, mEvents) { ei->branchMoved(repo, branch); } } - void Events::branchUpstreamChanged(Repo* repo, Branch* branch) + void Events::branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) { foreach (EventsInterface* ei, mEvents) { ei->branchUpstreamChanged(repo, branch); } } - void Events::namespaceCreated(Repo* repo, Namespace* nameSpace) + void Events::namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) { foreach (EventsInterface* ei, mEvents) { ei->namespaceCreated(repo, nameSpace); } } - void Events::namespaceAboutToBeDeleted(Repo* repo, Namespace* nameSpace) + void Events::namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) { foreach (EventsInterface* ei, mEvents) { ei->namespaceAboutToBeDeleted(repo, nameSpace); } } - void Events::refLogChanged(Repo* repo, RefLog* reflog) + void Events::refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) { foreach (EventsInterface* ei, mEvents) { ei->refLogChanged(repo, reflog); } } - void Events::refLogNewEntry(Repo* repo, RefLog* reflog) + void Events::refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) { foreach (EventsInterface* ei, mEvents) { ei->refLogNewEntry(repo, reflog); } } - void Events::stageCreated(Repo* repo, Ref* ref) + void Events::stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { foreach (EventsInterface* ei, mEvents) { ei->stageCreated(repo, ref); } } - void Events::stageAboutToBeDeleted(Repo* repo, Ref* ref) + void Events::stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { foreach (EventsInterface* ei, mEvents) { ei->stageAboutToBeDeleted(repo, ref); } } - void Events::remoteCreated(Repo* repo, Remote* remote) + void Events::remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) { foreach (EventsInterface* ei, mEvents) { ei->remoteCreated(repo, remote); } } - void Events::remoteAboutToBeDeleted(Repo* repo, Remote* remote) + void Events::remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) { foreach (EventsInterface* ei, mEvents) { ei->remoteAboutToBeDeleted(repo, remote); } } - void Events::remoteModified(Repo* repo, Remote* remote) + void Events::remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) { foreach (EventsInterface* ei, mEvents) { ei->remoteModified(repo, remote); } } - void Events::submoduleCreated(Repo* repo, Submodule* submodule) + void Events::submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) { foreach (EventsInterface* ei, mEvents) { ei->submoduleCreated(repo, submodule); } } - void Events::submoduleAboutToBeDeleted(Repo* repo, Submodule* submodule) + void Events::submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) { foreach (EventsInterface* ei, mEvents) { ei->submoduleAboutToBeDeleted(repo, submodule); } } - void Events::submoduleMoved(Repo* repo, Submodule* submodule) + void Events::submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) { foreach (EventsInterface* ei, mEvents) { ei->submoduleMoved(repo, submodule); } } - void Events::repositoryStateChanged(Repo* repo) + void Events::repositoryStateChanged(const RM::Frontend::Repo& repo) { foreach (EventsInterface* ei, mEvents) { ei->repositoryStateChanged(repo); } } - void Events::indexUpdated(Repo* repo) + void Events::indexUpdated(const RM::Frontend::Repo& repo) { foreach (EventsInterface* ei, mEvents) { ei->indexUpdated(repo); } } - void Events::workTreeUpdated(Repo* repo) + void Events::workTreeUpdated(const RM::Frontend::Repo& repo) { foreach (EventsInterface* ei, mEvents) { ei->workTreeUpdated(repo); diff --git a/Libs/libMacGitverCore/RepoMan/Events.hpp b/Libs/libMacGitverCore/RepoMan/Events.hpp index 5f30ee04..738a6f66 100644 --- a/Libs/libMacGitverCore/RepoMan/Events.hpp +++ b/Libs/libMacGitverCore/RepoMan/Events.hpp @@ -19,23 +19,26 @@ #pragma once -#include +#include "libMacGitverCore/RepoMan/Core.hpp" -#include "libMacGitverCore/MacGitverApi.hpp" +#include namespace RM { - class Base; - class Namespace; - class Repo; - class Ref; - class Remote; - class Submodule; - class RefTreeNode; - class RefLog; - class Branch; - class Tag; + namespace Frontend + { + class Base; + class Namespace; + class Repo; + class Reference; + class Remote; + class Submodule; + class RefTreeNode; + class RefLog; + class Branch; + class Tag; + } class MGV_CORE_API EventsInterface { @@ -43,50 +46,50 @@ namespace RM virtual ~EventsInterface() {} public: - virtual void repositoryOpened(Repo* repo) = 0; - virtual void repositoryAboutToClose(Repo* repo) = 0; - virtual void repositoryActivated(Repo* repo) = 0; - virtual void repositoryDeactivated(Repo* repo) = 0; + virtual void repositoryOpened(const RM::Frontend::Repo& repo) = 0; + virtual void repositoryAboutToClose(const RM::Frontend::Repo& repo) = 0; + virtual void repositoryActivated(const RM::Frontend::Repo& repo) = 0; + virtual void repositoryDeactivated(const RM::Frontend::Repo& repo) = 0; - virtual void objectCreated(Repo* repo, Base* object) = 0; - virtual void objectAboutToBeDeleted(Repo* repo, Base* object) = 0; + virtual void objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) = 0; + virtual void objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) = 0; - virtual void refTreeNodeCreated(Repo* repo, RefTreeNode* node) = 0; - virtual void refTreeNodeAboutToBeDeleted(Repo* repo, RefTreeNode* node) = 0; + virtual void refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) = 0; + virtual void refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) = 0; - virtual void refCreated(Repo* repo, Ref* ref) = 0; - virtual void refAboutToBeDeleted(Repo* repo, Ref* ref) = 0; - virtual void refMoved(Repo* repo, Ref* ref) = 0; - virtual void refHeadDetached(Repo* repo, Ref* ref) = 0; + virtual void refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; + virtual void refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; + virtual void refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; + virtual void refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; - virtual void tagCreated(Repo* repo, Tag* tag) = 0; - virtual void tagAboutToBeDeleted(Repo* repo, Tag* tag) = 0; + virtual void tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) = 0; + virtual void tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) = 0; - virtual void branchCreated(Repo* repo, Branch* branch) = 0; - virtual void branchAboutToBeDeleted(Repo* repo, Branch* branch) = 0; - virtual void branchMoved(Repo* repo, Branch* branch) = 0; - virtual void branchUpstreamChanged(Repo* repo, Branch* branch) = 0; + virtual void branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) = 0; + virtual void branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) = 0; + virtual void branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) = 0; + virtual void branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) = 0; - virtual void namespaceCreated(Repo* repo, Namespace* nameSpace) = 0; - virtual void namespaceAboutToBeDeleted(Repo* repo, Namespace* nameSpace) = 0; + virtual void namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) = 0; + virtual void namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) = 0; - virtual void refLogChanged(Repo* repo, RefLog* reflog) = 0; - virtual void refLogNewEntry(Repo* repo, RefLog* reflog) = 0; + virtual void refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) = 0; + virtual void refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) = 0; - virtual void stageCreated(Repo* repo, Ref* ref) = 0; - virtual void stageAboutToBeDeleted(Repo* repo, Ref* ref) = 0; + virtual void stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; + virtual void stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; - virtual void remoteCreated(Repo* repo, Remote* remote) = 0; - virtual void remoteAboutToBeDeleted(Repo* repo, Remote* remote) = 0; - virtual void remoteModified(Repo* repo, Remote* remote) = 0; + virtual void remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) = 0; + virtual void remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) = 0; + virtual void remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) = 0; - virtual void submoduleCreated(Repo* repo, Submodule* submodule) = 0; - virtual void submoduleAboutToBeDeleted(Repo* repo, Submodule* submodule) = 0; - virtual void submoduleMoved(Repo* repo, Submodule* submodule) = 0; + virtual void submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) = 0; + virtual void submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) = 0; + virtual void submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) = 0; - virtual void repositoryStateChanged(Repo* repo) = 0; - virtual void indexUpdated(Repo* repo) = 0; - virtual void workTreeUpdated(Repo* repo) = 0; + virtual void repositoryStateChanged(const RM::Frontend::Repo& repo) = 0; + virtual void indexUpdated(const RM::Frontend::Repo& repo) = 0; + virtual void workTreeUpdated(const RM::Frontend::Repo& repo) = 0; }; class MGV_CORE_API Events // : public EventsInterface @@ -100,43 +103,43 @@ namespace RM static void delReceiver(EventsInterface* ev); private: - QSet< EventsInterface* > mEvents; + QSet mEvents; static Events* sSelf; public: - void repositoryOpened(Repo* repo); - void repositoryAboutToClose(Repo* repo); - void repositoryActivated(Repo* repo); - void repositoryDeactivated(Repo* repo); - void objectCreated(Repo* repo, Base* object); - void objectAboutToBeDeleted(Repo* repo, Base* object); - void refTreeNodeCreated(Repo* repo, RefTreeNode* node); - void refTreeNodeAboutToBeDeleted(Repo* repo, RefTreeNode* node); - void refCreated(Repo* repo, Ref* ref); - void refAboutToBeDeleted(Repo* repo, Ref* ref); - void refMoved(Repo* repo, Ref* ref); - void refHeadDetached(Repo* repo, Ref* ref); - void tagCreated(Repo* repo, Tag* tag); - void tagAboutToBeDeleted(Repo* repo, Tag* tag); - void branchCreated(Repo* repo, Branch* branch); - void branchAboutToBeDeleted(Repo* repo, Branch* branch); - void branchMoved(Repo* repo, Branch* branch); - void branchUpstreamChanged(Repo* repo, Branch* branch); - void namespaceCreated(Repo* repo, Namespace* nameSpace); - void namespaceAboutToBeDeleted(Repo* repo, Namespace* nameSpace); - void refLogChanged(Repo* repo, RefLog* reflog); - void refLogNewEntry(Repo* repo, RefLog* reflog); - void stageCreated(Repo* repo, Ref* ref); - void stageAboutToBeDeleted(Repo* repo, Ref* ref); - void remoteCreated(Repo* repo, Remote* remote); - void remoteAboutToBeDeleted(Repo* repo, Remote* remote); - void remoteModified(Repo* repo, Remote* remote); - void submoduleCreated(Repo* repo, Submodule* submodule); - void submoduleAboutToBeDeleted(Repo* repo, Submodule* submodule); - void submoduleMoved(Repo* repo, Submodule* submodule); - void repositoryStateChanged(Repo* repo); - void indexUpdated(Repo* repo); - void workTreeUpdated(Repo* repo); + void repositoryOpened(const RM::Frontend::Repo& repo); + void repositoryAboutToClose(const RM::Frontend::Repo& repo); + void repositoryActivated(const RM::Frontend::Repo& repo); + void repositoryDeactivated(const RM::Frontend::Repo& repo); + void objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); + void objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); + void refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); + void refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); + void refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); + void tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); + void branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); + void namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); + void refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); + void refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); + void stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); + void remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); + void remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); + void submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void repositoryStateChanged(const RM::Frontend::Repo& repo); + void indexUpdated(const RM::Frontend::Repo& repo); + void workTreeUpdated(const RM::Frontend::Repo& repo); }; } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp index daf3f876..518e42d7 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp @@ -17,26 +17,26 @@ * */ -#include -#include - -#include "libHeavenIcons/IconRef.hpp" - #include "App/MacGitver.hpp" -#include "RepoMan/Base.hpp" -#include "RepoMan/Repo.hpp" +#include "RepoMan/Frontend/BaseInternal.hpp" +#include "RepoMan/Frontend/Repo.hpp" #include "RepoMan/RepoMan.hpp" -#include "RepoMan/RefTreeNode.hpp" +#include "RepoMan/Frontend/RefTreeNode.hpp" + #include "RepoMan/Events.hpp" -#include "RepoMan/Data/RepoManData.hpp" -#include "RepoMan/Data/BaseData.hpp" +#include "RepoMan/Data/Base.hpp" #include "RepoMan/Private/Dumper.hpp" +#include "libHeavenIcons/IconRef.hpp" + +#include +#include + /** - * @class Base + * @class RM::Frontend::Base * @brief Base class for all RepoMan objects * * This base class takes care of a unified linking between a parent and its children. Children @@ -57,36 +57,6 @@ namespace RM namespace Frontend { - /** - * @fn bool Base::refreshSelf() - * @brief Refresh this object's data and sent events - * - * This method is called during the refreshing mechanism. It is the first step and can determine - * that the object itself does no longer exist. However, if this happens, the child refreshing - * logic of the parent is most probably broken. - * - * Implementations should _only_ refresh the object itself and not the children. See refresh() - * for details on how exactly the refreshing process works. - */ - - /** - * @fn bool Base::isA() - * @brief Check this object's type - * - * @tparam T Type to check against - * - * @return `true`, if this is an object of type @a T. `false` otherwise. - */ - - /*-* // Keep this comment away from doxygen: https://bugzilla.gnome.org/show_bug.cgi?id=709052 - * @fn T::Set Base::childObjects() const - * @brief Find (existing) children filtered by a given type - * - * @tparam T Type to check the children against - * - * @return A set of children of type @a T. - */ - /** * @brief Constructor * @@ -96,122 +66,91 @@ namespace RM * @param[in] parent The parent to whom we shall link this new child to. * */ - Base::Base(BasePrivate& _d) - : mData(&_d) + Base::Base(const std::shared_ptr& d) + : mData(d) { } - /** - * @brief Destructor - * - * At the point where the destructor is called, all children should have been unlinked from the - * tree and this object has to be unlinked too. - * - */ - Base::~Base() + Base::Base(std::shared_ptr&& d) + : mData(std::move(d)) { - delete mData; } - /** - * @brief Find (existing) children - * - * @return A set of all children of this object (unfiltered). - */ - Base::List Base::childObjects() const - { - RM_CD(Base); + Base::Base() + {} - return d->mChildren; + Base::Base(const Base& other) + : mData(other.mData) + { } - /** - * @brief Find (existing) children of a specific type - * - * @param[in] type The object type of the children to find. - * - * @return A set of children of this object filtered by object type. - * - */ - Base::List Base::childObjects(ObjTypes type) const + Base::Base(Base&& other) + : mData(std::move(other.mData)) { - RM_CD(Base); - - List children; - - foreach(Base* child, d->mChildren) { - if (child->objType() == type) { - children.append(child); - } - } - - return children; } - /** - * @brief Get the direct parent object - * - * The direct parent object is specified during construction and can never be changed. - * - * @return The direct parent object. - * - */ - Base* Base::parentObject() const + Base& Base::operator=(Base&& other) { - RM_CD(Base); + std::swap(mData, other.mData); + return * this; + } - return d->mParentObj->mPub; + bool Base::operator==(const Base& other) const + { + return mData == other.mData; } + Base::operator bool() const + { + return !!mData; + } /** - * @brief Refresh this object + * @brief Destructor * - * Refreshs this object and all its children. + * At the point where the destructor is called, all children should have been unlinked from the + * tree and this object has to be unlinked too. * */ - void Base::refresh() + Base::~Base() { - RM_D(Base); - d->refresh(); } - /** - * @brief Find the repository for this object - * - * @return The first repository in hierarchy (Repo or Submodule) - * - */ - const Repo* Base::repository() const + Base& Base::operator=(const Base& other) { - RM_CD(Base); - return d->mRepo; + mData = other.mData; + return * this; } /** - * @brief find the repository for this object + * @brief Get the direct parent object * - * Walks up the hierarchy of objects to find the repository. Since objects can never be - * reparented, the result of this method never changes. + * The direct parent object is specified during construction and can never be changed. * - * @return The first repository in hierarchy that is found + * @return The direct parent object. * */ - Repo* Base::repository() + Base Base::parent() const { - RM_D(Base); - return d->mRepo; + return mData->parent(); } /** - * @brief Get a string that can be used to display this object + * @brief Find the repository for this object * - * @return Always ``. Reimplementations should return something more meaningful. + * @return The first repository in hierarchy (Repo or Submodule) * */ - QString Base::displayName() const + Repo Base::repository() const { - RM_CD(Base); - return d->displayName(); + if (mData) { + return mData->repository().lock(); + } + return Repo(); + } + + bool Base::inherits(ObjTypes type) const + { + return mData->inherits(type); } /** @@ -225,8 +164,7 @@ namespace RM */ ObjTypes Base::objType() const { - RM_CD(Base); - return d->objType(); + return mData->objType(); } /** @@ -237,10 +175,8 @@ namespace RM */ QString Base::dump() const { - RM_CD(Base); - - Dumper dumper; - d->dumpRecursive(dumper); + Internal::Dumper dumper; + mData->dumpRecursive(dumper); return dumper.output(); } @@ -252,10 +188,37 @@ namespace RM */ QString Base::typeName() const { - RM_CD(Base); - return d->objectTypeName(); + return mData->objectTypeName(); + } + + std::shared_ptr Base::data() const + { + return mData; + } + + Base::List Base::children() const + { + // ###REPOMAN Do we need to lock here? + if (mData) { + //return mData->children(); + } + + return List(); + } + + /** + * @brief Get a string that can be used to display this object + * + * @return Always ``. Reimplementations should return something more meaningful. + * + */ + QString Base::displayName() const + { + DPtrT d(this); + return d->displayName(); } + #if 0 // ###DEAD /** * @brief Get a context menu for this object * @@ -268,6 +231,7 @@ namespace RM RepoMan::Private* rmp = BasePrivate::dataOf(rm); return rmp->contextMenuFor(this); } + #endif /** * @brief Get an icon for this object @@ -277,16 +241,10 @@ namespace RM */ Heaven::IconRef Base::icon(bool small) const { - RM_D(Base); + DPtrT d(this); return d->icon(small); } - bool Base::inheritsRepoManType(ObjTypes type) const - { - RM_CD(Base); - return d->inherits(type); - } - } } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Base.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Base.hpp index f5ca7db0..c2a3a586 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Base.hpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Base.hpp @@ -24,19 +24,14 @@ namespace RM { - class Repo; - class RefTreeNode; - class Namespace; - class Ref; - class Remote; - class RefLog; - class Submodule; - class Tag; - namespace Internal { class Dumper; - class BasePrivate; + } + + namespace Data + { + class Base; } namespace Frontend @@ -44,40 +39,33 @@ namespace RM class MGV_CORE_API Base { - friend class Repo; - friend class Internal::BasePrivate; - public: - typedef QVector< Base* > List; - - protected: - Base(Internal::BasePrivate& _d); - virtual ~Base(); + using List = std::vector; + using DPtrType = Data::Base; public: - ObjTypes objType() const; + Base(const std::shared_ptr& _d); + Base(std::shared_ptr&& _d); + virtual ~Base(); + Base(); public: - void refresh(); - - const Repo* repository() const; - Repo* repository(); - - Base* parentObject() const; - - List childObjects() const; - List childObjects(ObjTypes type) const; + Base(const Base& other); + Base(Base&& other); + Base& operator=(const Base& other); + Base& operator=(Base&& other); - template< class T > - typename T::List childObjects() const; + bool operator==(const Base& other) const; - template< class T > - bool isA() const; + operator bool() const; - template< class T > - bool inheritsRepoManType() const; + public: + ObjTypes objType() const; + bool inherits(ObjTypes type) const; - bool inheritsRepoManType(ObjTypes type) const; + public: + Repo repository() const; + Base parent() const; Heaven::IconRef icon(bool small = false) const; @@ -87,38 +75,34 @@ namespace RM Heaven::Menu* contextMenu(); - protected: - Internal::BasePrivate* mData; + std::shared_ptr data() const; - private: - Base(const Base& other); - Base& operator=(const Base& other); - }; + template + T as() const; - template< class T > - inline bool Base::isA() const - { - return objType() == ObjTypes(T::StaticObjectType); - } + List children() const; - template< class T > - inline bool Base::inheritsRepoManType() const - { - return inheritsRepoManType(ObjTypes(T::StaticObjectType)); - } + protected: + std::shared_ptr mData; - template< class T > - inline typename T::List Base::childObjects() const - { - typename T::List children; + protected: + enum LockingMechanism { Locked, NotLocked }; + + private: + template + struct Locker; - foreach(Base* child, childObjects()) { - if (child->inheritsRepoManType()) { - children.append(static_cast(child)); - } - } + protected: + template + class DPtrT; + }; - return children; + template + inline T Base::as() const + { + using Dest = typename T::DPtrType; + const Dest* p = std::static_pointer_cast(mData); + return T(p); } } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/BaseInternal.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/BaseInternal.hpp new file mode 100644 index 00000000..6e94ed4b --- /dev/null +++ b/Libs/libMacGitverCore/RepoMan/Frontend/BaseInternal.hpp @@ -0,0 +1,121 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include "RepoMan/Frontend/Base.hpp" +#include "RepoMan/Backend/RepoLocker.hpp" + +namespace RM +{ + namespace Frontend + { + + template + struct Base::Locker + { + /* constexpr */ Locker(const std::shared_ptr&) + {} + }; + + template<> + struct Base::Locker + : private Backend::RepoLocker + { + public: + Locker(const std::shared_ptr& t) + : Backend::RepoLocker(std::const_pointer_cast(t)) + {} + }; + + template + class Base::DPtrT + { + public: + using DPtrType = typename T::DPtrType; + + public: + DPtrT(T* that); + + public: + const DPtrType* operator->() const { return d.get(); } + DPtrType* operator->() { return d.get(); } + operator const DPtrType*() const { return d.get(); } + operator DPtrType*() { return d.get(); } + + private: + std::shared_ptr d; + Base::Locker l; + }; + + template + inline Base::DPtrT::DPtrT(T* that) + : d(std::static_pointer_cast(that->mData)) + , l(d->repository().lock()) + { + } + + template + class Base::DPtrT + { + public: + using DPtrType = typename T::DPtrType; + + public: + DPtrT(const T* that); + + public: + const DPtrType* operator->() const { return d.get(); } + operator const DPtrType*() const { return d.get(); } + + private: + std::shared_ptr d; + Base::Locker l; + }; + + template + inline Base::DPtrT::DPtrT(const T* that) + : d(std::static_pointer_cast(that->mData)) + , l(d->repository().lock()) + { + } + + template + inline typename T::List toFrontend(const typename T::DPtrType::SList& slist) + { + typename T::List frontendlist; + for (const typename T::DPtrType::SPtr& s : slist) { + frontendlist.push_back(T(s)); + } + return frontendlist; + } + + template + inline typename T::List toFrontend(const typename T::DPtrType::WList& wlist) + { + typename T::List frontendlist; + for (const typename T::DPtrType::WPtr& w : wlist) { + frontendlist.push_back(T(w.lock())); + } + return frontendlist; + } + + } + +} diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp index afbba9d8..5e4452c4 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp @@ -17,14 +17,15 @@ * */ -#include "RepoMan/Branch.hpp" -#include "RepoMan/Repo.hpp" +#include "RepoMan/Frontend/Branch.hpp" +#include "RepoMan/Frontend/Repo.hpp" +#include "RepoMan/Frontend/Head.hpp" + #include "RepoMan/Events.hpp" -#include "RepoMan/Head.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/BranchData.hpp" +#include "RepoMan/Data/Branch.hpp" namespace RM { @@ -32,8 +33,9 @@ namespace RM namespace Frontend { + #if 0 Branch::Branch(Base* parent, const Git::Reference &ref) - : Ref( *new Internal::BranchPrivate(this, ref) ) + : Reference( *new Data::Branch(this, ref) ) { RM_D(Branch); d->linkToParent( parent ); @@ -45,9 +47,9 @@ namespace RM return d->mUpstreamRefName; } - Ref* Branch::upstream() + Reference Branch::upstream() { - return repository()->findReference(upstreamRefName()); + return repository().findReference(upstreamRefName()); } bool Branch::hasUpstream() const @@ -74,6 +76,7 @@ namespace RM const Head* h = r ? r->head() : NULL; return h && h->is(this); } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp index e5965dc9..151ca34f 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp @@ -19,12 +19,12 @@ #include "RepoMan/Events.hpp" -#include "RepoMan/Head.hpp" +#include "RepoMan/Frontend/Head.hpp" +#include "RepoMan/Frontend/Repo.hpp" -#include "RepoMan/Data/HeadData.hpp" +#include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Branch.hpp" -#include "RepoMan/Repo.hpp" +#include "RepoMan/Data/Head.hpp" #include "libGitWrap/Repository.hpp" @@ -34,6 +34,7 @@ namespace RM namespace Frontend { + #if 0 Head::Head(const Git::Repository& repo, Base* parent) : Base(*new Internal::HeadPrivate(this, repo)) { @@ -80,6 +81,8 @@ namespace RM return ref && d->symbolicName == ref->fullName(); } + #endif + } } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Head.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Head.hpp index 55adad10..b966521f 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Head.hpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Head.hpp @@ -19,26 +19,24 @@ #pragma once -#include "RepoMan/Base.hpp" -#include "RepoMan/Branch.hpp" +#include "RepoMan/Frontend/Branch.hpp" namespace RM { - namespace Internal + namespace Data { - class HeadPrivate; + class Head; } namespace Frontend { - class MGV_CORE_API Head : public Base { public: static const ObjTypes StaticObjectType = ObjTypes::Head; - typedef Internal::HeadPrivate Private; - typedef QVector< Head* > List; + typedef Data::Head Private; + typedef QVector List; public: Head(const Git::Repository& repo, Base* parent); @@ -55,6 +53,4 @@ namespace RM } - using Head = Frontend::Head; - } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp index daac92a6..72a5577e 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp @@ -19,10 +19,10 @@ #include "RepoMan/Events.hpp" -#include "RepoMan/Namespace.hpp" +#include "RepoMan/Frontend/Namespace.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/NamespaceData.hpp" +#include "RepoMan/Data/Namespace.hpp" namespace RM { @@ -30,8 +30,9 @@ namespace RM namespace Frontend { + #if 0 Namespace::Namespace(Base* _parent, const QString& _name) - : Base(*new Internal::NamespacePrivate(this, _name)) + : Base(*new Data::Namespace(this, _name)) { RM_D(Namespace); d->linkToParent(_parent); @@ -43,6 +44,7 @@ namespace RM return d->name; } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.hpp index d6906b08..e8940bf4 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.hpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.hpp @@ -19,14 +19,14 @@ #pragma once -#include "Base.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Base.hpp" namespace RM { - namespace Internal + namespace Data { - class NamespacePrivate; + class Namespace; } namespace Frontend @@ -37,8 +37,8 @@ namespace RM { public: static const ObjTypes StaticObjectType = ObjTypes::Namespace; - typedef Internal::NamespacePrivate Private; - typedef QVector< Namespace* > List; + typedef Data::Namespace Private; + typedef QVector List; public: Namespace(Base* parent, const QString& _name); diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp index 11c0715b..148ea405 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp @@ -17,10 +17,11 @@ * */ -#include "RepoMan/RefLog.hpp" +#include "RepoMan/Frontend/RefLog.hpp" + +#include "RepoMan/Data/RefLog.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/RefLogData.hpp" namespace RM { @@ -28,12 +29,14 @@ namespace RM namespace Frontend { + #if 0 RefLog::RefLog(Base* _parent) - : Base(*new Internal::RefLogPrivate(this)) + : Base(*new Data::RefLog(this)) { RM_D(RefLog); d->linkToParent(_parent); } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.hpp index 267dea54..18fca711 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.hpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.hpp @@ -19,14 +19,14 @@ #pragma once -#include "Base.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Base.hpp" namespace RM { - namespace Internal + namespace Data { - class RefLogPrivate; + class RefLog; } namespace Frontend @@ -37,8 +37,8 @@ namespace RM { public: static const ObjTypes StaticObjectType = ObjTypes::RefLog; - typedef Internal::RefLogPrivate Private; - + typedef Data::RefLog Private; + public: RefLog(Base* _parent); }; diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp index 21ca9b58..85792fa1 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp @@ -19,11 +19,11 @@ #include "RepoMan/Events.hpp" -#include "RepoMan/RefTreeNode.hpp" +#include "RepoMan/Frontend/RefTreeNode.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/RefTreeNodeData.hpp" +#include "RepoMan/Data/RefTreeNode.hpp" namespace RM { @@ -31,8 +31,9 @@ namespace RM namespace Frontend { + #if 0 RefTreeNode::RefTreeNode(Base* _parent, const QString& _name) - : Base(*new Internal::RefTreeNodePrivate(this, _name)) + : Base(*new Data::RefTreeNode(this, _name)) { RM_D(RefTreeNode); d->linkToParent(_parent); @@ -44,6 +45,7 @@ namespace RM return d->name; } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp index 4e2f65b7..9a8935f9 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp @@ -19,9 +19,9 @@ #pragma once -#include +#include "libMacGitverCore/RepoMan/Frontend/Base.hpp" -#include "Base.hpp" +#include namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp index 28a380b8..3ce0622e 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp @@ -23,11 +23,13 @@ #include "RepoMan/Events.hpp" +#include "RepoMan/Frontend/BaseInternal.hpp" #include "RepoMan/Frontend/Reference.hpp" -#include "RepoMan/Repo.hpp" +#include "RepoMan/Frontend/Repo.hpp" + +#include "RepoMan/Data/Reference.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/RefData.hpp" namespace RM { @@ -35,39 +37,42 @@ namespace RM namespace Frontend { - Reference::Reference(Internal::ReferencePrivate& data) - : Base( data ) + #if 0 + + Reference::Reference(Data::Reference* data) + : Base(data) { } - Reference::Reference(Base* parent, ReferenceTypes type, const Git::Reference& Reference) - : Base( *new Internal::ReferencePrivate( this, type, Reference ) ) + Reference::Reference(Base* parent, RefTypes type, const Git::Reference& ref) + : Base( *new Data::Reference( this, type, ref ) ) { - RM_D( Reference ); + RM_D(Reference); d->linkToParent( parent ); } + #endif - ReferenceTypes Reference::type() const + RefTypes Reference::type() const { - RM_CD(Reference); + DPtrT d(this); return d->mType; } QString Reference::name() const { - RM_CD(Reference); + DPtrT d(this); return d->mName; } QString Reference::fullName() const { - RM_CD(Reference); + DPtrT d(this); return d->mFullQualifiedName; } Git::ObjectId Reference::id() const { - RM_CD(Reference); + DPtrT d(this); return d->mId; } @@ -76,6 +81,7 @@ namespace RM return id().toString(8); } + #if 0 Git::Reference Reference::load(Git::Result& r) { RM_D(Reference); @@ -89,6 +95,8 @@ namespace RM return gitReference; } + #endif + } } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp index c7c9f5b6..d0630bbe 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp @@ -26,32 +26,37 @@ namespace RM { - namespace Internal + namespace Data { - class RefPrivate; + class Reference; } - namespace Frontend + enum RefTypes { + BranchType, + TagType + }; - enum RefTypes - { - BranchType, - TagType - }; + namespace Frontend + { class MGV_CORE_API Reference : public Base { public: static const ObjTypes StaticObjectType = ObjTypes::Reference; - - typedef QList< Ref* > List; + using DPtrType = Data::Reference; + using List = QList; protected: - Reference(Internal::RefPrivate& data); + + Reference(Data::Reference* data); public: + Reference(); + + public: + GW_DEPRECATED Reference(Base* parent, RefTypes type, const Git::Reference& ref); GW_DEPRECATED @@ -65,6 +70,14 @@ namespace RM QString displaySha1() const; }; + inline Reference::Reference() + : Base() + { + } + + GW_DEPRECATED + typedef Reference Ref; + } } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp index 189b7a2f..6c22d84b 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp @@ -21,12 +21,12 @@ #include "RepoMan/Events.hpp" -#include "RepoMan/Repo.hpp" -#include "RepoMan/Remote.hpp" +#include "RepoMan/Frontend/Repo.hpp" +#include "RepoMan/Frontend/Remote.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/RemoteData.hpp" +#include "RepoMan/Data/Remote.hpp" namespace RM { @@ -34,8 +34,9 @@ namespace RM namespace Frontend { + #if 0 Remote::Remote(const Git::Remote& gitObj, Base* _parent) - : Base(*new Internal::RemotePrivate(this, gitObj)) + : Base(*new Data::Remote(this, gitObj)) { RM_D(Remote); @@ -54,6 +55,7 @@ namespace RM return d->name; } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp index 1b9756cc..8467c88d 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp @@ -17,24 +17,29 @@ * */ -#include -#include - -#include "libMacGitverCore/App/MacGitver.hpp" +#include "libGitWrap/Reference.hpp" +#include "libGitWrap/ObjectId.hpp" +#include "libGitWrap/RefName.hpp" +#include "libGitWrap/Submodule.hpp" #include "RepoMan/Events.hpp" -#include "RepoMan/Repo.hpp" #include "RepoMan/RepoMan.hpp" -#include "RepoMan/Head.hpp" -#include "RepoMan/Remote.hpp" -#include "RepoMan/Namespace.hpp" -#include "RepoMan/Ref.hpp" -#include "RepoMan/Tag.hpp" -#include "RepoMan/Branch.hpp" -#include "RepoMan/Submodule.hpp" -#include "RepoMan/Data/RepoData.hpp" -#include "RepoMan/Data/RemoteData.hpp" +#include "RepoMan/Frontend/BaseInternal.hpp" +#include "RepoMan/Frontend/Repo.hpp" +#include "RepoMan/Frontend/Head.hpp" +#include "RepoMan/Frontend/Remote.hpp" +#include "RepoMan/Frontend/Namespace.hpp" +#include "RepoMan/Frontend/Reference.hpp" +#include "RepoMan/Frontend/Tag.hpp" +#include "RepoMan/Frontend/Branch.hpp" +#include "RepoMan/Frontend/Submodule.hpp" + +#include "RepoMan/Data/Repo.hpp" +#include "RepoMan/Data/Head.hpp" +#include "RepoMan/Data/Remote.hpp" + +#include namespace RM { @@ -42,26 +47,17 @@ namespace RM namespace Frontend { - Repo::Repo(Internal::RepoPrivate& _d) - : Base(_d) + Repo::Repo(const std::shared_ptr& d) + : Base(std::move(std::shared_ptr(d))) { } - Repo::Repo(const Git::Repository& repo, Base* parent) - : Base( *new Internal::RepoPrivate(this, repo) ) - { - RM_D(Repo); - - d->linkToParent(parent); - d->refresh(); - - d->mIsInitializing = false; - } - - Repo::~Repo() + Repo::Repo(std::shared_ptr&& d) + : Base(std::shared_ptr(std::move(d))) { } +#if 0 Git::Repository Repo::gitRepo() { RM_D(Repo); @@ -73,115 +69,92 @@ namespace RM RM_D(Repo); return d->gitRepo(); } +#endif QString Repo::path() const { - RM_CD(Repo); - - return d->mPath; + DPtrT d(this); + return d->path(); } bool Repo::isSubModule() const { - RM_CD(Repo); - + DPtrT d(this); return d->mIsSubModule; } bool Repo::isBare() const { - RM_CD(Repo); - + DPtrT d(this); return d->mIsBare; } bool Repo::isLoaded() const { - RM_CD(Repo); - + DPtrT d(this); return d->mIsLoaded; } bool Repo::isActive() const { - RM_CD(Repo); - - return d->mIsActive; + DPtrT d(this); + return d && d->mIsActive; } - /** - * @brief Are we in initialization phase? - * - * @return `true` if we're still doing an initial seed with repository objects. In this - * case no events for new or changed objects shall be sent out to any listeners. - * - */ - bool Repo::isInitializing() const + Repo Repo::parentRepository() { - RM_CD(Repo); - - return d->mIsInitializing; - } - - Repo* Repo::parentRepository() - { - Base* p = parentObject(); - - if (!p) { - return NULL; - } - - if (p->inheritsRepoManType(ObjTypes::Repo)) { - return static_cast(p); - } - - return NULL; + DPtrT d(this); + return d->parent()->as(); } Repo::List Repo::submodules() const { - return childObjects(); + DPtrT d(this); + return toFrontend(d->submodules()); } void Repo::activated() { - // ### Should be very private - RM_D(Repo); + DPtrT d(this); + Q_ASSERT(!d->mIsActive); +#if 0 if (d->mUnloadTimer) { d->mUnloadTimer->stop(); d->mUnloadTimer->deleteLater(); d->mUnloadTimer = NULL; } - +#endif d->mIsActive = true; } void Repo::deactivated() { - // ### Should be very private - RM_D(Repo); - Q_ASSERT(d->mIsActive); + DPtrT d(this); + Q_ASSERT(d->mIsActive); +#if 0 Q_ASSERT(!d->mUnloadTimer); + d->mUnloadTimer = new QTimer(this); connect(d->mUnloadTimer, SIGNAL(timeout()), this, SLOT(unloadTimer())); d->mUnloadTimer->setInterval(15 * 60 * 1000); // quarter of an hour d->mUnloadTimer->start(); +#endif d->mIsActive = false; } QString Repo::displayAlias() const { - RM_CD(Repo); - + DPtrT d(this); return d->mDisplayAlias; } void Repo::setDisplayAlias(const QString& alias) { +#if 0 RM_D(Repo); if (d->mDisplayAlias != alias) { @@ -189,16 +162,20 @@ namespace RM // ###REPOMAN Create new Event "RepoAliasChanged" // emit aliasChanged(alias); } +#endif } +#if 0 void Repo::unloadTimer() { RM_D(Repo); d->unload(); } +#endif void Repo::close() { + #if 0 RM_D(Repo); if (d->mIsActive) { @@ -212,29 +189,31 @@ namespace RM } d->terminateObject(); + #endif } QString Repo::branchDisplay() const { // TODO: This method is totally wrong placed here - RM_D(Repo); + DPtrT d(this); if (d->mIsLoaded && d->mHead) { if (d->mHead->isDetached()) { - return tr("detached at %1" ).arg(d->mHead->detachedId().toString()); + return QObject::tr("detached at %1" ).arg(d->mHead->detachedId().toString()); } if (d->mHead->isUnborn()) { - return tr("Branch yet to be born"); + return QObject::tr("Branch yet to be born"); } - return tr("%1" ).arg(d->mHead->symbolicName().mid(11)); } - return tr("<unknown>"); + return QObject::tr("<unknown>"); } + #if 0 Ref* Repo::findReference(const Git::Reference& ref) { RM_D(Repo); @@ -276,6 +255,7 @@ namespace RM RM_CD(Repo); return d->mHead; } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.hpp index aa3ea4b3..1ba46160 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.hpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Repo.hpp @@ -19,13 +19,9 @@ #pragma once -#include - -class QTimer; - #include "libGitWrap/Repository.hpp" -#include "libMacGitverCore/RepoMan/Base.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Base.hpp" namespace RM { @@ -33,32 +29,30 @@ namespace RM class RepoMan; class Head; - namespace Internal + namespace Data { - class RepoPrivate; + class Repo; } namespace Frontend { class MGV_CORE_API Repo - : public QObject - , public Base + : public Base { friend class RepoMan; - - Q_OBJECT public: static const ObjTypes StaticObjectType = ObjTypes::Repo; - typedef Internal::RepoPrivate Private; - typedef QVector< Repo* > List; - - protected: - Repo(Internal::RepoPrivate& _d); + typedef Data::Repo DPtrType; + typedef QVector List; public: - Repo(const Git::Repository& repo, Base* parent); - ~Repo(); + Repo() = default; + Repo(const std::shared_ptr& o); + Repo(std::shared_ptr&& o); + ~Repo() = default; + + bool operator==(const Repo& other) const; public: GW_DEPRECATED Git::Repository gitRepo(); @@ -70,7 +64,7 @@ namespace RM bool isActive() const; bool isInitializing() const; - Repo* parentRepository(); + Repo parentRepository(); List submodules() const; QString path() const; @@ -82,23 +76,37 @@ namespace RM void close(); - Ref* findReference( const Git::Reference& ref); - Ref* findReference( const QString& fqrn); - Remote* findRemote( const Git::Remote& remote); - Remote* findRemote( const QString& remoteName); - Namespace* findNamespace( const QStringList& namespaces); - Namespace* findNamespace( const QString& nsFullName); + GW_DEPRECATED + Reference findReference( const Git::Reference& ref); + Reference findReference( const QString& fqrn); + GW_DEPRECATED + Remote findRemote( const Git::Remote& remote); + Remote findRemote( const QString& remoteName); + + Namespace findNamespace( const QStringList& namespaces); + Namespace findNamespace( const QString& nsFullName); + + #if 0 // ###DEAD Head* head() const; + #endif private: void activated(); void deactivated(); + #if 0 // ###DEAD private slots: void unloadTimer(); + #endif }; + + inline bool Repo::operator==(const Repo& other) const + { + return Base::operator==(other); + } + } } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp index 393d7ab8..18781bb2 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp @@ -19,10 +19,9 @@ #include "RepoMan/Events.hpp" -#include "RepoMan/Submodule.hpp" +#include "RepoMan/Data/Submodule.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/SubmoduleData.hpp" namespace RM { @@ -30,8 +29,9 @@ namespace RM namespace Frontend { + #if 0 Submodule::Submodule(const Git::Repository& repo, Repo* parent) - : Repo( *new Internal::SubmodulePrivate( this, repo ) ) + : Repo( *new Data::Submodule( this, repo ) ) { RM_D(Submodule); @@ -41,9 +41,8 @@ namespace RM d->linkToParent( parent ); d->refresh(); - - d->mIsInitializing = false; } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.hpp index b0508274..a53acb73 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.hpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.hpp @@ -19,7 +19,7 @@ #pragma once -#include "Repo.hpp" +#include "libMacGitverCore/Repoman/Frontend/Repo.hpp" namespace RM { @@ -27,8 +27,7 @@ namespace RM namespace Frontend { - class MGV_CORE_API Submodule - : public Repo + class MGV_CORE_API Submodule : public Repo { public: static const ObjTypes StaticObjectType = ObjTypes::Submodule; @@ -42,8 +41,6 @@ namespace RM ObjTypes objType() const; void preTerminate(); void dumpSelf(Internal::Dumper& dumper) const; - - private: }; } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp index f2df5b8e..589e2318 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp @@ -19,11 +19,11 @@ #include "RepoMan/Events.hpp" -#include "RepoMan/Tag.hpp" +#include "RepoMan/Frontend/Tag.hpp" #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/TagData.hpp" +#include "RepoMan/Data/Tag.hpp" namespace RM { @@ -31,12 +31,14 @@ namespace RM namespace Frontend { + #if 0 Tag::Tag(Base* _parent, const Git::Reference& _ref) - : Ref(*new Internal::TagPrivate(this, _ref)) + : Ref(*new Data::Tag(this, _ref)) { RM_D(Tag); d->linkToParent(_parent); } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.hpp b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.hpp index 44e2c942..c04a33c9 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.hpp +++ b/Libs/libMacGitverCore/RepoMan/Frontend/Tag.hpp @@ -19,7 +19,7 @@ #pragma once -#include "Ref.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Reference.hpp" namespace RM { @@ -27,11 +27,11 @@ namespace RM namespace Frontend { - class MGV_CORE_API Tag : public Ref + class MGV_CORE_API Tag : public Reference { public: static const ObjTypes StaticObjectType = ObjTypes::Tag; - typedef QVector< Tag* > List; + typedef QVector List; public: Tag(Base* _parent, const Git::Reference& _ref); @@ -49,3 +49,4 @@ namespace RM } } + diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp index dbe59535..06c0b00c 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp +++ b/Libs/libMacGitverCore/RepoMan/RepoMan.cpp @@ -24,8 +24,8 @@ #include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/RepoManData.hpp" -#include "RepoMan/Data/RepoData.hpp" +#include "RepoMan/Data/RepoMan.hpp" +#include "RepoMan/Data/Repo.hpp" #include "libBlueSky/Application.hpp" @@ -34,8 +34,6 @@ namespace RM { - using namespace Internal; - /** * @class RepoMan * @brief Manages the open / active repositories @@ -48,14 +46,13 @@ namespace RM * */ RepoMan::RepoMan() - : Base(*new RepoManPrivate(this)) { Events::addReceiver(this); connect(BlueSky::Application::instance(), - SIGNAL(activeModeChanged(BlueSky::Mode*)), + &BlueSky::Application::activeModeChanged, this, - SLOT(reactivateWorkaround())); + &RepoMan::reactivateWorkaround); } /** @@ -104,24 +101,29 @@ namespace RM */ void RepoMan::closeAll() { + #if 0 // ###DEAD RM_D(RepoMan); foreach(Repo* repo, d->repos) { repo->close(); } + #endif } void RepoMan::reactivateWorkaround() { + #if 0 // ###DEAD RM_D(RepoMan); if (d->activeRepo) { Events::self()->repositoryDeactivated(d->activeRepo); Events::self()->repositoryActivated(d->activeRepo); } + #endif } - void RepoMan::activate(Repo* repository) + void RepoMan::activate(const Frontend::Repo& repository) { + #if 0 // ###DEAD RM_D(RepoMan); if(repository != d->activeRepo) { @@ -144,8 +146,10 @@ namespace RM emit hasActiveRepositoryChanged(d->activeRepo != NULL); } } + #endif } + #if 0 // ###DEAD void RepoMan::internalClosedRepo(Repo* repository) { RM_D(RepoMan); @@ -168,19 +172,29 @@ namespace RM } } } + #endif - Repo* RepoMan::activeRepository() + Frontend::Repo RepoMan::activeRepository() { + #if 0 // ###DEAD RM_D(RepoMan); return d->activeRepo; + #else + return Frontend::Repo(); + #endif } - Repo::List RepoMan::repositories() const + Frontend::Repo::List RepoMan::repositories() const { + #if 0 // ###DEAD RM_CD(RepoMan); return d->repos; + #else + return Frontend::Repo::List(); + #endif } + #if 0 // ###DEAD //-- RepoManPrivate ---------------------------------------------------------------------------- RepoManPrivate::RepoManPrivate(RepoMan* _pub) @@ -210,20 +224,9 @@ namespace RM // Do we need to do smth? } - QString RepoManPrivate::displayName() const - { - return QStringLiteral("RepoMan"); - } - - QString RepoManPrivate::objectTypeName() const - { - return QStringLiteral("RepoMan"); - } - Heaven::Menu* RepoManPrivate::contextMenuFor(Base* object) { switch (object->objType()) { - case ObjTypes::Branch: return menuCtxBranch; case ObjTypes::Tag: return menuCtxTag; case ObjTypes::Repo: return menuCtxRepo; @@ -231,15 +234,18 @@ namespace RM case ObjTypes::Namespace: return menuCtxNamespace; case ObjTypes::RefLog: return menuCtxRefLog; case ObjTypes::Remote: return menuCtxRemote; +<<<<<<< HEAD //case ObjTypes::Reference: return menuCtxRef; //case ObjTypes::RefTreeNode: return menuCtxRefTreeNode; default: break; +======= + default: return nullptr; +>>>>>>> 66f7428... Temporary code } - - return nullptr; } + #endif } diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.hpp b/Libs/libMacGitverCore/RepoMan/RepoMan.hpp index 2b214ae7..a2152649 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.hpp +++ b/Libs/libMacGitverCore/RepoMan/RepoMan.hpp @@ -19,33 +19,23 @@ #pragma once -#include - -#include "libGitWrap/Repository.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" -#include "libMacGitverCore/RepoMan/Repo.hpp" #include "libMacGitverCore/RepoMan/Events.hpp" +#include + namespace RM { - namespace Internal - { - class RepoManPrivate; - } - class MGV_CORE_API RepoMan : public QObject - , public Base , private EventsInterface { Q_OBJECT - public: - static const ObjTypes StaticObjectType = ObjTypes::RepoManager; - typedef Internal::RepoManPrivate Private; - - public: + private: RepoMan(); + public: ~RepoMan(); public: @@ -53,12 +43,10 @@ namespace RM void closeAll(); - Repo* activeRepository(); - void activate(Repo* repository); - - Repo::List repositories() const; + Frontend::Repo activeRepository(); + void activate(const Frontend::Repo& repository); - void internalClosedRepo(Repo* repository); + Frontend::Repo::List repositories() const; public: static RepoMan& instance(); @@ -74,39 +62,39 @@ namespace RM void hasActiveRepositoryChanged(bool hasActiveRepo); signals: - void repositoryOpened(RM::Repo* repo); - void repositoryAboutToClose(RM::Repo* repo); - void repositoryActivated(RM::Repo* repo); - void repositoryDeactivated(RM::Repo* repo); - void objectCreated(RM::Repo* repo, RM::Base* object); - void objectAboutToBeDeleted(RM::Repo* repo, RM::Base* object); - void refTreeNodeCreated(RM::Repo* repo, RM::RefTreeNode* node); - void refTreeNodeAboutToBeDeleted(RM::Repo* repo, RM::RefTreeNode* node); - void refCreated(RM::Repo* repo, RM::Ref* ref); - void refAboutToBeDeleted(RM::Repo* repo, RM::Ref* ref); - void refMoved(RM::Repo* repo, RM::Ref* ref); - void refHeadDetached(RM::Repo* repo, RM::Ref* ref); - void tagCreated(RM::Repo* repo, RM::Tag* tag); - void tagAboutToBeDeleted(RM::Repo* repo, RM::Tag* tag); - void branchCreated(RM::Repo* repo, RM::Branch* branch); - void branchAboutToBeDeleted(RM::Repo* repo, RM::Branch* branch); - void branchMoved(RM::Repo* repo, RM::Branch* branch); - void branchUpstreamChanged(RM::Repo* repo, RM::Branch* branch); - void namespaceCreated(RM::Repo* repo, RM::Namespace* nameSpace); - void namespaceAboutToBeDeleted(RM::Repo* repo, RM::Namespace* nameSpace); - void refLogChanged(RM::Repo* repo, RM::RefLog* reflog); - void refLogNewEntry(RM::Repo* repo, RM::RefLog* reflog); - void stageCreated(RM::Repo* repo, RM::Ref* ref); - void stageAboutToBeDeleted(RM::Repo* repo, RM::Ref* ref); - void remoteCreated(RM::Repo* repo, RM::Remote* remote); - void remoteAboutToBeDeleted(RM::Repo* repo, RM::Remote* remote); - void remoteModified(RM::Repo* repo, RM::Remote* remote); - void submoduleCreated(RM::Repo* repo, RM::Submodule* submodule); - void submoduleAboutToBeDeleted(RM::Repo* repo, RM::Submodule* submodule); - void submoduleMoved(RM::Repo* repo, RM::Submodule* submodule); - void repositoryStateChanged(RM::Repo* repo); - void indexUpdated(RM::Repo* repo); - void workTreeUpdated(RM::Repo* repo); + void repositoryOpened(const RM::Frontend::Repo& repo); + void repositoryAboutToClose(const RM::Frontend::Repo& repo); + void repositoryActivated(const RM::Frontend::Repo& repo); + void repositoryDeactivated(const RM::Frontend::Repo& repo); + void objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); + void objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); + void refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); + void refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); + void refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); + void tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); + void branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); + void namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); + void refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); + void refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); + void stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); + void remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); + void remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); + void submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void repositoryStateChanged(const RM::Frontend::Repo& repo); + void indexUpdated(const RM::Frontend::Repo& repo); + void workTreeUpdated(const RM::Frontend::Repo& repo); }; } diff --git a/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp b/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp index 4338faec..8aa4e6f0 100644 --- a/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp +++ b/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp @@ -25,15 +25,15 @@ #include "libHeavenIcons/IconRef.hpp" #include "libHeavenIcons/Icon.hpp" -#include "RepoMan/Ref.hpp" +#include "RepoMan/Frontend/Reference.hpp" +#include "RepoMan/Frontend/Repo.hpp" + #include "RepoMan/RepoMan.hpp" -#include "RepoMan/Repo.hpp" #include "RepoStateWidget.hpp" RepoStateWidget::RepoStateWidget() { - repo = NULL; setupUi(); RM::RepoMan& rm = RM::RepoMan::instance(); @@ -48,20 +48,18 @@ RepoStateWidget::RepoStateWidget() this, &RepoStateWidget::repositoryDeactivated); } -void RepoStateWidget::repositoryActivated(RM::Repo* info) +void RepoStateWidget::repositoryActivated(const RM::Frontend::Repo& info) { - if( repo != info ) - { + if (repo != info) { repo = info; setRepoState(); } } -void RepoStateWidget::repositoryDeactivated(RM::Repo* info) +void RepoStateWidget::repositoryDeactivated(const RM::Frontend::Repo& info) { - if( repo == info ) - { - repo = NULL; + if (repo == info) { + repo = RM::Frontend::Repo(); setRepoState(); } } @@ -70,22 +68,24 @@ void RepoStateWidget::setRepoState() { txtState->hide(); - txtRepo->setText( repo ? repo->displayAlias() : QString() ); - onUpdateHEAD( repo, NULL ); + txtRepo->setText(repo ? repo.displayAlias() : QString()); + onUpdateHEAD(repo, RM::Frontend::Reference()); } -void RepoStateWidget::onUpdateHEAD(RM::Repo* ownerRepo, RM::Ref* ref) +void RepoStateWidget::onUpdateHEAD( + const RM::Frontend::Repo& ownerRepo, + const RM::Frontend::Reference& ref) { - if ( ownerRepo != repo ) { + if (ownerRepo != repo) { return; } - if ( ref && ref->name() != QStringLiteral("HEAD") ) { + if (ref && ref.name() != QStringLiteral("HEAD")) { return; } // TODO: implement a HTML formatter to highlight HEAD - txtBranch->setText( repo ? repo->branchDisplay() : QString() ); + txtBranch->setText(repo ? repo.branchDisplay() : QString()); } static inline QLabel* pixmapLabel(const char* name) diff --git a/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp b/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp index 2fa038c0..d65ab3d2 100644 --- a/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp +++ b/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp @@ -19,16 +19,12 @@ #pragma once +#include "RepoMan/Frontend/Repo.hpp" + class QLabel; #include -namespace RM -{ - class Ref; - class Repo; -} - class RepoStateWidget : public QWidget { Q_OBJECT @@ -36,19 +32,19 @@ class RepoStateWidget : public QWidget RepoStateWidget(); private slots: - void repositoryActivated(RM::Repo* info); - void repositoryDeactivated(RM::Repo* info); + void repositoryActivated(const RM::Frontend::Repo& repo); + void repositoryDeactivated(const RM::Frontend::Repo& repo); private: void setupUi(); void setRepoState(); public slots: - void onUpdateHEAD(RM::Repo* ownerRepo, RM::Ref* ref); + void onUpdateHEAD(const RM::Frontend::Repo& ownerRepo, const RM::Frontend::Reference& ref); private: - RM::Repo* repo; - QLabel* txtRepo; - QLabel* txtState; - QLabel* txtBranch; + RM::Frontend::Repo repo; + QLabel* txtRepo; + QLabel* txtState; + QLabel* txtBranch; }; From 671679279dc25b9d4d4259966bf88bb50c7d4489 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Mon, 11 May 2015 00:48:57 +0100 Subject: [PATCH 48/60] Fixup to "Temporary Code" :( --- Libs/libMacGitverCore/MacGitver/IRepositoryContext.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Libs/libMacGitverCore/MacGitver/IRepositoryContext.hpp b/Libs/libMacGitverCore/MacGitver/IRepositoryContext.hpp index 3ad14874..ff11181b 100644 --- a/Libs/libMacGitverCore/MacGitver/IRepositoryContext.hpp +++ b/Libs/libMacGitverCore/MacGitver/IRepositoryContext.hpp @@ -23,13 +23,16 @@ namespace RM { - class Repo; + namespace Frontend + { + class Repo; + } } class IRepositoryContext { public: - virtual RM::Repo* repository() const = 0; + virtual RM::Frontend::Repo repository() const = 0; }; Q_DECLARE_INTERFACE( IRepositoryContext, From 621c60e1e81a92cb8a97b445d5ca62e8513fd9fa Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Mon, 11 May 2015 03:52:34 +0100 Subject: [PATCH 49/60] Adjustments --- Modules/CMakeLists.txt | 8 +- Modules/GitConfig/GitConfigModule.cpp | 7 +- Modules/History/HistoryList.cpp | 12 +- Modules/History/HistoryModel.cpp | 16 +- Modules/History/HistoryModel.h | 13 +- Modules/History/HistoryView.cpp | 8 +- Modules/History/HistoryView.h | 9 +- Modules/RefsViews/Branches/BranchesModel.cpp | 107 ++++++------- Modules/RefsViews/Branches/BranchesModel.hpp | 50 +++--- Modules/RefsViews/Branches/RefItem.cpp | 8 +- Modules/RefsViews/Branches/RefItem.hpp | 51 +++--- Modules/RefsViews/RefRenameDialog.cpp | 10 +- Modules/RefsViews/RefRenameDialog.hpp | 10 +- Modules/RepoManLogger/Listener.cpp | 96 ++++++------ Modules/RepoManLogger/Listener.hpp | 66 ++++---- Modules/Repository/RepoInfoModel.cpp | 156 +++++++++++-------- Modules/Repository/RepoInfoModel.hpp | 43 ++--- Modules/Repository/RepoTreeView.cpp | 21 ++- Modules/Repository/RepoTreeView.hpp | 16 +- Modules/Repository/RepositoryModule.cpp | 23 +-- Modules/Repository/RepositoryModule.h | 6 +- 21 files changed, 388 insertions(+), 348 deletions(-) diff --git a/Modules/CMakeLists.txt b/Modules/CMakeLists.txt index 7d30339a..e3308327 100644 --- a/Modules/CMakeLists.txt +++ b/Modules/CMakeLists.txt @@ -7,12 +7,12 @@ INCLUDE_DIRECTORIES( ${HEAVEN_INCLUDE_DIRS} ) -ADD_SUBDIRECTORY(History) +#ADD_SUBDIRECTORY(History) ADD_SUBDIRECTORY(GitConfig) -ADD_SUBDIRECTORY(RefsViews) +#ADD_SUBDIRECTORY(RefsViews) ADD_SUBDIRECTORY(Repository) -ADD_SUBDIRECTORY(Remotes) +#ADD_SUBDIRECTORY(Remotes) ADD_SUBDIRECTORY(Welcome) -ADD_SUBDIRECTORY(WorkingTree) +#ADD_SUBDIRECTORY(WorkingTree) ADD_SUBDIRECTORY(Logging) ADD_SUBDIRECTORY(RepoManLogger) diff --git a/Modules/GitConfig/GitConfigModule.cpp b/Modules/GitConfig/GitConfigModule.cpp index 3b4edb6a..d4812d9f 100644 --- a/Modules/GitConfig/GitConfigModule.cpp +++ b/Modules/GitConfig/GitConfigModule.cpp @@ -19,7 +19,7 @@ #include "libMacGitverCore/App/MacGitver.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Repo.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" #include "GitConfigModule.h" #include "GitConfigDialog.h" @@ -40,10 +40,13 @@ void GitConfigModule::deinitialize() void GitConfigModule::onToolsGitConfig() { + RM::Frontend::Repo repo(RM::RepoMan::instance().activeRepository()); + + #if 0 // ###REPOMAN Git::Repository gitRepo; - RM::Repo* repo = MacGitver::repoMan().activeRepository(); if (repo) { gitRepo = repo->gitRepo(); } GitConfigDialog( gitRepo ).exec(); + #endif } diff --git a/Modules/History/HistoryList.cpp b/Modules/History/HistoryList.cpp index 82152e44..0b7f712a 100644 --- a/Modules/History/HistoryList.cpp +++ b/Modules/History/HistoryList.cpp @@ -16,7 +16,7 @@ #include "libMacGitverCore/App/MacGitver.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Repo.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" #include "libMacGitverCore/Widgets/HeaderView.h" #include "CreateBranchDialog.h" @@ -128,6 +128,7 @@ QModelIndex HistoryList::deeplyMapToSource( QModelIndex current ) const void HistoryList::onCheckout() { + #if 0 // ### REPOMAN Heaven::Action* action = qobject_cast< Heaven::Action* >( sender() ); if ( !action ) return; @@ -162,10 +163,12 @@ void HistoryList::onCheckout() trUtf8("Checkout of commit failed. Git message:\n%1").arg(r.errorText())); return; } + #endif } void HistoryList::checkout(Git::Result& result, const Git::Reference& ref) { + #if 0 // ### REPOMAN GW_CHECK_RESULT(result, void()); Git::CheckoutReferenceOperation* op = new Git::CheckoutReferenceOperation( ref ); @@ -181,10 +184,12 @@ void HistoryList::checkout(Git::Result& result, const Git::Reference& ref) .arg( ref.shorthand() ) .arg( result.errorText() ) ); } + #endif } void HistoryList::onCreateBranch() { + #if 0 // ### REPOMAN Heaven::Action* action = qobject_cast< Heaven::Action* >( sender() ); if ( !action ) return; @@ -220,10 +225,12 @@ void HistoryList::onCreateBranch() { checkout( r, branch ); } + #endif } void HistoryList::onCreateTag() { + #if 0 // ### REPOMAN Heaven::Action* action = qobject_cast< Heaven::Action* >( sender() ); if ( !action ) return; @@ -253,10 +260,12 @@ void HistoryList::onCreateTag() trUtf8("Failed to create tag. Git message:\n%1").arg(r.errorText()) ); return; } + #endif } void HistoryList::onShowHEAD() { + #if 0 // ### REPOMAN Git::Result r; Git::Repository repo = MacGitver::repoMan().activeRepository()->gitRepo(); @@ -280,5 +289,6 @@ void HistoryList::onShowHEAD() "Important Note: This is a feature preview!\n\n" "Please make sure the HEAD commit is at least once visible!" ) ); } + #endif } diff --git a/Modules/History/HistoryModel.cpp b/Modules/History/HistoryModel.cpp index 5c964087..a655d851 100644 --- a/Modules/History/HistoryModel.cpp +++ b/Modules/History/HistoryModel.cpp @@ -22,7 +22,7 @@ #include "libMacGitverCore/App/MacGitver.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Ref.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Reference.hpp" #include "libGitWrap/Reference.hpp" @@ -40,7 +40,7 @@ HistoryModel::HistoryModel( const Git::Repository& repo, QObject* parent ) mDisplays = 0; - RM::RepoMan &rm = MacGitver::repoMan(); + RM::RepoMan &rm = RM::RepoMan::instance(); connect(&rm, &RM::RepoMan::refCreated, this, &HistoryModel::onRefCreated); connect(&rm, &RM::RepoMan::refAboutToBeDeleted, this, &HistoryModel::onRefDestroyed); connect(&rm, &RM::RepoMan::refMoved, this, &HistoryModel::onRefMoved); @@ -229,35 +229,41 @@ void HistoryModel::afterAppend() endInsertRows(); } -void HistoryModel::onRefCreated(RM::Repo* repo, RM::Ref* ref) +void HistoryModel::onRefCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { Q_UNUSED( ref ) + #if 0 // ###REPOMAN if ( !repo || (repo->gitLoadedRepo() != mRepo) ) { return; } + #endif scanInlineReferences(); } -void HistoryModel::onRefDestroyed(RM::Repo* repo, RM::Ref* ref) +void HistoryModel::onRefDestroyed(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { Q_UNUSED( ref ) + #if 0 // ###REPOMAN if ( !repo || (repo->gitLoadedRepo() != mRepo) ) { return; } + #endif scanInlineReferences(); } -void HistoryModel::onRefMoved(RM::Repo* repo, RM::Ref* ref) +void HistoryModel::onRefMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { Q_UNUSED( ref ); + #if 0 // ###REPOMAN if ( !repo || (repo->gitLoadedRepo() != mRepo) ) { return; } + #endif scanInlineReferences(); } diff --git a/Modules/History/HistoryModel.h b/Modules/History/HistoryModel.h index 39e4875d..606f1ae8 100644 --- a/Modules/History/HistoryModel.h +++ b/Modules/History/HistoryModel.h @@ -30,8 +30,11 @@ namespace RM { - class Ref; - class Repo; + namespace Frontend + { + class Reference; + class Repo; + } } class HistoryModel : public QAbstractTableModel @@ -114,9 +117,9 @@ private slots: void beforeAppend(); void afterAppend(); - void onRefCreated(RM::Repo* repo, RM::Ref* ref); - void onRefDestroyed(RM::Repo* repo, RM::Ref* ref); - void onRefMoved(RM::Repo*repo, RM::Ref*ref); + void onRefCreated (const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void onRefDestroyed(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void onRefMoved (const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); private: InlineRefDisplays mDisplays; diff --git a/Modules/History/HistoryView.cpp b/Modules/History/HistoryView.cpp index cd656611..fdd981fe 100644 --- a/Modules/History/HistoryView.cpp +++ b/Modules/History/HistoryView.cpp @@ -31,7 +31,7 @@ #include "libMacGitverCore/App/MacGitver.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Repo.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" #include "HistoryView.h" #include "HistoryEntry.h" @@ -73,13 +73,14 @@ HistoryView::HistoryView() this, &HistoryView::repoActivated); } -void HistoryView::repoActivated(RM::Repo* repo) +void HistoryView::repoActivated(const RM::Frontend::Repo& repo) { if (mRepo != repo) { mRepo = repo; - Git::Repository repo = mRepo->gitRepo(); + #if 0 // ###REPOMAN + Git::Repository repo = mRepo.gitRepo(); if (mModel) { mList->setModel(NULL); @@ -104,6 +105,7 @@ void HistoryView::repoActivated(RM::Repo* repo) mModel->buildHistory(); mList->setModel(mModel); } + #endif } } diff --git a/Modules/History/HistoryView.h b/Modules/History/HistoryView.h index 10c64071..efd0239f 100644 --- a/Modules/History/HistoryView.h +++ b/Modules/History/HistoryView.h @@ -33,10 +33,7 @@ class QToolBar; #include "HistoryModel.h" -namespace RM -{ - class Repo; -} +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" class HistoryDetails; class HistoryList; @@ -53,7 +50,7 @@ class HistoryView : public BlueSky::View, HistoryView(); private slots: - void repoActivated(RM::Repo* repo); + void repoActivated(const RM::Frontend::Repo& repo); void currentCommitChanged(const Git::ObjectId& sha1); void onChangeShowLocalBranches(bool checked); @@ -78,7 +75,7 @@ private slots: HistoryList* mList; HistoryDetails* mDetails; HistoryDiff* mDiff; - RM::Repo* mRepo; + RM::Frontend::Repo mRepo; }; #endif diff --git a/Modules/RefsViews/Branches/BranchesModel.cpp b/Modules/RefsViews/Branches/BranchesModel.cpp index 8cd44d53..f6af1f42 100644 --- a/Modules/RefsViews/Branches/BranchesModel.cpp +++ b/Modules/RefsViews/Branches/BranchesModel.cpp @@ -16,21 +16,19 @@ * */ -#include -#include +#include "BranchesModel.hpp" #include "libMacGitverCore/App/MacGitver.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Ref.hpp" -#include "libMacGitverCore/RepoMan/RefTreeNode.hpp" -#include "libMacGitverCore/RepoMan/Branch.hpp" -#include "libMacGitverCore/RepoMan/Remote.hpp" -#include "libMacGitverCore/RepoMan/CollectionNode.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Reference.hpp" +#include "libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Branch.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Remote.hpp" #include "libGitWrap/Result.hpp" -#include "BranchesModel.hpp" - +#include +#include BranchesModel::BranchesModel( BranchesViewData* parent ) : QAbstractItemModel( parent ) @@ -40,7 +38,7 @@ BranchesModel::BranchesModel( BranchesViewData* parent ) , mHeaderRemote( NULL ) , mHeaderTags( NULL ) { - RM::RepoMan& rm = MacGitver::repoMan(); + RM::RepoMan& rm = RM::RepoMan::instance(); connect(&rm, &RM::RepoMan::refCreated, this, &BranchesModel::onRefCreated); @@ -76,15 +74,14 @@ QModelIndex BranchesModel::itemToIndex(RefItem* item) const return createIndex( row, 0, item ); } -QModelIndex BranchesModel::objectToIndex(RM::Base* obj) const +QModelIndex BranchesModel::objectToIndex(const RM::Frontend::Base& obj) const { return itemToIndex(mObjToItems.value(obj, NULL)); } -int BranchesModel::rowCount( const QModelIndex& parent ) const +int BranchesModel::rowCount(const QModelIndex& parent) const { - if( parent.column() > 0 ) - { + if (parent.column() > 0) { return 0; } @@ -92,17 +89,19 @@ int BranchesModel::rowCount( const QModelIndex& parent ) const return parentItem->children.count(); } -int BranchesModel::columnCount( const QModelIndex& parent ) const +int BranchesModel::columnCount(const QModelIndex& parent) const { return 1; } -QVariant BranchesModel::data( const QModelIndex& index, int role ) const +QVariant BranchesModel::data(const QModelIndex& index, int role) const { RefItem* item = indexToItem(index); + if (index.column() != 0) { return QVariant(); } + return item ? item->data(role) : QVariant(); } @@ -178,15 +177,15 @@ RefItem* BranchesModel::link(bool notify, RefItem* it) return it; } -RefItem* BranchesModel::createBranchItem(bool notify, RefItem* parent, RM::Branch* obj) +RefItem* BranchesModel::createBranchItem(bool notify, RefItem* parent, const RM::Frontend::Branch& obj) { - if (obj->name() == QStringLiteral("HEAD")) { - return NULL; + if (obj.name() == QStringLiteral("HEAD")) { + return nullptr; } - if (!parent && obj->parentObject()->objType() != RM::ObjTypes::CollectionNode) { - parent = insertObject(notify, obj->parentObject()); - return NULL; + if (!parent /* && obj.parent().objType() != RM::ObjTypes::CollectionNode */) { // ###REPOMAN + parent = insertObject(notify, obj.parent()); + return nullptr; } if (!parent) { @@ -196,10 +195,10 @@ RefItem* BranchesModel::createBranchItem(bool notify, RefItem* parent, RM::Branc return link(notify, new RefBranch(parent, obj)); } -RefItem* BranchesModel::createTagItem(bool notify, RefItem* parent, RM::Tag* obj) +RefItem* BranchesModel::createTagItem(bool notify, RefItem* parent, const RM::Frontend::Tag& obj) { - if (!parent && obj->parentObject()->objType() != RM::ObjTypes::CollectionNode) { - parent = insertObject(notify, obj->parentObject()); + if (!parent /* && obj->parentObject()->objType() != RM::ObjTypes::CollectionNode */) { // ###REPOMAN + parent = insertObject(notify, obj.parent()); return NULL; } @@ -210,23 +209,25 @@ RefItem* BranchesModel::createTagItem(bool notify, RefItem* parent, RM::Tag* obj return link(notify, new RefTag(parent, obj)); } -RefItem* BranchesModel::createScopeItem(bool notify, RefItem* parent, RM::RefTreeNode* obj) +RefItem* BranchesModel::createScopeItem(bool notify, RefItem* parent, const RM::Frontend::RefTreeNode& obj) { if (!parent) { - RM::Base* parObj = obj->parentObject(); + RM::Frontend::Base parObj = obj.parent(); + + #if 0 // ###REPOMAN if (parObj->objType() != RM::ObjTypes::CollectionNode) { parent = insertObject(notify, parObj); - return NULL; + return nullptr; } - RM::CollectionNode* cn = static_cast(parObj); + RM::Frontend::CollectionNode* cn = static_cast(parObj); switch (cn->collectionType()) { - case RM::ctTags: + case RM::Frontend::ctTags: parent = mHeaderTags; break; - case RM::ctBranches: + case RM::Frontend::ctBranches: parent = mHeaderLocal; break; @@ -234,12 +235,13 @@ RefItem* BranchesModel::createScopeItem(bool notify, RefItem* parent, RM::RefTre // Should we assert here? return NULL; } + #endif } return link(notify, new RefScope(parent, obj)); } -RefItem* BranchesModel::createRemoteItem(bool notify, RefItem* parent, RM::Remote* obj) +RefItem* BranchesModel::createRemoteItem(bool notify, RefItem* parent, const RM::Frontend::Remote& obj) { if (!parent) { parent = mHeaderRemote; @@ -248,35 +250,36 @@ RefItem* BranchesModel::createRemoteItem(bool notify, RefItem* parent, RM::Remot return link(notify, new RefRemote(parent, obj)); } -RefItem* BranchesModel::insertObject(bool notify, RM::Base* obj) +RefItem* BranchesModel::insertObject(bool notify, const RM::Frontend::Base& obj) { if (!obj) { return NULL; } - qDebug() << obj->displayName(); + qDebug() << obj.displayName(); bool doChildren = false; - RefItem* parent = mObjToItems.value(obj->parentObject(), NULL); + RefItem* parent = mObjToItems.value(obj.parent(), NULL); RefItem* it = mObjToItems.value(obj, NULL); if (!it) { - switch (obj->objType()) { + + switch (obj.objType()) { case RM::ObjTypes::Branch: - it = createBranchItem(notify, parent, static_cast(obj)); + it = createBranchItem(notify, parent, obj.as()); break; case RM::ObjTypes::Tag: - it = createTagItem(notify, parent, static_cast(obj)); + it = createTagItem(notify, parent, obj.as()); break; case RM::ObjTypes::RefTreeNode: - it = createScopeItem(notify, parent, static_cast(obj)); + it = createScopeItem(notify, parent, obj.as()); doChildren = true; break; case RM::ObjTypes::Remote: - it = createRemoteItem(notify, parent, static_cast(obj)); + it = createRemoteItem(notify, parent, obj.as()); doChildren = true; break; @@ -290,7 +293,7 @@ RefItem* BranchesModel::insertObject(bool notify, RM::Base* obj) mItemToObjs.insert(it, obj); if (doChildren) { - foreach(RM::Base* child, obj->childObjects()) { + foreach(RM::Frontend::Base child, obj.children()) { insertObject(notify, child); } } @@ -299,14 +302,14 @@ RefItem* BranchesModel::insertObject(bool notify, RM::Base* obj) return it; } -void BranchesModel::insertCollection(RM::CollectionNode* coll) +void BranchesModel::insertCollection(RM::Frontend::CollectionNode* coll) { - foreach(RM::Base* obj, coll->childObjects()) { + foreach(RM::Frontend::Base* obj, coll->childObjects()) { insertObject(false, obj); } } -void BranchesModel::updatedObject(RM::Base* obj) +void BranchesModel::updatedObject(RM::Frontend::Base* obj) { RefItem* it = mObjToItems.value(obj, NULL); if (!it) { @@ -334,7 +337,7 @@ void BranchesModel::deleteItem(RefItem* it) beginRemoveRows(itemToIndex(parent), pos, pos); - RM::Base* obj = it->object(); + RM::Frontend::Base* obj = it->object(); if (obj) { mObjToItems.remove(obj); mItemToObjs.remove(it); @@ -345,12 +348,12 @@ void BranchesModel::deleteItem(RefItem* it) endRemoveRows(); } -void BranchesModel::deletedObject(RM::Base* obj) +void BranchesModel::deletedObject(RM::Frontend::Base* obj) { deleteItem(mObjToItems.value(obj, NULL)); } -void BranchesModel::setRepository(RM::Repo* repo) +void BranchesModel::setRepository(RM::Frontend::Repo* repo) { if (mRepo == repo) { return; @@ -374,14 +377,14 @@ void BranchesModel::setRepository(RM::Repo* repo) insertCollection(mRepo->branches()); insertCollection(mRepo->tags()); - foreach (RM::Remote* rmRemote, repo->childObjects()) { + foreach (RM::Frontend::Remote* rmRemote, repo->childObjects()) { insertObject(false, rmRemote); } endResetModel(); } -void BranchesModel::onRefCreated(RM::Repo* repo, RM::Ref* ref) +void BranchesModel::onRefCreated(RM::Frontend::Repo* repo, RM::Frontend::Ref* ref) { if (repo != mRepo) { return; @@ -390,7 +393,7 @@ void BranchesModel::onRefCreated(RM::Repo* repo, RM::Ref* ref) insertObject(true, ref); } -void BranchesModel::onRefDestroyed(RM::Repo* repo, RM::Ref* ref) +void BranchesModel::onRefDestroyed(RM::Frontend::Repo* repo, RM::Frontend::Ref* ref) { if (repo != mRepo) { return; @@ -399,7 +402,7 @@ void BranchesModel::onRefDestroyed(RM::Repo* repo, RM::Ref* ref) deletedObject(ref); } -void BranchesModel::onRefTreeNodeAboutToBeDeleted(RM::Repo* repo, RM::RefTreeNode* obj) +void BranchesModel::onRefTreeNodeAboutToBeDeleted(RM::Frontend::Repo* repo, RM::Frontend::RefTreeNode* obj) { if (repo != mRepo) { return; @@ -408,7 +411,7 @@ void BranchesModel::onRefTreeNodeAboutToBeDeleted(RM::Repo* repo, RM::RefTreeNod deletedObject(obj); } -void BranchesModel::onRefMoved(RM::Repo* repo, RM::Ref* ref) +void BranchesModel::onRefMoved(RM::Frontend::Repo* repo, RM::Frontend::Ref* ref) { if (repo != mRepo) { return; diff --git a/Modules/RefsViews/Branches/BranchesModel.hpp b/Modules/RefsViews/Branches/BranchesModel.hpp index 87956ba8..895fef79 100644 --- a/Modules/RefsViews/Branches/BranchesModel.hpp +++ b/Modules/RefsViews/Branches/BranchesModel.hpp @@ -19,20 +19,16 @@ #ifndef MGV_BRANCHES_MODEL_HPP #define MGV_BRANCHES_MODEL_HPP -#include +#include "Branches/BranchesViewData.hpp" +#include "RefItem.hpp" + +#include "libMacGitverCore/RepoMan/Frontend/Branch.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" #include "libGitWrap/Reference.hpp" #include "libGitWrap/Repository.hpp" -#include "Branches/BranchesViewData.hpp" -#include "RefItem.hpp" - -namespace RM -{ - class Ref; - class Repo; - class CollectionNode; -} +#include class RefItem; class RefScope; @@ -61,37 +57,37 @@ class BranchesModel : public QAbstractItemModel void gitError( const Git::Result& error ); private slots: - void onRefCreated(RM::Repo* repo, RM::Ref* ref); - void onRefDestroyed(RM::Repo* repo, RM::Ref* ref); - void onRefMoved(RM::Repo* repo, RM::Ref* ref); - void onRefTreeNodeAboutToBeDeleted(RM::Repo* repo, RM::RefTreeNode* obj); + void onRefCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void onRefDestroyed(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void onRefMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void onRefTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& obj); private: QModelIndex itemToIndex(RefItem* item) const; - QModelIndex objectToIndex(RM::Base* obj) const; + QModelIndex objectToIndex(const RM::Frontend::Base& obj) const; RefItem* link(bool notify, RefItem* it); - void insertCollection(RM::CollectionNode* coll); - RefItem* insertObject(bool notify, RM::Base* obj); - RefItem* createBranchItem(bool notify, RefItem* parent, RM::Branch* obj); - RefItem* createTagItem(bool notify, RefItem* parent, RM::Tag* obj); - RefItem* createScopeItem(bool notify, RefItem* parent, RM::RefTreeNode* obj); - RefItem* createRemoteItem(bool notify, RefItem* parent, RM::Remote* obj); - - void updatedObject(RM::Base* obj); - void deletedObject(RM::Base* obj); + //void insertCollection(RM::CollectionNode* coll); + RefItem* insertObject(bool notify, const RM::Frontend::Base& obj); + RefItem* createBranchItem(bool notify, RefItem* parent, const RM::Frontend::Branch& obj); + RefItem* createTagItem(bool notify, RefItem* parent, const RM::Frontend::Tag& obj); + RefItem* createScopeItem(bool notify, RefItem* parent, const RM::Frontend::RefTreeNode& obj); + RefItem* createRemoteItem(bool notify, RefItem* parent, const RM::Frontend::Remote& obj); + + void updatedObject(const RM::Frontend::Base& obj); + void deletedObject(const RM::Frontend::Base& obj); void deleteItem(RefItem* it); private: - RM::Repo* mRepo; + RM::Frontend::Repo mRepo; RefRoot* mRoot; RefHeadline* mHeaderLocal; RefHeadline* mHeaderRemote; RefHeadline* mHeaderTags; - QHash mObjToItems; - QHash mItemToObjs; + QHash mObjToItems; + QHash mItemToObjs; }; #endif diff --git a/Modules/RefsViews/Branches/RefItem.cpp b/Modules/RefsViews/Branches/RefItem.cpp index dda9f28e..3c607cc3 100644 --- a/Modules/RefsViews/Branches/RefItem.cpp +++ b/Modules/RefsViews/Branches/RefItem.cpp @@ -47,9 +47,9 @@ RefItem::~RefItem() qDeleteAll( children ); } -RM::Base* RefItem::object() +RM::Frontend::Base RefItem::object() { - return NULL; + return nullptr; } int RefItem::itemPosition() @@ -140,7 +140,7 @@ QVariant RefBranch::data(int role) const switch (role) { case Qt::FontRole: - if (object()->isHead()) { + if (object().isHead()) { QFont f; f.setBold( true ); return f; @@ -175,7 +175,7 @@ QVariant RefTag::data(int role) const switch (role) { case Qt::EditRole: - return object()->name(); + return object().name(); } return RefItemObject::data(role); diff --git a/Modules/RefsViews/Branches/RefItem.hpp b/Modules/RefsViews/Branches/RefItem.hpp index 8ce32359..0ebb5bdb 100644 --- a/Modules/RefsViews/Branches/RefItem.hpp +++ b/Modules/RefsViews/Branches/RefItem.hpp @@ -22,25 +22,16 @@ #include "libHeavenIcons/Icon.hpp" -#include "libMacGitverCore/RepoMan/RefTreeNode.hpp" -#include "libMacGitverCore/RepoMan/Ref.hpp" -#include "libMacGitverCore/RepoMan/Branch.hpp" -#include "libMacGitverCore/RepoMan/Tag.hpp" -#include "libMacGitverCore/RepoMan/Remote.hpp" +#include "libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Reference.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Branch.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Tag.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Remote.hpp" #include #include #include -namespace RM -{ - class Base; - class Ref; - class Branch; - class RefTreeNode; - class Namespace; -} - class BranchesModel; class RefItem @@ -74,7 +65,7 @@ class RefItem public: int itemPosition(); virtual ItemType type() const = 0; - virtual RM::Base* object(); + virtual RM::Frontend::Base object(); public: RefItem* parent; @@ -118,28 +109,30 @@ template class RefItemObject : public RefItem { protected: - RefItemObject(RefItem* parent, T* object) + RefItemObject(RefItem* parent, const T& object) : RefItem(parent) , mObject(object) {} public: - const T* object() const { + const T& object() const { return mObject; } - T* object() { + #if 0 // ###REPOMAN got unsafe now, right? + T& object() { return mObject; } + #endif QVariant data(int role) const { if (mObject) { switch (role) { case Qt::DisplayRole: - return mObject->displayName(); + return mObject.displayName(); case Qt::DecorationRole: - Heaven::IconRef iref = mObject->icon(true); + Heaven::IconRef iref = mObject.icon(true); Heaven::Icon icon = iref.icon(); return icon.pixmap(); } @@ -148,16 +141,16 @@ class RefItemObject : public RefItem } protected: - T* mObject; + T mObject; }; -class RefScope : public RefItemObject +class RefScope : public RefItemObject { public: enum { StaticType = Scope }; public: - RefScope(RefItem* parent, RM::RefTreeNode* obj) + RefScope(RefItem* parent, const RM::Frontend::RefTreeNode& obj) : RefItemObject(parent, obj) {} @@ -176,13 +169,13 @@ class RefNameSpace : public RefScope ItemType type() const; }; -class RefRemote : public RefItemObject +class RefRemote : public RefItemObject { public: enum { StaticType = Remote }; public: - RefRemote(RefItem* parent, RM::Remote* remote) + RefRemote(RefItem* parent, const RM::Frontend::Remote& remote) : RefItemObject(parent, remote) { } @@ -191,13 +184,13 @@ class RefRemote : public RefItemObject ItemType type() const; }; -class RefBranch : public RefItemObject +class RefBranch : public RefItemObject { public: enum { StaticType = Branch }; public: - RefBranch(RefItem* parent, RM::Branch* branch) + RefBranch(RefItem* parent, const RM::Frontend::Branch& branch) : RefItemObject(parent, branch) { } @@ -208,13 +201,13 @@ class RefBranch : public RefItemObject }; -class RefTag : public RefItemObject +class RefTag : public RefItemObject { public: enum { StaticType = Tag }; public: - RefTag(RefItem* parent, RM::Tag* tag) + RefTag(RefItem* parent, const RM::Frontend::Tag& tag) : RefItemObject(parent, tag) { } diff --git a/Modules/RefsViews/RefRenameDialog.cpp b/Modules/RefsViews/RefRenameDialog.cpp index cd111d29..0b5f7688 100644 --- a/Modules/RefsViews/RefRenameDialog.cpp +++ b/Modules/RefsViews/RefRenameDialog.cpp @@ -24,10 +24,10 @@ #include "libGitWrap/RefName.hpp" -#include "libMacGitverCore/RepoMan/Branch.hpp" -#include "libMacGitverCore/RepoMan/Repo.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Branch.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" -RefRenameDialog::RefRenameDialog(const Git::Reference &ref, RM::Repo* repo) +RefRenameDialog::RefRenameDialog(const Git::Reference &ref, const RM::Frontend::Repo& repo) : BlueSky::Dialog() , mRef(ref) , mRepo(repo) @@ -64,7 +64,9 @@ void RefRenameDialog::accept() mRef.rename(mGitResult, newRefName); if (mGitResult) { - mRepo->refresh(); + // ###REPOMAN When making this a service, we need to refresh (but all services need to + // do that). + //mRepo->refresh(); QDialog::accept(); return; } diff --git a/Modules/RefsViews/RefRenameDialog.hpp b/Modules/RefsViews/RefRenameDialog.hpp index 79e554e5..08d08136 100644 --- a/Modules/RefsViews/RefRenameDialog.hpp +++ b/Modules/RefsViews/RefRenameDialog.hpp @@ -23,7 +23,7 @@ #include "libGitWrap/Result.hpp" #include "libGitWrap/Reference.hpp" -#include "libMacGitverCore/RepoMan/Repo.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" #include "ui_RefRenameDialog.h" @@ -33,7 +33,7 @@ class RefRenameDialog { Q_OBJECT public: - RefRenameDialog(const Git::Reference& ref, RM::Repo* repo); + RefRenameDialog(const Git::Reference& ref, const RM::Frontend::Repo& repo); const Git::Result &gitResult() const; @@ -41,7 +41,7 @@ private slots: void accept(); private: - Git::Result mGitResult; - Git::Reference mRef; - RM::Repo* mRepo; + Git::Result mGitResult; + Git::Reference mRef; + RM::Frontend::Repo mRepo; }; diff --git a/Modules/RepoManLogger/Listener.cpp b/Modules/RepoManLogger/Listener.cpp index 5c223b55..2542f219 100644 --- a/Modules/RepoManLogger/Listener.cpp +++ b/Modules/RepoManLogger/Listener.cpp @@ -17,10 +17,10 @@ * */ -#include "libMacGitverCore/RepoMan/Repo.hpp" -#include "libMacGitverCore/RepoMan/Tag.hpp" -#include "libMacGitverCore/RepoMan/Branch.hpp" -#include "libMacGitverCore/RepoMan/Submodule.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Tag.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Branch.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Submodule.hpp" #include "Listener.hpp" #include "TemplateNames.hpp" @@ -36,180 +36,180 @@ Listener::~Listener() RM::Events::delReceiver(this); } -void Listener::repositoryOpened(RM::Repo* repo) +void Listener::repositoryOpened(const RM::Frontend::Repo& repo) { Log::Event e = Log::Event::create(TMPL_REPO_ACTIVITY); Q_ASSERT(e); e.setParam(QStringLiteral("Action"), tr("opened")); - e.setParam(QStringLiteral("RepoName"), repo->displayAlias()); + e.setParam(QStringLiteral("RepoName"), repo.displayAlias()); repoManChannel.addEvent(e); } -void Listener::repositoryAboutToClose(RM::Repo* repo) +void Listener::repositoryAboutToClose(const RM::Frontend::Repo& repo) { Log::Event e = Log::Event::create(TMPL_REPO_ACTIVITY); Q_ASSERT(e); e.setParam(QStringLiteral("Action"), tr("closed")); - e.setParam(QStringLiteral("RepoName"), repo->displayAlias()); + e.setParam(QStringLiteral("RepoName"), repo.displayAlias()); repoManChannel.addEvent(e); } -void Listener::repositoryActivated(RM::Repo* repo) +void Listener::repositoryActivated(const RM::Frontend::Repo& repo) { Log::Event e = Log::Event::create(TMPL_REPO_ACTIVITY); Q_ASSERT(e); e.setParam(QStringLiteral("Action"), tr("activated")); - e.setParam(QStringLiteral("RepoName"), repo->displayAlias()); + e.setParam(QStringLiteral("RepoName"), repo.displayAlias()); repoManChannel.addEvent(e); } -void Listener::repositoryDeactivated(RM::Repo* repo) +void Listener::repositoryDeactivated(const RM::Frontend::Repo& repo) { // We don't want to report deactivation } -void Listener::objectCreated(RM::Repo* repo, RM::Base* object) +void Listener::objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) { } -void Listener::objectAboutToBeDeleted(RM::Repo* repo, RM::Base* object) +void Listener::objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) { } -void Listener::refTreeNodeCreated(RM::Repo* repo, RM::RefTreeNode* node) +void Listener::refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) { } -void Listener::refTreeNodeAboutToBeDeleted(RM::Repo* repo, RM::RefTreeNode* node) +void Listener::refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) { } -void Listener::refCreated(RM::Repo* repo, RM::Ref* ref) +void Listener::refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { } -void Listener::refAboutToBeDeleted(RM::Repo* repo, RM::Ref* ref) +void Listener::refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { } -void Listener::refMoved(RM::Repo* repo, RM::Ref* ref) +void Listener::refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { } -void Listener::refHeadDetached(RM::Repo* repo, RM::Ref* ref) +void Listener::refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { } -void Listener::tagCreated(RM::Repo* repo, RM::Tag* tag) +void Listener::tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) { Log::Event e = Log::Event::create(TMPL_FOUND_NEW_REF); Q_ASSERT(e); e.setParam(QStringLiteral("Type"), tr("tag")); - e.setParam(QStringLiteral("ObjName"), tag->displayName()); - e.setParam(QStringLiteral("SHA"), tag->displaySha1()); - e.setParam(QStringLiteral("RepoName"), repo->displayAlias()); + e.setParam(QStringLiteral("ObjName"), tag.displayName()); + e.setParam(QStringLiteral("SHA"), tag.displaySha1()); + e.setParam(QStringLiteral("RepoName"), repo.displayAlias()); repoManChannel.addEvent(e); } -void Listener::tagAboutToBeDeleted(RM::Repo* repo, RM::Tag* tag) +void Listener::tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) { } -void Listener::branchCreated(RM::Repo* repo, RM::Branch* branch) +void Listener::branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) { } -void Listener::branchAboutToBeDeleted(RM::Repo* repo, RM::Branch* branch) +void Listener::branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) { } -void Listener::branchMoved(RM::Repo* repo, RM::Branch* branch) +void Listener::branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) { Log::Event e = Log::Event::create(TMPL_BRANCH_MOVED); Q_ASSERT(e); - e.setParam(QStringLiteral("ObjName"), branch->displayName()); - e.setParam(QStringLiteral("SHA"), branch->displaySha1()); - e.setParam(QStringLiteral("RepoName"), repo->displayAlias()); + e.setParam(QStringLiteral("ObjName"), branch.displayName()); + e.setParam(QStringLiteral("SHA"), branch.displaySha1()); + e.setParam(QStringLiteral("RepoName"), repo.displayAlias()); repoManChannel.addEvent(e); } -void Listener::branchUpstreamChanged(RM::Repo* repo, RM::Branch* branch) +void Listener::branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) { } -void Listener::namespaceCreated(RM::Repo* repo, RM::Namespace* nameSpace) +void Listener::namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) { } -void Listener::namespaceAboutToBeDeleted(RM::Repo* repo, RM::Namespace* nameSpace) +void Listener::namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) { } -void Listener::refLogChanged(RM::Repo* repo, RM::RefLog* reflog) +void Listener::refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) { } -void Listener::refLogNewEntry(RM::Repo* repo, RM::RefLog* reflog) +void Listener::refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) { } -void Listener::stageCreated(RM::Repo* repo, RM::Ref* ref) +void Listener::stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { } -void Listener::stageAboutToBeDeleted(RM::Repo* repo, RM::Ref* ref) +void Listener::stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) { } -void Listener::remoteCreated(RM::Repo* repo, RM::Remote* remote) +void Listener::remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) { } -void Listener::remoteAboutToBeDeleted(RM::Repo* repo, RM::Remote* remote) +void Listener::remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) { } -void Listener::remoteModified(RM::Repo* repo, RM::Remote* remote) +void Listener::remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) { } -void Listener::submoduleCreated(RM::Repo* repo, RM::Submodule* submodule) +void Listener::submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) { Log::Event e = Log::Event::create(TMPL_FOUND_NEW_SM); Q_ASSERT(e); - e.setParam(QStringLiteral("ObjName"), submodule->displayName()); - e.setParam(QStringLiteral("RepoName"), repo->displayAlias()); + e.setParam(QStringLiteral("ObjName"), submodule.displayName()); + e.setParam(QStringLiteral("RepoName"), repo.displayAlias()); repoManChannel.addEvent(e); } -void Listener::submoduleAboutToBeDeleted(RM::Repo* repo, RM::Submodule* submodule) +void Listener::submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) { } -void Listener::submoduleMoved(RM::Repo* repo, RM::Submodule* submodule) +void Listener::submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) { } -void Listener::repositoryStateChanged(RM::Repo* repo) +void Listener::repositoryStateChanged(const RM::Frontend::Repo& repo) { } -void Listener::indexUpdated(RM::Repo* repo) +void Listener::indexUpdated(const RM::Frontend::Repo& repo) { } -void Listener::workTreeUpdated(RM::Repo* repo) +void Listener::workTreeUpdated(const RM::Frontend::Repo& repo) { } diff --git a/Modules/RepoManLogger/Listener.hpp b/Modules/RepoManLogger/Listener.hpp index 2652dac4..6648d41d 100644 --- a/Modules/RepoManLogger/Listener.hpp +++ b/Modules/RepoManLogger/Listener.hpp @@ -35,39 +35,39 @@ class Listener : public RM::EventsInterface ~Listener(); public: - void repositoryOpened(RM::Repo* repo); - void repositoryAboutToClose(RM::Repo* repo); - void repositoryActivated(RM::Repo* repo); - void repositoryDeactivated(RM::Repo* repo); - void objectCreated(RM::Repo* repo, RM::Base* object); - void objectAboutToBeDeleted(RM::Repo* repo, RM::Base* object); - void refTreeNodeCreated(RM::Repo* repo, RM::RefTreeNode* node); - void refTreeNodeAboutToBeDeleted(RM::Repo* repo, RM::RefTreeNode* node); - void refCreated(RM::Repo* repo, RM::Ref* ref); - void refAboutToBeDeleted(RM::Repo* repo, RM::Ref* ref); - void refMoved(RM::Repo* repo, RM::Ref* ref); - void refHeadDetached(RM::Repo* repo, RM::Ref* ref); - void tagCreated(RM::Repo* repo, RM::Tag* tag); - void tagAboutToBeDeleted(RM::Repo* repo, RM::Tag* tag); - void branchCreated(RM::Repo* repo, RM::Branch* branch); - void branchAboutToBeDeleted(RM::Repo* repo, RM::Branch* branch); - void branchMoved(RM::Repo* repo, RM::Branch* branch); - void branchUpstreamChanged(RM::Repo* repo, RM::Branch* branch); - void namespaceCreated(RM::Repo* repo, RM::Namespace* nameSpace); - void namespaceAboutToBeDeleted(RM::Repo* repo, RM::Namespace* nameSpace); - void refLogChanged(RM::Repo* repo, RM::RefLog* reflog); - void refLogNewEntry(RM::Repo* repo, RM::RefLog* reflog); - void stageCreated(RM::Repo* repo, RM::Ref* ref); - void stageAboutToBeDeleted(RM::Repo* repo, RM::Ref* ref); - void remoteCreated(RM::Repo* repo, RM::Remote* remote); - void remoteAboutToBeDeleted(RM::Repo* repo, RM::Remote* remote); - void remoteModified(RM::Repo* repo, RM::Remote* remote); - void submoduleCreated(RM::Repo* repo, RM::Submodule* submodule); - void submoduleAboutToBeDeleted(RM::Repo* repo, RM::Submodule* submodule); - void submoduleMoved(RM::Repo* repo, RM::Submodule* submodule); - void repositoryStateChanged(RM::Repo* repo); - void indexUpdated(RM::Repo* repo); - void workTreeUpdated(RM::Repo* repo); + void repositoryOpened(const RM::Frontend::Repo& repo); + void repositoryAboutToClose(const RM::Frontend::Repo& repo); + void repositoryActivated(const RM::Frontend::Repo& repo); + void repositoryDeactivated(const RM::Frontend::Repo& repo); + void objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); + void objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); + void refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); + void refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); + void refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); + void tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); + void branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); + void namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); + void namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); + void refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); + void refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); + void stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); + void remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); + void remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); + void remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); + void submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void repositoryStateChanged(const RM::Frontend::Repo& repo); + void indexUpdated(const RM::Frontend::Repo& repo); + void workTreeUpdated(const RM::Frontend::Repo& repo); private: Log::Channel repoManChannel; diff --git a/Modules/Repository/RepoInfoModel.cpp b/Modules/Repository/RepoInfoModel.cpp index eb512740..8c87e1c5 100644 --- a/Modules/Repository/RepoInfoModel.cpp +++ b/Modules/Repository/RepoInfoModel.cpp @@ -14,6 +14,8 @@ * */ +#include "RepoInfoModel.hpp" + #include "libMacGitverCore/App/MacGitver.hpp" #include "libMacGitverCore/Config/Config.h" #include "libMacGitverCore/RepoMan/RepoMan.hpp" @@ -21,54 +23,72 @@ #include "libHeavenIcons/IconRef.hpp" #include "libHeavenIcons/Icon.hpp" -#include "RepoInfoModel.hpp" +struct RepoInfoModel::RepoInfo +{ + RepoInfo(RM::Frontend::Repo&& r) + : mRepo(std::move(r)) + {} + + ~RepoInfo() + { + qDeleteAll(mChildren); + } + + RM::Frontend::Repo mRepo; + RepoInfoModel::RepoInfos mChildren; +}; RepoInfoModel::RepoInfoModel() { - mRepoMan = &MacGitver::repoMan(); + RM::RepoMan& rm = RM::RepoMan::instance(); - connect( mRepoMan, &RM::RepoMan::repositoryDeactivated, - this, &RepoInfoModel::invalidateRepository); + connect( &rm, &RM::RepoMan::repositoryDeactivated, + this, &RepoInfoModel::invalidateRepository); - connect( mRepoMan, &RM::RepoMan::repositoryActivated, - this, &RepoInfoModel::invalidateRepository); + connect( &rm, &RM::RepoMan::repositoryActivated, + this, &RepoInfoModel::invalidateRepository); - connect( mRepoMan, &RM::RepoMan::repositoryOpened, - this, &RepoInfoModel::invalidateRepository); + connect( &rm, &RM::RepoMan::repositoryOpened, + this, &RepoInfoModel::invalidateRepository); +} + +RepoInfoModel::~RepoInfoModel() +{ + qDeleteAll(mRoots); } int RepoInfoModel::rowCount( const QModelIndex& parent ) const { - if( parent.isValid() ) - { - RM::Repo* info = index2Info( parent ); - return info ? info->submodules().count() : 0; + if (parent.isValid()) { + RM::Frontend::Repo info = index2Repo( parent ); + return info ? info.submodules().count() : 0; } - else - { - return mRepoMan->repositories().count(); + else { + return RM::RepoMan::instance().repositories().count(); } } -int RepoInfoModel::columnCount( const QModelIndex& parent ) const +int RepoInfoModel::columnCount(const QModelIndex& parent) const { return 1; } -QVariant RepoInfoModel::data( const QModelIndex& index, int role ) const +QVariant RepoInfoModel::data(const QModelIndex& index, int role) const { - if( !index.isValid() ) return QVariant(); + if (!index.isValid()) { + return QVariant(); + } - RM::Repo* info = index2Info( index ); - if( info ) - { - switch(role) { + RM::Frontend::Repo info = index2Repo(index); + if (info) { + + switch (role) { case Qt::DisplayRole: - return info->displayAlias(); + return info.displayAlias(); case Qt::DecorationRole: { - Heaven::IconRef icon = info->icon().clone(); + Heaven::IconRef icon = info.icon().clone(); QFont f; int size = (f.pixelSize() <= 0) ? f.pointSize() : f.pixelSize(); icon.setSize( qMax(size + 2, 16) ); @@ -79,11 +99,11 @@ QVariant RepoInfoModel::data( const QModelIndex& index, int role ) const { QFont f1, f2; f2.setBold( true ); - return info->isActive() ? f2 : f1; + return info.isActive() ? f2 : f1; } case IsActive: - return info->isActive(); + return info.isActive(); case Qt::ToolTipRole: return trUtf8( @@ -100,75 +120,71 @@ QVariant RepoInfoModel::data( const QModelIndex& index, int role ) const "
Branch: %2
" "" "") - .arg(info->displayName()) - .arg(info->branchDisplay()); + .arg(info.displayName()) + .arg(info.branchDisplay()); } } return QVariant(); } -QModelIndex RepoInfoModel::index( int row, int column, const QModelIndex& parent ) const +QModelIndex RepoInfoModel::index(int row, int column, const QModelIndex& parent) const { Q_UNUSED(column); - RM::Repo::List list; + RM::Frontend::Repo::List list; - if( parent.isValid() ) - { - RM::Repo* infoParent = index2Info( parent ); - if( !infoParent ) - { + if (parent.isValid()) { + + RM::Frontend::Repo repoParent = index2Repo(parent); + + if (!repoParent) { return QModelIndex(); } - foreach (RM::Repo* r, infoParent->submodules()) { - list.append(r); - } + list = repoParent.submodules(); } - else - { - list = mRepoMan->repositories(); + else { + list = RM::RepoMan::instance().repositories(); } - if( row >= list.count() || row < 0 ) - { + if (row >= list.count() || row < 0) { return QModelIndex(); } - return info2Index( list.at( row ) ); + return repo2Index(list.at(row)); } -QModelIndex RepoInfoModel::parent( const QModelIndex& child ) const +QModelIndex RepoInfoModel::parent(const QModelIndex& child) const { - if( !child.isValid() ) - { + if (!child.isValid()) { return QModelIndex(); } - RM::Repo* info = index2Info( child ); - if( !info || !info->parentRepository() ) - { + RM::Frontend::Repo info = index2Repo(child); + + if (!info || !info.parentRepository()) { return QModelIndex(); } - return info2Index( info->parentRepository() ); + return repo2Index(info.parentRepository()); } -RM::Repo* RepoInfoModel::index2Info( const QModelIndex& index ) const +RM::Frontend::Repo RepoInfoModel::index2Repo(const QModelIndex& index) const { - return static_cast< RM::Repo* >( index.internalPointer() ); + RepoInfo* ri = index2info(index); + return ri ? ri->mRepo : RM::Frontend::Repo(); } -QModelIndex RepoInfoModel::info2Index(RM::Repo* info) const +QModelIndex RepoInfoModel::repo2Index(const RM::Frontend::Repo& repo) const { int row = 0; - if( !info ) - { + if (!repo) { return QModelIndex(); } - if( info->parentRepository() ) +#if 0 + if (info->parentRepository()) { RM::Repo::List list = info->parentRepository()->submodules(); // ###REPOMAN Shouldn't this be sorted? @@ -185,18 +201,27 @@ QModelIndex RepoInfoModel::info2Index(RM::Repo* info) const } return createIndex( row, 0, info ); +#endif } -void RepoInfoModel::invalidateRepository(RM::Repo *info) +void RepoInfoModel::invalidateRepository(const RM::Frontend::Repo& info) { - if ( !info ) return; + if (!info) { + return; + } + + QModelIndex index = repo2Index(info); + emit dataChanged(index, index); +} - QModelIndex index = info2Index( info ); - emit dataChanged( index, index ); +RepoInfoModel::RepoInfo* RepoInfoModel::index2info(const QModelIndex& index) const +{ + return nullptr; } -void RepoInfoModel::repositoryOpened(RM::Repo *info) +void RepoInfoModel::repositoryOpened(const RM::Frontend::Repo& info) { +#if 0 if (!info || info->parentRepository()) { return; } @@ -215,11 +240,13 @@ void RepoInfoModel::repositoryOpened(RM::Repo *info) int row = mRepoMan->repositories().count() - 1; emit beginInsertRows(QModelIndex(), row, row); emit endInsertRows(); +#endif } -void RepoInfoModel::repositoryChildAdded(RM::Repo* parent, RM::Repo* child) +void RepoInfoModel::repositoryChildAdded(const RM::Frontend::Repo& parent, const RM::Frontend::Repo& child) { - QModelIndex parentIndex = info2Index(parent); +#if 0 + QModelIndex parentIndex = repo2Index(parent); // we add a row just at the end of the root. This is stupid. But that's the way it works when // a model actually isn't a model... @@ -227,4 +254,5 @@ void RepoInfoModel::repositoryChildAdded(RM::Repo* parent, RM::Repo* child) int row = parent->submodules().count() - 1; emit beginInsertRows(parentIndex, row, row); emit endInsertRows(); +#endif } diff --git a/Modules/Repository/RepoInfoModel.hpp b/Modules/Repository/RepoInfoModel.hpp index 31e261f8..28e71df8 100644 --- a/Modules/Repository/RepoInfoModel.hpp +++ b/Modules/Repository/RepoInfoModel.hpp @@ -14,22 +14,18 @@ * */ -#ifndef MGV_REPO_INFO_MODEL_HPP -#define MGV_REPO_INFO_MODEL_HPP +#pragma once #include -namespace RM -{ - class Repo; - class RepoMan; -} +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" class RepoInfoModel : public QAbstractItemModel { Q_OBJECT public: RepoInfoModel(); + ~RepoInfoModel(); enum ExtraRoles { @@ -37,23 +33,28 @@ class RepoInfoModel : public QAbstractItemModel }; public: - int rowCount( const QModelIndex& parent = QModelIndex() ) const; - int columnCount( const QModelIndex& parent = QModelIndex() ) const; - QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const; - QModelIndex index( int row, int column, const QModelIndex& parent = QModelIndex() ) const; - QModelIndex parent( const QModelIndex& child ) const; + int rowCount(const QModelIndex& parent = QModelIndex()) const; + int columnCount(const QModelIndex& parent = QModelIndex()) const; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; + QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex& child) const; public: - RM::Repo* index2Info( const QModelIndex& index ) const; - QModelIndex info2Index( RM::Repo* info ) const; + RM::Frontend::Repo index2Repo(const QModelIndex& index) const; + QModelIndex repo2Index(const RM::Frontend::Repo& repo) const; -public slots: - void invalidateRepository(RM::Repo* info); - void repositoryOpened(RM::Repo* info); - void repositoryChildAdded(RM::Repo* parent, RM::Repo* child); +private: + struct RepoInfo; + using RepoInfos = QVector; private: - RM::RepoMan* mRepoMan; -}; + RepoInfo* index2info(const QModelIndex& index) const; -#endif +private slots: + void invalidateRepository(const RM::Frontend::Repo& repo); + void repositoryOpened(const RM::Frontend::Repo& repo); + void repositoryChildAdded(const RM::Frontend::Repo& parent, const RM::Frontend::Repo& child); + +private: + RepoInfos mRoots; +}; diff --git a/Modules/Repository/RepoTreeView.cpp b/Modules/Repository/RepoTreeView.cpp index 55b44df5..7d28bc3b 100644 --- a/Modules/Repository/RepoTreeView.cpp +++ b/Modules/Repository/RepoTreeView.cpp @@ -21,7 +21,7 @@ #include "libMacGitverCore/App/MacGitver.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Repo.hpp" +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" #include "RepoTreeView.hpp" #include "RepoInfoModel.hpp" @@ -79,7 +79,8 @@ QModelIndex RepoTreeView::deeplyMapToSource( QModelIndex current ) const void RepoTreeView::contextMenu( const QModelIndex& index, const QPoint& globalPos ) { - RM::Repo* info = mModel->index2Info(deeplyMapToSource(index)); +#if 0 + RM::Repo* info = mModel->index2Repo(deeplyMapToSource(index)); if (info) { Heaven::Menu* menu = info->isSubModule() ? menuCtxMenuSMRepo : menuCtxMenuRepo; @@ -88,23 +89,26 @@ void RepoTreeView::contextMenu( const QModelIndex& index, const QPoint& globalPo menu->showPopup( globalPos ); } +#endif } void RepoTreeView::onCtxActivate() { +#if 0 Heaven::Action* action = qobject_cast< Heaven::Action* >( sender() ); - if( action ) - { + if (action) { RM::Repo* info = qobject_cast< RM::Repo* >( action->activatedBy() ); if( info ) { MacGitver::repoMan().activate( info ); } } +#endif } void RepoTreeView::onCtxClose() { +#if 0 Heaven::Action* action = qobject_cast< Heaven::Action* >( sender() ); if( action ) { @@ -114,10 +118,12 @@ void RepoTreeView::onCtxClose() info->close(); } } +#endif } -void RepoTreeView::onRepoActivated(RM::Repo* repo) +void RepoTreeView::onRepoActivated(const RM::Frontend::Repo& repo) { +#if 0 BlueSky::ContextKeys keys = mkKeys(); keys.set("RepoName", repo->path()); @@ -132,15 +138,18 @@ void RepoTreeView::onRepoActivated(RM::Repo* repo) } setCurrentContext(ctx); +#endif } -void RepoTreeView::onRepoDeactivated(RM::Repo* repo) +void RepoTreeView::onRepoDeactivated(const RM::Frontend::Repo& repo) { +#if 0 RepositoryContext* ctx = qobject_cast< RepositoryContext* >(currentContext()); if (ctx && ctx->repository() == repo) { setCurrentContext( NULL ); } +#endif } BlueSky::ViewContext* RepoTreeView::createContextObject() const diff --git a/Modules/Repository/RepoTreeView.hpp b/Modules/Repository/RepoTreeView.hpp index 5904fdbd..0c9ba394 100644 --- a/Modules/Repository/RepoTreeView.hpp +++ b/Modules/Repository/RepoTreeView.hpp @@ -14,8 +14,7 @@ * */ -#ifndef MGV_REPO_TREE_VIEW_HPP -#define MGV_REPO_TREE_VIEW_HPP +#pragma once #include "libBlueSky/Contexts.hpp" @@ -23,14 +22,11 @@ class QModelIndex; -namespace RM -{ - class Repo; -} - class RepoInfoModel; class TreeViewCtxMenu; +#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" + class RepoTreeView : public BlueSky::ContextView , private RepoTreeViewCtxMenu @@ -50,8 +46,8 @@ private slots: // from mRepos void contextMenu( const QModelIndex& index, const QPoint& globalPos ); private slots: // for MacGitver::repoMan() - void onRepoActivated(RM::Repo* repo); - void onRepoDeactivated(RM::Repo* repo); + void onRepoActivated(const RM::Frontend::Repo& repo); + void onRepoDeactivated(const RM::Frontend::Repo& repo); private: QModelIndex deeplyMapToSource( QModelIndex current ) const; @@ -61,5 +57,3 @@ private slots: // for MacGitver::repoMan() RepoInfoModel* mModel; TreeViewCtxMenu* mRepos; }; - -#endif diff --git a/Modules/Repository/RepositoryModule.cpp b/Modules/Repository/RepositoryModule.cpp index 38a9558f..9b42f664 100644 --- a/Modules/Repository/RepositoryModule.cpp +++ b/Modules/Repository/RepositoryModule.cpp @@ -54,8 +54,8 @@ void RepositoryModule::initialize() mMostRecentlyUsed = configGet( "MRU", QStringList() ); - connect(&MacGitver::repoMan(), SIGNAL(repositoryOpened(RM::Repo*)), - this, SLOT(onCoreRepoOpen(RM::Repo*))); + connect(&RM::RepoMan::instance(), &RM::RepoMan::repositoryOpened, + this, &RepositoryModule::onCoreRepoOpen); updateMostRecentlyUsedMenu(); @@ -117,17 +117,8 @@ void RepositoryModule::onRepositoryOpenHelper() return; } - MacGitver::repoMan().open(repoDir); - - // ###REPOMAN This should move to an eventlistener, which is invoked by RepoMan for every - // opened repository. This will then also boost the priority in the LRU menu for - // repositories opened through it. - - // If we successfully loaded the repository at that directory, - // we store the repository's work dir as "lastUsedDir". - // If it is a bare repository, we store the repository's directory. + RM::RepoMan::instance().open(repoDir); Config::self().set("Repository/lastUsedDir", repoDir); - // repo.isBare() ? repoDir : repo.basePath() ); } void RepositoryModule::onRepositoryClone() @@ -138,17 +129,17 @@ void RepositoryModule::onRepositoryClone() void RepositoryModule::onRecentRepositoryOpen( const QVariant& path ) { QString repoPath = path.toString(); - MacGitver::repoMan().open( repoPath ); + RM::RepoMan::instance().open( repoPath ); } -void RepositoryModule::onCoreRepoOpen(RM::Repo* repo) +void RepositoryModule::onCoreRepoOpen(const RM::Frontend::Repo& repo) { - if( repo->isSubModule() ) + if( repo.isSubModule() ) { return; } - QString path = repo->path(); + QString path = repo.path(); mMostRecentlyUsed.removeAll( path ); mMostRecentlyUsed.prepend( path ); diff --git a/Modules/Repository/RepositoryModule.h b/Modules/Repository/RepositoryModule.h index ac7086b2..b46f3b88 100644 --- a/Modules/Repository/RepositoryModule.h +++ b/Modules/Repository/RepositoryModule.h @@ -26,7 +26,9 @@ namespace RM { - class Repo; + namespace Frontend { + class Repo; + } } class RepositoryModule @@ -63,7 +65,7 @@ private slots: private slots: void onRepositoryOpenHelper(); - void onCoreRepoOpen(RM::Repo* repo); + void onCoreRepoOpen(const RM::Frontend::Repo& repo); private: void updateMostRecentlyUsedMenu(); From 95b72da8c311ad4683ce7156ad75eaf639b2d93c Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sat, 11 Apr 2015 02:09:39 +0100 Subject: [PATCH 50/60] Split off RepoMan & make everything compile at least --- CMakeLists.txt | 1 + Libs/CMakeLists.txt | 2 + Libs/libMacGitverCore/App/MacGitver.cpp | 5 +- .../libMacGitverCore/App/MgvPrimaryWindow.cpp | 4 +- Libs/libMacGitverCore/CMakeLists.txt | 75 +---------- .../MacGitver/AutoRefresher.cpp | 2 +- .../Widgets/RepoStateWidget.cpp | 6 +- .../Widgets/RepoStateWidget.hpp | 2 +- Libs/libRepoMan/CMakeLists.txt | 125 ++++++++++++++++++ .../RepoMan => libRepoMan}/Core.hpp | 8 +- .../RepoMan => libRepoMan}/Data/Base.cpp | 7 +- .../RepoMan => libRepoMan}/Data/Base.hpp | 2 +- .../RepoMan => libRepoMan}/Data/Branch.cpp | 6 +- .../RepoMan => libRepoMan}/Data/Branch.hpp | 4 +- .../RepoMan => libRepoMan}/Data/Head.cpp | 6 +- .../RepoMan => libRepoMan}/Data/Head.hpp | 4 +- .../RepoMan => libRepoMan}/Data/Namespace.cpp | 6 +- .../RepoMan => libRepoMan}/Data/Namespace.hpp | 4 +- .../RepoMan => libRepoMan}/Data/RefLog.cpp | 6 +- .../RepoMan => libRepoMan}/Data/RefLog.hpp | 4 +- .../Data/RefTreeNode.cpp | 6 +- .../Data/RefTreeNode.hpp | 4 +- .../RepoMan => libRepoMan}/Data/Reference.cpp | 8 +- .../RepoMan => libRepoMan}/Data/Reference.hpp | 4 +- .../RepoMan => libRepoMan}/Data/Remote.cpp | 6 +- .../RepoMan => libRepoMan}/Data/Remote.hpp | 4 +- .../RepoMan => libRepoMan}/Data/Repo.cpp | 4 +- .../RepoMan => libRepoMan}/Data/Repo.hpp | 7 +- .../RepoMan => libRepoMan}/Data/RepoMan.hpp | 6 +- .../RepoMan => libRepoMan}/Data/Submodule.cpp | 6 +- .../RepoMan => libRepoMan}/Data/Submodule.hpp | 4 +- .../RepoMan => libRepoMan}/Data/Tag.cpp | 6 +- .../RepoMan => libRepoMan}/Data/Tag.hpp | 4 +- .../RepoMan => libRepoMan}/Events.cpp | 2 +- .../RepoMan => libRepoMan}/Events.hpp | 6 +- .../RepoMan => libRepoMan}/Frontend/Base.cpp | 16 +-- .../RepoMan => libRepoMan}/Frontend/Base.hpp | 4 +- .../Frontend/BaseInternal.hpp | 4 +- .../Frontend/Branch.cpp | 12 +- .../Frontend/Branch.hpp | 8 +- .../RepoMan => libRepoMan}/Frontend/Head.cpp | 10 +- .../RepoMan => libRepoMan}/Frontend/Head.hpp | 4 +- .../Frontend/Namespace.cpp | 8 +- .../Frontend/Namespace.hpp | 4 +- .../Frontend/RefLog.cpp | 6 +- .../Frontend/RefLog.hpp | 4 +- .../Frontend/RefTreeNode.cpp | 8 +- .../Frontend/RefTreeNode.hpp | 4 +- .../Frontend/Reference.cpp | 12 +- .../Frontend/Reference.hpp | 2 +- .../Frontend/Remote.cpp | 10 +- .../Frontend/Remote.hpp | 4 +- .../RepoMan => libRepoMan}/Frontend/Repo.cpp | 32 ++--- .../RepoMan => libRepoMan}/Frontend/Repo.hpp | 4 +- .../Frontend/Submodule.cpp | 6 +- .../Frontend/Submodule.hpp | 4 +- .../RepoMan => libRepoMan}/Frontend/Tag.cpp | 8 +- .../RepoMan => libRepoMan}/Frontend/Tag.hpp | 5 +- .../RepoMan => libRepoMan}/Private/Dumper.cpp | 0 .../RepoMan => libRepoMan}/Private/Dumper.hpp | 0 .../Private/RepoManActions.hid | 0 .../RepoMan => libRepoMan}/RepoMan.cpp | 13 +- .../RepoMan => libRepoMan}/RepoMan.hpp | 6 +- Modules/GitConfig/GitConfigModule.cpp | 3 +- Modules/Logging/LoggingMode.cpp | 3 +- Modules/RepoManLogger/Listener.cpp | 8 +- Modules/RepoManLogger/Listener.hpp | 2 +- Modules/Repository/CreateRepositoryDlg.cpp | 3 +- Modules/Repository/RepoInfoModel.cpp | 3 +- Modules/Repository/RepoInfoModel.hpp | 2 +- Modules/Repository/RepoTreeView.cpp | 3 +- Modules/Repository/RepoTreeView.hpp | 2 +- Modules/Repository/RepositoryModule.cpp | 3 +- 73 files changed, 323 insertions(+), 263 deletions(-) create mode 100644 Libs/libRepoMan/CMakeLists.txt rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Core.hpp (91%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Base.cpp (98%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Base.hpp (99%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Branch.cpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Branch.hpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Head.cpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Head.hpp (96%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Namespace.cpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Namespace.hpp (94%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/RefLog.cpp (94%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/RefLog.hpp (94%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/RefTreeNode.cpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/RefTreeNode.hpp (94%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Reference.cpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Reference.hpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Remote.cpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Remote.hpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Repo.cpp (97%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Repo.hpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/RepoMan.hpp (92%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Submodule.cpp (94%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Submodule.hpp (94%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Tag.cpp (94%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Data/Tag.hpp (94%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Events.cpp (99%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Events.hpp (98%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Base.cpp (95%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Base.hpp (97%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/BaseInternal.hpp (97%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Branch.cpp (88%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Branch.hpp (81%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Head.cpp (91%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Head.hpp (94%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Namespace.cpp (87%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Namespace.hpp (93%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/RefLog.cpp (89%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/RefLog.hpp (92%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/RefTreeNode.cpp (87%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/RefTreeNode.hpp (93%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Reference.cpp (90%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Reference.hpp (98%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Remote.cpp (87%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Remote.hpp (94%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Repo.cpp (91%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Repo.hpp (97%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Submodule.cpp (90%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Submodule.hpp (91%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Tag.cpp (87%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Frontend/Tag.hpp (91%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Private/Dumper.cpp (100%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Private/Dumper.hpp (100%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/Private/RepoManActions.hid (100%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/RepoMan.cpp (96%) rename Libs/{libMacGitverCore/RepoMan => libRepoMan}/RepoMan.hpp (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbed2818..e7e99317 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ ENABLE_TESTING() SET(UTILS_APP_NAME MacGitver) RAD_DEFINE_VERSION(MACGITVER_CORE 0 0 1) +RAD_DEFINE_VERSION(REPOMAN 0 0 1) ADD_SUBDIRECTORY(CfgComp) diff --git a/Libs/CMakeLists.txt b/Libs/CMakeLists.txt index 26912da6..b80fdabd 100644 --- a/Libs/CMakeLists.txt +++ b/Libs/CMakeLists.txt @@ -12,4 +12,6 @@ INCLUDE_DIRECTORIES( BEFORE ADD_SUBDIRECTORY(libLogger) ADD_SUBDIRECTORY(libDiffViews) +ADD_SUBDIRECTORY(libRepoMan) ADD_SUBDIRECTORY(libMacGitverCore) + diff --git a/Libs/libMacGitverCore/App/MacGitver.cpp b/Libs/libMacGitverCore/App/MacGitver.cpp index cbbc8594..f282d30b 100644 --- a/Libs/libMacGitverCore/App/MacGitver.cpp +++ b/Libs/libMacGitverCore/App/MacGitver.cpp @@ -32,11 +32,12 @@ #include "libMacGitverCore/App/MgvPrimaryWindow.hpp" #include "libMacGitverCore/Config/Config.h" #include "libMacGitverCore/Config/Ui/GeneralConfigPage.hpp" -#include "libMacGitverCore/Config/Ui//RepoManConfigPage.hpp" +#include "libMacGitverCore/Config/Ui/RepoManConfigPage.hpp" #include "libMacGitverCore/MacGitver/Modules.h" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" #include "libMacGitverCore/MacGitver/AutoRefresher.hpp" +#include "libRepoMan/RepoMan.hpp" + /** * @class MacGitver * @brief Central core of the MacGitver application diff --git a/Libs/libMacGitverCore/App/MgvPrimaryWindow.cpp b/Libs/libMacGitverCore/App/MgvPrimaryWindow.cpp index 54b77419..bbba0f90 100644 --- a/Libs/libMacGitverCore/App/MgvPrimaryWindow.cpp +++ b/Libs/libMacGitverCore/App/MgvPrimaryWindow.cpp @@ -22,12 +22,12 @@ #include "libMacGitverCore/App/MgvPrimaryWindowPrivate.hpp" #include "libMacGitverCore/MacGitver/Modules.h" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" - #include "libMacGitverCore/Config/Config.h" #include "libMacGitverCore/Config/Ui/ConfigDialog.hpp" #include "libMacGitverCore/Widgets/RepoStateWidget.hpp" +#include "libRepoMan/RepoMan.hpp" + #include "libBlueSky/Application.hpp" #include "libBlueSky/FooterWidget.hpp" diff --git a/Libs/libMacGitverCore/CMakeLists.txt b/Libs/libMacGitverCore/CMakeLists.txt index 76b15eff..9ed93c6a 100644 --- a/Libs/libMacGitverCore/CMakeLists.txt +++ b/Libs/libMacGitverCore/CMakeLists.txt @@ -27,44 +27,6 @@ SET( SRC_FILES MacGitver/GitPatchConsumer.cpp MacGitver/AutoRefresher.cpp - RepoMan/Events.cpp - RepoMan/RepoMan.cpp - - RepoMan/Frontend/Base.cpp - RepoMan/Frontend/Branch.cpp - RepoMan/Frontend/Namespace.cpp - RepoMan/Frontend/Reference.cpp - RepoMan/Frontend/RefLog.cpp - RepoMan/Frontend/RefTreeNode.cpp - RepoMan/Frontend/Remote.cpp - RepoMan/Frontend/Repo.cpp - RepoMan/Frontend/Submodule.cpp - RepoMan/Frontend/Tag.cpp - RepoMan/Frontend/Head.cpp - - RepoMan/Data/Base.cpp - RepoMan/Data/Branch.cpp - RepoMan/Data/Head.cpp - RepoMan/Data/Namespace.cpp - RepoMan/Data/Reference.cpp - RepoMan/Data/RefLog.cpp - RepoMan/Data/RefTreeNode.cpp - RepoMan/Data/Remote.cpp - RepoMan/Data/Repo.cpp - - RepoMan/Data/Branch.cpp - RepoMan/Data/Head.cpp - RepoMan/Data/Namespace.cpp - RepoMan/Data/Reference.cpp - RepoMan/Data/RefLog.cpp - RepoMan/Data/RefTreeNode.cpp - RepoMan/Data/Remote.cpp - RepoMan/Data/Repo.cpp - RepoMan/Data/Submodule.cpp - RepoMan/Data/Tag.cpp - - RepoMan/Private/Dumper.cpp - SHMParser/ShellExpand.cpp Widgets/ExpandableDlg.cpp @@ -97,22 +59,6 @@ SET( PUB_HDR_FILES MacGitver/GitPatchConsumer.hpp MacGitver/IRepositoryContext.hpp - RepoMan/Core.hpp - RepoMan/Events.hpp - RepoMan/RepoMan.hpp - - RepoMan/Frontend/Base.hpp - RepoMan/Frontend/Branch.hpp - RepoMan/Frontend/Head.hpp - RepoMan/Frontend/Namespace.hpp - RepoMan/Frontend/Reference.hpp - RepoMan/Frontend/Repo.hpp - RepoMan/Frontend/Remote.hpp - RepoMan/Frontend/RefLog.hpp - RepoMan/Frontend/RefTreeNode.hpp - RepoMan/Frontend/Submodule.hpp - RepoMan/Frontend/Tag.hpp - SHMParser/ShellExpand.hpp Widgets/ExpandableDlg.hpp @@ -139,26 +85,11 @@ SET( PRI_HDR_FILES Config/Ui/GeneralConfigPage.hpp Config/Ui/RepoManConfigPage.hpp - RepoMan/Private/Dumper.hpp - - RepoMan/Data/Base.hpp - RepoMan/Data/Branch.hpp - RepoMan/Data/Head.hpp - RepoMan/Data/Namespace.hpp - RepoMan/Data/Reference.hpp - RepoMan/Data/RefLog.hpp - RepoMan/Data/RefTreeNode.hpp - RepoMan/Data/Remote.hpp - RepoMan/Data/Repo.hpp - RepoMan/Data/RepoMan.hpp - RepoMan/Data/Tag.hpp - RepoMan/Data/Submodule.hpp - - RepoMan/Frontend/BaseInternal.hpp - Widgets/StringSelectorWidgetPrivate.h Widgets/FlatTreeModelPrivate.h Widgets/RepoStateWidget.hpp + + MacGitver/AutoRefresher.hpp ) SET( UI_FILES @@ -175,7 +106,6 @@ SET( UI_FILES SET( HID_FILES App/MgvPrimaryWindowActions.hid - RepoMan/Private/RepoManActions.hid ) @@ -216,6 +146,7 @@ TARGET_LINK_LIBRARIES( HeavenIcons BlueSky Logger + RepoMan LINK_PRIVATE GitWrap diff --git a/Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp b/Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp index 49a89c22..311a4628 100644 --- a/Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp +++ b/Libs/libMacGitverCore/MacGitver/AutoRefresher.cpp @@ -20,7 +20,7 @@ #include "libMacGitverCore/MacGitver/AutoRefresher.hpp" #include "AutoRefresherCfg.hpp" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" +#include "libRepoMan/RepoMan.hpp" #include #include diff --git a/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp b/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp index 8aa4e6f0..bd26c3d2 100644 --- a/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp +++ b/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp @@ -25,10 +25,10 @@ #include "libHeavenIcons/IconRef.hpp" #include "libHeavenIcons/Icon.hpp" -#include "RepoMan/Frontend/Reference.hpp" -#include "RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Frontend/Reference.hpp" +#include "libRepoMan/Frontend/Repo.hpp" -#include "RepoMan/RepoMan.hpp" +#include "libRepoMan/RepoMan.hpp" #include "RepoStateWidget.hpp" diff --git a/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp b/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp index d65ab3d2..4d6a5bd3 100644 --- a/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp +++ b/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Frontend/Repo.hpp" class QLabel; diff --git a/Libs/libRepoMan/CMakeLists.txt b/Libs/libRepoMan/CMakeLists.txt new file mode 100644 index 00000000..5ae8ec94 --- /dev/null +++ b/Libs/libRepoMan/CMakeLists.txt @@ -0,0 +1,125 @@ + +PROJECT(REPOMAN) + +QT_PREPARE(Core Gui Widgets) + +INCLUDE_DIRECTORIES( BEFORE + ${REPOMAN_SOURCE_DIR} + ${REPOMAN_BINARY_DIR} +) + +SET( SRC_FILES + + Events.cpp + RepoMan.cpp + + Frontend/Base.cpp + Frontend/Branch.cpp + Frontend/Namespace.cpp + Frontend/Reference.cpp + Frontend/RefLog.cpp + Frontend/RefTreeNode.cpp + Frontend/Remote.cpp + Frontend/Repo.cpp + Frontend/Submodule.cpp + Frontend/Tag.cpp + Frontend/Head.cpp + + Data/Base.cpp + Data/Branch.cpp + Data/Namespace.cpp + Data/Reference.cpp + Data/RefLog.cpp + Data/RefTreeNode.cpp + Data/Remote.cpp + Data/Repo.cpp + Data/Submodule.cpp + Data/Tag.cpp + Data/Head.cpp + + Private/Dumper.cpp +) + +SET( PUB_HDR_FILES + + Core.hpp + Events.hpp + RepoMan.hpp + + Frontend/Base.hpp + Frontend/Reference.hpp + Frontend/Repo.hpp + Frontend/Remote.hpp + Frontend/Tag.hpp + Frontend/Branch.hpp + Frontend/RefLog.hpp + Frontend/Submodule.hpp + Frontend/RefTreeNode.hpp + Frontend/Namespace.hpp + Frontend/Head.hpp +) + +SET( PRI_HDR_FILES + + Private/Dumper.hpp + + Data/Base.hpp + Data/Branch.hpp + Data/Namespace.hpp + Data/Reference.hpp + Data/RefLog.hpp + Data/RefTreeNode.hpp + Data/Remote.hpp + Data/Repo.hpp + Data/RepoMan.hpp + Data/Submodule.hpp + Data/Tag.hpp + Data/Head.hpp + + Frontend/BaseInternal.hpp +) + +SET( HID_FILES + + Private/RepoManActions.hid +) + +SET( HDR_FILES ${PRI_HDR_FILES} ${PUB_HDR_FILES} ) + +QT_MOC( MOC_FILES ${HDR_FILES} ) +HIC( HIC_FILES ${HID_FILES} ) + +ADD_QT_LIBRARY( + RepoMan SHARED + + ${SRC_FILES} + ${HDR_FILES} + ${MOC_FILES} + ${HIC_FILES} ${HID_FILES} +) + +TARGET_LINK_LIBRARIES( + RepoMan + + LINK_PUBLIC + HeavenActions + HeavenIcons + BlueSky + + LINK_PRIVATE + GitWrap +) + +IF(UNIX AND NOT APPLE) + SET_TARGET_PROPERTIES( + RepoMan + PROPERTIES INSTALL_RPATH + "\$ORIGIN" + ) +ENDIF() + +RAD_DEFINE_VERSION(REPOMAN 0 0 1) +RAD_SET_TARGET_VERSION( RepoMan REPOMAN ) +RAD_INSTALL_LIBRARY( RepoMan RepoMan ) +RAD_INSTALL_HEADERS( libRepoMan ${PUB_HDR_FILES} ) +RAD_SPLIT_SOURCE_TREE( RepoMan ) diff --git a/Libs/libMacGitverCore/RepoMan/Core.hpp b/Libs/libRepoMan/Core.hpp similarity index 91% rename from Libs/libMacGitverCore/RepoMan/Core.hpp rename to Libs/libRepoMan/Core.hpp index 575d0115..a907ecf2 100644 --- a/Libs/libMacGitverCore/RepoMan/Core.hpp +++ b/Libs/libRepoMan/Core.hpp @@ -24,7 +24,13 @@ #include #include -#include "libMacGitverCore/MacGitverApi.hpp" +#include + +#ifdef RepoMan_EXPORTS +# define REPOMAN_API Q_DECL_EXPORT +#else +# define REPOMAN_API Q_DECL_IMPORT +#endif namespace Heaven { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Base.cpp b/Libs/libRepoMan/Data/Base.cpp similarity index 98% rename from Libs/libMacGitverCore/RepoMan/Data/Base.cpp rename to Libs/libRepoMan/Data/Base.cpp index ebdb735f..c7333e11 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Base.cpp +++ b/Libs/libRepoMan/Data/Base.cpp @@ -17,12 +17,11 @@ * */ -#include "RepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Base.hpp" -#include "RepoMan/Frontend/Base.hpp" -#include "RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Frontend/Repo.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" #include "libHeavenIcons/IconRef.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Data/Base.hpp b/Libs/libRepoMan/Data/Base.hpp similarity index 99% rename from Libs/libMacGitverCore/RepoMan/Data/Base.hpp rename to Libs/libRepoMan/Data/Base.hpp index c7506e5b..458cad74 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Base.hpp +++ b/Libs/libRepoMan/Data/Base.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Core.hpp" +#include "libRepoMan/Core.hpp" #include #include diff --git a/Libs/libMacGitverCore/RepoMan/Data/Branch.cpp b/Libs/libRepoMan/Data/Branch.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Data/Branch.cpp rename to Libs/libRepoMan/Data/Branch.cpp index f159fdc6..bbf93812 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Branch.cpp +++ b/Libs/libRepoMan/Data/Branch.cpp @@ -17,11 +17,11 @@ * */ -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Data/Branch.hpp" +#include "libRepoMan/Data/Branch.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Branch.hpp b/Libs/libRepoMan/Data/Branch.hpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Data/Branch.hpp rename to Libs/libRepoMan/Data/Branch.hpp index 5435afcf..23cdd606 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Branch.hpp +++ b/Libs/libRepoMan/Data/Branch.hpp @@ -19,9 +19,9 @@ #pragma once -#include "RepoMan/Data/Reference.hpp" +#include "libRepoMan/Data/Reference.hpp" -#include "RepoMan/Frontend/Branch.hpp" +#include "libRepoMan/Frontend/Branch.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Head.cpp b/Libs/libRepoMan/Data/Head.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Data/Head.cpp rename to Libs/libRepoMan/Data/Head.cpp index a446c4d4..cf1f391d 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Head.cpp +++ b/Libs/libRepoMan/Data/Head.cpp @@ -17,11 +17,11 @@ * */ -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Data/Head.hpp" +#include "libRepoMan/Data/Head.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" #include "libGitWrap/Repository.hpp" #include "libGitWrap/BranchRef.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Data/Head.hpp b/Libs/libRepoMan/Data/Head.hpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/Data/Head.hpp rename to Libs/libRepoMan/Data/Head.hpp index e4fcf189..0e31ae13 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Head.hpp +++ b/Libs/libRepoMan/Data/Head.hpp @@ -19,9 +19,9 @@ #pragma once -#include "RepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Base.hpp" -#include "RepoMan/Frontend/Head.hpp" +#include "libRepoMan/Frontend/Head.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp b/Libs/libRepoMan/Data/Namespace.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp rename to Libs/libRepoMan/Data/Namespace.cpp index 9f7cf1c0..2a9edd0c 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Namespace.cpp +++ b/Libs/libRepoMan/Data/Namespace.cpp @@ -17,11 +17,11 @@ * */ -#include "RepoMan/Data/Namespace.hpp" +#include "libRepoMan/Data/Namespace.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Namespace.hpp b/Libs/libRepoMan/Data/Namespace.hpp similarity index 94% rename from Libs/libMacGitverCore/RepoMan/Data/Namespace.hpp rename to Libs/libRepoMan/Data/Namespace.hpp index 6db03dfc..76c6804f 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Namespace.hpp +++ b/Libs/libRepoMan/Data/Namespace.hpp @@ -19,9 +19,9 @@ #pragma once -#include "RepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Base.hpp" -#include "RepoMan/Frontend/Namespace.hpp" +#include "libRepoMan/Frontend/Namespace.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp b/Libs/libRepoMan/Data/RefLog.cpp similarity index 94% rename from Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp rename to Libs/libRepoMan/Data/RefLog.cpp index 5a5a2d0d..51f2a992 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/RefLog.cpp +++ b/Libs/libRepoMan/Data/RefLog.cpp @@ -17,11 +17,11 @@ * */ -#include "RepoMan/Data/RefLog.hpp" +#include "libRepoMan/Data/RefLog.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefLog.hpp b/Libs/libRepoMan/Data/RefLog.hpp similarity index 94% rename from Libs/libMacGitverCore/RepoMan/Data/RefLog.hpp rename to Libs/libRepoMan/Data/RefLog.hpp index 322fc62a..1f697948 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/RefLog.hpp +++ b/Libs/libRepoMan/Data/RefLog.hpp @@ -19,9 +19,9 @@ #pragma once -#include "RepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Base.hpp" -#include "RepoMan/Frontend/RefLog.hpp" +#include "libRepoMan/Frontend/RefLog.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp b/Libs/libRepoMan/Data/RefTreeNode.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp rename to Libs/libRepoMan/Data/RefTreeNode.cpp index d16ddba5..cc037dfa 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.cpp +++ b/Libs/libRepoMan/Data/RefTreeNode.cpp @@ -17,11 +17,11 @@ * */ -#include "RepoMan/Data/RefTreeNode.hpp" +#include "libRepoMan/Data/RefTreeNode.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.hpp b/Libs/libRepoMan/Data/RefTreeNode.hpp similarity index 94% rename from Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.hpp rename to Libs/libRepoMan/Data/RefTreeNode.hpp index 759e4eac..ff6989b2 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/RefTreeNode.hpp +++ b/Libs/libRepoMan/Data/RefTreeNode.hpp @@ -19,9 +19,9 @@ #pragma once -#include "RepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Base.hpp" -#include "RepoMan/Frontend/RefTreeNode.hpp" +#include "libRepoMan/Frontend/RefTreeNode.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Reference.cpp b/Libs/libRepoMan/Data/Reference.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Data/Reference.cpp rename to Libs/libRepoMan/Data/Reference.cpp index c0187c1f..d9a4fcbd 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Reference.cpp +++ b/Libs/libRepoMan/Data/Reference.cpp @@ -17,13 +17,13 @@ * */ -#include "RepoMan/Data/Reference.hpp" +#include "libRepoMan/Data/Reference.hpp" -#include "RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Frontend/Repo.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" #include "libGitWrap/Result.hpp" #include "libGitWrap/Reference.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Data/Reference.hpp b/Libs/libRepoMan/Data/Reference.hpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Data/Reference.hpp rename to Libs/libRepoMan/Data/Reference.hpp index 8e1dac3d..e07c5ef6 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Reference.hpp +++ b/Libs/libRepoMan/Data/Reference.hpp @@ -19,9 +19,9 @@ #pragma once -#include "RepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Base.hpp" -#include "RepoMan/Frontend/Reference.hpp" +#include "libRepoMan/Frontend/Reference.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Remote.cpp b/Libs/libRepoMan/Data/Remote.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Data/Remote.cpp rename to Libs/libRepoMan/Data/Remote.cpp index f002322b..855c3705 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Remote.cpp +++ b/Libs/libRepoMan/Data/Remote.cpp @@ -17,11 +17,11 @@ * */ -#include "RepoMan/Data/Remote.hpp" +#include "libRepoMan/Data/Remote.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Remote.hpp b/Libs/libRepoMan/Data/Remote.hpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Data/Remote.hpp rename to Libs/libRepoMan/Data/Remote.hpp index 78f96b95..3d8f8b44 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Remote.hpp +++ b/Libs/libRepoMan/Data/Remote.hpp @@ -19,9 +19,9 @@ #pragma once -#include "RepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Base.hpp" -#include "RepoMan/Frontend/Remote.hpp" +#include "libRepoMan/Frontend/Remote.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Repo.cpp b/Libs/libRepoMan/Data/Repo.cpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/Data/Repo.cpp rename to Libs/libRepoMan/Data/Repo.cpp index d2e7ebbc..9d178dbf 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Repo.cpp +++ b/Libs/libRepoMan/Data/Repo.cpp @@ -17,9 +17,9 @@ * */ -#include "RepoMan/Data/Repo.hpp" +#include "libRepoMan/Data/Repo.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Repo.hpp b/Libs/libRepoMan/Data/Repo.hpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Data/Repo.hpp rename to Libs/libRepoMan/Data/Repo.hpp index 3d0152ba..9632b313 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Repo.hpp +++ b/Libs/libRepoMan/Data/Repo.hpp @@ -19,9 +19,9 @@ #pragma once -#include "RepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Base.hpp" -#include "RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Frontend/Repo.hpp" class QTimer; @@ -55,9 +55,6 @@ namespace RM public: ObjTypes objType() const; - bool refreshSelf(); - void preTerminate(); - void postRefreshChildren(); QString displayName() const; void dumpSelf(Internal::Dumper& dumper) const; QString objectTypeName() const; diff --git a/Libs/libMacGitverCore/RepoMan/Data/RepoMan.hpp b/Libs/libRepoMan/Data/RepoMan.hpp similarity index 92% rename from Libs/libMacGitverCore/RepoMan/Data/RepoMan.hpp rename to Libs/libRepoMan/Data/RepoMan.hpp index f3c0cc1e..0b1c25f9 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/RepoMan.hpp +++ b/Libs/libRepoMan/Data/RepoMan.hpp @@ -19,9 +19,9 @@ #pragma once -#include "libMacGitverCore/RepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Base.hpp" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" +#include "libRepoMan/RepoMan.hpp" #include "libMacGitverCore/MacGitver/AutoRefresher.hpp" @@ -38,7 +38,7 @@ namespace RM { public: RepoMan(RepoMan* _pub); - + Heaven::Menu* contextMenuFor(Base* object); public: diff --git a/Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp b/Libs/libRepoMan/Data/Submodule.cpp similarity index 94% rename from Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp rename to Libs/libRepoMan/Data/Submodule.cpp index af67c870..861db461 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Submodule.cpp +++ b/Libs/libRepoMan/Data/Submodule.cpp @@ -17,11 +17,11 @@ * */ -#include "RepoMan/Data/Submodule.hpp" +#include "libRepoMan/Data/Submodule.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Submodule.hpp b/Libs/libRepoMan/Data/Submodule.hpp similarity index 94% rename from Libs/libMacGitverCore/RepoMan/Data/Submodule.hpp rename to Libs/libRepoMan/Data/Submodule.hpp index d89f30ef..8cb02afd 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Submodule.hpp +++ b/Libs/libRepoMan/Data/Submodule.hpp @@ -19,9 +19,9 @@ #pragma once -#include "RepoMan/Data/Repo.hpp" +#include "libRepoMan/Data/Repo.hpp" -#include "RepoMan/Frontend/Submodule.hpp" +#include "libRepoMan/Frontend/Submodule.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Tag.cpp b/Libs/libRepoMan/Data/Tag.cpp similarity index 94% rename from Libs/libMacGitverCore/RepoMan/Data/Tag.cpp rename to Libs/libRepoMan/Data/Tag.cpp index 19266ef3..c8aac34e 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Tag.cpp +++ b/Libs/libRepoMan/Data/Tag.cpp @@ -17,11 +17,11 @@ * */ -#include "RepoMan/Data/Tag.hpp" +#include "libRepoMan/Data/Tag.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Data/Tag.hpp b/Libs/libRepoMan/Data/Tag.hpp similarity index 94% rename from Libs/libMacGitverCore/RepoMan/Data/Tag.hpp rename to Libs/libRepoMan/Data/Tag.hpp index 3f4b367e..6064587c 100644 --- a/Libs/libMacGitverCore/RepoMan/Data/Tag.hpp +++ b/Libs/libRepoMan/Data/Tag.hpp @@ -19,9 +19,9 @@ #pragma once -#include "RepoMan/Data/Reference.hpp" +#include "libRepoMan/Data/Reference.hpp" -#include "RepoMan/Frontend/Tag.hpp" +#include "libRepoMan/Frontend/Tag.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Events.cpp b/Libs/libRepoMan/Events.cpp similarity index 99% rename from Libs/libMacGitverCore/RepoMan/Events.cpp rename to Libs/libRepoMan/Events.cpp index f208fd68..45db5a75 100644 --- a/Libs/libMacGitverCore/RepoMan/Events.cpp +++ b/Libs/libRepoMan/Events.cpp @@ -17,7 +17,7 @@ * */ -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Events.hpp b/Libs/libRepoMan/Events.hpp similarity index 98% rename from Libs/libMacGitverCore/RepoMan/Events.hpp rename to Libs/libRepoMan/Events.hpp index 738a6f66..6bb6fe7c 100644 --- a/Libs/libMacGitverCore/RepoMan/Events.hpp +++ b/Libs/libRepoMan/Events.hpp @@ -19,7 +19,7 @@ #pragma once -#include "libMacGitverCore/RepoMan/Core.hpp" +#include "libRepoMan/Core.hpp" #include @@ -40,7 +40,7 @@ namespace RM class Tag; } - class MGV_CORE_API EventsInterface + class REPOMAN_API EventsInterface { public: virtual ~EventsInterface() {} @@ -92,7 +92,7 @@ namespace RM virtual void workTreeUpdated(const RM::Frontend::Repo& repo) = 0; }; - class MGV_CORE_API Events // : public EventsInterface + class REPOMAN_API Events // : public EventsInterface { private: Events(); diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp b/Libs/libRepoMan/Frontend/Base.cpp similarity index 95% rename from Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp rename to Libs/libRepoMan/Frontend/Base.cpp index 518e42d7..325e3396 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Base.cpp +++ b/Libs/libRepoMan/Frontend/Base.cpp @@ -17,18 +17,18 @@ * */ -#include "App/MacGitver.hpp" +//#include "App/MacGitver.hpp" -#include "RepoMan/Frontend/BaseInternal.hpp" -#include "RepoMan/Frontend/Repo.hpp" -#include "RepoMan/RepoMan.hpp" -#include "RepoMan/Frontend/RefTreeNode.hpp" +#include "libRepoMan/Frontend/BaseInternal.hpp" +#include "libRepoMan/Frontend/Repo.hpp" +#include "libRepoMan/RepoMan.hpp" +#include "libRepoMan/Frontend/RefTreeNode.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Base.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" #include "libHeavenIcons/IconRef.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Base.hpp b/Libs/libRepoMan/Frontend/Base.hpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/Frontend/Base.hpp rename to Libs/libRepoMan/Frontend/Base.hpp index c2a3a586..0eac9406 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Base.hpp +++ b/Libs/libRepoMan/Frontend/Base.hpp @@ -19,7 +19,7 @@ #pragma once -#include "libMacGitverCore/RepoMan/Core.hpp" +#include "libRepoMan/Core.hpp" namespace RM { @@ -37,7 +37,7 @@ namespace RM namespace Frontend { - class MGV_CORE_API Base + class REPOMAN_API Base { public: using List = std::vector; diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/BaseInternal.hpp b/Libs/libRepoMan/Frontend/BaseInternal.hpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/Frontend/BaseInternal.hpp rename to Libs/libRepoMan/Frontend/BaseInternal.hpp index 6e94ed4b..78a1446b 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/BaseInternal.hpp +++ b/Libs/libRepoMan/Frontend/BaseInternal.hpp @@ -19,8 +19,8 @@ #pragma once -#include "RepoMan/Frontend/Base.hpp" -#include "RepoMan/Backend/RepoLocker.hpp" +#include "libRepoMan/Frontend/Base.hpp" +#include "libRepoMan/Backend/RepoLocker.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp b/Libs/libRepoMan/Frontend/Branch.cpp similarity index 88% rename from Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp rename to Libs/libRepoMan/Frontend/Branch.cpp index 5e4452c4..9ada37d6 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Branch.cpp +++ b/Libs/libRepoMan/Frontend/Branch.cpp @@ -17,15 +17,15 @@ * */ -#include "RepoMan/Frontend/Branch.hpp" -#include "RepoMan/Frontend/Repo.hpp" -#include "RepoMan/Frontend/Head.hpp" +#include "libRepoMan/Frontend/Branch.hpp" +#include "libRepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Frontend/Head.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/Branch.hpp" +#include "libRepoMan/Data/Branch.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Branch.hpp b/Libs/libRepoMan/Frontend/Branch.hpp similarity index 81% rename from Libs/libMacGitverCore/RepoMan/Frontend/Branch.hpp rename to Libs/libRepoMan/Frontend/Branch.hpp index 72f073c1..6490ac1b 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Branch.hpp +++ b/Libs/libRepoMan/Frontend/Branch.hpp @@ -19,7 +19,11 @@ #pragma once +<<<<<<< HEAD:Libs/libMacGitverCore/RepoMan/Frontend/Branch.hpp #include "Ref.hpp" +======= +#include "libRepoMan/Frontend/Reference.hpp" +>>>>>>> 7799bdc... Split off RepoMan & make everything compile at least:Libs/libRepoMan/Frontend/Branch.hpp namespace RM { @@ -27,8 +31,8 @@ namespace RM namespace Frontend { - class MGV_CORE_API Branch - : public Ref + class REPOMAN_API Branch + : public Reference { public: static const ObjTypes StaticObjectType = ObjTypes::Branch; diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp b/Libs/libRepoMan/Frontend/Head.cpp similarity index 91% rename from Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp rename to Libs/libRepoMan/Frontend/Head.cpp index 151ca34f..39190171 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Head.cpp +++ b/Libs/libRepoMan/Frontend/Head.cpp @@ -17,14 +17,14 @@ * */ -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Frontend/Head.hpp" -#include "RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Data/Head.hpp" -#include "RepoMan/Data/Head.hpp" +#include "libRepoMan/Frontend/Branch.hpp" +#include "libRepoMan/Frontend/Repo.hpp" #include "libGitWrap/Repository.hpp" diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Head.hpp b/Libs/libRepoMan/Frontend/Head.hpp similarity index 94% rename from Libs/libMacGitverCore/RepoMan/Frontend/Head.hpp rename to Libs/libRepoMan/Frontend/Head.hpp index b966521f..6478e4b9 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Head.hpp +++ b/Libs/libRepoMan/Frontend/Head.hpp @@ -19,7 +19,7 @@ #pragma once -#include "RepoMan/Frontend/Branch.hpp" +#include "libRepoMan/Frontend/Branch.hpp" namespace RM { @@ -31,7 +31,7 @@ namespace RM namespace Frontend { - class MGV_CORE_API Head : public Base + class REPOMAN_API Head : public Base { public: static const ObjTypes StaticObjectType = ObjTypes::Head; diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp b/Libs/libRepoMan/Frontend/Namespace.cpp similarity index 87% rename from Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp rename to Libs/libRepoMan/Frontend/Namespace.cpp index 72a5577e..6fd1d1e1 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.cpp +++ b/Libs/libRepoMan/Frontend/Namespace.cpp @@ -17,12 +17,12 @@ * */ -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Frontend/Namespace.hpp" +#include "libRepoMan/Frontend/Namespace.hpp" -#include "RepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/Namespace.hpp" +#include "libRepoMan/Private/Dumper.hpp" +#include "libRepoMan/Data/Namespace.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.hpp b/Libs/libRepoMan/Frontend/Namespace.hpp similarity index 93% rename from Libs/libMacGitverCore/RepoMan/Frontend/Namespace.hpp rename to Libs/libRepoMan/Frontend/Namespace.hpp index e8940bf4..d54e274e 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Namespace.hpp +++ b/Libs/libRepoMan/Frontend/Namespace.hpp @@ -19,7 +19,7 @@ #pragma once -#include "libMacGitverCore/RepoMan/Frontend/Base.hpp" +#include "libRepoMan/Frontend/Base.hpp" namespace RM { @@ -32,7 +32,7 @@ namespace RM namespace Frontend { - class MGV_CORE_API Namespace + class REPOMAN_API Namespace : public Base { public: diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp b/Libs/libRepoMan/Frontend/RefLog.cpp similarity index 89% rename from Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp rename to Libs/libRepoMan/Frontend/RefLog.cpp index 148ea405..cf13296d 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.cpp +++ b/Libs/libRepoMan/Frontend/RefLog.cpp @@ -17,11 +17,11 @@ * */ -#include "RepoMan/Frontend/RefLog.hpp" +#include "libRepoMan/Frontend/RefLog.hpp" -#include "RepoMan/Data/RefLog.hpp" +#include "libRepoMan/Data/RefLog.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.hpp b/Libs/libRepoMan/Frontend/RefLog.hpp similarity index 92% rename from Libs/libMacGitverCore/RepoMan/Frontend/RefLog.hpp rename to Libs/libRepoMan/Frontend/RefLog.hpp index 18fca711..db0af7d1 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefLog.hpp +++ b/Libs/libRepoMan/Frontend/RefLog.hpp @@ -19,7 +19,7 @@ #pragma once -#include "libMacGitverCore/RepoMan/Frontend/Base.hpp" +#include "libRepoMan/Frontend/Base.hpp" namespace RM { @@ -32,7 +32,7 @@ namespace RM namespace Frontend { - class MGV_CORE_API RefLog + class REPOMAN_API RefLog : public Base { public: diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp b/Libs/libRepoMan/Frontend/RefTreeNode.cpp similarity index 87% rename from Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp rename to Libs/libRepoMan/Frontend/RefTreeNode.cpp index 85792fa1..be8b7e6a 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.cpp +++ b/Libs/libRepoMan/Frontend/RefTreeNode.cpp @@ -17,13 +17,13 @@ * */ -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Frontend/RefTreeNode.hpp" +#include "libRepoMan/Frontend/RefTreeNode.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/RefTreeNode.hpp" +#include "libRepoMan/Data/RefTreeNode.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp b/Libs/libRepoMan/Frontend/RefTreeNode.hpp similarity index 93% rename from Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp rename to Libs/libRepoMan/Frontend/RefTreeNode.hpp index 9a8935f9..4e08c9c4 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/RefTreeNode.hpp +++ b/Libs/libRepoMan/Frontend/RefTreeNode.hpp @@ -19,7 +19,7 @@ #pragma once -#include "libMacGitverCore/RepoMan/Frontend/Base.hpp" +#include "libRepoMan/Frontend/Base.hpp" #include @@ -34,7 +34,7 @@ namespace RM namespace Frontend { - class MGV_CORE_API RefTreeNode + class REPOMAN_API RefTreeNode : public Base { public: diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp b/Libs/libRepoMan/Frontend/Reference.cpp similarity index 90% rename from Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp rename to Libs/libRepoMan/Frontend/Reference.cpp index 3ce0622e..298f0f7c 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.cpp +++ b/Libs/libRepoMan/Frontend/Reference.cpp @@ -21,15 +21,15 @@ #include "libGitWrap/Reference.hpp" #include "libGitWrap/RefName.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Frontend/BaseInternal.hpp" -#include "RepoMan/Frontend/Reference.hpp" -#include "RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Frontend/BaseInternal.hpp" +#include "libRepoMan/Frontend/Reference.hpp" +#include "libRepoMan/Frontend/Repo.hpp" -#include "RepoMan/Data/Reference.hpp" +#include "libRepoMan/Data/Reference.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp b/Libs/libRepoMan/Frontend/Reference.hpp similarity index 98% rename from Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp rename to Libs/libRepoMan/Frontend/Reference.hpp index d0630bbe..e951cbac 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Reference.hpp +++ b/Libs/libRepoMan/Frontend/Reference.hpp @@ -40,7 +40,7 @@ namespace RM namespace Frontend { - class MGV_CORE_API Reference + class REPOMAN_API Reference : public Base { public: diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp b/Libs/libRepoMan/Frontend/Remote.cpp similarity index 87% rename from Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp rename to Libs/libRepoMan/Frontend/Remote.cpp index 6c22d84b..c5ee19b7 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Remote.cpp +++ b/Libs/libRepoMan/Frontend/Remote.cpp @@ -19,14 +19,14 @@ #include "libGitWrap/Result.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Frontend/Repo.hpp" -#include "RepoMan/Frontend/Remote.hpp" +#include "libRepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Frontend/Remote.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/Remote.hpp" +#include "libRepoMan/Data/Remote.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Remote.hpp b/Libs/libRepoMan/Frontend/Remote.hpp similarity index 94% rename from Libs/libMacGitverCore/RepoMan/Frontend/Remote.hpp rename to Libs/libRepoMan/Frontend/Remote.hpp index a94f4c54..244802c9 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Remote.hpp +++ b/Libs/libRepoMan/Frontend/Remote.hpp @@ -21,7 +21,7 @@ #include "libGitWrap/Remote.hpp" -#include "Base.hpp" +#include "libRepoman/Frontend/Base.hpp" namespace RM { @@ -34,7 +34,7 @@ namespace RM namespace Frontend { - class MGV_CORE_API Remote + class REPOMAN_API Remote : public Base { public: diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp b/Libs/libRepoMan/Frontend/Repo.cpp similarity index 91% rename from Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp rename to Libs/libRepoMan/Frontend/Repo.cpp index 8467c88d..4416b3e9 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.cpp +++ b/Libs/libRepoMan/Frontend/Repo.cpp @@ -22,22 +22,22 @@ #include "libGitWrap/RefName.hpp" #include "libGitWrap/Submodule.hpp" -#include "RepoMan/Events.hpp" -#include "RepoMan/RepoMan.hpp" - -#include "RepoMan/Frontend/BaseInternal.hpp" -#include "RepoMan/Frontend/Repo.hpp" -#include "RepoMan/Frontend/Head.hpp" -#include "RepoMan/Frontend/Remote.hpp" -#include "RepoMan/Frontend/Namespace.hpp" -#include "RepoMan/Frontend/Reference.hpp" -#include "RepoMan/Frontend/Tag.hpp" -#include "RepoMan/Frontend/Branch.hpp" -#include "RepoMan/Frontend/Submodule.hpp" - -#include "RepoMan/Data/Repo.hpp" -#include "RepoMan/Data/Head.hpp" -#include "RepoMan/Data/Remote.hpp" +#include "libRepoMan/Events.hpp" +#include "libRepoMan/RepoMan.hpp" + +#include "libRepoMan/Frontend/BaseInternal.hpp" +#include "libRepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Frontend/Head.hpp" +#include "libRepoMan/Frontend/Remote.hpp" +#include "libRepoMan/Frontend/Namespace.hpp" +#include "libRepoMan/Frontend/Reference.hpp" +#include "libRepoMan/Frontend/Tag.hpp" +#include "libRepoMan/Frontend/Branch.hpp" +#include "libRepoMan/Frontend/Submodule.hpp" + +#include "libRepoMan/Data/Repo.hpp" +#include "libRepoMan/Data/Head.hpp" +#include "libRepoMan/Data/Remote.hpp" #include diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.hpp b/Libs/libRepoMan/Frontend/Repo.hpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/Frontend/Repo.hpp rename to Libs/libRepoMan/Frontend/Repo.hpp index 1ba46160..4e542fee 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Repo.hpp +++ b/Libs/libRepoMan/Frontend/Repo.hpp @@ -21,7 +21,7 @@ #include "libGitWrap/Repository.hpp" -#include "libMacGitverCore/RepoMan/Frontend/Base.hpp" +#include "libRepoMan/Frontend/Base.hpp" namespace RM { @@ -37,7 +37,7 @@ namespace RM namespace Frontend { - class MGV_CORE_API Repo + class REPOMAN_API Repo : public Base { friend class RepoMan; diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp b/Libs/libRepoMan/Frontend/Submodule.cpp similarity index 90% rename from Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp rename to Libs/libRepoMan/Frontend/Submodule.cpp index 18781bb2..c14f8482 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.cpp +++ b/Libs/libRepoMan/Frontend/Submodule.cpp @@ -17,11 +17,11 @@ * */ -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Data/Submodule.hpp" +#include "libRepoMan/Data/Submodule.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.hpp b/Libs/libRepoMan/Frontend/Submodule.hpp similarity index 91% rename from Libs/libMacGitverCore/RepoMan/Frontend/Submodule.hpp rename to Libs/libRepoMan/Frontend/Submodule.hpp index a53acb73..af9026b7 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Submodule.hpp +++ b/Libs/libRepoMan/Frontend/Submodule.hpp @@ -19,7 +19,7 @@ #pragma once -#include "libMacGitverCore/Repoman/Frontend/Repo.hpp" +#include "libRepoman/Frontend/Repo.hpp" namespace RM { @@ -27,7 +27,7 @@ namespace RM namespace Frontend { - class MGV_CORE_API Submodule : public Repo + class REPOMAN_API Submodule : public Repo { public: static const ObjTypes StaticObjectType = ObjTypes::Submodule; diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp b/Libs/libRepoMan/Frontend/Tag.cpp similarity index 87% rename from Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp rename to Libs/libRepoMan/Frontend/Tag.cpp index 589e2318..5d374750 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.cpp +++ b/Libs/libRepoMan/Frontend/Tag.cpp @@ -17,13 +17,13 @@ * */ -#include "RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/Frontend/Tag.hpp" +#include "libRepoMan/Frontend/Tag.hpp" -#include "RepoMan/Private/Dumper.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Data/Tag.hpp" +#include "libRepoMan/Data/Tag.hpp" namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.hpp b/Libs/libRepoMan/Frontend/Tag.hpp similarity index 91% rename from Libs/libMacGitverCore/RepoMan/Frontend/Tag.hpp rename to Libs/libRepoMan/Frontend/Tag.hpp index c04a33c9..a05ea595 100644 --- a/Libs/libMacGitverCore/RepoMan/Frontend/Tag.hpp +++ b/Libs/libRepoMan/Frontend/Tag.hpp @@ -19,7 +19,7 @@ #pragma once -#include "libMacGitverCore/RepoMan/Frontend/Reference.hpp" +#include "libRepoMan/Frontend/Reference.hpp" namespace RM { @@ -27,7 +27,8 @@ namespace RM namespace Frontend { - class MGV_CORE_API Tag : public Reference + class REPOMAN_API Tag + : public Reference { public: static const ObjTypes StaticObjectType = ObjTypes::Tag; diff --git a/Libs/libMacGitverCore/RepoMan/Private/Dumper.cpp b/Libs/libRepoMan/Private/Dumper.cpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Private/Dumper.cpp rename to Libs/libRepoMan/Private/Dumper.cpp diff --git a/Libs/libMacGitverCore/RepoMan/Private/Dumper.hpp b/Libs/libRepoMan/Private/Dumper.hpp similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Private/Dumper.hpp rename to Libs/libRepoMan/Private/Dumper.hpp diff --git a/Libs/libMacGitverCore/RepoMan/Private/RepoManActions.hid b/Libs/libRepoMan/Private/RepoManActions.hid similarity index 100% rename from Libs/libMacGitverCore/RepoMan/Private/RepoManActions.hid rename to Libs/libRepoMan/Private/RepoManActions.hid diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp b/Libs/libRepoMan/RepoMan.cpp similarity index 96% rename from Libs/libMacGitverCore/RepoMan/RepoMan.cpp rename to Libs/libRepoMan/RepoMan.cpp index 06c0b00c..68a16f56 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.cpp +++ b/Libs/libRepoMan/RepoMan.cpp @@ -17,19 +17,18 @@ * */ -#include "libMacGitverCore/App/MacGitver.hpp" +#include "libRepoMan/RepoMan.hpp" +#include "libRepoMan/Events.hpp" -#include "RepoMan/RepoMan.hpp" -#include "RepoMan/Events.hpp" +#include "libRepoMan/Private/Dumper.hpp" -#include "RepoMan/Private/Dumper.hpp" - -#include "RepoMan/Data/RepoMan.hpp" -#include "RepoMan/Data/Repo.hpp" +#include "libRepoMan/Data/RepoMan.hpp" +#include "libRepoMan/Data/Repo.hpp" #include "libBlueSky/Application.hpp" #include +#include namespace RM { diff --git a/Libs/libMacGitverCore/RepoMan/RepoMan.hpp b/Libs/libRepoMan/RepoMan.hpp similarity index 97% rename from Libs/libMacGitverCore/RepoMan/RepoMan.hpp rename to Libs/libRepoMan/RepoMan.hpp index a2152649..33f0bbf3 100644 --- a/Libs/libMacGitverCore/RepoMan/RepoMan.hpp +++ b/Libs/libRepoMan/RepoMan.hpp @@ -19,16 +19,16 @@ #pragma once -#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/Frontend/Repo.hpp" -#include "libMacGitverCore/RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" #include namespace RM { - class MGV_CORE_API RepoMan + class REPOMAN_API RepoMan : public QObject , private EventsInterface { diff --git a/Modules/GitConfig/GitConfigModule.cpp b/Modules/GitConfig/GitConfigModule.cpp index d4812d9f..1afcf167 100644 --- a/Modules/GitConfig/GitConfigModule.cpp +++ b/Modules/GitConfig/GitConfigModule.cpp @@ -18,8 +18,7 @@ #include #include "libMacGitverCore/App/MacGitver.hpp" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/RepoMan.hpp" #include "GitConfigModule.h" #include "GitConfigDialog.h" diff --git a/Modules/Logging/LoggingMode.cpp b/Modules/Logging/LoggingMode.cpp index 55cdab78..e00499fa 100644 --- a/Modules/Logging/LoggingMode.cpp +++ b/Modules/Logging/LoggingMode.cpp @@ -20,8 +20,7 @@ #include #include "libMacGitverCore/App/MacGitver.hpp" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" - +#include "libRepoMan/RepoMan.hpp" #include "LoggingMode.hpp" LoggingMode::LoggingMode(QObject *parent) diff --git a/Modules/RepoManLogger/Listener.cpp b/Modules/RepoManLogger/Listener.cpp index 2542f219..003df9ff 100644 --- a/Modules/RepoManLogger/Listener.cpp +++ b/Modules/RepoManLogger/Listener.cpp @@ -17,10 +17,10 @@ * */ -#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" -#include "libMacGitverCore/RepoMan/Frontend/Tag.hpp" -#include "libMacGitverCore/RepoMan/Frontend/Branch.hpp" -#include "libMacGitverCore/RepoMan/Frontend/Submodule.hpp" +#include "libRepoMan/RepoMan.hpp" +#include "libRepoMan/Frontend/Tag.hpp" +#include "libRepoMan/Frontend/Branch.hpp" +#include "libRepoMan/Frontend/Submodule.hpp" #include "Listener.hpp" #include "TemplateNames.hpp" diff --git a/Modules/RepoManLogger/Listener.hpp b/Modules/RepoManLogger/Listener.hpp index 6648d41d..3ded666c 100644 --- a/Modules/RepoManLogger/Listener.hpp +++ b/Modules/RepoManLogger/Listener.hpp @@ -21,7 +21,7 @@ #include -#include "libMacGitverCore/RepoMan/Events.hpp" +#include "libRepoMan/Events.hpp" #include "libLogger/Channel.hpp" #include "libLogger/Event.hpp" diff --git a/Modules/Repository/CreateRepositoryDlg.cpp b/Modules/Repository/CreateRepositoryDlg.cpp index a60ba1db..c62330d2 100644 --- a/Modules/Repository/CreateRepositoryDlg.cpp +++ b/Modules/Repository/CreateRepositoryDlg.cpp @@ -20,8 +20,7 @@ #include "libMacGitverCore/Config/Config.h" #include "libMacGitverCore/App/MacGitver.hpp" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" - +#include "libRepoMan/RepoMan.hpp" #include "CreateRepositoryDlg.h" CreateRepositoryDlg::CreateRepositoryDlg() diff --git a/Modules/Repository/RepoInfoModel.cpp b/Modules/Repository/RepoInfoModel.cpp index 8c87e1c5..968c9b85 100644 --- a/Modules/Repository/RepoInfoModel.cpp +++ b/Modules/Repository/RepoInfoModel.cpp @@ -18,8 +18,7 @@ #include "libMacGitverCore/App/MacGitver.hpp" #include "libMacGitverCore/Config/Config.h" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" - +#include "libRepoMan/RepoMan.hpp" #include "libHeavenIcons/IconRef.hpp" #include "libHeavenIcons/Icon.hpp" diff --git a/Modules/Repository/RepoInfoModel.hpp b/Modules/Repository/RepoInfoModel.hpp index 28e71df8..599d54cb 100644 --- a/Modules/Repository/RepoInfoModel.hpp +++ b/Modules/Repository/RepoInfoModel.hpp @@ -18,7 +18,7 @@ #include -#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/RepoMan.hpp" class RepoInfoModel : public QAbstractItemModel { diff --git a/Modules/Repository/RepoTreeView.cpp b/Modules/Repository/RepoTreeView.cpp index 7d28bc3b..3b7e7189 100644 --- a/Modules/Repository/RepoTreeView.cpp +++ b/Modules/Repository/RepoTreeView.cpp @@ -20,8 +20,7 @@ #include "libMacGitverCore/Widgets/TreeViewCtxMenu.hpp" #include "libMacGitverCore/App/MacGitver.hpp" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/RepoMan.hpp" #include "RepoTreeView.hpp" #include "RepoInfoModel.hpp" diff --git a/Modules/Repository/RepoTreeView.hpp b/Modules/Repository/RepoTreeView.hpp index 0c9ba394..94259191 100644 --- a/Modules/Repository/RepoTreeView.hpp +++ b/Modules/Repository/RepoTreeView.hpp @@ -25,7 +25,7 @@ class QModelIndex; class RepoInfoModel; class TreeViewCtxMenu; -#include "libMacGitverCore/RepoMan/Frontend/Repo.hpp" +#include "libRepoMan/RepoMan.hpp" class RepoTreeView : public BlueSky::ContextView diff --git a/Modules/Repository/RepositoryModule.cpp b/Modules/Repository/RepositoryModule.cpp index 9b42f664..7197406f 100644 --- a/Modules/Repository/RepositoryModule.cpp +++ b/Modules/Repository/RepositoryModule.cpp @@ -24,8 +24,7 @@ #include "libMacGitverCore/Config/Config.h" #include "libMacGitverCore/App/MacGitver.hpp" -#include "libMacGitverCore/RepoMan/RepoMan.hpp" - +#include "libRepoMan/Frontend/Repo.hpp" #include "RepositoryModule.h" #include "RepoTreeView.hpp" #include "CloneRepositoryDlg.h" From c0db8d5d16d3c9f118be97fa516a0249fc0191cb Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Tue, 12 May 2015 23:19:31 +0100 Subject: [PATCH 51/60] Remove events include from frontend classes --- Libs/libRepoMan/Frontend/Base.cpp | 4 ---- Libs/libRepoMan/Frontend/Branch.cpp | 2 -- Libs/libRepoMan/Frontend/Head.cpp | 2 -- Libs/libRepoMan/Frontend/Namespace.cpp | 2 -- Libs/libRepoMan/Frontend/RefTreeNode.cpp | 2 -- Libs/libRepoMan/Frontend/Reference.cpp | 2 -- Libs/libRepoMan/Frontend/Remote.cpp | 2 -- Libs/libRepoMan/Frontend/Repo.cpp | 1 - Libs/libRepoMan/Frontend/Submodule.cpp | 2 -- Libs/libRepoMan/Frontend/Tag.cpp | 2 -- 10 files changed, 21 deletions(-) diff --git a/Libs/libRepoMan/Frontend/Base.cpp b/Libs/libRepoMan/Frontend/Base.cpp index 325e3396..30503cb5 100644 --- a/Libs/libRepoMan/Frontend/Base.cpp +++ b/Libs/libRepoMan/Frontend/Base.cpp @@ -17,15 +17,11 @@ * */ -//#include "App/MacGitver.hpp" - #include "libRepoMan/Frontend/BaseInternal.hpp" #include "libRepoMan/Frontend/Repo.hpp" #include "libRepoMan/RepoMan.hpp" #include "libRepoMan/Frontend/RefTreeNode.hpp" -#include "libRepoMan/Events.hpp" - #include "libRepoMan/Data/Base.hpp" #include "libRepoMan/Private/Dumper.hpp" diff --git a/Libs/libRepoMan/Frontend/Branch.cpp b/Libs/libRepoMan/Frontend/Branch.cpp index 9ada37d6..c79189cf 100644 --- a/Libs/libRepoMan/Frontend/Branch.cpp +++ b/Libs/libRepoMan/Frontend/Branch.cpp @@ -21,8 +21,6 @@ #include "libRepoMan/Frontend/Repo.hpp" #include "libRepoMan/Frontend/Head.hpp" -#include "libRepoMan/Events.hpp" - #include "libRepoMan/Private/Dumper.hpp" #include "libRepoMan/Data/Branch.hpp" diff --git a/Libs/libRepoMan/Frontend/Head.cpp b/Libs/libRepoMan/Frontend/Head.cpp index 39190171..c59079ff 100644 --- a/Libs/libRepoMan/Frontend/Head.cpp +++ b/Libs/libRepoMan/Frontend/Head.cpp @@ -17,8 +17,6 @@ * */ -#include "libRepoMan/Events.hpp" - #include "libRepoMan/Private/Dumper.hpp" #include "libRepoMan/Data/Head.hpp" diff --git a/Libs/libRepoMan/Frontend/Namespace.cpp b/Libs/libRepoMan/Frontend/Namespace.cpp index 6fd1d1e1..b8ecb916 100644 --- a/Libs/libRepoMan/Frontend/Namespace.cpp +++ b/Libs/libRepoMan/Frontend/Namespace.cpp @@ -17,8 +17,6 @@ * */ -#include "libRepoMan/Events.hpp" - #include "libRepoMan/Frontend/Namespace.hpp" #include "libRepoMan/Private/Dumper.hpp" diff --git a/Libs/libRepoMan/Frontend/RefTreeNode.cpp b/Libs/libRepoMan/Frontend/RefTreeNode.cpp index be8b7e6a..6f0164f2 100644 --- a/Libs/libRepoMan/Frontend/RefTreeNode.cpp +++ b/Libs/libRepoMan/Frontend/RefTreeNode.cpp @@ -17,8 +17,6 @@ * */ -#include "libRepoMan/Events.hpp" - #include "libRepoMan/Frontend/RefTreeNode.hpp" #include "libRepoMan/Private/Dumper.hpp" diff --git a/Libs/libRepoMan/Frontend/Reference.cpp b/Libs/libRepoMan/Frontend/Reference.cpp index 298f0f7c..603670e9 100644 --- a/Libs/libRepoMan/Frontend/Reference.cpp +++ b/Libs/libRepoMan/Frontend/Reference.cpp @@ -21,8 +21,6 @@ #include "libGitWrap/Reference.hpp" #include "libGitWrap/RefName.hpp" -#include "libRepoMan/Events.hpp" - #include "libRepoMan/Frontend/BaseInternal.hpp" #include "libRepoMan/Frontend/Reference.hpp" #include "libRepoMan/Frontend/Repo.hpp" diff --git a/Libs/libRepoMan/Frontend/Remote.cpp b/Libs/libRepoMan/Frontend/Remote.cpp index c5ee19b7..c888b461 100644 --- a/Libs/libRepoMan/Frontend/Remote.cpp +++ b/Libs/libRepoMan/Frontend/Remote.cpp @@ -19,8 +19,6 @@ #include "libGitWrap/Result.hpp" -#include "libRepoMan/Events.hpp" - #include "libRepoMan/Frontend/Repo.hpp" #include "libRepoMan/Frontend/Remote.hpp" diff --git a/Libs/libRepoMan/Frontend/Repo.cpp b/Libs/libRepoMan/Frontend/Repo.cpp index 4416b3e9..b838cd97 100644 --- a/Libs/libRepoMan/Frontend/Repo.cpp +++ b/Libs/libRepoMan/Frontend/Repo.cpp @@ -22,7 +22,6 @@ #include "libGitWrap/RefName.hpp" #include "libGitWrap/Submodule.hpp" -#include "libRepoMan/Events.hpp" #include "libRepoMan/RepoMan.hpp" #include "libRepoMan/Frontend/BaseInternal.hpp" diff --git a/Libs/libRepoMan/Frontend/Submodule.cpp b/Libs/libRepoMan/Frontend/Submodule.cpp index c14f8482..93e7c3cf 100644 --- a/Libs/libRepoMan/Frontend/Submodule.cpp +++ b/Libs/libRepoMan/Frontend/Submodule.cpp @@ -17,8 +17,6 @@ * */ -#include "libRepoMan/Events.hpp" - #include "libRepoMan/Data/Submodule.hpp" #include "libRepoMan/Private/Dumper.hpp" diff --git a/Libs/libRepoMan/Frontend/Tag.cpp b/Libs/libRepoMan/Frontend/Tag.cpp index 5d374750..731b6d03 100644 --- a/Libs/libRepoMan/Frontend/Tag.cpp +++ b/Libs/libRepoMan/Frontend/Tag.cpp @@ -17,8 +17,6 @@ * */ -#include "libRepoMan/Events.hpp" - #include "libRepoMan/Frontend/Tag.hpp" #include "libRepoMan/Private/Dumper.hpp" From ea4e5c6268300d885d5a81a0c2b9155cd6553a1e Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 19 Apr 2015 02:50:22 +0100 Subject: [PATCH 52/60] Repoman Events --- Libs/libRepoMan/CMakeLists.txt | 13 +- Libs/libRepoMan/Core.hpp | 2 + Libs/libRepoMan/Data/Base.cpp | 9 + Libs/libRepoMan/Data/Base.hpp | 12 +- Libs/libRepoMan/Events.cpp | 391 ------------------ Libs/libRepoMan/Events.hpp | 145 ------- Libs/libRepoMan/Events/Compat.cpp | 384 +++++++++++++++++ Libs/libRepoMan/Events/Compat.hpp | 123 ++++++ Libs/libRepoMan/Events/Event.cpp | 93 +++++ Libs/libRepoMan/Events/Event.hpp | 74 ++++ Libs/libRepoMan/Events/EventData.cpp | 49 +++ Libs/libRepoMan/Events/EventData.hpp | 55 +++ Libs/libRepoMan/Events/Manager.cpp | 71 ++++ Libs/libRepoMan/Events/Manager.hpp | 62 +++ Libs/libRepoMan/Frontend/Base.hpp | 4 +- Libs/libRepoMan/RepoMan.cpp | 4 - Libs/libRepoMan/RepoMan.hpp | 8 +- Modules/RepoManLogger/Listener.cpp | 66 +-- Modules/RepoManLogger/Listener.hpp | 64 +-- Modules/RepoManLogger/RepoManLoggerModule.cpp | 4 +- 20 files changed, 1017 insertions(+), 616 deletions(-) delete mode 100644 Libs/libRepoMan/Events.cpp delete mode 100644 Libs/libRepoMan/Events.hpp create mode 100644 Libs/libRepoMan/Events/Compat.cpp create mode 100644 Libs/libRepoMan/Events/Compat.hpp create mode 100644 Libs/libRepoMan/Events/Event.cpp create mode 100644 Libs/libRepoMan/Events/Event.hpp create mode 100644 Libs/libRepoMan/Events/EventData.cpp create mode 100644 Libs/libRepoMan/Events/EventData.hpp create mode 100644 Libs/libRepoMan/Events/Manager.cpp create mode 100644 Libs/libRepoMan/Events/Manager.hpp diff --git a/Libs/libRepoMan/CMakeLists.txt b/Libs/libRepoMan/CMakeLists.txt index 5ae8ec94..6c69f0a6 100644 --- a/Libs/libRepoMan/CMakeLists.txt +++ b/Libs/libRepoMan/CMakeLists.txt @@ -10,9 +10,13 @@ INCLUDE_DIRECTORIES( BEFORE SET( SRC_FILES - Events.cpp RepoMan.cpp + Events/Event.cpp + Events/EventData.cpp + Events/Manager.cpp + Events/Compat.cpp + Frontend/Base.cpp Frontend/Branch.cpp Frontend/Namespace.cpp @@ -43,9 +47,12 @@ SET( SRC_FILES SET( PUB_HDR_FILES Core.hpp - Events.hpp RepoMan.hpp + Events/Event.hpp + Events/Manager.hpp + Events/Compat.hpp + Frontend/Base.hpp Frontend/Reference.hpp Frontend/Repo.hpp @@ -63,6 +70,8 @@ SET( PRI_HDR_FILES Private/Dumper.hpp + Events/EventData.hpp + Data/Base.hpp Data/Branch.hpp Data/Namespace.hpp diff --git a/Libs/libRepoMan/Core.hpp b/Libs/libRepoMan/Core.hpp index a907ecf2..36f5bbf4 100644 --- a/Libs/libRepoMan/Core.hpp +++ b/Libs/libRepoMan/Core.hpp @@ -60,6 +60,7 @@ namespace RM namespace Frontend { + class Base; class Repo; class RefTreeNode; class Namespace; @@ -68,6 +69,7 @@ namespace RM class RefLog; class Submodule; class Tag; + class Branch; } } diff --git a/Libs/libRepoMan/Data/Base.cpp b/Libs/libRepoMan/Data/Base.cpp index c7333e11..05443c3e 100644 --- a/Libs/libRepoMan/Data/Base.cpp +++ b/Libs/libRepoMan/Data/Base.cpp @@ -19,6 +19,9 @@ #include "libRepoMan/Data/Base.hpp" +#include "libRepoMan/Events/Manager.hpp" +#include "libRepoMan/Events/EventData.hpp" + #include "libRepoMan/Frontend/Repo.hpp" #include "libRepoMan/Private/Dumper.hpp" @@ -70,6 +73,12 @@ namespace RM return QStringLiteral(""); } + void Base::emitEvent(EventType type) + { + Event ev(Internal::EventData::create(type, this)); + EventManager::self().sendEvent(ev); + } + #if 0 // ###REPOMAN /** * @brief Refresh this object diff --git a/Libs/libRepoMan/Data/Base.hpp b/Libs/libRepoMan/Data/Base.hpp index 458cad74..d28974d2 100644 --- a/Libs/libRepoMan/Data/Base.hpp +++ b/Libs/libRepoMan/Data/Base.hpp @@ -19,7 +19,7 @@ #pragma once -#include "libRepoMan/Core.hpp" +#include "libRepoMan/Events/Event.hpp" #include #include @@ -75,6 +75,9 @@ namespace RM std::weak_ptr repository() const; SPtr parent() const; + public: + SPtr getPtr() { return shared_from_this(); } + public: virtual QString displayName() const; virtual QString objectTypeName() const = 0; @@ -92,6 +95,9 @@ namespace RM template std::shared_ptr as(); + protected: + void emitEvent(EventType type); + private: std::weak_ptr mRepo; std::weak_ptr mParent; @@ -101,7 +107,7 @@ namespace RM inline std::shared_ptr Base::as() const { if (inherits(T::StaticObjectType)) { - return std::shared_ptr(static_cast(this)); + return std::static_pointer_cast(shared_from_this()); } return std::shared_ptr(); } @@ -110,7 +116,7 @@ namespace RM inline std::shared_ptr Base::as() { if (inherits(T::StaticObjectType)) { - return std::shared_ptr(static_cast(this)); + return std::static_pointer_cast(shared_from_this()); } return std::shared_ptr(); } diff --git a/Libs/libRepoMan/Events.cpp b/Libs/libRepoMan/Events.cpp deleted file mode 100644 index 45db5a75..00000000 --- a/Libs/libRepoMan/Events.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2015 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#include "libRepoMan/Events.hpp" - -namespace RM -{ - - /** - * @class EventsInterface - * @brief Interface that receives all RepoMan events - * - * All pure virtual methods in this interface represent events from the RepoMan. - * - * Each of these events can be connected to individually via Qt's SIGNAL/SLOT mechanism on the - * MacGitver::repoMan() singleton. - * - * You can also write an implementation of the whole interface and register it through the - * Events singleton. We're doing that in the unit tests - and probably will do it in a - * Heaven::View in order to display the repository events. - * - * @fn EventsInterface::repositoryOpened(Repo* repo) - * @brief Sent after a repository is opened - * - * This is an administrative event. It implies no actual change to the underlying repository. - * - * @param[in] repo The repository that was opened - * - * - * @fn EventsInterface::repositoryAboutToClose(Repo* repo) - * @brief Sent before a repository will be closed - * - * This is an administrative event. It implies no actual change to the underlying repository. - * - * @param[in] repo The repository that is about to be closed - * - * - * @fn EventsInterface::repositoryActivated(Repo* repo) - * @brief Sent after a repository was activated - * - * This is an administrative event. It implies no actual change to the underlying repository. - * - * @param[in] repo The repository that became the active one - * - * - * @fn EventsInterface::repositoryDeactivated(Repo* repo) - * @brief Sent after a repository was deactivated - * - * This is an administrative event. It implies no actual change to the underlying repository. - * - * @param[in] repo The repository that was activated - * - * - * @fn EventsInterface::repositoryStateChanged(Repo* repo) - * @brief Sent after a change in a repository's state was detected - * - * Transitions between "normal", "rebasing", "merging" etc. are detected. - * - * @param[in] repo The repository whose state changed - * - * @fn EventsInterface::refTreeNodeCreated(Repo* repo, RefTreeNode* node) - * @brief Sent when a new tree node in a ref tree was created - * - * This is a virtual event. It is artificially created. - * - * @param[in] repo The repository for which a ref tree node was created - * @param[in] node The node that was created - * - * - * @fn EventsInterface::refTreeNodeAboutToBeRemoved(Repo* repo, RefTreeNode* node) - * @brief Sent before a tree node in a ref tree will be removed - * - * This is a virtual event. It is artificially created. - * - * @param[in] repo The repository for which a ref tree node will be removed - * @param[in] node The node that will be removed - * - * - * @fn EventsInterface::refCreated(Repo* repo, Ref* ref) - * @brief Sent after a reference was created - * - * @param[in] repo The affected repository - * @param[in] ref The newly created reference - * - * @fn EventsInterface::refAboutToBeRemoved(Repo* repo, Ref* ref) - * @brief Sent before a reference is about to be removed - * - * The reference is most probably already physically removed. This event is sent before it is - * removed from RepoMan's data model. - * - * @param[in] repo The affected repository - * @param[in] ref The reference that will be removed - * - * - * @fn EventsInterface::refMoved(Repo* repo, Ref* ref) - * @brief Sent when either the target id or the symbolic target of a reference changed. - * - * The reference is most probably already physically moved. This event is sent when the change - * is discovered by the RepoMan. - * - * @param[in] repo The affected repository - * @param[in] ref The reference that will move - * - * - * @fn EventsInterface::refHeadDetached(Repo* repo, Ref* ref) - * @brief Sent after the HEAD reference got into a detached state - * - * This event will be sent when RepoMan detected that the HEAD reference has been set to a - * detached state. - * - * This will happen constantly during a rebase action and also happens after checking out a - * given SHA1 or a tag. - * - * @param[in] repo The affected repository - * @param[in] ref The HEAD reference that got detached - * - */ - - Events::Events() - { - } - - Events* Events::sSelf = NULL; - - Events* Events::self() - { - if (sSelf == NULL) { - sSelf = new Events; - } - return sSelf; - } - - void Events::addReceiver(EventsInterface* ev) - { - self()->mEvents.insert(ev); - } - - void Events::delReceiver(EventsInterface* ev) - { - self()->mEvents.remove(ev); - } - - void Events::repositoryOpened(const RM::Frontend::Repo& repo) - { - foreach (EventsInterface* ei, mEvents) { - ei->repositoryOpened(repo); - } - } - - void Events::repositoryAboutToClose(const RM::Frontend::Repo& repo) - { - foreach (EventsInterface* ei, mEvents) { - ei->repositoryAboutToClose(repo); - } - } - - void Events::repositoryActivated(const RM::Frontend::Repo& repo) - { - foreach (EventsInterface* ei, mEvents) { - ei->repositoryActivated(repo); - } - } - - void Events::repositoryDeactivated(const RM::Frontend::Repo& repo) - { - foreach (EventsInterface* ei, mEvents) { - ei->repositoryDeactivated(repo); - } - } - - void Events::objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) - { - foreach (EventsInterface* ei, mEvents) { - ei->objectCreated(repo, object); - } - } - - void Events::objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) - { - foreach (EventsInterface* ei, mEvents) { - ei->objectAboutToBeDeleted(repo, object); - } - } - - void Events::refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) - { - foreach (EventsInterface* ei, mEvents) { - ei->refTreeNodeCreated(repo, node); - } - } - - void Events::refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) - { - foreach (EventsInterface* ei, mEvents) { - ei->refTreeNodeAboutToBeDeleted(repo, node); - } - } - - void Events::refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) - { - foreach (EventsInterface* ei, mEvents) { - ei->refCreated(repo, ref); - } - } - - void Events::refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) - { - foreach (EventsInterface* ei, mEvents) { - ei->refAboutToBeDeleted(repo, ref); - } - } - - void Events::refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) - { - foreach (EventsInterface* ei, mEvents) { - ei->refMoved(repo, ref); - } - } - - void Events::refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) - { - foreach (EventsInterface* ei, mEvents) { - ei->refHeadDetached(repo, ref); - } - } - - void Events::tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) - { - foreach (EventsInterface* ei, mEvents) { - ei->tagCreated(repo, tag); - } - } - - void Events::tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) - { - foreach (EventsInterface* ei, mEvents) { - ei->tagAboutToBeDeleted(repo, tag); - } - } - - void Events::branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) - { - foreach (EventsInterface* ei, mEvents) { - ei->branchCreated(repo, branch); - } - } - - void Events::branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) - { - foreach (EventsInterface* ei, mEvents) { - ei->branchAboutToBeDeleted(repo, branch); - } - } - - void Events::branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) - { - foreach (EventsInterface* ei, mEvents) { - ei->branchMoved(repo, branch); - } - } - - void Events::branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) - { - foreach (EventsInterface* ei, mEvents) { - ei->branchUpstreamChanged(repo, branch); - } - } - - void Events::namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) - { - foreach (EventsInterface* ei, mEvents) { - ei->namespaceCreated(repo, nameSpace); - } - } - - void Events::namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) - { - foreach (EventsInterface* ei, mEvents) { - ei->namespaceAboutToBeDeleted(repo, nameSpace); - } - } - - void Events::refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) - { - foreach (EventsInterface* ei, mEvents) { - ei->refLogChanged(repo, reflog); - } - } - - void Events::refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) - { - foreach (EventsInterface* ei, mEvents) { - ei->refLogNewEntry(repo, reflog); - } - } - - void Events::stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) - { - foreach (EventsInterface* ei, mEvents) { - ei->stageCreated(repo, ref); - } - } - - void Events::stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) - { - foreach (EventsInterface* ei, mEvents) { - ei->stageAboutToBeDeleted(repo, ref); - } - } - - void Events::remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) - { - foreach (EventsInterface* ei, mEvents) { - ei->remoteCreated(repo, remote); - } - } - - void Events::remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) - { - foreach (EventsInterface* ei, mEvents) { - ei->remoteAboutToBeDeleted(repo, remote); - } - } - - void Events::remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) - { - foreach (EventsInterface* ei, mEvents) { - ei->remoteModified(repo, remote); - } - } - - void Events::submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) - { - foreach (EventsInterface* ei, mEvents) { - ei->submoduleCreated(repo, submodule); - } - } - - void Events::submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) - { - foreach (EventsInterface* ei, mEvents) { - ei->submoduleAboutToBeDeleted(repo, submodule); - } - } - - void Events::submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) - { - foreach (EventsInterface* ei, mEvents) { - ei->submoduleMoved(repo, submodule); - } - } - - void Events::repositoryStateChanged(const RM::Frontend::Repo& repo) - { - foreach (EventsInterface* ei, mEvents) { - ei->repositoryStateChanged(repo); - } - } - - void Events::indexUpdated(const RM::Frontend::Repo& repo) - { - foreach (EventsInterface* ei, mEvents) { - ei->indexUpdated(repo); - } - } - - void Events::workTreeUpdated(const RM::Frontend::Repo& repo) - { - foreach (EventsInterface* ei, mEvents) { - ei->workTreeUpdated(repo); - } - } - - -} diff --git a/Libs/libRepoMan/Events.hpp b/Libs/libRepoMan/Events.hpp deleted file mode 100644 index 6bb6fe7c..00000000 --- a/Libs/libRepoMan/Events.hpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012-2015 The MacGitver-Developers - * - * (C) Sascha Cunz - * (C) Cunz RaD Ltd. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; if - * not, see . - * - */ - -#pragma once - -#include "libRepoMan/Core.hpp" - -#include - -namespace RM -{ - - namespace Frontend - { - class Base; - class Namespace; - class Repo; - class Reference; - class Remote; - class Submodule; - class RefTreeNode; - class RefLog; - class Branch; - class Tag; - } - - class REPOMAN_API EventsInterface - { - public: - virtual ~EventsInterface() {} - - public: - virtual void repositoryOpened(const RM::Frontend::Repo& repo) = 0; - virtual void repositoryAboutToClose(const RM::Frontend::Repo& repo) = 0; - virtual void repositoryActivated(const RM::Frontend::Repo& repo) = 0; - virtual void repositoryDeactivated(const RM::Frontend::Repo& repo) = 0; - - virtual void objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) = 0; - virtual void objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) = 0; - - virtual void refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) = 0; - virtual void refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) = 0; - - virtual void refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; - virtual void refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; - virtual void refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; - virtual void refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; - - virtual void tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) = 0; - virtual void tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) = 0; - - virtual void branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) = 0; - virtual void branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) = 0; - virtual void branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) = 0; - virtual void branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) = 0; - - virtual void namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) = 0; - virtual void namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) = 0; - - virtual void refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) = 0; - virtual void refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) = 0; - - virtual void stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; - virtual void stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) = 0; - - virtual void remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) = 0; - virtual void remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) = 0; - virtual void remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) = 0; - - virtual void submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) = 0; - virtual void submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) = 0; - virtual void submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) = 0; - - virtual void repositoryStateChanged(const RM::Frontend::Repo& repo) = 0; - virtual void indexUpdated(const RM::Frontend::Repo& repo) = 0; - virtual void workTreeUpdated(const RM::Frontend::Repo& repo) = 0; - }; - - class REPOMAN_API Events // : public EventsInterface - { - private: - Events(); - - public: - static Events* self(); - static void addReceiver(EventsInterface* ev); - static void delReceiver(EventsInterface* ev); - - private: - QSet mEvents; - static Events* sSelf; - - public: - void repositoryOpened(const RM::Frontend::Repo& repo); - void repositoryAboutToClose(const RM::Frontend::Repo& repo); - void repositoryActivated(const RM::Frontend::Repo& repo); - void repositoryDeactivated(const RM::Frontend::Repo& repo); - void objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); - void objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); - void refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); - void refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); - void refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); - void tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); - void branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); - void namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); - void refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); - void refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); - void stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); - void remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); - void remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); - void submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); - void submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); - void submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); - void repositoryStateChanged(const RM::Frontend::Repo& repo); - void indexUpdated(const RM::Frontend::Repo& repo); - void workTreeUpdated(const RM::Frontend::Repo& repo); - }; - -} diff --git a/Libs/libRepoMan/Events/Compat.cpp b/Libs/libRepoMan/Events/Compat.cpp new file mode 100644 index 00000000..c6d704dc --- /dev/null +++ b/Libs/libRepoMan/Events/Compat.cpp @@ -0,0 +1,384 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "libRepoMan/Events/Event.hpp" +#include "libRepoMan/Events/Compat.hpp" + +namespace RM +{ + + /** + * @class CompatEventsInterface + * @brief Interface that receives all RepoMan events + * + * All pure virtual methods in this interface represent events from the RepoMan. + * + * Each of these events can be connected to individually via Qt's SIGNAL/SLOT mechanism on the + * MacGitver::repoMan() singleton. + * + * You can also write an implementation of the whole interface and register it through the + * CompatEvents singleton. We're doing that in the unit tests - and probably will do it in a + * Heaven::View in order to display the repository events. + * + * @fn CompatEventsInterface::repositoryOpened(Repo* repo) + * @brief Sent after a repository is opened + * + * This is an administrative event. It implies no actual change to the underlying repository. + * + * @param[in] repo The repository that was opened + * + * + * @fn CompatEventsInterface::repositoryAboutToClose(Repo* repo) + * @brief Sent before a repository will be closed + * + * This is an administrative event. It implies no actual change to the underlying repository. + * + * @param[in] repo The repository that is about to be closed + * + * + * @fn CompatEventsInterface::repositoryActivated(Repo* repo) + * @brief Sent after a repository was activated + * + * This is an administrative event. It implies no actual change to the underlying repository. + * + * @param[in] repo The repository that became the active one + * + * + * @fn CompatEventsInterface::repositoryDeactivated(Repo* repo) + * @brief Sent after a repository was deactivated + * + * This is an administrative event. It implies no actual change to the underlying repository. + * + * @param[in] repo The repository that was activated + * + * + * @fn CompatEventsInterface::repositoryStateChanged(Repo* repo) + * @brief Sent after a change in a repository's state was detected + * + * Transitions between "normal", "rebasing", "merging" etc. are detected. + * + * @param[in] repo The repository whose state changed + * + * @fn CompatEventsInterface::refTreeNodeCreated(Repo* repo, RefTreeNode* node) + * @brief Sent when a new tree node in a ref tree was created + * + * This is a virtual event. It is artificially created. + * + * @param[in] repo The repository for which a ref tree node was created + * @param[in] node The node that was created + * + * + * @fn CompatEventsInterface::refTreeNodeAboutToBeRemoved(Repo* repo, RefTreeNode* node) + * @brief Sent before a tree node in a ref tree will be removed + * + * This is a virtual event. It is artificially created. + * + * @param[in] repo The repository for which a ref tree node will be removed + * @param[in] node The node that will be removed + * + * + * @fn CompatEventsInterface::refCreated(Repo* repo, Ref* ref) + * @brief Sent after a reference was created + * + * @param[in] repo The affected repository + * @param[in] ref The newly created reference + * + * @fn CompatEventsInterface::refAboutToBeRemoved(Repo* repo, Ref* ref) + * @brief Sent before a reference is about to be removed + * + * The reference is most probably already physically removed. This event is sent before it is + * removed from RepoMan's data model. + * + * @param[in] repo The affected repository + * @param[in] ref The reference that will be removed + * + * + * @fn CompatEventsInterface::refMoved(Repo* repo, Ref* ref) + * @brief Sent when either the target id or the symbolic target of a reference changed. + * + * The reference is most probably already physically moved. This event is sent when the change + * is discovered by the RepoMan. + * + * @param[in] repo The affected repository + * @param[in] ref The reference that will move + * + * + * @fn CompatEventsInterface::refHeadDetached(Repo* repo, Ref* ref) + * @brief Sent after the HEAD reference got into a detached state + * + * This event will be sent when RepoMan detected that the HEAD reference has been set to a + * detached state. + * + * This will happen constantly during a rebase action and also happens after checking out a + * given SHA1 or a tag. + * + * @param[in] repo The affected repository + * @param[in] ref The HEAD reference that got detached + * + */ + + std::vector CompatEvents::mEvents; + + void CompatEvents::addReceiver(CompatEventsInterface* ev) + { + mEvents.push_back(ev); + } + + void CompatEvents::delReceiver(CompatEventsInterface* ev) + { + for (auto it = mEvents.begin(); it != mEvents.end(); ++it) { + if (*it == ev) { + mEvents.erase(it); + return; + } + } + } + + void CompatEvents::repositoryOpened(const RM::Frontend::Repo& repo) + { + for (CompatEventsInterface* ei : mEvents) { + ei->repositoryOpened(repo); + } + } + + void CompatEvents::repositoryAboutToClose(const RM::Frontend::Repo& repo) + { + for (CompatEventsInterface* ei : mEvents) { + ei->repositoryAboutToClose(repo); + } + } + + void CompatEvents::repositoryActivated(const RM::Frontend::Repo& repo) + { + for (CompatEventsInterface* ei : mEvents) { + ei->repositoryActivated(repo); + } + } + + void CompatEvents::repositoryDeactivated(const RM::Frontend::Repo& repo) + { + for (CompatEventsInterface* ei : mEvents) { + ei->repositoryDeactivated(repo); + } + } + + void CompatEvents::objectCreated(const RM::Frontend::Base& object) + { + for (CompatEventsInterface* ei : mEvents) { + ei->objectCreated(object); + } + } + + void CompatEvents::objectAboutToBeDeleted(const RM::Frontend::Base& object) + { + for (CompatEventsInterface* ei : mEvents) { + ei->objectAboutToBeDeleted(object); + } + } + + void CompatEvents::refTreeNodeCreated(const RM::Frontend::RefTreeNode& node) + { + for (CompatEventsInterface* ei : mEvents) { + ei->refTreeNodeCreated(node); + } + } + + void CompatEvents::refTreeNodeAboutToBeDeleted(const RM::Frontend::RefTreeNode& node) + { + for (CompatEventsInterface* ei : mEvents) { + ei->refTreeNodeAboutToBeDeleted(node); + } + } + + void CompatEvents::refCreated(const RM::Frontend::Reference& ref) + { + for (CompatEventsInterface* ei : mEvents) { + ei->refCreated(ref); + } + } + + void CompatEvents::refAboutToBeDeleted(const RM::Frontend::Reference& ref) + { + for (CompatEventsInterface* ei : mEvents) { + ei->refAboutToBeDeleted(ref); + } + } + + void CompatEvents::refMoved(const RM::Frontend::Reference& ref) + { + for (CompatEventsInterface* ei : mEvents) { + ei->refMoved(ref); + } + } + + void CompatEvents::refHeadDetached(const RM::Frontend::Reference& ref) + { + for (CompatEventsInterface* ei : mEvents) { + ei->refHeadDetached(ref); + } + } + + void CompatEvents::tagCreated(const RM::Frontend::Tag& tag) + { + for (CompatEventsInterface* ei : mEvents) { + ei->tagCreated(tag); + } + } + + void CompatEvents::tagAboutToBeDeleted(const RM::Frontend::Tag& tag) + { + for (CompatEventsInterface* ei : mEvents) { + ei->tagAboutToBeDeleted(tag); + } + } + + void CompatEvents::branchCreated(const RM::Frontend::Branch& branch) + { + for (CompatEventsInterface* ei : mEvents) { + ei->branchCreated(branch); + } + } + + void CompatEvents::branchAboutToBeDeleted(const RM::Frontend::Branch& branch) + { + for (CompatEventsInterface* ei : mEvents) { + ei->branchAboutToBeDeleted(branch); + } + } + + void CompatEvents::branchMoved(const RM::Frontend::Branch& branch) + { + for (CompatEventsInterface* ei : mEvents) { + ei->branchMoved(branch); + } + } + + void CompatEvents::branchUpstreamChanged(const RM::Frontend::Branch& branch) + { + for (CompatEventsInterface* ei : mEvents) { + ei->branchUpstreamChanged(branch); + } + } + + void CompatEvents::namespaceCreated(const RM::Frontend::Namespace& nameSpace) + { + for (CompatEventsInterface* ei : mEvents) { + ei->namespaceCreated(nameSpace); + } + } + + void CompatEvents::namespaceAboutToBeDeleted(const RM::Frontend::Namespace& nameSpace) + { + for (CompatEventsInterface* ei : mEvents) { + ei->namespaceAboutToBeDeleted(nameSpace); + } + } + + void CompatEvents::refLogChanged(const RM::Frontend::RefLog& reflog) + { + for (CompatEventsInterface* ei : mEvents) { + ei->refLogChanged(reflog); + } + } + + void CompatEvents::refLogNewEntry(const RM::Frontend::RefLog& reflog) + { + for (CompatEventsInterface* ei : mEvents) { + ei->refLogNewEntry(reflog); + } + } + + void CompatEvents::stageCreated(const RM::Frontend::Reference& ref) + { + for (CompatEventsInterface* ei : mEvents) { + ei->stageCreated(ref); + } + } + + void CompatEvents::stageAboutToBeDeleted(const RM::Frontend::Reference& ref) + { + for (CompatEventsInterface* ei : mEvents) { + ei->stageAboutToBeDeleted(ref); + } + } + + void CompatEvents::remoteCreated(const RM::Frontend::Remote& remote) + { + for (CompatEventsInterface* ei : mEvents) { + ei->remoteCreated(remote); + } + } + + void CompatEvents::remoteAboutToBeDeleted(const RM::Frontend::Remote& remote) + { + for (CompatEventsInterface* ei : mEvents) { + ei->remoteAboutToBeDeleted(remote); + } + } + + void CompatEvents::remoteModified(const RM::Frontend::Remote& remote) + { + for (CompatEventsInterface* ei : mEvents) { + ei->remoteModified(remote); + } + } + + void CompatEvents::submoduleCreated(const RM::Frontend::Submodule& submodule) + { + for (CompatEventsInterface* ei : mEvents) { + ei->submoduleCreated(submodule); + } + } + + void CompatEvents::submoduleAboutToBeDeleted(const RM::Frontend::Submodule& submodule) + { + for (CompatEventsInterface* ei : mEvents) { + ei->submoduleAboutToBeDeleted(submodule); + } + } + + void CompatEvents::submoduleMoved(const RM::Frontend::Submodule& submodule) + { + for (CompatEventsInterface* ei : mEvents) { + ei->submoduleMoved(submodule); + } + } + + void CompatEvents::repositoryStateChanged(const RM::Frontend::Repo& repo) + { + for (CompatEventsInterface* ei : mEvents) { + ei->repositoryStateChanged(repo); + } + } + + void CompatEvents::indexUpdated() + { + for (CompatEventsInterface* ei : mEvents) { + ei->indexUpdated(); + } + } + + void CompatEvents::workTreeUpdated() + { + for (CompatEventsInterface* ei : mEvents) { + ei->workTreeUpdated(); + } + } + +} diff --git a/Libs/libRepoMan/Events/Compat.hpp b/Libs/libRepoMan/Events/Compat.hpp new file mode 100644 index 00000000..41a0dc40 --- /dev/null +++ b/Libs/libRepoMan/Events/Compat.hpp @@ -0,0 +1,123 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include "libRepoMan/Frontend/Base.hpp" + +namespace RM +{ + + class REPOMAN_API CompatEventsInterface + { + public: + virtual ~CompatEventsInterface() {} + + public: + virtual void repositoryOpened(const RM::Frontend::Repo& repo) = 0; + virtual void repositoryAboutToClose(const RM::Frontend::Repo& repo) = 0; + virtual void repositoryActivated(const RM::Frontend::Repo& repo) = 0; + virtual void repositoryDeactivated(const RM::Frontend::Repo& repo) = 0; + + virtual void objectCreated(const RM::Frontend::Base& object) = 0; + virtual void objectAboutToBeDeleted(const RM::Frontend::Base& object) = 0; + + virtual void refTreeNodeCreated(const RM::Frontend::RefTreeNode& node) = 0; + virtual void refTreeNodeAboutToBeDeleted(const RM::Frontend::RefTreeNode& node) = 0; + + virtual void refCreated(const RM::Frontend::Reference& ref) = 0; + virtual void refAboutToBeDeleted(const RM::Frontend::Reference& ref) = 0; + virtual void refMoved(const RM::Frontend::Reference& ref) = 0; + virtual void refHeadDetached(const RM::Frontend::Reference& ref) = 0; + + virtual void tagCreated(const RM::Frontend::Tag& tag) = 0; + virtual void tagAboutToBeDeleted(const RM::Frontend::Tag& tag) = 0; + + virtual void branchCreated(const RM::Frontend::Branch& branch) = 0; + virtual void branchAboutToBeDeleted(const RM::Frontend::Branch& branch) = 0; + virtual void branchMoved(const RM::Frontend::Branch& branch) = 0; + virtual void branchUpstreamChanged(const RM::Frontend::Branch& branch) = 0; + + virtual void namespaceCreated(const RM::Frontend::Namespace& nameSpace) = 0; + virtual void namespaceAboutToBeDeleted(const RM::Frontend::Namespace& nameSpace) = 0; + + virtual void refLogChanged(const RM::Frontend::RefLog& reflog) = 0; + virtual void refLogNewEntry(const RM::Frontend::RefLog& reflog) = 0; + + virtual void stageCreated(const RM::Frontend::Reference& ref) = 0; + virtual void stageAboutToBeDeleted(const RM::Frontend::Reference& ref) = 0; + + virtual void remoteCreated(const RM::Frontend::Remote& remote) = 0; + virtual void remoteAboutToBeDeleted(const RM::Frontend::Remote& remote) = 0; + virtual void remoteModified(const RM::Frontend::Remote& remote) = 0; + + virtual void submoduleCreated(const RM::Frontend::Submodule& submodule) = 0; + virtual void submoduleAboutToBeDeleted(const RM::Frontend::Submodule& submodule) = 0; + virtual void submoduleMoved(const RM::Frontend::Submodule& submodule) = 0; + + virtual void repositoryStateChanged(const RM::Frontend::Repo& repo) = 0; + virtual void indexUpdated() = 0; + virtual void workTreeUpdated() = 0; + }; + + class REPOMAN_API CompatEvents + { + static std::vector mEvents; + + public: + static void addReceiver(CompatEventsInterface* ei); + static void delReceiver(CompatEventsInterface* ei); + + public: + static void repositoryOpened(const RM::Frontend::Repo& repo); + static void repositoryAboutToClose(const RM::Frontend::Repo& repo); + static void repositoryActivated(const RM::Frontend::Repo& repo); + static void repositoryDeactivated(const RM::Frontend::Repo& repo); + static void objectCreated(const RM::Frontend::Base& object); + static void objectAboutToBeDeleted(const RM::Frontend::Base& object); + static void refTreeNodeCreated(const RM::Frontend::RefTreeNode& node); + static void refTreeNodeAboutToBeDeleted(const RM::Frontend::RefTreeNode& node); + static void refCreated(const RM::Frontend::Reference& ref); + static void refAboutToBeDeleted(const RM::Frontend::Reference& ref); + static void refMoved(const RM::Frontend::Reference& ref); + static void refHeadDetached(const RM::Frontend::Reference& ref); + static void tagCreated(const RM::Frontend::Tag& tag); + static void tagAboutToBeDeleted(const RM::Frontend::Tag& tag); + static void branchCreated(const RM::Frontend::Branch& branch); + static void branchAboutToBeDeleted(const RM::Frontend::Branch& branch); + static void branchMoved(const RM::Frontend::Branch& branch); + static void branchUpstreamChanged(const RM::Frontend::Branch& branch); + static void namespaceCreated(const RM::Frontend::Namespace& nameSpace); + static void namespaceAboutToBeDeleted(const RM::Frontend::Namespace& nameSpace); + static void refLogChanged(const RM::Frontend::RefLog& reflog); + static void refLogNewEntry(const RM::Frontend::RefLog& reflog); + static void stageCreated(const RM::Frontend::Reference& ref); + static void stageAboutToBeDeleted(const RM::Frontend::Reference& ref); + static void remoteCreated(const RM::Frontend::Remote& remote); + static void remoteAboutToBeDeleted(const RM::Frontend::Remote& remote); + static void remoteModified(const RM::Frontend::Remote& remote); + static void submoduleCreated(const RM::Frontend::Submodule& submodule); + static void submoduleAboutToBeDeleted(const RM::Frontend::Submodule& submodule); + static void submoduleMoved(const RM::Frontend::Submodule& submodule); + static void repositoryStateChanged(const RM::Frontend::Repo& repo); + static void indexUpdated(); + static void workTreeUpdated(); + }; + +} diff --git a/Libs/libRepoMan/Events/Event.cpp b/Libs/libRepoMan/Events/Event.cpp new file mode 100644 index 00000000..3d5b0fdd --- /dev/null +++ b/Libs/libRepoMan/Events/Event.cpp @@ -0,0 +1,93 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "libRepoMan/Events/Event.hpp" +#include "libRepoMan/Events/EventData.hpp" + +#include "libRepoMan/Frontend/Repo.hpp" + +namespace RM +{ + + + Event::Event() + { + } + + Event::~Event() + { + } + + Event::Event(const Event& o) + : d(o.d) + { + } + + Event::Event(Event&& o) + : d(std::move(o.d)) + { + } + + Event::Event(const std::shared_ptr& o) + : d(o) + { + } + + Event::Event(std::shared_ptr&& o) + : d(std::move(o)) + { + } + + Event& Event::operator =(const Event& o) + { + d = o.d; + return *this; + } + + Event& Event::operator =(Event&& o) + { + d = std::move(o.d); + return *this; + } + + EventType Event::type() const + { + if (!d) { + return EventType::None; + } + return d->type(); + } + + Frontend::Repo Event::repo() const + { + if (!d) { + return Frontend::Repo(); + } + return d->repo().lock(); + } + + Frontend::Base Event::baseContext() const + { + if (!d) { + return Frontend::Base(); + } + return d->context(); + } + +} diff --git a/Libs/libRepoMan/Events/Event.hpp b/Libs/libRepoMan/Events/Event.hpp new file mode 100644 index 00000000..3c2d2dad --- /dev/null +++ b/Libs/libRepoMan/Events/Event.hpp @@ -0,0 +1,74 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include "libRepoMan/Frontend/Base.hpp" + +#include + +namespace RM +{ + + namespace Internal + { + class EventData; + } + + enum class EventType + { + None, + + RepoOpened, + RepoAboutToClose, + RepoActivated, + RepoDeactivated, + }; + + class REPOMAN_API Event + { + public: + Event(); + Event(std::shared_ptr&& d); + Event(const std::shared_ptr& d); + Event(const Event& o); + Event(Event&& o); + + Event& operator=(const Event& o); + Event& operator=(Event&& o); + + ~Event(); + + public: + EventType type() const; + Frontend::Repo repo() const; + + Frontend::Base baseContext() const; + + template + T context() const + { + return baseContext().as(); + } + + private: + std::shared_ptr d; + }; + +} diff --git a/Libs/libRepoMan/Events/EventData.cpp b/Libs/libRepoMan/Events/EventData.cpp new file mode 100644 index 00000000..298767cc --- /dev/null +++ b/Libs/libRepoMan/Events/EventData.cpp @@ -0,0 +1,49 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "libRepoMan/Events/EventData.hpp" + +namespace RM +{ + + namespace Internal + { + + EventData::EventData(EventType type, Data::Base* context) + : mType(type) + , mContext(context ? context->getPtr() : Data::Base::SPtr()) + { + } + + std::shared_ptr EventData::create(EventType type, Data::Base* context) + { + return std::make_shared(type, context); + } + + Data::Repo::WPtr EventData::repo() const + { + if (!mContext) { + return Data::Repo::WPtr(); + } + return mContext->repository(); + } + + } + +} diff --git a/Libs/libRepoMan/Events/EventData.hpp b/Libs/libRepoMan/Events/EventData.hpp new file mode 100644 index 00000000..4539d8a4 --- /dev/null +++ b/Libs/libRepoMan/Events/EventData.hpp @@ -0,0 +1,55 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include "libRepoMan/Events/Event.hpp" +#include "libRepoMan/Data/Base.hpp" +#include "libRepoMan/Data/Repo.hpp" + +namespace RM +{ + + namespace Internal + { + + class EventData + { + public: + EventData() = delete; + EventData(const EventData&) = delete; + EventData(EventType type, Data::Base* context); + + public: + static std::shared_ptr create(EventType type, Data::Base* context); + + public: + Data::Repo::WPtr repo() const; + const Data::Base::SPtr& context() const { return mContext; } + EventType type() const { return mType; } + + private: + EventType mType; + Data::Base::SPtr mContext; + }; + + + } + +} diff --git a/Libs/libRepoMan/Events/Manager.cpp b/Libs/libRepoMan/Events/Manager.cpp new file mode 100644 index 00000000..1b7ab1c9 --- /dev/null +++ b/Libs/libRepoMan/Events/Manager.cpp @@ -0,0 +1,71 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "libRepoMan/Events/Manager.hpp" + +#include +#include +#include +#include + +namespace RM +{ + + namespace Internal + { + + void ThreadMover::sendMovedEvent(const Event& e) + { + Q_ASSERT(QThread::currentThread() == thread()); + EventManager::self().sendEvent(e); + } + + } + + EventManager::EventManager() + { + if(thread() != qApp->thread()) { + qDebug() << "Moving EventManager to main thread"; + moveToThread(qApp->thread()); + } + + mMover = new Internal::ThreadMover(this); + } + + void EventManager::sendEvent(const Event& ev) + { + if (QThread::currentThread() != thread()) { + QMetaObject::invokeMethod(mMover, "sendMovedEvent", Qt::QueuedConnection, + Q_ARG(RM::Event, ev)); + return; + } + emit repoEvent(ev); + } + + EventManager& EventManager::self() + { + static QPointer s; + if (!s) { + s = new EventManager; + } + return *s; + } + +} + diff --git a/Libs/libRepoMan/Events/Manager.hpp b/Libs/libRepoMan/Events/Manager.hpp new file mode 100644 index 00000000..83d3fdc0 --- /dev/null +++ b/Libs/libRepoMan/Events/Manager.hpp @@ -0,0 +1,62 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include "libRepoMan/Events/Event.hpp" + +namespace RM +{ + + namespace Internal + { + + class ThreadMover : public QObject + { + Q_OBJECT + public: + using QObject::QObject; + + public slots: + void sendMovedEvent(const RM::Event& e); + }; + + } + + class REPOMAN_API EventManager + : public QObject + { + Q_OBJECT + public: + static EventManager& self(); + + private: + EventManager(); + + public: + void sendEvent(const Event& ev); + + signals: + void repoEvent(const Event& ev); + + private: + Internal::ThreadMover* mMover; + }; + +} diff --git a/Libs/libRepoMan/Frontend/Base.hpp b/Libs/libRepoMan/Frontend/Base.hpp index 0eac9406..2029dbe0 100644 --- a/Libs/libRepoMan/Frontend/Base.hpp +++ b/Libs/libRepoMan/Frontend/Base.hpp @@ -44,8 +44,8 @@ namespace RM using DPtrType = Data::Base; public: - Base(const std::shared_ptr& _d); - Base(std::shared_ptr&& _d); + Base(const std::shared_ptr& d); + Base(std::shared_ptr&& d); virtual ~Base(); Base(); diff --git a/Libs/libRepoMan/RepoMan.cpp b/Libs/libRepoMan/RepoMan.cpp index 68a16f56..41c3df7f 100644 --- a/Libs/libRepoMan/RepoMan.cpp +++ b/Libs/libRepoMan/RepoMan.cpp @@ -18,7 +18,6 @@ */ #include "libRepoMan/RepoMan.hpp" -#include "libRepoMan/Events.hpp" #include "libRepoMan/Private/Dumper.hpp" @@ -46,8 +45,6 @@ namespace RM */ RepoMan::RepoMan() { - Events::addReceiver(this); - connect(BlueSky::Application::instance(), &BlueSky::Application::activeModeChanged, this, @@ -63,7 +60,6 @@ namespace RM RepoMan::~RepoMan() { closeAll(); - Events::delReceiver(this); } RepoMan& RepoMan::instance() diff --git a/Libs/libRepoMan/RepoMan.hpp b/Libs/libRepoMan/RepoMan.hpp index 33f0bbf3..298b0dde 100644 --- a/Libs/libRepoMan/RepoMan.hpp +++ b/Libs/libRepoMan/RepoMan.hpp @@ -21,16 +21,18 @@ #include "libRepoMan/Frontend/Repo.hpp" -#include "libRepoMan/Events.hpp" +#include "libRepoMan/Events/Event.hpp" #include namespace RM { + namespace Frontend { class Branch; } + class REPOMAN_API RepoMan : public QObject - , private EventsInterface + //, private EventsInterface { Q_OBJECT private: @@ -61,6 +63,7 @@ namespace RM void repositoryClosed(); void hasActiveRepositoryChanged(bool hasActiveRepo); + #ifndef REPOMAN_NO_COMPAT signals: void repositoryOpened(const RM::Frontend::Repo& repo); void repositoryAboutToClose(const RM::Frontend::Repo& repo); @@ -95,6 +98,7 @@ namespace RM void repositoryStateChanged(const RM::Frontend::Repo& repo); void indexUpdated(const RM::Frontend::Repo& repo); void workTreeUpdated(const RM::Frontend::Repo& repo); + #endif }; } diff --git a/Modules/RepoManLogger/Listener.cpp b/Modules/RepoManLogger/Listener.cpp index 003df9ff..ae3c0bf5 100644 --- a/Modules/RepoManLogger/Listener.cpp +++ b/Modules/RepoManLogger/Listener.cpp @@ -28,12 +28,12 @@ Listener::Listener(Log::Channel channel) : repoManChannel(channel) { - RM::Events::addReceiver(this); + RM::CompatEvents::addReceiver(this); } Listener::~Listener() { - RM::Events::delReceiver(this); + RM::CompatEvents::delReceiver(this); } void Listener::repositoryOpened(const RM::Frontend::Repo& repo) @@ -74,39 +74,39 @@ void Listener::repositoryDeactivated(const RM::Frontend::Repo& repo) // We don't want to report deactivation } -void Listener::objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) +void Listener::objectCreated(const RM::Frontend::Base& object) { } -void Listener::objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object) +void Listener::objectAboutToBeDeleted(const RM::Frontend::Base& object) { } -void Listener::refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) +void Listener::refTreeNodeCreated(const RM::Frontend::RefTreeNode& node) { } -void Listener::refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node) +void Listener::refTreeNodeAboutToBeDeleted(const RM::Frontend::RefTreeNode& node) { } -void Listener::refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) +void Listener::refCreated(const RM::Frontend::Reference& ref) { } -void Listener::refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) +void Listener::refAboutToBeDeleted(const RM::Frontend::Reference& ref) { } -void Listener::refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) +void Listener::refMoved(const RM::Frontend::Reference& ref) { } -void Listener::refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) +void Listener::refHeadDetached(const RM::Frontend::Reference& ref) { } -void Listener::tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) +void Listener::tagCreated(const RM::Frontend::Tag& tag) { Log::Event e = Log::Event::create(TMPL_FOUND_NEW_REF); Q_ASSERT(e); @@ -114,91 +114,91 @@ void Listener::tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Ta e.setParam(QStringLiteral("Type"), tr("tag")); e.setParam(QStringLiteral("ObjName"), tag.displayName()); e.setParam(QStringLiteral("SHA"), tag.displaySha1()); - e.setParam(QStringLiteral("RepoName"), repo.displayAlias()); + e.setParam(QStringLiteral("RepoName"), tag.repository().displayAlias()); repoManChannel.addEvent(e); } -void Listener::tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag) +void Listener::tagAboutToBeDeleted(const RM::Frontend::Tag& tag) { } -void Listener::branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) +void Listener::branchCreated(const RM::Frontend::Branch& branch) { } -void Listener::branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) +void Listener::branchAboutToBeDeleted(const RM::Frontend::Branch& branch) { } -void Listener::branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) +void Listener::branchMoved(const RM::Frontend::Branch& branch) { Log::Event e = Log::Event::create(TMPL_BRANCH_MOVED); Q_ASSERT(e); e.setParam(QStringLiteral("ObjName"), branch.displayName()); e.setParam(QStringLiteral("SHA"), branch.displaySha1()); - e.setParam(QStringLiteral("RepoName"), repo.displayAlias()); + e.setParam(QStringLiteral("RepoName"), branch.repository().displayAlias()); repoManChannel.addEvent(e); } -void Listener::branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch) +void Listener::branchUpstreamChanged(const RM::Frontend::Branch& branch) { } -void Listener::namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) +void Listener::namespaceCreated(const RM::Frontend::Namespace& nameSpace) { } -void Listener::namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace) +void Listener::namespaceAboutToBeDeleted(const RM::Frontend::Namespace& nameSpace) { } -void Listener::refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) +void Listener::refLogChanged(const RM::Frontend::RefLog& reflog) { } -void Listener::refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog) +void Listener::refLogNewEntry(const RM::Frontend::RefLog& reflog) { } -void Listener::stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) +void Listener::stageCreated(const RM::Frontend::Reference& ref) { } -void Listener::stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref) +void Listener::stageAboutToBeDeleted(const RM::Frontend::Reference& ref) { } -void Listener::remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) +void Listener::remoteCreated(const RM::Frontend::Remote& remote) { } -void Listener::remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) +void Listener::remoteAboutToBeDeleted(const RM::Frontend::Remote& remote) { } -void Listener::remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote) +void Listener::remoteModified(const RM::Frontend::Remote& remote) { } -void Listener::submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) +void Listener::submoduleCreated(const RM::Frontend::Submodule& submodule) { Log::Event e = Log::Event::create(TMPL_FOUND_NEW_SM); Q_ASSERT(e); e.setParam(QStringLiteral("ObjName"), submodule.displayName()); - e.setParam(QStringLiteral("RepoName"), repo.displayAlias()); + e.setParam(QStringLiteral("RepoName"), submodule.repository().displayAlias()); repoManChannel.addEvent(e); } -void Listener::submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) +void Listener::submoduleAboutToBeDeleted(const RM::Frontend::Submodule& submodule) { } -void Listener::submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule) +void Listener::submoduleMoved(const RM::Frontend::Submodule& submodule) { } @@ -206,10 +206,10 @@ void Listener::repositoryStateChanged(const RM::Frontend::Repo& repo) { } -void Listener::indexUpdated(const RM::Frontend::Repo& repo) +void Listener::indexUpdated() { } -void Listener::workTreeUpdated(const RM::Frontend::Repo& repo) +void Listener::workTreeUpdated() { } diff --git a/Modules/RepoManLogger/Listener.hpp b/Modules/RepoManLogger/Listener.hpp index 3ded666c..8fd867e3 100644 --- a/Modules/RepoManLogger/Listener.hpp +++ b/Modules/RepoManLogger/Listener.hpp @@ -19,14 +19,14 @@ #pragma once -#include - -#include "libRepoMan/Events.hpp" +#include "libRepoMan/Events/Compat.hpp" #include "libLogger/Channel.hpp" #include "libLogger/Event.hpp" -class Listener : public RM::EventsInterface +#include + +class Listener : public RM::CompatEventsInterface { Q_DECLARE_TR_FUNCTIONS(RepoManLogger) @@ -39,35 +39,35 @@ class Listener : public RM::EventsInterface void repositoryAboutToClose(const RM::Frontend::Repo& repo); void repositoryActivated(const RM::Frontend::Repo& repo); void repositoryDeactivated(const RM::Frontend::Repo& repo); - void objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); - void objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); - void refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); - void refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); - void refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); - void tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); - void branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); - void namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); - void refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); - void refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); - void stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); - void remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); - void remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); - void submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); - void submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); - void submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void objectCreated(const RM::Frontend::Base& object); + void objectAboutToBeDeleted(const RM::Frontend::Base& object); + void refTreeNodeCreated(const RM::Frontend::RefTreeNode& node); + void refTreeNodeAboutToBeDeleted(const RM::Frontend::RefTreeNode& node); + void refCreated(const RM::Frontend::Reference& ref); + void refAboutToBeDeleted(const RM::Frontend::Reference& ref); + void refMoved(const RM::Frontend::Reference& ref); + void refHeadDetached(const RM::Frontend::Reference& ref); + void tagCreated(const RM::Frontend::Tag& tag); + void tagAboutToBeDeleted(const RM::Frontend::Tag& tag); + void branchCreated(const RM::Frontend::Branch& branch); + void branchAboutToBeDeleted(const RM::Frontend::Branch& branch); + void branchMoved(const RM::Frontend::Branch& branch); + void branchUpstreamChanged(const RM::Frontend::Branch& branch); + void namespaceCreated(const RM::Frontend::Namespace& nameSpace); + void namespaceAboutToBeDeleted(const RM::Frontend::Namespace& nameSpace); + void refLogChanged(const RM::Frontend::RefLog& reflog); + void refLogNewEntry(const RM::Frontend::RefLog& reflog); + void stageCreated(const RM::Frontend::Reference& ref); + void stageAboutToBeDeleted(const RM::Frontend::Reference& ref); + void remoteCreated(const RM::Frontend::Remote& remote); + void remoteAboutToBeDeleted(const RM::Frontend::Remote& remote); + void remoteModified(const RM::Frontend::Remote& remote); + void submoduleCreated(const RM::Frontend::Submodule& submodule); + void submoduleAboutToBeDeleted(const RM::Frontend::Submodule& submodule); + void submoduleMoved(const RM::Frontend::Submodule& submodule); void repositoryStateChanged(const RM::Frontend::Repo& repo); - void indexUpdated(const RM::Frontend::Repo& repo); - void workTreeUpdated(const RM::Frontend::Repo& repo); + void indexUpdated(); + void workTreeUpdated(); private: Log::Channel repoManChannel; diff --git a/Modules/RepoManLogger/RepoManLoggerModule.cpp b/Modules/RepoManLogger/RepoManLoggerModule.cpp index 7b8ec21b..6c51d615 100644 --- a/Modules/RepoManLogger/RepoManLoggerModule.cpp +++ b/Modules/RepoManLogger/RepoManLoggerModule.cpp @@ -25,7 +25,7 @@ #include "TemplateNames.hpp" RepoManLoggerModule::RepoManLoggerModule() - : listener(NULL) + : listener(nullptr) { } @@ -49,7 +49,7 @@ void RepoManLoggerModule::deinitialize() // Channel should also be kept registered // But listener has to be destroyed... delete listener; - listener = NULL; + listener = nullptr; } void RepoManLoggerModule::setupTemplates() From b02537722b4e6b2022c77cc54eb65dd64ef32298 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Mon, 20 Apr 2015 00:56:04 +0100 Subject: [PATCH 53/60] Fix some Compat-Event compile issues --- .../Widgets/RepoStateWidget.cpp | 21 ++++--- .../Widgets/RepoStateWidget.hpp | 4 +- Libs/libRepoMan/RepoMan.hpp | 61 +++++++++---------- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp b/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp index bd26c3d2..c0d4f884 100644 --- a/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp +++ b/Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp @@ -48,18 +48,18 @@ RepoStateWidget::RepoStateWidget() this, &RepoStateWidget::repositoryDeactivated); } -void RepoStateWidget::repositoryActivated(const RM::Frontend::Repo& info) +void RepoStateWidget::repositoryActivated(const RM::Frontend::Repo& repo) { - if (repo != info) { - repo = info; + if (mRepo != repo) { + mRepo = repo; setRepoState(); } } -void RepoStateWidget::repositoryDeactivated(const RM::Frontend::Repo& info) +void RepoStateWidget::repositoryDeactivated(const RM::Frontend::Repo& repo) { - if (repo == info) { - repo = RM::Frontend::Repo(); + if (mRepo == repo) { + mRepo = RM::Frontend::Repo(); setRepoState(); } } @@ -68,15 +68,16 @@ void RepoStateWidget::setRepoState() { txtState->hide(); - txtRepo->setText(repo ? repo.displayAlias() : QString()); - onUpdateHEAD(repo, RM::Frontend::Reference()); + txtRepo->setText(mRepo ? mRepo.displayAlias() : QString()); + onUpdateHEAD(RM::Frontend::Reference()); } void RepoStateWidget::onUpdateHEAD( - const RM::Frontend::Repo& ownerRepo, const RM::Frontend::Reference& ref) { - if (ownerRepo != repo) { + RM::Frontend::Repo repo = ref.repository(); + + if (repo != mRepo) { return; } diff --git a/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp b/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp index 4d6a5bd3..773f3ad3 100644 --- a/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp +++ b/Libs/libMacGitverCore/Widgets/RepoStateWidget.hpp @@ -40,10 +40,10 @@ private slots: void setRepoState(); public slots: - void onUpdateHEAD(const RM::Frontend::Repo& ownerRepo, const RM::Frontend::Reference& ref); + void onUpdateHEAD(const RM::Frontend::Reference& ref); private: - RM::Frontend::Repo repo; + RM::Frontend::Repo mRepo; QLabel* txtRepo; QLabel* txtState; QLabel* txtBranch; diff --git a/Libs/libRepoMan/RepoMan.hpp b/Libs/libRepoMan/RepoMan.hpp index 298b0dde..fc37bbbb 100644 --- a/Libs/libRepoMan/RepoMan.hpp +++ b/Libs/libRepoMan/RepoMan.hpp @@ -22,6 +22,7 @@ #include "libRepoMan/Frontend/Repo.hpp" #include "libRepoMan/Events/Event.hpp" +#include "libRepoMan/Events/Compat.hpp" #include @@ -32,7 +33,7 @@ namespace RM class REPOMAN_API RepoMan : public QObject - //, private EventsInterface + , private CompatEventsInterface { Q_OBJECT private: @@ -63,42 +64,40 @@ namespace RM void repositoryClosed(); void hasActiveRepositoryChanged(bool hasActiveRepo); - #ifndef REPOMAN_NO_COMPAT signals: void repositoryOpened(const RM::Frontend::Repo& repo); void repositoryAboutToClose(const RM::Frontend::Repo& repo); void repositoryActivated(const RM::Frontend::Repo& repo); void repositoryDeactivated(const RM::Frontend::Repo& repo); - void objectCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); - void objectAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Base& object); - void refTreeNodeCreated(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); - void refTreeNodeAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::RefTreeNode& node); - void refCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void refAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void refMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void refHeadDetached(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void tagCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); - void tagAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Tag& tag); - void branchCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void branchAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void branchMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void branchUpstreamChanged(const RM::Frontend::Repo& repo, const RM::Frontend::Branch& branch); - void namespaceCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); - void namespaceAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Namespace& nameSpace); - void refLogChanged(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); - void refLogNewEntry(const RM::Frontend::Repo& repo, const RM::Frontend::RefLog& reflog); - void stageCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void stageAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Reference& ref); - void remoteCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); - void remoteAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); - void remoteModified(const RM::Frontend::Repo& repo, const RM::Frontend::Remote& remote); - void submoduleCreated(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); - void submoduleAboutToBeDeleted(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); - void submoduleMoved(const RM::Frontend::Repo& repo, const RM::Frontend::Submodule& submodule); + void objectCreated(const RM::Frontend::Base& object); + void objectAboutToBeDeleted(const RM::Frontend::Base& object); + void refTreeNodeCreated(const RM::Frontend::RefTreeNode& node); + void refTreeNodeAboutToBeDeleted(const RM::Frontend::RefTreeNode& node); + void refCreated(const RM::Frontend::Reference& ref); + void refAboutToBeDeleted(const RM::Frontend::Reference& ref); + void refMoved(const RM::Frontend::Reference& ref); + void refHeadDetached(const RM::Frontend::Reference& ref); + void tagCreated(const RM::Frontend::Tag& tag); + void tagAboutToBeDeleted(const RM::Frontend::Tag& tag); + void branchCreated(const RM::Frontend::Branch& branch); + void branchAboutToBeDeleted(const RM::Frontend::Branch& branch); + void branchMoved(const RM::Frontend::Branch& branch); + void branchUpstreamChanged(const RM::Frontend::Branch& branch); + void namespaceCreated(const RM::Frontend::Namespace& nameSpace); + void namespaceAboutToBeDeleted(const RM::Frontend::Namespace& nameSpace); + void refLogChanged(const RM::Frontend::RefLog& reflog); + void refLogNewEntry(const RM::Frontend::RefLog& reflog); + void stageCreated(const RM::Frontend::Reference& ref); + void stageAboutToBeDeleted(const RM::Frontend::Reference& ref); + void remoteCreated(const RM::Frontend::Remote& remote); + void remoteAboutToBeDeleted(const RM::Frontend::Remote& remote); + void remoteModified(const RM::Frontend::Remote& remote); + void submoduleCreated(const RM::Frontend::Submodule& submodule); + void submoduleAboutToBeDeleted(const RM::Frontend::Submodule& submodule); + void submoduleMoved(const RM::Frontend::Submodule& submodule); void repositoryStateChanged(const RM::Frontend::Repo& repo); - void indexUpdated(const RM::Frontend::Repo& repo); - void workTreeUpdated(const RM::Frontend::Repo& repo); - #endif + void indexUpdated(); + void workTreeUpdated(); }; } From 7d11a403fd3da6798bc682468d1a50499a1a32ff Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Tue, 21 Apr 2015 22:38:06 +0100 Subject: [PATCH 54/60] Logging Channel for Git --- Libs/libRepoMan/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Libs/libRepoMan/CMakeLists.txt b/Libs/libRepoMan/CMakeLists.txt index 6c69f0a6..af8429ca 100644 --- a/Libs/libRepoMan/CMakeLists.txt +++ b/Libs/libRepoMan/CMakeLists.txt @@ -116,6 +116,7 @@ TARGET_LINK_LIBRARIES( BlueSky LINK_PRIVATE + Logger GitWrap ) From a6fbed86fea0414ee31801086a339e5ec7ead1e3 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sat, 9 May 2015 21:36:29 +0100 Subject: [PATCH 55/60] Add Service Runner into the backend --- Libs/libRepoMan/Backend/AbstractService.cpp | 61 ++++++++++ Libs/libRepoMan/Backend/AbstractService.hpp | 49 ++++++++ Libs/libRepoMan/Backend/RepoLocker.hpp | 57 +++++++++ Libs/libRepoMan/Backend/RepoMan.cpp | 59 ++++++++++ Libs/libRepoMan/Backend/RepoMan.hpp | 55 +++++++++ Libs/libRepoMan/Backend/ServiceRunner.cpp | 122 ++++++++++++++++++++ Libs/libRepoMan/Backend/ServiceRunner.hpp | 69 +++++++++++ Libs/libRepoMan/CMakeLists.txt | 9 ++ 8 files changed, 481 insertions(+) create mode 100644 Libs/libRepoMan/Backend/AbstractService.cpp create mode 100644 Libs/libRepoMan/Backend/AbstractService.hpp create mode 100644 Libs/libRepoMan/Backend/RepoLocker.hpp create mode 100644 Libs/libRepoMan/Backend/RepoMan.cpp create mode 100644 Libs/libRepoMan/Backend/RepoMan.hpp create mode 100644 Libs/libRepoMan/Backend/ServiceRunner.cpp create mode 100644 Libs/libRepoMan/Backend/ServiceRunner.hpp diff --git a/Libs/libRepoMan/Backend/AbstractService.cpp b/Libs/libRepoMan/Backend/AbstractService.cpp new file mode 100644 index 00000000..8d8e996c --- /dev/null +++ b/Libs/libRepoMan/Backend/AbstractService.cpp @@ -0,0 +1,61 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "libLogger/Manager.hpp" +#include "libLogger/Event.hpp" + +#include "libRepoMan/Backend/AbstractService.hpp" +#include "libRepoMan/Backend/RepoMan.hpp" + +#include + +namespace RM { namespace Backend { + +AbstractService::AbstractService() +{ +} + +void AbstractService::execute() +{ + if (thread() != RepoMan::workerThread()) { + qDebug() << "Running a Service outside of the RepoMan Thread."; + Q_ASSERT(false); + return; + } + + emit started(); + + run(); + + emit finished(); +} + +void AbstractService::logGitError(const Git::Result& r, const char* msg) +{ + Log::Channel ch = RepoMan::instance().gitErrorChannel(); + Log::Template tpl = RepoMan::instance().gitErrorTemplate(); + Log::Event ev = Log::Event::create(tpl); + + ev.setParam(QStringLiteral("gwerror"), r.errorText()); + ev.setText(QString::fromUtf8(msg)); + + Log::Manager().addEvent(ch, ev); +} + +} } diff --git a/Libs/libRepoMan/Backend/AbstractService.hpp b/Libs/libRepoMan/Backend/AbstractService.hpp new file mode 100644 index 00000000..edf77744 --- /dev/null +++ b/Libs/libRepoMan/Backend/AbstractService.hpp @@ -0,0 +1,49 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include "libGitWrap/Result.hpp" + +#include + +namespace RM { namespace Backend { + +class AbstractService + : public QObject +{ + Q_OBJECT +public: + AbstractService(); + +signals: + void started(); + void finished(); + +public: + void execute(); + +protected: + virtual void run() = 0; + +protected: + void logGitError(const Git::Result& r, const char* msg = nullptr); +}; + +} } diff --git a/Libs/libRepoMan/Backend/RepoLocker.hpp b/Libs/libRepoMan/Backend/RepoLocker.hpp new file mode 100644 index 00000000..72438e92 --- /dev/null +++ b/Libs/libRepoMan/Backend/RepoLocker.hpp @@ -0,0 +1,57 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include "libRepoMan/Data/Repo.hpp" + +namespace RM +{ + + namespace Backend + { + + class RepoLocker + { + public: + RepoLocker() = delete; + RepoLocker(const RepoLocker&) = delete; + + inline RepoLocker(const Data::Repo::SPtr& p) + : d(p) + { + if (d) { + d->mutex().lock(); + } + } + + inline ~RepoLocker() + { + if (d) { + d->mutex().unlock(); + } + } + + private: + Data::Repo::SPtr d; + }; + + } + +} diff --git a/Libs/libRepoMan/Backend/RepoMan.cpp b/Libs/libRepoMan/Backend/RepoMan.cpp new file mode 100644 index 00000000..4687491c --- /dev/null +++ b/Libs/libRepoMan/Backend/RepoMan.cpp @@ -0,0 +1,59 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "libRepoMan/Backend/RepoMan.hpp" + +#include +#include + +namespace RM +{ + + namespace Backend + { + + static RepoMan* repoMan() + { + static QPointer< RepoMan > sInstance; + if (sInstance.isNull()) { + sInstance = new RepoMan; + } + return sInstance; + } + + RepoMan::RepoMan() + : mWorkerThread(new QThread) + { + moveToThread(mWorkerThread); + mWorkerThread->start(); + } + + RepoMan& RepoMan::instance() + { + return *repoMan(); + } + + QThread* RepoMan::workerThread() + { + return repoMan()->mWorkerThread; + } + + } + +} diff --git a/Libs/libRepoMan/Backend/RepoMan.hpp b/Libs/libRepoMan/Backend/RepoMan.hpp new file mode 100644 index 00000000..e93f3791 --- /dev/null +++ b/Libs/libRepoMan/Backend/RepoMan.hpp @@ -0,0 +1,55 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include "libRepoMan/Data/Repo.hpp" + +#include +#include + +namespace RM +{ + + namespace Backend + { + + class RepoMan + : public QObject + { + Q_OBJECT + public: + RepoMan(); + + public: + static RepoMan& instance(); + static QThread* workerThread(); + + public: + Data::Repo::SPtr findRepo(const QString& workTreePath) const; + + private: + QThread* mWorkerThread; + mutable QMutex mRepoMan; + Data::Repo::SList mRepos; + }; + + } + +} diff --git a/Libs/libRepoMan/Backend/ServiceRunner.cpp b/Libs/libRepoMan/Backend/ServiceRunner.cpp new file mode 100644 index 00000000..00bd096d --- /dev/null +++ b/Libs/libRepoMan/Backend/ServiceRunner.cpp @@ -0,0 +1,122 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "libRepoMan/Backend/ServiceRunner.hpp" +#include "libRepoMan/Backend/AbstractService.hpp" +#include "libRepoMan/Backend/RepoMan.hpp" + +#include +#include +#include +#include + +namespace RM { namespace Backend { + +typedef QQueue< QPointer > ServiceQueue; + +class ServiceRunner::Data +{ +public: + QMutex mMtx; + +public: + ServiceQueue& queueFor(RunnerPriority priority); + AbstractService* dequeueNext(); + +private: + ServiceQueue mLowQueue, mDefaultQueue, mUrgentQueue, mImmediateQueue; +}; + +ServiceQueue& ServiceRunner::Data::queueFor(RunnerPriority priority) +{ + switch (priority) { + case RunnerPriority::Low: return mLowQueue; + case RunnerPriority::Default: return mDefaultQueue; + case RunnerPriority::Urgent: return mUrgentQueue; + case RunnerPriority::Immediate: return mImmediateQueue; + default: Q_ASSERT(false); + } +} + +AbstractService* ServiceRunner::Data::dequeueNext() +{ + QMutexLocker _(&mMtx); + + if (!mImmediateQueue.empty()) { + return mImmediateQueue.dequeue(); + } + else if (!mUrgentQueue.empty()) { + return mUrgentQueue.dequeue(); + } + else if (!mDefaultQueue.empty()) { + return mDefaultQueue.dequeue(); + } + else if (!mLowQueue.empty()) { + return mLowQueue.dequeue(); + } + + return NULL; +} + +void ServiceRunner::processNext() +{ + AbstractService* next = d->dequeueNext(); + + if (next) { + next->execute(); + } +} + +ServiceRunner::ServiceRunner() + : d(new Data) +{ + connect(this, &ServiceRunner::processNextService, + this, &ServiceRunner::processNext, + Qt::QueuedConnection); +} + +ServiceRunner::~ServiceRunner() +{ + delete d; +} + +void ServiceRunner::enqueue(Backend::AbstractService* svc, RunnerPriority priority) +{ + QMutexLocker(&d->mMtx); + + ServiceQueue& queue(d->queueFor(priority)); + svc->moveToThread(Backend::RepoMan::workerThread()); + queue.enqueue(svc); + + emit processNextService(); +} + +ServiceRunner& ServiceRunner::instance() +{ + QPointer< ServiceRunner > sSelf; + + if (sSelf.isNull()) { + sSelf = new ServiceRunner; + sSelf->moveToThread(Backend::RepoMan::workerThread()); + } + + return *sSelf; +} + +} } diff --git a/Libs/libRepoMan/Backend/ServiceRunner.hpp b/Libs/libRepoMan/Backend/ServiceRunner.hpp new file mode 100644 index 00000000..046f2eed --- /dev/null +++ b/Libs/libRepoMan/Backend/ServiceRunner.hpp @@ -0,0 +1,69 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include + +namespace RM { namespace Backend { + +class AbstractService; + +enum class RunnerPriority +{ + Low, + Default, + Urgent, + Immediate, +}; + +class ServiceRunner + : public QObject +{ + Q_OBJECT +private: + ServiceRunner(); +public: + ~ServiceRunner(); + +public: + static ServiceRunner& instance(); + +public: + void enqueue(Backend::AbstractService* svc, RunnerPriority priority); + +signals: + void processNextService(); + +private: + void processNext(); + +private: + class Data; + Data* d; +}; + +static inline void perform( + Backend::AbstractService* svc, + RunnerPriority priority = RunnerPriority::Default) +{ + ServiceRunner::instance().enqueue(svc, priority); +} + +} } diff --git a/Libs/libRepoMan/CMakeLists.txt b/Libs/libRepoMan/CMakeLists.txt index af8429ca..cc1318a0 100644 --- a/Libs/libRepoMan/CMakeLists.txt +++ b/Libs/libRepoMan/CMakeLists.txt @@ -42,6 +42,10 @@ SET( SRC_FILES Data/Head.cpp Private/Dumper.cpp + + Backend/AbstractService.cpp + Backend/ServiceRunner.cpp + Backend/RepoMan.cpp ) SET( PUB_HDR_FILES @@ -86,6 +90,11 @@ SET( PRI_HDR_FILES Data/Head.hpp Frontend/BaseInternal.hpp + + Backend/AbstractService.hpp + Backend/ServiceRunner.hpp + Backend/RepoMan.hpp + Backend/RepoLocker.hpp ) SET( HID_FILES From 583a2a803ac3c6ba4c60f0d09b56434b104854f0 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 10 May 2015 00:35:14 +0100 Subject: [PATCH 56/60] Add: OpenRepository Service --- Libs/libRepoMan/CMakeLists.txt | 4 ++ Libs/libRepoMan/Services/OpenRepository.cpp | 44 +++++++++++++++++++++ Libs/libRepoMan/Services/OpenRepository.hpp | 40 +++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 Libs/libRepoMan/Services/OpenRepository.cpp create mode 100644 Libs/libRepoMan/Services/OpenRepository.hpp diff --git a/Libs/libRepoMan/CMakeLists.txt b/Libs/libRepoMan/CMakeLists.txt index cc1318a0..96d6d75a 100644 --- a/Libs/libRepoMan/CMakeLists.txt +++ b/Libs/libRepoMan/CMakeLists.txt @@ -46,6 +46,8 @@ SET( SRC_FILES Backend/AbstractService.cpp Backend/ServiceRunner.cpp Backend/RepoMan.cpp + + Services/OpenRepository.cpp ) SET( PUB_HDR_FILES @@ -95,6 +97,8 @@ SET( PRI_HDR_FILES Backend/ServiceRunner.hpp Backend/RepoMan.hpp Backend/RepoLocker.hpp + + Services/OpenRepository.hpp ) SET( HID_FILES diff --git a/Libs/libRepoMan/Services/OpenRepository.cpp b/Libs/libRepoMan/Services/OpenRepository.cpp new file mode 100644 index 00000000..b163a6b1 --- /dev/null +++ b/Libs/libRepoMan/Services/OpenRepository.cpp @@ -0,0 +1,44 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "libRepoMan/Data/Repo.hpp" +#include "libRepoMan/Services/OpenRepository.hpp" + +#include "libGitWrap/Repository.hpp" + +namespace RM { namespace Services { + +OpenRepository::OpenRepository(const QString& path) + : mPath(path) +{ +} + +void OpenRepository::run() +{ + Git::Result res; + Git::Repository gitRepo = Git::Repository::open(res, mPath); + if (!res) { + logGitError(res); + } + + Data::Repo::SPtr repoData; + repoData.make_shared(gitRepo); +} + +} } diff --git a/Libs/libRepoMan/Services/OpenRepository.hpp b/Libs/libRepoMan/Services/OpenRepository.hpp new file mode 100644 index 00000000..85b44f6d --- /dev/null +++ b/Libs/libRepoMan/Services/OpenRepository.hpp @@ -0,0 +1,40 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include "libRepoMan/Backend/AbstractService.hpp" + +namespace RM { namespace Services { + +class OpenRepository + : public Backend::AbstractService +{ + Q_OBJECT +public: + OpenRepository(const QString& path); + +private: + void run(); + +private: + QString mPath; +}; + +} } From 302c1c5672c6e372e9e69eba37f6bd1da885b5eb Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 10 May 2015 16:54:29 +0100 Subject: [PATCH 57/60] Invoke OpenRepository service --- Libs/libRepoMan/RepoMan.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Libs/libRepoMan/RepoMan.cpp b/Libs/libRepoMan/RepoMan.cpp index 41c3df7f..176cd25e 100644 --- a/Libs/libRepoMan/RepoMan.cpp +++ b/Libs/libRepoMan/RepoMan.cpp @@ -21,6 +21,10 @@ #include "libRepoMan/Private/Dumper.hpp" +#include "libRepoMan/Backend/ServiceRunner.hpp" + +#include "libRepoMan/Services/OpenRepository.hpp" + #include "libRepoMan/Data/RepoMan.hpp" #include "libRepoMan/Data/Repo.hpp" @@ -86,8 +90,7 @@ namespace RM */ void RepoMan::open(const QString& path) { - // ### REPOMAN TODO - qDebug() << "RepoMan::Open is currently not implemented."; + Backend::perform(new Services::OpenRepository(path)); } /** From c36ac2dab8d5c5aa3cc357cf796cd6ec48c1f94b Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 10 May 2015 00:36:30 +0100 Subject: [PATCH 58/60] Add: RefreshRepository Service --- Libs/libRepoMan/CMakeLists.txt | 2 + .../libRepoMan/Services/RefreshRepository.cpp | 100 ++++++++++++++++++ .../libRepoMan/Services/RefreshRepository.hpp | 46 ++++++++ 3 files changed, 148 insertions(+) create mode 100644 Libs/libRepoMan/Services/RefreshRepository.cpp create mode 100644 Libs/libRepoMan/Services/RefreshRepository.hpp diff --git a/Libs/libRepoMan/CMakeLists.txt b/Libs/libRepoMan/CMakeLists.txt index 96d6d75a..f500985d 100644 --- a/Libs/libRepoMan/CMakeLists.txt +++ b/Libs/libRepoMan/CMakeLists.txt @@ -48,6 +48,7 @@ SET( SRC_FILES Backend/RepoMan.cpp Services/OpenRepository.cpp + Services/RefreshRepository.cpp ) SET( PUB_HDR_FILES @@ -99,6 +100,7 @@ SET( PRI_HDR_FILES Backend/RepoLocker.hpp Services/OpenRepository.hpp + Services/RefreshRepository.hpp ) SET( HID_FILES diff --git a/Libs/libRepoMan/Services/RefreshRepository.cpp b/Libs/libRepoMan/Services/RefreshRepository.cpp new file mode 100644 index 00000000..1c6708ca --- /dev/null +++ b/Libs/libRepoMan/Services/RefreshRepository.cpp @@ -0,0 +1,100 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#include "libRepoMan/Backend/RepoMan.hpp" + +#include "libRepoMan/Backend/RepoLocker.hpp" +#include "libRepoMan/Services/RefreshRepository.hpp" + +#include "libGitWrap/Submodule.hpp" + +#include + +namespace RM { namespace Services { + +RefreshRepository::RefreshRepository(const Frontend::Repo& repo) + : mRepo() +{ + +} + +RefreshRepository::RefreshRepository(const Data::Repo::SPtr& repo) + : mRepo(repo) +{ +} + +void RefreshRepository::run() +{ + Backend::RepoLocker lock(mRepo); + + mGitRepo = mRepo->gitRepo(false); + if (!mGitRepo.isValid()) { + return; + } + + scanSubmodules(); +} + + +void RefreshRepository::scanSubmodules() +{ + Git::Result r; + Git::Submodule::List subs = mGitRepo.submodules(r); + if (!r) { + return; + } + + Data::Repo::SList oldSubmodules = Data::sharedFromWeakList(mRepo->submodules()); + + foreach (Git::Submodule sub, subs) { + Git::Result child; + + Git::Repository subRepo = sub.subRepository(child); + if (!child) { + // If we cannot load the repository, keep it in list of submodules to remove. + continue; + } + Q_ASSERT(subRepo.isValid()); + + QString path = subRepo.workTreePath(); + + if (path.endsWith(L'/')) { + path = path.left(path.length() - 1); + } + + auto it = std::find(oldSubmodules.begin(), oldSubmodules.end(), + mRepo->repoByPath(path, true)); + if (it != oldSubmodules.end()) { + oldSubmodules.erase(it); + } + else { + // ###REPOMAN + qDebug() << "Existing Submodule does not exist in data structure"; + // subInfo = new Submodule(subRepo, p); + } + } + + foreach (Data::Repo::WPtr repo, oldSubmodules) { + // ###REPOMAN + Q_UNUSED(repo); + // dataOf(repo)->terminateObject(); + } +} + +} } diff --git a/Libs/libRepoMan/Services/RefreshRepository.hpp b/Libs/libRepoMan/Services/RefreshRepository.hpp new file mode 100644 index 00000000..c2495fd6 --- /dev/null +++ b/Libs/libRepoMan/Services/RefreshRepository.hpp @@ -0,0 +1,46 @@ +/* + * MacGitver + * Copyright (C) 2012-2015 The MacGitver-Developers + * + * (C) Sascha Cunz + * (C) Cunz RaD Ltd. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License (Version 2) as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if + * not, see . + * + */ + +#pragma once + +#include "libRepoMan/Backend/AbstractService.hpp" +#include "libRepoMan/Data/Repo.hpp" + +namespace RM { namespace Services { + +class RefreshRepository + : public Backend::AbstractService +{ + Q_OBJECT +public: + RefreshRepository(const Frontend::Repo& repo); + RefreshRepository(const Data::Repo::SPtr& repo); + +private: + void run(); + +private: + void scanSubmodules(); + +private: + Data::Repo::SPtr mRepo; + Git::Repository mGitRepo; +}; + +} } From e24515ee1f65f368ff796ba924a212d9efd8ba46 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Sun, 10 May 2015 16:57:48 +0100 Subject: [PATCH 59/60] Add: refresh() method to RepoMan --- Libs/libRepoMan/RepoMan.cpp | 9 +++++++++ Libs/libRepoMan/RepoMan.hpp | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/Libs/libRepoMan/RepoMan.cpp b/Libs/libRepoMan/RepoMan.cpp index 176cd25e..246a3536 100644 --- a/Libs/libRepoMan/RepoMan.cpp +++ b/Libs/libRepoMan/RepoMan.cpp @@ -24,10 +24,13 @@ #include "libRepoMan/Backend/ServiceRunner.hpp" #include "libRepoMan/Services/OpenRepository.hpp" +#include "libRepoMan/Services/RefreshRepository.hpp" #include "libRepoMan/Data/RepoMan.hpp" #include "libRepoMan/Data/Repo.hpp" +#include "libLogger/Manager.hpp" + #include "libBlueSky/Application.hpp" #include @@ -192,6 +195,12 @@ namespace RM #endif } + void RepoMan::refresh(RefreshTypes what) + { + Log::Manager().addMessage(trUtf8("Refreshing git repositories...")); + Backend::perform(new Services::RefreshRepository(activeRepository())); + } + #if 0 // ###DEAD //-- RepoManPrivate ---------------------------------------------------------------------------- diff --git a/Libs/libRepoMan/RepoMan.hpp b/Libs/libRepoMan/RepoMan.hpp index fc37bbbb..9b9ce51d 100644 --- a/Libs/libRepoMan/RepoMan.hpp +++ b/Libs/libRepoMan/RepoMan.hpp @@ -29,6 +29,13 @@ namespace RM { + enum class RefreshTypes + { + Repositories, + Indicies, + Worktrees + }; + namespace Frontend { class Branch; } class REPOMAN_API RepoMan @@ -42,6 +49,7 @@ namespace RM ~RepoMan(); public: + void refresh(RefreshTypes what); void open(const QString& path); void closeAll(); From 1878ca15356ebd322c48049e30f5381d14a9c2c7 Mon Sep 17 00:00:00 2001 From: Sascha Cunz Date: Tue, 12 May 2015 21:19:18 +0100 Subject: [PATCH 60/60] Missing Reference methods --- Libs/libRepoMan/Data/Reference.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Libs/libRepoMan/Data/Reference.cpp b/Libs/libRepoMan/Data/Reference.cpp index d9a4fcbd..c871c5cc 100644 --- a/Libs/libRepoMan/Data/Reference.cpp +++ b/Libs/libRepoMan/Data/Reference.cpp @@ -44,11 +44,12 @@ namespace RM , mId( ref.objectId() ) { } + #endif void Reference::dumpSelf(Internal::Dumper& dumper) const { dumper.addLine(QString(QStringLiteral("Ref 0x%1 [%2]")) - .arg(quintptr(mPub),0,16) + .arg(quintptr(this),0,16) .arg(mName)); } @@ -64,14 +65,15 @@ namespace RM QString Reference::objectTypeName() const { - return QStringLiteral("Ref"); + return QStringLiteral("Reference"); } bool Reference::inherits(ObjTypes type) const { - return type == ObjTypes::Reference || BasePrivate::inherits(type); + return type == ObjTypes::Reference || Base::inherits(type); } + #if 0 void Reference::postCreation() { RM_P(Ref);