mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 13:01:42 +00:00
Added: #1450 Added multiple undo stacks per context.
This commit is contained in:
parent
47eac5203e
commit
fe25a3332d
5 changed files with 37 additions and 4 deletions
|
@ -78,6 +78,18 @@ Core::IContext *ContextManager::context(const QString &id) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContextManager::registerUndoStack(QUndoStack *stack)
|
||||||
|
{
|
||||||
|
nlassert(stack);
|
||||||
|
d->m_mainWindow->undoGroup()->addStack(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::unregisterUndoStack(QUndoStack *stack)
|
||||||
|
{
|
||||||
|
nlassert(stack);
|
||||||
|
d->m_mainWindow->undoGroup()->removeStack(stack);
|
||||||
|
}
|
||||||
|
|
||||||
void ContextManager::activateContext(const QString &id)
|
void ContextManager::activateContext(const QString &id)
|
||||||
{
|
{
|
||||||
const int index = indexOf(id);
|
const int index = indexOf(id);
|
||||||
|
@ -85,6 +97,11 @@ void ContextManager::activateContext(const QString &id)
|
||||||
d->m_tabWidget->setCurrentIndex(index);
|
d->m_tabWidget->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContextManager::updateCurrentContext()
|
||||||
|
{
|
||||||
|
d->m_mainWindow->updateContext(currentContext());
|
||||||
|
}
|
||||||
|
|
||||||
void ContextManager::objectAdded(QObject *obj)
|
void ContextManager::objectAdded(QObject *obj)
|
||||||
{
|
{
|
||||||
IContext *context = qobject_cast<IContext *>(obj);
|
IContext *context = qobject_cast<IContext *>(obj);
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QTabWidget;
|
class QTabWidget;
|
||||||
|
class QUndoStack;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
|
@ -45,12 +46,17 @@ public:
|
||||||
Core::IContext *currentContext() const;
|
Core::IContext *currentContext() const;
|
||||||
Core::IContext *context(const QString &id) const;
|
Core::IContext *context(const QString &id) const;
|
||||||
|
|
||||||
|
// temporary solution for multiple undo stacks per context
|
||||||
|
void registerUndoStack(QUndoStack *stack);
|
||||||
|
void unregisterUndoStack(QUndoStack *stack);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
// the default argument '=0' is important for connects without the oldContext argument.
|
// the default argument '=0' is important for connects without the oldContext argument.
|
||||||
void currentContextChanged(Core::IContext *context, Core::IContext *oldContext = 0);
|
void currentContextChanged(Core::IContext *context, Core::IContext *oldContext = 0);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void activateContext(const QString &id);
|
void activateContext(const QString &id);
|
||||||
|
void updateCurrentContext();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void objectAdded(QObject *obj);
|
void objectAdded(QObject *obj);
|
||||||
|
|
|
@ -92,7 +92,7 @@ const char *const SEARCH_PATHS = "SearchPaths";
|
||||||
const char *const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes";
|
const char *const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes";
|
||||||
const char *const LEVELDESIGN_PATH = "LevelDesignPath";
|
const char *const LEVELDESIGN_PATH = "LevelDesignPath";
|
||||||
const char *const PRIMITIVES_PATH = "PrimitivesPath";
|
const char *const PRIMITIVES_PATH = "PrimitivesPath";
|
||||||
const char * const ASSETS_PATH = "AssetsPath";
|
const char *const ASSETS_PATH = "AssetsPath";
|
||||||
const char *const LIGOCONFIG_FILE = "LigoConfigFile";
|
const char *const LIGOCONFIG_FILE = "LigoConfigFile";
|
||||||
const char *const REMAP_EXTENSIONS = "RemapExtensions";
|
const char *const REMAP_EXTENSIONS = "RemapExtensions";
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,11 @@ QSettings *MainWindow::settings() const
|
||||||
return m_settings;
|
return m_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QUndoGroup *MainWindow::undoGroup() const
|
||||||
|
{
|
||||||
|
return m_undoGroup;
|
||||||
|
}
|
||||||
|
|
||||||
ExtensionSystem::IPluginManager *MainWindow::pluginManager() const
|
ExtensionSystem::IPluginManager *MainWindow::pluginManager() const
|
||||||
{
|
{
|
||||||
return m_pluginManager;
|
return m_pluginManager;
|
||||||
|
@ -135,12 +140,16 @@ ExtensionSystem::IPluginManager *MainWindow::pluginManager() const
|
||||||
|
|
||||||
void MainWindow::addContextObject(IContext *context)
|
void MainWindow::addContextObject(IContext *context)
|
||||||
{
|
{
|
||||||
m_undoGroup->addStack(context->undoStack());
|
QUndoStack *stack = context->undoStack();
|
||||||
|
if (stack)
|
||||||
|
m_undoGroup->addStack(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::removeContextObject(IContext *context)
|
void MainWindow::removeContextObject(IContext *context)
|
||||||
{
|
{
|
||||||
m_undoGroup->removeStack(context->undoStack());
|
QUndoStack *stack = context->undoStack();
|
||||||
|
if (stack)
|
||||||
|
m_undoGroup->removeStack(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::open()
|
void MainWindow::open()
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
MenuManager *menuManager() const;
|
MenuManager *menuManager() const;
|
||||||
ContextManager *contextManager() const;
|
ContextManager *contextManager() const;
|
||||||
QSettings *settings() const;
|
QSettings *settings() const;
|
||||||
|
QUndoGroup *undoGroup() const;
|
||||||
|
|
||||||
ExtensionSystem::IPluginManager *pluginManager() const;
|
ExtensionSystem::IPluginManager *pluginManager() const;
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ public Q_SLOTS:
|
||||||
bool showOptionsDialog(const QString &group = QString(),
|
bool showOptionsDialog(const QString &group = QString(),
|
||||||
const QString &page = QString(),
|
const QString &page = QString(),
|
||||||
QWidget *parent = 0);
|
QWidget *parent = 0);
|
||||||
|
void updateContext(Core::IContext *context);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void open();
|
void open();
|
||||||
|
@ -77,7 +79,6 @@ private Q_SLOTS:
|
||||||
void gotoPos();
|
void gotoPos();
|
||||||
void setFullScreen(bool enabled);
|
void setFullScreen(bool enabled);
|
||||||
void about();
|
void about();
|
||||||
void updateContext(Core::IContext *context);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent *event);
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
|
|
Loading…
Reference in a new issue