// Constructor. CodeViewModeState::CodeViewModeState(CodeView* pView, Editor *pEditor, QObject *pParent) : ModeState(pParent), m_pView( LEAN_ASSERT_NOT_NULL(pView) ), m_pEditor( LEAN_ASSERT_NOT_NULL(pEditor) ) { const Ui::MainWindow &mainWindow = m_pEditor->mainWindow()->widgets(); // Enable clipboard functionality on entry assignProperty(mainWindow.actionCut, "enabled", false); // Set for proper revertion assignProperty(mainWindow.actionCopy, "enabled", false); assignProperty(mainWindow.actionPaste, "enabled", true); addConnection(m_pView->textEdit(), SIGNAL(copyAvailable(bool)), mainWindow.actionCut, SLOT(setEnabled(bool))); addConnection(m_pView->textEdit(), SIGNAL(copyAvailable(bool)), mainWindow.actionCopy, SLOT(setEnabled(bool))); addConnection(mainWindow.actionCut, SIGNAL(triggered()), m_pView->textEdit(), SLOT(cut())); addConnection(mainWindow.actionCopy, SIGNAL(triggered()), m_pView->textEdit(), SLOT(copy())); addConnection(mainWindow.actionPaste, SIGNAL(triggered()), m_pView->textEdit(), SLOT(paste())); }
// Constructor. DocumentModeState::DocumentModeState(AbstractDocument* pDocument, Editor *pEditor, QObject *pParent) : ModeState(pParent), m_pDocument( LEAN_ASSERT_NOT_NULL(pDocument) ), m_pEditor( LEAN_ASSERT_NOT_NULL(pEditor) ), m_pViewModes() { const Ui::MainWindow &mainWindow = m_pEditor->mainWindow()->widgets(); // Main window title checkedConnect(m_pDocument, SIGNAL(fileChanged(const QString&)), this, SLOT(updateWindowTitle())); checkedConnect(m_pDocument, SIGNAL(documentChanged(bool)), this, SLOT(updateWindowTitle())); // Enable save functionality on entry assignProperty(mainWindow.actionSave, "enabled", true); assignProperty(mainWindow.actionSave_As, "enabled", true); addConnection(mainWindow.actionSave, SIGNAL(triggered()), this, SLOT(save())); addConnection(mainWindow.actionSave_As, SIGNAL(triggered()), this, SLOT(saveAs())); }
State::State(QObject* stateMachineComponent, State* parent, const char* name, bool assignName) : QState(parent), parent(*parent), name(name), nameVariant(this->name) { if (parent != 0) { this->name.prepend(parent->getName() + "::"); } if (assignName) assignProperty(stateMachineComponent, "activeState", this->name); }