mirror of
https://github.com/juzzlin/Heimer.git
synced 2025-05-10 05:08:58 +08:00
Introduce Core namespace
This commit is contained in:
parent
0eff4abc5a
commit
a5ed832a2c
@ -28,7 +28,6 @@ set(HEIMER_LIB_SRC
|
|||||||
editor_scene.cpp
|
editor_scene.cpp
|
||||||
editor_view.cpp
|
editor_view.cpp
|
||||||
grid.cpp
|
grid.cpp
|
||||||
hash_seed.cpp
|
|
||||||
image.cpp
|
image.cpp
|
||||||
image_manager.cpp
|
image_manager.cpp
|
||||||
item_filter.cpp
|
item_filter.cpp
|
||||||
@ -36,26 +35,27 @@ set(HEIMER_LIB_SRC
|
|||||||
magic_zoom.cpp
|
magic_zoom.cpp
|
||||||
main_window.cpp
|
main_window.cpp
|
||||||
mediator.cpp
|
mediator.cpp
|
||||||
mind_map_data.cpp
|
|
||||||
mind_map_data_base.cpp
|
|
||||||
mouse_action.cpp
|
mouse_action.cpp
|
||||||
node_action.hpp
|
node_action.hpp
|
||||||
recent_files_manager.cpp
|
recent_files_manager.cpp
|
||||||
selection_group.cpp
|
selection_group.cpp
|
||||||
state_machine.cpp
|
state_machine.cpp
|
||||||
test_mode.cpp
|
|
||||||
types.hpp
|
types.hpp
|
||||||
undo_stack.cpp
|
undo_stack.cpp
|
||||||
user_exception.hpp
|
|
||||||
utils.cpp
|
utils.cpp
|
||||||
version.hpp
|
|
||||||
version_checker.cpp
|
|
||||||
|
|
||||||
core/graph.cpp
|
core/graph.cpp
|
||||||
|
core/hash_seed.cpp
|
||||||
|
core/mind_map_data.cpp
|
||||||
|
core/mind_map_data_base.cpp
|
||||||
core/settings.cpp
|
core/settings.cpp
|
||||||
core/settings_proxy.cpp
|
core/settings_proxy.cpp
|
||||||
core/shadow_effect_params.hpp
|
core/shadow_effect_params.hpp
|
||||||
core/single_instance_container.cpp
|
core/single_instance_container.cpp
|
||||||
|
core/test_mode.cpp
|
||||||
|
core/user_exception.hpp
|
||||||
|
core/version.hpp
|
||||||
|
core/version_checker.cpp
|
||||||
|
|
||||||
dialogs/about_dialog.cpp
|
dialogs/about_dialog.cpp
|
||||||
dialogs/color_dialog.cpp
|
dialogs/color_dialog.cpp
|
||||||
|
@ -25,12 +25,12 @@
|
|||||||
#include "node_action.hpp"
|
#include "node_action.hpp"
|
||||||
#include "recent_files_manager.hpp"
|
#include "recent_files_manager.hpp"
|
||||||
#include "state_machine.hpp"
|
#include "state_machine.hpp"
|
||||||
#include "user_exception.hpp"
|
|
||||||
#include "version_checker.hpp"
|
|
||||||
|
|
||||||
#include "core/settings.hpp"
|
#include "core/settings.hpp"
|
||||||
#include "core/settings_proxy.hpp"
|
#include "core/settings_proxy.hpp"
|
||||||
#include "core/single_instance_container.hpp"
|
#include "core/single_instance_container.hpp"
|
||||||
|
#include "core/user_exception.hpp"
|
||||||
|
#include "core/version_checker.hpp"
|
||||||
|
|
||||||
#include "dialogs/layout_optimization_dialog.hpp"
|
#include "dialogs/layout_optimization_dialog.hpp"
|
||||||
#include "dialogs/png_export_dialog.hpp"
|
#include "dialogs/png_export_dialog.hpp"
|
||||||
@ -144,7 +144,7 @@ void Application::parseArgs(int argc, char ** argv)
|
|||||||
Application::Application(int & argc, char ** argv)
|
Application::Application(int & argc, char ** argv)
|
||||||
: m_app(argc, argv)
|
: m_app(argc, argv)
|
||||||
, m_stateMachine(std::make_unique<StateMachine>())
|
, m_stateMachine(std::make_unique<StateMachine>())
|
||||||
, m_versionChecker(std::make_unique<VersionChecker>())
|
, m_versionChecker(std::make_unique<Core::VersionChecker>())
|
||||||
{
|
{
|
||||||
parseArgs(argc, argv);
|
parseArgs(argc, argv);
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ Application::Application(int & argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_versionChecker.get(), &VersionChecker::newVersionFound, this, [this](Version version, QString downloadUrl) {
|
connect(m_versionChecker.get(), &Core::VersionChecker::newVersionFound, this, [this](Core::Version version, QString downloadUrl) {
|
||||||
m_mainWindow->showStatusText(QString(tr("A new version %1 available at <a href='%2'>%2</a>")).arg(version.toString(), downloadUrl));
|
m_mainWindow->showStatusText(QString(tr("A new version %1 available at <a href='%2'>%2</a>")).arg(version.toString(), downloadUrl));
|
||||||
});
|
});
|
||||||
m_versionChecker->checkForNewReleases();
|
m_versionChecker->checkForNewReleases();
|
||||||
|
@ -30,8 +30,10 @@ class EditorView;
|
|||||||
class ImageManager;
|
class ImageManager;
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class Mediator;
|
class Mediator;
|
||||||
class Node;
|
|
||||||
|
namespace Core {
|
||||||
class VersionChecker;
|
class VersionChecker;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
class PngExportDialog;
|
class PngExportDialog;
|
||||||
@ -120,7 +122,7 @@ private:
|
|||||||
|
|
||||||
std::unique_ptr<Dialogs::SvgExportDialog> m_svgExportDialog;
|
std::unique_ptr<Dialogs::SvgExportDialog> m_svgExportDialog;
|
||||||
|
|
||||||
std::unique_ptr<VersionChecker> m_versionChecker;
|
std::unique_ptr<Core::VersionChecker> m_versionChecker;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPLICATION_HPP
|
#endif // APPLICATION_HPP
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "graph.hpp"
|
#include "graph.hpp"
|
||||||
|
|
||||||
#include "../test_mode.hpp"
|
#include "test_mode.hpp"
|
||||||
|
|
||||||
#include "simple_logger.hpp"
|
#include "simple_logger.hpp"
|
||||||
|
|
||||||
@ -27,6 +27,8 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
namespace rv = ranges::views;
|
namespace rv = ranges::views;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -180,3 +182,5 @@ Graph::~Graph()
|
|||||||
|
|
||||||
juzzlin::L().debug() << "Graph deleted";
|
juzzlin::L().debug() << "Graph deleted";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
class Graph
|
class Graph
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -95,4 +97,6 @@ private:
|
|||||||
int m_count = 0;
|
int m_count = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
#endif // GRAPH_HPP
|
#endif // GRAPH_HPP
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "hash_seed.hpp"
|
#include "hash_seed.hpp"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
void HashSeed::init()
|
void HashSeed::init()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x50600
|
#if QT_VERSION >= 0x50600
|
||||||
@ -23,3 +25,5 @@ void HashSeed::init()
|
|||||||
qt_qhash_seed.store(0);
|
qt_qhash_seed.store(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Core
|
@ -22,10 +22,10 @@
|
|||||||
extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed;
|
extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace HashSeed {
|
namespace Core::HashSeed {
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
}
|
} // namespace Core::HashSeed
|
||||||
|
|
||||||
#endif // HASH_SEED_HPP
|
#endif // HASH_SEED_HPP
|
@ -15,15 +15,17 @@
|
|||||||
|
|
||||||
#include "mind_map_data.hpp"
|
#include "mind_map_data.hpp"
|
||||||
|
|
||||||
#include "grid.hpp"
|
#include "graph.hpp"
|
||||||
#include "image_manager.hpp"
|
#include "settings_proxy.hpp"
|
||||||
|
#include "shadow_effect_params.hpp"
|
||||||
|
#include "single_instance_container.hpp"
|
||||||
|
|
||||||
#include "core/settings_proxy.hpp"
|
#include "../grid.hpp"
|
||||||
#include "core/shadow_effect_params.hpp"
|
#include "../image_manager.hpp"
|
||||||
#include "core/single_instance_container.hpp"
|
|
||||||
|
|
||||||
#include "core/graph.hpp"
|
#include "../scene_items/node.hpp"
|
||||||
#include "scene_items/node.hpp"
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
struct MindMapData::Style
|
struct MindMapData::Style
|
||||||
{
|
{
|
||||||
@ -307,3 +309,5 @@ void MindMapData::setVersion(const QString & version)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MindMapData::~MindMapData() = default;
|
MindMapData::~MindMapData() = default;
|
||||||
|
|
||||||
|
} // namespace Core
|
@ -24,12 +24,15 @@
|
|||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "mind_map_data_base.hpp"
|
#include "mind_map_data_base.hpp"
|
||||||
|
|
||||||
class Graph;
|
|
||||||
class Grid;
|
class Grid;
|
||||||
class ImageManager;
|
class ImageManager;
|
||||||
class ObjectModelLoader;
|
class ObjectModelLoader;
|
||||||
struct ShadowEffectParams;
|
struct ShadowEffectParams;
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
class Graph;
|
||||||
|
|
||||||
class MindMapData : public MindMapDataBase
|
class MindMapData : public MindMapDataBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -125,6 +128,6 @@ private:
|
|||||||
LayoutOptimizerParameters m_layoutOptimizerParameters;
|
LayoutOptimizerParameters m_layoutOptimizerParameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<MindMapData> MindMapDataPtr;
|
} // namespace Core
|
||||||
|
|
||||||
#endif // MIND_MAP_DATA_HPP
|
#endif // MIND_MAP_DATA_HPP
|
@ -14,8 +14,11 @@
|
|||||||
// along with Heimer. If not, see <http://www.gnu.org/licenses/>.
|
// along with Heimer. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "test_mode.hpp"
|
#include "test_mode.hpp"
|
||||||
|
|
||||||
#include "simple_logger.hpp"
|
#include "simple_logger.hpp"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
bool TestMode::m_enabled = false;
|
bool TestMode::m_enabled = false;
|
||||||
|
|
||||||
bool TestMode::enabled()
|
bool TestMode::enabled()
|
||||||
@ -32,3 +35,5 @@ void TestMode::logDisabledCode(const std::string & message)
|
|||||||
{
|
{
|
||||||
juzzlin::L().debug() << "TestMode: '" << message << "' disabled";
|
juzzlin::L().debug() << "TestMode: '" << message << "' disabled";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Core
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
class TestMode
|
class TestMode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -31,4 +33,6 @@ private:
|
|||||||
static bool m_enabled;
|
static bool m_enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
#endif // TEST_MODE_HPP
|
#endif // TEST_MODE_HPP
|
@ -19,6 +19,8 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
class UserException : public std::runtime_error
|
class UserException : public std::runtime_error
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -28,4 +30,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
#endif // USER_EXCEPTION_HPP
|
#endif // USER_EXCEPTION_HPP
|
@ -26,6 +26,8 @@
|
|||||||
#undef minor
|
#undef minor
|
||||||
#undef patch
|
#undef patch
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
struct Version
|
struct Version
|
||||||
{
|
{
|
||||||
Version()
|
Version()
|
||||||
@ -120,4 +122,6 @@ inline std::ostream & operator<<(std::ostream & os, const Version & version)
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
#endif // VERSION_HPP
|
#endif // VERSION_HPP
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
using juzzlin::L;
|
using juzzlin::L;
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
VersionChecker::VersionChecker(QObject * parent)
|
VersionChecker::VersionChecker(QObject * parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
@ -64,3 +66,5 @@ void VersionChecker::checkForNewReleases()
|
|||||||
});
|
});
|
||||||
manager->get(QNetworkRequest({ Constants::Application::RELEASES_URL }));
|
manager->get(QNetworkRequest({ Constants::Application::RELEASES_URL }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Core
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
class VersionChecker : public QObject
|
class VersionChecker : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -33,4 +35,6 @@ signals:
|
|||||||
void newVersionFound(Version version, QString downloadUrl);
|
void newVersionFound(Version version, QString downloadUrl);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
#endif // VERSION_CHECKER_HPP
|
#endif // VERSION_CHECKER_HPP
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
#include "../constants.hpp"
|
#include "../constants.hpp"
|
||||||
#include "../layout_optimizer.hpp"
|
#include "../layout_optimizer.hpp"
|
||||||
#include "../mind_map_data.hpp"
|
|
||||||
|
#include "../core/mind_map_data.hpp"
|
||||||
|
|
||||||
#include "widget_factory.hpp"
|
#include "widget_factory.hpp"
|
||||||
|
|
||||||
@ -35,7 +36,7 @@
|
|||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
|
|
||||||
LayoutOptimizationDialog::LayoutOptimizationDialog(QWidget & parent, MindMapData & mindMapData, LayoutOptimizer & layoutOptimizer)
|
LayoutOptimizationDialog::LayoutOptimizationDialog(QWidget & parent, MindMapDataR mindMapData, LayoutOptimizer & layoutOptimizer)
|
||||||
: QDialog(&parent)
|
: QDialog(&parent)
|
||||||
, m_mindMapData(mindMapData)
|
, m_mindMapData(mindMapData)
|
||||||
, m_layoutOptimizer(layoutOptimizer)
|
, m_layoutOptimizer(layoutOptimizer)
|
||||||
@ -68,7 +69,7 @@ void LayoutOptimizationDialog::finishOptimization()
|
|||||||
QTimer::singleShot(500, this, &QDialog::accept);
|
QTimer::singleShot(500, this, &QDialog::accept);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayoutOptimizationDialog::initWidgets(const MindMapData & mindMapData)
|
void LayoutOptimizationDialog::initWidgets(MindMapDataCR mindMapData)
|
||||||
{
|
{
|
||||||
const auto mainLayout = new QVBoxLayout(this);
|
const auto mainLayout = new QVBoxLayout(this);
|
||||||
|
|
||||||
|
@ -18,8 +18,9 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "../types.hpp"
|
||||||
|
|
||||||
class LayoutOptimizer;
|
class LayoutOptimizer;
|
||||||
class MindMapData;
|
|
||||||
class QDoubleSpinBox;
|
class QDoubleSpinBox;
|
||||||
class QProgressBar;
|
class QProgressBar;
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ class LayoutOptimizationDialog : public QDialog
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
explicit LayoutOptimizationDialog(QWidget & parent, MindMapData & mindMapData, LayoutOptimizer & layoutOptimizer);
|
explicit LayoutOptimizationDialog(QWidget & parent, MindMapDataR mindMapData, LayoutOptimizer & layoutOptimizer);
|
||||||
|
|
||||||
int exec() override;
|
int exec() override;
|
||||||
|
|
||||||
@ -44,9 +45,9 @@ private slots:
|
|||||||
void finishOptimization();
|
void finishOptimization();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initWidgets(const MindMapData & mindMapData);
|
void initWidgets(MindMapDataCR mindMapData);
|
||||||
|
|
||||||
MindMapData & m_mindMapData;
|
MindMapDataR m_mindMapData;
|
||||||
|
|
||||||
LayoutOptimizer & m_layoutOptimizer;
|
LayoutOptimizer & m_layoutOptimizer;
|
||||||
|
|
||||||
|
@ -19,14 +19,15 @@
|
|||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "recent_files_manager.hpp"
|
#include "recent_files_manager.hpp"
|
||||||
#include "selection_group.hpp"
|
#include "selection_group.hpp"
|
||||||
#include "test_mode.hpp"
|
|
||||||
|
|
||||||
|
#include "core/graph.hpp"
|
||||||
|
#include "core/mind_map_data.hpp"
|
||||||
#include "core/settings_proxy.hpp"
|
#include "core/settings_proxy.hpp"
|
||||||
#include "core/single_instance_container.hpp"
|
#include "core/single_instance_container.hpp"
|
||||||
|
#include "core/test_mode.hpp"
|
||||||
|
|
||||||
#include "io/alz_file_io.hpp"
|
#include "io/alz_file_io.hpp"
|
||||||
|
|
||||||
#include "core/graph.hpp"
|
|
||||||
#include "scene_items/edge.hpp"
|
#include "scene_items/edge.hpp"
|
||||||
#include "scene_items/node.hpp"
|
#include "scene_items/node.hpp"
|
||||||
|
|
||||||
@ -87,10 +88,10 @@ void EditorData::loadMindMapData(QString fileName)
|
|||||||
|
|
||||||
m_selectedEdge = nullptr;
|
m_selectedEdge = nullptr;
|
||||||
|
|
||||||
if (!TestMode::enabled()) {
|
if (!Core::TestMode::enabled()) {
|
||||||
setMindMapData(m_alzFileIO->fromFile(fileName));
|
setMindMapData(m_alzFileIO->fromFile(fileName));
|
||||||
} else {
|
} else {
|
||||||
TestMode::logDisabledCode("setMindMapData");
|
Core::TestMode::logDisabledCode("setMindMapData");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fileName = fileName;
|
m_fileName = fileName;
|
||||||
@ -167,7 +168,7 @@ bool EditorData::saveMindMap(bool async)
|
|||||||
|
|
||||||
void EditorData::saveUndoPoint(bool dontClearRedoStack)
|
void EditorData::saveUndoPoint(bool dontClearRedoStack)
|
||||||
{
|
{
|
||||||
if (!TestMode::enabled()) {
|
if (!Core::TestMode::enabled()) {
|
||||||
if (m_undoTimer.isActive()) {
|
if (m_undoTimer.isActive()) {
|
||||||
L().debug() << "Saving undo point skipped..";
|
L().debug() << "Saving undo point skipped..";
|
||||||
m_undoTimer.start();
|
m_undoTimer.start();
|
||||||
@ -250,7 +251,7 @@ void EditorData::setTextColorForSelectedNodes(QColor color)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorData::setMindMapData(MindMapDataPtr mindMapData)
|
void EditorData::setMindMapData(MindMapDataS mindMapData)
|
||||||
{
|
{
|
||||||
m_mindMapData = mindMapData;
|
m_mindMapData = mindMapData;
|
||||||
|
|
||||||
@ -467,7 +468,7 @@ NodeS EditorData::getNodeByIndex(int index)
|
|||||||
void EditorData::initializeNewMindMap()
|
void EditorData::initializeNewMindMap()
|
||||||
{
|
{
|
||||||
requestAutosave(false);
|
requestAutosave(false);
|
||||||
setMindMapData(std::make_shared<MindMapData>());
|
setMindMapData(std::make_shared<Core::MindMapData>());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditorData::isInSelectionGroup(NodeR node)
|
bool EditorData::isInSelectionGroup(NodeR node)
|
||||||
@ -475,7 +476,7 @@ bool EditorData::isInSelectionGroup(NodeR node)
|
|||||||
return m_selectionGroup->hasNode(node);
|
return m_selectionGroup->hasNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
MindMapDataPtr EditorData::mindMapData()
|
MindMapDataS EditorData::mindMapData()
|
||||||
{
|
{
|
||||||
return m_mindMapData;
|
return m_mindMapData;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "copy_context.hpp"
|
#include "copy_context.hpp"
|
||||||
#include "grid.hpp"
|
#include "grid.hpp"
|
||||||
#include "mind_map_data.hpp"
|
|
||||||
#include "mouse_action.hpp"
|
#include "mouse_action.hpp"
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
#include "undo_stack.hpp"
|
#include "undo_stack.hpp"
|
||||||
@ -117,7 +116,7 @@ public:
|
|||||||
|
|
||||||
void loadMindMapData(QString fileName);
|
void loadMindMapData(QString fileName);
|
||||||
|
|
||||||
MindMapDataPtr mindMapData();
|
MindMapDataS mindMapData();
|
||||||
|
|
||||||
void mirror(bool vertically);
|
void mirror(bool vertically);
|
||||||
|
|
||||||
@ -143,7 +142,7 @@ public:
|
|||||||
|
|
||||||
void setGridSize(int size, bool autoSnap);
|
void setGridSize(int size, bool autoSnap);
|
||||||
|
|
||||||
void setMindMapData(MindMapDataPtr newMindMapData);
|
void setMindMapData(MindMapDataS newMindMapData);
|
||||||
|
|
||||||
void setSelectedEdge(EdgeP edge);
|
void setSelectedEdge(EdgeP edge);
|
||||||
|
|
||||||
@ -190,7 +189,7 @@ private:
|
|||||||
|
|
||||||
MouseAction m_mouseAction;
|
MouseAction m_mouseAction;
|
||||||
|
|
||||||
MindMapDataPtr m_mindMapData;
|
MindMapDataS m_mindMapData;
|
||||||
|
|
||||||
std::unique_ptr<IO::AlzFileIO> m_alzFileIO;
|
std::unique_ptr<IO::AlzFileIO> m_alzFileIO;
|
||||||
|
|
||||||
|
@ -31,10 +31,10 @@
|
|||||||
#include "item_filter.hpp"
|
#include "item_filter.hpp"
|
||||||
#include "magic_zoom.hpp"
|
#include "magic_zoom.hpp"
|
||||||
#include "mediator.hpp"
|
#include "mediator.hpp"
|
||||||
#include "mind_map_data.hpp"
|
|
||||||
#include "mouse_action.hpp"
|
#include "mouse_action.hpp"
|
||||||
#include "node_action.hpp"
|
#include "node_action.hpp"
|
||||||
|
|
||||||
|
#include "core/mind_map_data.hpp"
|
||||||
#include "core/single_instance_container.hpp"
|
#include "core/single_instance_container.hpp"
|
||||||
|
|
||||||
#include "menus/edge_context_menu.hpp"
|
#include "menus/edge_context_menu.hpp"
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
#include "alz_file_io.hpp"
|
#include "alz_file_io.hpp"
|
||||||
#include "alz_file_io_worker.hpp"
|
#include "alz_file_io_worker.hpp"
|
||||||
|
|
||||||
#include "../mind_map_data.hpp"
|
#include "../core/mind_map_data.hpp"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(std::shared_ptr<MindMapData>)
|
Q_DECLARE_METATYPE(MindMapDataS)
|
||||||
|
|
||||||
namespace IO {
|
namespace IO {
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ AlzFileIO::AlzFileIO()
|
|||||||
: m_worker(std::make_unique<AlzFileIOWorker>())
|
: m_worker(std::make_unique<AlzFileIOWorker>())
|
||||||
, m_workerThread(std::make_unique<QThread>())
|
, m_workerThread(std::make_unique<QThread>())
|
||||||
{
|
{
|
||||||
qRegisterMetaType<std::shared_ptr<MindMapData>>();
|
qRegisterMetaType<MindMapDataS>();
|
||||||
|
|
||||||
if (!m_workerThread->isRunning()) {
|
if (!m_workerThread->isRunning()) {
|
||||||
m_workerThread->start();
|
m_workerThread->start();
|
||||||
@ -43,26 +43,26 @@ void AlzFileIO::finish()
|
|||||||
m_workerThread->wait();
|
m_workerThread->wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> AlzFileIO::fromFile(QString path) const
|
MindMapDataU AlzFileIO::fromFile(QString path) const
|
||||||
{
|
{
|
||||||
return m_worker->fromFile(path);
|
return m_worker->fromFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlzFileIO::toFile(std::shared_ptr<MindMapData> mindMapData, QString path, bool async) const
|
bool AlzFileIO::toFile(MindMapDataS mindMapData, QString path, bool async) const
|
||||||
{
|
{
|
||||||
const auto connectionType = async ? Qt::QueuedConnection : Qt::BlockingQueuedConnection;
|
const auto connectionType = async ? Qt::QueuedConnection : Qt::BlockingQueuedConnection;
|
||||||
|
|
||||||
return QMetaObject::invokeMethod(m_worker.get(), "toFile", connectionType,
|
return QMetaObject::invokeMethod(m_worker.get(), "toFile", connectionType,
|
||||||
Q_ARG(std::shared_ptr<MindMapData>, mindMapData),
|
Q_ARG(MindMapDataS, mindMapData),
|
||||||
Q_ARG(QString, path));
|
Q_ARG(QString, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> AlzFileIO::fromXml(QString xml) const
|
MindMapDataU AlzFileIO::fromXml(QString xml) const
|
||||||
{
|
{
|
||||||
return m_worker->fromXml(xml);
|
return m_worker->fromXml(xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AlzFileIO::toXml(std::shared_ptr<MindMapData> mindMapData) const
|
QString AlzFileIO::toXml(MindMapDataS mindMapData) const
|
||||||
{
|
{
|
||||||
return m_worker->toXml(mindMapData);
|
return m_worker->toXml(mindMapData);
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
#define ALZ_FILE_IO_HPP
|
#define ALZ_FILE_IO_HPP
|
||||||
|
|
||||||
#include "file_io.hpp"
|
#include "file_io.hpp"
|
||||||
|
#include "types.hpp"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class MindMapData;
|
|
||||||
class QThread;
|
class QThread;
|
||||||
|
|
||||||
namespace IO {
|
namespace IO {
|
||||||
@ -36,13 +36,13 @@ public:
|
|||||||
|
|
||||||
void finish() override;
|
void finish() override;
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> fromFile(QString path) const override;
|
MindMapDataU fromFile(QString path) const override;
|
||||||
|
|
||||||
bool toFile(std::shared_ptr<MindMapData> mindMapData, QString path, bool async) const override;
|
bool toFile(MindMapDataS mindMapData, QString path, bool async) const override;
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> fromXml(QString xml) const;
|
MindMapDataU fromXml(QString xml) const;
|
||||||
|
|
||||||
QString toXml(std::shared_ptr<MindMapData> mindMapData) const;
|
QString toXml(MindMapDataS mindMapData) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<AlzFileIOWorker> m_worker;
|
std::unique_ptr<AlzFileIOWorker> m_worker;
|
||||||
|
@ -20,10 +20,11 @@
|
|||||||
|
|
||||||
#include "../constants.hpp"
|
#include "../constants.hpp"
|
||||||
#include "../image_manager.hpp"
|
#include "../image_manager.hpp"
|
||||||
#include "../test_mode.hpp"
|
|
||||||
#include "../types.hpp"
|
#include "../types.hpp"
|
||||||
|
|
||||||
#include "../core/graph.hpp"
|
#include "../core/graph.hpp"
|
||||||
|
#include "../core/mind_map_data.hpp"
|
||||||
|
#include "../core/test_mode.hpp"
|
||||||
|
|
||||||
#include "../scene_items/edge.hpp"
|
#include "../scene_items/edge.hpp"
|
||||||
#include "../scene_items/node.hpp"
|
#include "../scene_items/node.hpp"
|
||||||
@ -40,6 +41,8 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTemporaryDir>
|
#include <QTemporaryDir>
|
||||||
|
|
||||||
|
using Core::TestMode;
|
||||||
|
|
||||||
namespace IO {
|
namespace IO {
|
||||||
|
|
||||||
namespace DataKeywords::MindMap {
|
namespace DataKeywords::MindMap {
|
||||||
@ -175,7 +178,7 @@ static void writeImageRef(QDomElement & parent, QDomDocument & doc, size_t image
|
|||||||
parent.appendChild(colorElement);
|
parent.appendChild(colorElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void writeNodes(std::shared_ptr<MindMapData> mindMapData, QDomElement & root, QDomDocument & doc)
|
static void writeNodes(MindMapDataS mindMapData, QDomElement & root, QDomDocument & doc)
|
||||||
{
|
{
|
||||||
for (auto && node : mindMapData->graph().getNodes()) {
|
for (auto && node : mindMapData->graph().getNodes()) {
|
||||||
auto nodeElement = doc.createElement(DataKeywords::MindMap::Graph::NODE);
|
auto nodeElement = doc.createElement(DataKeywords::MindMap::Graph::NODE);
|
||||||
@ -206,7 +209,7 @@ static void writeNodes(std::shared_ptr<MindMapData> mindMapData, QDomElement & r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void writeEdges(std::shared_ptr<MindMapData> mindMapData, QDomElement & root, QDomDocument & doc)
|
static void writeEdges(MindMapDataS mindMapData, QDomElement & root, QDomDocument & doc)
|
||||||
{
|
{
|
||||||
for (auto && node : mindMapData->graph().getNodes()) {
|
for (auto && node : mindMapData->graph().getNodes()) {
|
||||||
for (auto && edge : mindMapData->graph().getEdgesFromNode(node)) {
|
for (auto && edge : mindMapData->graph().getEdgesFromNode(node)) {
|
||||||
@ -261,7 +264,7 @@ static QImage base64ToQImage(const std::string & base64, size_t imageId, std::st
|
|||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void writeImages(std::shared_ptr<MindMapData> mindMapData, QDomElement & root, QDomDocument & doc)
|
static void writeImages(MindMapDataS mindMapData, QDomElement & root, QDomDocument & doc)
|
||||||
{
|
{
|
||||||
std::set<size_t> writtenImageRefs;
|
std::set<size_t> writtenImageRefs;
|
||||||
for (auto && node : mindMapData->graph().getNodes()) {
|
for (auto && node : mindMapData->graph().getNodes()) {
|
||||||
@ -294,7 +297,7 @@ static void writeImages(std::shared_ptr<MindMapData> mindMapData, QDomElement &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void writeLayoutOptimizer(std::shared_ptr<MindMapData> mindMapData, QDomElement & root, QDomDocument & doc)
|
static void writeLayoutOptimizer(MindMapDataS mindMapData, QDomElement & root, QDomDocument & doc)
|
||||||
{
|
{
|
||||||
auto layoutOptimizerElement = doc.createElement(DataKeywords::MindMap::LayoutOptimizer::LAYOUT_OPTIMIZER);
|
auto layoutOptimizerElement = doc.createElement(DataKeywords::MindMap::LayoutOptimizer::LAYOUT_OPTIMIZER);
|
||||||
layoutOptimizerElement.setAttribute(DataKeywords::MindMap::LayoutOptimizer::ASPECT_RATIO, mindMapData->aspectRatio() * SCALE);
|
layoutOptimizerElement.setAttribute(DataKeywords::MindMap::LayoutOptimizer::ASPECT_RATIO, mindMapData->aspectRatio() * SCALE);
|
||||||
@ -384,7 +387,7 @@ static NodeU readNode(const QDomElement & element)
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EdgeU readEdge(const QDomElement & element, MindMapData & data)
|
static EdgeU readEdge(const QDomElement & element, Core::MindMapData & data)
|
||||||
{
|
{
|
||||||
const int arrowMode = element.attribute(DataKeywords::MindMap::Graph::Edge::ARROW_MODE, "0").toInt();
|
const int arrowMode = element.attribute(DataKeywords::MindMap::Graph::Edge::ARROW_MODE, "0").toInt();
|
||||||
const bool dashedLine = element.attribute(DataKeywords::MindMap::Graph::Edge::DASHED_LINE, "0").toInt();
|
const bool dashedLine = element.attribute(DataKeywords::MindMap::Graph::Edge::DASHED_LINE, "0").toInt();
|
||||||
@ -405,7 +408,7 @@ static EdgeU readEdge(const QDomElement & element, MindMapData & data)
|
|||||||
return edge;
|
return edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void readLayoutOptimizer(const QDomElement & element, MindMapData & data)
|
static void readLayoutOptimizer(const QDomElement & element, Core::MindMapData & data)
|
||||||
{
|
{
|
||||||
double aspectRatio = element.attribute(DataKeywords::MindMap::LayoutOptimizer::ASPECT_RATIO, "-1").toDouble() / SCALE;
|
double aspectRatio = element.attribute(DataKeywords::MindMap::LayoutOptimizer::ASPECT_RATIO, "-1").toDouble() / SCALE;
|
||||||
aspectRatio = std::min(aspectRatio, Constants::LayoutOptimizer::MAX_ASPECT_RATIO);
|
aspectRatio = std::min(aspectRatio, Constants::LayoutOptimizer::MAX_ASPECT_RATIO);
|
||||||
@ -418,7 +421,7 @@ static void readLayoutOptimizer(const QDomElement & element, MindMapData & data)
|
|||||||
data.setMinEdgeLength(minEdgeLength);
|
data.setMinEdgeLength(minEdgeLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void readGraph(const QDomElement & graph, MindMapData & data)
|
static void readGraph(const QDomElement & graph, Core::MindMapData & data)
|
||||||
{
|
{
|
||||||
readChildren(graph, {
|
readChildren(graph, {
|
||||||
{ QString(DataKeywords::MindMap::Graph::NODE), [&data](const QDomElement & e) {
|
{ QString(DataKeywords::MindMap::Graph::NODE), [&data](const QDomElement & e) {
|
||||||
@ -430,10 +433,10 @@ static void readGraph(const QDomElement & graph, MindMapData & data)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> fromXml(QDomDocument document)
|
MindMapDataU fromXml(QDomDocument document)
|
||||||
{
|
{
|
||||||
const auto root = document.documentElement();
|
const auto root = document.documentElement();
|
||||||
auto data = std::make_unique<MindMapData>();
|
auto data = std::make_unique<Core::MindMapData>();
|
||||||
data->setVersion(root.attribute(DataKeywords::MindMap::APPLICATION_VERSION, "UNDEFINED"));
|
data->setVersion(root.attribute(DataKeywords::MindMap::APPLICATION_VERSION, "UNDEFINED"));
|
||||||
|
|
||||||
readChildren(root, { { QString(DataKeywords::MindMap::GRAPH), [&data](const QDomElement & e) {
|
readChildren(root, { { QString(DataKeywords::MindMap::GRAPH), [&data](const QDomElement & e) {
|
||||||
@ -485,7 +488,7 @@ std::unique_ptr<MindMapData> fromXml(QDomDocument document)
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDomDocument toXml(std::shared_ptr<MindMapData> mindMapData)
|
QDomDocument toXml(MindMapDataS mindMapData)
|
||||||
{
|
{
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
|
|
||||||
@ -543,24 +546,24 @@ QDomDocument toXml(std::shared_ptr<MindMapData> mindMapData)
|
|||||||
|
|
||||||
AlzFileIOWorker::~AlzFileIOWorker() = default;
|
AlzFileIOWorker::~AlzFileIOWorker() = default;
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> AlzFileIOWorker::fromFile(QString path) const
|
MindMapDataU AlzFileIOWorker::fromFile(QString path) const
|
||||||
{
|
{
|
||||||
return IO::fromXml(XmlReader::readFromFile(path));
|
return IO::fromXml(XmlReader::readFromFile(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlzFileIOWorker::toFile(std::shared_ptr<MindMapData> mindMapData, QString path) const
|
bool AlzFileIOWorker::toFile(MindMapDataS mindMapData, QString path) const
|
||||||
{
|
{
|
||||||
return XmlWriter::writeToFile(IO::toXml(mindMapData), path);
|
return XmlWriter::writeToFile(IO::toXml(mindMapData), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> AlzFileIOWorker::fromXml(QString xml) const
|
MindMapDataU AlzFileIOWorker::fromXml(QString xml) const
|
||||||
{
|
{
|
||||||
QDomDocument document;
|
QDomDocument document;
|
||||||
document.setContent(xml, false);
|
document.setContent(xml, false);
|
||||||
return IO::fromXml(document);
|
return IO::fromXml(document);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AlzFileIOWorker::toXml(std::shared_ptr<MindMapData> mindMapData) const
|
QString AlzFileIOWorker::toXml(MindMapDataS mindMapData) const
|
||||||
{
|
{
|
||||||
return IO::toXml(mindMapData).toString();
|
return IO::toXml(mindMapData).toString();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "../mind_map_data.hpp"
|
#include "../types.hpp"
|
||||||
|
|
||||||
namespace IO {
|
namespace IO {
|
||||||
|
|
||||||
@ -34,13 +34,13 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> fromFile(QString path) const;
|
MindMapDataU fromFile(QString path) const;
|
||||||
|
|
||||||
bool toFile(std::shared_ptr<MindMapData> mindMapData, QString path) const;
|
bool toFile(MindMapDataS mindMapData, QString path) const;
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> fromXml(QString xml) const;
|
MindMapDataU fromXml(QString xml) const;
|
||||||
|
|
||||||
QString toXml(std::shared_ptr<MindMapData> mindMapData) const;
|
QString toXml(MindMapDataS mindMapData) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace IO
|
} // namespace IO
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class MindMapData;
|
#include "types.hpp"
|
||||||
|
|
||||||
namespace IO {
|
namespace IO {
|
||||||
|
|
||||||
@ -29,9 +29,9 @@ class FileIO
|
|||||||
public:
|
public:
|
||||||
virtual void finish() = 0;
|
virtual void finish() = 0;
|
||||||
|
|
||||||
virtual std::unique_ptr<MindMapData> fromFile(QString path) const = 0;
|
virtual MindMapDataU fromFile(QString path) const = 0;
|
||||||
|
|
||||||
virtual bool toFile(std::shared_ptr<MindMapData> mindMapData, QString path, bool async) const = 0;
|
virtual bool toFile(MindMapDataS mindMapData, QString path, bool async) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace IO
|
} // namespace IO
|
||||||
|
@ -18,9 +18,10 @@
|
|||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "contrib/SimpleLogger/src/simple_logger.hpp"
|
#include "contrib/SimpleLogger/src/simple_logger.hpp"
|
||||||
#include "grid.hpp"
|
#include "grid.hpp"
|
||||||
#include "mind_map_data.hpp"
|
|
||||||
|
|
||||||
#include "core/graph.hpp"
|
#include "core/graph.hpp"
|
||||||
|
#include "core/mind_map_data.hpp"
|
||||||
|
|
||||||
#include "scene_items/node.hpp"
|
#include "scene_items/node.hpp"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -48,7 +49,7 @@ inline double dot(double x1, double y1, double x2, double y2)
|
|||||||
class LayoutOptimizer::Impl
|
class LayoutOptimizer::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Impl(MindMapDataPtr mindMapData, const Grid & grid)
|
Impl(MindMapDataS mindMapData, const Grid & grid)
|
||||||
: m_mindMapData(mindMapData)
|
: m_mindMapData(mindMapData)
|
||||||
, m_grid(grid)
|
, m_grid(grid)
|
||||||
{
|
{
|
||||||
@ -220,7 +221,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QRectF calculateLayoutDimensions(const Graph::NodeVector & nodes) const
|
QRectF calculateLayoutDimensions(const Core::Graph::NodeVector & nodes) const
|
||||||
{
|
{
|
||||||
if (nodes.empty()) {
|
if (nodes.empty()) {
|
||||||
return {};
|
return {};
|
||||||
@ -349,7 +350,7 @@ private:
|
|||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
MindMapDataPtr m_mindMapData;
|
MindMapDataS m_mindMapData;
|
||||||
|
|
||||||
const Grid & m_grid;
|
const Grid & m_grid;
|
||||||
|
|
||||||
@ -595,7 +596,7 @@ private:
|
|||||||
|
|
||||||
size_t LayoutOptimizer::Impl::Cell::globalMoveId = 0;
|
size_t LayoutOptimizer::Impl::Cell::globalMoveId = 0;
|
||||||
|
|
||||||
LayoutOptimizer::LayoutOptimizer(MindMapDataPtr mindMapData, const Grid & grid)
|
LayoutOptimizer::LayoutOptimizer(MindMapDataS mindMapData, const Grid & grid)
|
||||||
: m_impl(std::make_unique<Impl>(mindMapData, grid))
|
: m_impl(std::make_unique<Impl>(mindMapData, grid))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,14 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "types.hpp"
|
||||||
|
|
||||||
class Grid;
|
class Grid;
|
||||||
class MindMapData;
|
|
||||||
|
|
||||||
class LayoutOptimizer
|
class LayoutOptimizer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LayoutOptimizer(std::shared_ptr<MindMapData> mindMapData, const Grid & grid);
|
LayoutOptimizer(MindMapDataS mindMapData, const Grid & grid);
|
||||||
|
|
||||||
~LayoutOptimizer();
|
~LayoutOptimizer();
|
||||||
|
|
||||||
|
@ -18,11 +18,12 @@
|
|||||||
|
|
||||||
#include "application.hpp"
|
#include "application.hpp"
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "hash_seed.hpp"
|
|
||||||
#include "simple_logger.hpp"
|
#include "simple_logger.hpp"
|
||||||
#include "user_exception.hpp"
|
|
||||||
#include "utils.hpp"
|
#include "utils.hpp"
|
||||||
|
|
||||||
|
#include "core/hash_seed.hpp"
|
||||||
|
#include "core/user_exception.hpp"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ static void initLogger()
|
|||||||
|
|
||||||
int main(int argc, char ** argv)
|
int main(int argc, char ** argv)
|
||||||
{
|
{
|
||||||
HashSeed::init();
|
Core::HashSeed::init();
|
||||||
|
|
||||||
#if QT_VERSION >= 0x50600 && QT_VERSION > 0x60000
|
#if QT_VERSION >= 0x50600 && QT_VERSION > 0x60000
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
@ -76,7 +77,7 @@ int main(int argc, char ** argv)
|
|||||||
initLogger();
|
initLogger();
|
||||||
return Application(argc, argv).run();
|
return Application(argc, argv).run();
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
if (!dynamic_cast<UserException *>(&e)) {
|
if (!dynamic_cast<Core::UserException *>(&e)) {
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -445,7 +445,7 @@ void Mediator::moveSelectionGroup(NodeR reference, QPointF location)
|
|||||||
m_editorData->moveSelectionGroup(reference, location);
|
m_editorData->moveSelectionGroup(reference, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
MindMapDataPtr Mediator::mindMapData() const
|
MindMapDataS Mediator::mindMapData() const
|
||||||
{
|
{
|
||||||
return m_editorData->mindMapData();
|
return m_editorData->mindMapData();
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
|
|
||||||
#include "mind_map_data.hpp"
|
#include "core/mind_map_data.hpp"
|
||||||
|
|
||||||
#include "scene_items/node.hpp"
|
#include "scene_items/node.hpp"
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ public:
|
|||||||
|
|
||||||
NodeS pasteNodeAt(NodeR source, QPointF pos);
|
NodeS pasteNodeAt(NodeR source, QPointF pos);
|
||||||
|
|
||||||
MindMapDataPtr mindMapData() const;
|
MindMapDataS mindMapData() const;
|
||||||
|
|
||||||
bool openMindMap(QString fileName);
|
bool openMindMap(QString fileName);
|
||||||
|
|
||||||
|
@ -27,8 +27,7 @@
|
|||||||
#include "../core/settings_proxy.hpp"
|
#include "../core/settings_proxy.hpp"
|
||||||
#include "../core/shadow_effect_params.hpp"
|
#include "../core/shadow_effect_params.hpp"
|
||||||
#include "../core/single_instance_container.hpp"
|
#include "../core/single_instance_container.hpp"
|
||||||
|
#include "../core/test_mode.hpp"
|
||||||
#include "../test_mode.hpp"
|
|
||||||
|
|
||||||
#include "simple_logger.hpp"
|
#include "simple_logger.hpp"
|
||||||
|
|
||||||
@ -47,6 +46,8 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
using Core::TestMode;
|
||||||
|
|
||||||
namespace SceneItems {
|
namespace SceneItems {
|
||||||
|
|
||||||
Edge::Edge(NodeP sourceNode, NodeP targetNode, bool enableAnimations, bool enableLabel)
|
Edge::Edge(NodeP sourceNode, NodeP targetNode, bool enableAnimations, bool enableLabel)
|
||||||
|
@ -38,7 +38,6 @@ struct ShadowEffectParams;
|
|||||||
namespace SceneItems {
|
namespace SceneItems {
|
||||||
|
|
||||||
class EdgeDot;
|
class EdgeDot;
|
||||||
class Graph;
|
|
||||||
class Node;
|
class Node;
|
||||||
|
|
||||||
//! A graphic representation of a graph edge between nodes.
|
//! A graphic representation of a graph edge between nodes.
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
|
|
||||||
#include "../constants.hpp"
|
#include "../constants.hpp"
|
||||||
#include "../image.hpp"
|
#include "../image.hpp"
|
||||||
#include "../test_mode.hpp"
|
|
||||||
#include "../utils.hpp"
|
#include "../utils.hpp"
|
||||||
|
|
||||||
#include "../core/settings_proxy.hpp"
|
#include "../core/settings_proxy.hpp"
|
||||||
#include "../core/shadow_effect_params.hpp"
|
#include "../core/shadow_effect_params.hpp"
|
||||||
#include "../core/single_instance_container.hpp"
|
#include "../core/single_instance_container.hpp"
|
||||||
|
#include "../core/test_mode.hpp"
|
||||||
|
|
||||||
#include "simple_logger.hpp"
|
#include "simple_logger.hpp"
|
||||||
|
|
||||||
@ -45,6 +45,8 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
using Core::TestMode;
|
||||||
|
|
||||||
namespace SceneItems {
|
namespace SceneItems {
|
||||||
|
|
||||||
NodeP Node::m_lastHoveredNode = nullptr;
|
NodeP Node::m_lastHoveredNode = nullptr;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "text_edit.hpp"
|
#include "text_edit.hpp"
|
||||||
|
|
||||||
#include "../test_mode.hpp"
|
#include "../core/test_mode.hpp"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
@ -24,6 +24,8 @@
|
|||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QTextOption>
|
#include <QTextOption>
|
||||||
|
|
||||||
|
using Core::TestMode;
|
||||||
|
|
||||||
namespace SceneItems {
|
namespace SceneItems {
|
||||||
|
|
||||||
TextEdit::TextEdit(QGraphicsItem * parentItem)
|
TextEdit::TextEdit(QGraphicsItem * parentItem)
|
||||||
|
@ -32,11 +32,22 @@ using EdgeS = std::shared_ptr<SceneItems::Edge>;
|
|||||||
|
|
||||||
using EdgeU = std::unique_ptr<SceneItems::Edge>;
|
using EdgeU = std::unique_ptr<SceneItems::Edge>;
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
class Graph;
|
class Graph;
|
||||||
|
class MindMapData;
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
using GraphCR = const Graph &;
|
using GraphCR = const Core::Graph &;
|
||||||
|
|
||||||
using GraphR = Graph &;
|
using GraphR = Core::Graph &;
|
||||||
|
|
||||||
|
using MindMapDataR = Core::MindMapData &;
|
||||||
|
|
||||||
|
using MindMapDataCR = const Core::MindMapData &;
|
||||||
|
|
||||||
|
using MindMapDataS = std::shared_ptr<Core::MindMapData>;
|
||||||
|
|
||||||
|
using MindMapDataU = std::unique_ptr<Core::MindMapData>;
|
||||||
|
|
||||||
namespace SceneItems {
|
namespace SceneItems {
|
||||||
class Node;
|
class Node;
|
||||||
|
@ -15,23 +15,25 @@
|
|||||||
|
|
||||||
#include "undo_stack.hpp"
|
#include "undo_stack.hpp"
|
||||||
|
|
||||||
|
#include "core/mind_map_data.hpp"
|
||||||
|
|
||||||
UndoStack::UndoStack(size_t maxHistorySize)
|
UndoStack::UndoStack(size_t maxHistorySize)
|
||||||
: m_maxHistorySize(maxHistorySize)
|
: m_maxHistorySize(maxHistorySize)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void UndoStack::pushUndoPoint(const MindMapData & mindMapData)
|
void UndoStack::pushUndoPoint(MindMapDataCR mindMapData)
|
||||||
{
|
{
|
||||||
m_undoStack.push_back(std::make_unique<MindMapData>(mindMapData));
|
m_undoStack.push_back(std::make_unique<Core::MindMapData>(mindMapData));
|
||||||
|
|
||||||
if (m_undoStack.size() > m_maxHistorySize && m_maxHistorySize) {
|
if (m_undoStack.size() > m_maxHistorySize && m_maxHistorySize) {
|
||||||
m_undoStack.pop_front();
|
m_undoStack.pop_front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UndoStack::pushRedoPoint(const MindMapData & mindMapData)
|
void UndoStack::pushRedoPoint(MindMapDataCR mindMapData)
|
||||||
{
|
{
|
||||||
m_redoStack.push_back(std::make_unique<MindMapData>(mindMapData));
|
m_redoStack.push_back(std::make_unique<Core::MindMapData>(mindMapData));
|
||||||
|
|
||||||
if (m_redoStack.size() > m_maxHistorySize && m_maxHistorySize) {
|
if (m_redoStack.size() > m_maxHistorySize && m_maxHistorySize) {
|
||||||
m_redoStack.pop_front();
|
m_redoStack.pop_front();
|
||||||
@ -54,7 +56,7 @@ bool UndoStack::isUndoable() const
|
|||||||
return !m_undoStack.empty();
|
return !m_undoStack.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> UndoStack::undo()
|
MindMapDataU UndoStack::undo()
|
||||||
{
|
{
|
||||||
if (isUndoable()) {
|
if (isUndoable()) {
|
||||||
auto head = std::move(m_undoStack.back());
|
auto head = std::move(m_undoStack.back());
|
||||||
@ -70,7 +72,7 @@ bool UndoStack::isRedoable() const
|
|||||||
return !m_redoStack.empty();
|
return !m_redoStack.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> UndoStack::redo()
|
MindMapDataU UndoStack::redo()
|
||||||
{
|
{
|
||||||
if (isRedoable()) {
|
if (isRedoable()) {
|
||||||
auto head = std::move(m_redoStack.back());
|
auto head = std::move(m_redoStack.back());
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#ifndef UNDO_STACK_HPP
|
#ifndef UNDO_STACK_HPP
|
||||||
#define UNDO_STACK_HPP
|
#define UNDO_STACK_HPP
|
||||||
|
|
||||||
#include "mind_map_data.hpp"
|
#include "types.hpp"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -27,9 +27,9 @@ public:
|
|||||||
//! \param maxHistorySize The size of undo stack or 0 for "unlimited".
|
//! \param maxHistorySize The size of undo stack or 0 for "unlimited".
|
||||||
UndoStack(size_t maxHistorySize = 0);
|
UndoStack(size_t maxHistorySize = 0);
|
||||||
|
|
||||||
void pushUndoPoint(const MindMapData & mindMapData);
|
void pushUndoPoint(MindMapDataCR mindMapData);
|
||||||
|
|
||||||
void pushRedoPoint(const MindMapData & mindMapData);
|
void pushRedoPoint(MindMapDataCR mindMapData);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
@ -37,14 +37,14 @@ public:
|
|||||||
|
|
||||||
bool isUndoable() const;
|
bool isUndoable() const;
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> undo();
|
MindMapDataU undo();
|
||||||
|
|
||||||
bool isRedoable() const;
|
bool isRedoable() const;
|
||||||
|
|
||||||
std::unique_ptr<MindMapData> redo();
|
MindMapDataU redo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using MindMapDataVector = std::list<std::unique_ptr<MindMapData>>;
|
using MindMapDataVector = std::list<MindMapDataU>;
|
||||||
|
|
||||||
MindMapDataVector m_undoStack;
|
MindMapDataVector m_undoStack;
|
||||||
|
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
#include "alz_file_io_test.hpp"
|
#include "alz_file_io_test.hpp"
|
||||||
|
|
||||||
#include "../../image_manager.hpp"
|
#include "../../image_manager.hpp"
|
||||||
#include "../../mind_map_data.hpp"
|
|
||||||
#include "../../test_mode.hpp"
|
#include "../../core/mind_map_data.hpp"
|
||||||
|
#include "../../core/test_mode.hpp"
|
||||||
|
|
||||||
#include "../../io/alz_file_io.hpp"
|
#include "../../io/alz_file_io.hpp"
|
||||||
#include "../../io/xml_reader.hpp"
|
#include "../../io/xml_reader.hpp"
|
||||||
@ -25,6 +26,8 @@
|
|||||||
|
|
||||||
#include "../../core/graph.hpp"
|
#include "../../core/graph.hpp"
|
||||||
|
|
||||||
|
using Core::MindMapData;
|
||||||
|
|
||||||
using SceneItems::Edge;
|
using SceneItems::Edge;
|
||||||
using SceneItems::EdgeModel;
|
using SceneItems::EdgeModel;
|
||||||
using SceneItems::Node;
|
using SceneItems::Node;
|
||||||
@ -32,7 +35,7 @@ using SceneItems::NodeModel;
|
|||||||
|
|
||||||
AlzFileIOTest::AlzFileIOTest()
|
AlzFileIOTest::AlzFileIOTest()
|
||||||
{
|
{
|
||||||
TestMode::setEnabled(true);
|
Core::TestMode::setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlzFileIOTest::testEmptyDesign()
|
void AlzFileIOTest::testEmptyDesign()
|
||||||
|
@ -16,10 +16,12 @@
|
|||||||
#include "editor_data_test.hpp"
|
#include "editor_data_test.hpp"
|
||||||
|
|
||||||
#include "../../editor_data.hpp"
|
#include "../../editor_data.hpp"
|
||||||
#include "../../mind_map_data.hpp"
|
|
||||||
#include "../../test_mode.hpp"
|
|
||||||
|
|
||||||
#include "../../core/graph.hpp"
|
#include "../../core/graph.hpp"
|
||||||
|
#include "../../core/mind_map_data.hpp"
|
||||||
|
#include "../../core/test_mode.hpp"
|
||||||
|
|
||||||
|
using Core::MindMapData;
|
||||||
|
|
||||||
using SceneItems::Edge;
|
using SceneItems::Edge;
|
||||||
using SceneItems::EdgeModel;
|
using SceneItems::EdgeModel;
|
||||||
@ -28,7 +30,7 @@ using SceneItems::NodeModel;
|
|||||||
|
|
||||||
EditorDataTest::EditorDataTest()
|
EditorDataTest::EditorDataTest()
|
||||||
{
|
{
|
||||||
TestMode::setEnabled(true);
|
Core::TestMode::setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorDataTest::testAddAndDeleteEdge()
|
void EditorDataTest::testAddAndDeleteEdge()
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
|
|
||||||
#include "graph_test.hpp"
|
#include "graph_test.hpp"
|
||||||
|
|
||||||
#include "../../test_mode.hpp"
|
|
||||||
|
|
||||||
#include "../../core/graph.hpp"
|
#include "../../core/graph.hpp"
|
||||||
|
#include "../../core/test_mode.hpp"
|
||||||
|
|
||||||
#include "../../scene_items/node.hpp"
|
#include "../../scene_items/node.hpp"
|
||||||
|
|
||||||
@ -26,12 +25,14 @@
|
|||||||
|
|
||||||
using std::make_shared;
|
using std::make_shared;
|
||||||
|
|
||||||
|
using Core::Graph;
|
||||||
|
|
||||||
using SceneItems::Edge;
|
using SceneItems::Edge;
|
||||||
using SceneItems::Node;
|
using SceneItems::Node;
|
||||||
|
|
||||||
GraphTest::GraphTest()
|
GraphTest::GraphTest()
|
||||||
{
|
{
|
||||||
TestMode::setEnabled(true);
|
Core::TestMode::setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphTest::testAddEdge()
|
void GraphTest::testAddEdge()
|
||||||
|
@ -17,22 +17,24 @@
|
|||||||
|
|
||||||
#include "../../grid.hpp"
|
#include "../../grid.hpp"
|
||||||
#include "../../layout_optimizer.hpp"
|
#include "../../layout_optimizer.hpp"
|
||||||
#include "../../mind_map_data.hpp"
|
|
||||||
#include "../../test_mode.hpp"
|
|
||||||
|
|
||||||
#include "../../core/graph.hpp"
|
#include "../../core/graph.hpp"
|
||||||
|
#include "../../core/mind_map_data.hpp"
|
||||||
|
#include "../../core/test_mode.hpp"
|
||||||
|
|
||||||
#include "simple_logger.hpp"
|
#include "simple_logger.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
|
using Core::MindMapData;
|
||||||
|
|
||||||
using SceneItems::Edge;
|
using SceneItems::Edge;
|
||||||
using SceneItems::Node;
|
using SceneItems::Node;
|
||||||
|
|
||||||
LayoutOptimizerTest::LayoutOptimizerTest()
|
LayoutOptimizerTest::LayoutOptimizerTest()
|
||||||
{
|
{
|
||||||
TestMode::setEnabled(true);
|
Core::TestMode::setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayoutOptimizerTest::testNoNodes_ShouldNotInitialize()
|
void LayoutOptimizerTest::testNoNodes_ShouldNotInitialize()
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "node_test.hpp"
|
#include "node_test.hpp"
|
||||||
|
|
||||||
#include "../../test_mode.hpp"
|
#include "../../core/test_mode.hpp"
|
||||||
|
|
||||||
#include "../../scene_items/node.hpp"
|
#include "../../scene_items/node.hpp"
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ using SceneItems::Node;
|
|||||||
|
|
||||||
NodeTest::NodeTest()
|
NodeTest::NodeTest()
|
||||||
{
|
{
|
||||||
TestMode::setEnabled(true);
|
Core::TestMode::setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeTest::testContainsText()
|
void NodeTest::testContainsText()
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
#include "selection_group_test.hpp"
|
#include "selection_group_test.hpp"
|
||||||
|
|
||||||
#include "selection_group.hpp"
|
#include "selection_group.hpp"
|
||||||
#include "test_mode.hpp"
|
|
||||||
|
#include "../../core/test_mode.hpp"
|
||||||
|
|
||||||
#include "../../scene_items/node.hpp"
|
#include "../../scene_items/node.hpp"
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ using SceneItems::Node;
|
|||||||
|
|
||||||
SelectionGroupTest::SelectionGroupTest()
|
SelectionGroupTest::SelectionGroupTest()
|
||||||
{
|
{
|
||||||
TestMode::setEnabled(true);
|
Core::TestMode::setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionGroupTest::testAddNodes_Explicit()
|
void SelectionGroupTest::testAddNodes_Explicit()
|
||||||
|
@ -14,9 +14,10 @@
|
|||||||
// along with Heimer. If not, see <http://www.gnu.org/licenses/>.
|
// along with Heimer. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "version_test.hpp"
|
#include "version_test.hpp"
|
||||||
#include "test_mode.hpp"
|
|
||||||
|
|
||||||
#include "../../version.hpp"
|
#include "../../core/version.hpp"
|
||||||
|
|
||||||
|
using Core::Version;
|
||||||
|
|
||||||
void VersionTest::testInitialization_defaultShouldNotBeValid()
|
void VersionTest::testInitialization_defaultShouldNotBeValid()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user