Compact allocating and pushing of commands
This commit is contained in:
@@ -384,8 +384,7 @@ void TeletextWidget::setCharacter(unsigned char newCharacter)
|
|||||||
|
|
||||||
void TeletextWidget::toggleCharacterBit(unsigned char bitToToggle)
|
void TeletextWidget::toggleCharacterBit(unsigned char bitToToggle)
|
||||||
{
|
{
|
||||||
QUndoCommand *toggleMosaicBitCommand = new ToggleMosaicBitCommand(m_teletextDocument, bitToToggle);
|
m_teletextDocument->undoStack()->push(new ToggleMosaicBitCommand(m_teletextDocument, bitToToggle));
|
||||||
m_teletextDocument->undoStack()->push(toggleMosaicBitCommand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<int, int> TeletextWidget::mouseToRowAndColumn(const QPoint &mousePosition)
|
QPair<int, int> TeletextWidget::mouseToRowAndColumn(const QPoint &mousePosition)
|
||||||
|
|||||||
@@ -577,20 +577,17 @@ void MainWindow::insertRow(bool copyRow)
|
|||||||
{
|
{
|
||||||
if (m_textWidget->document()->cursorRow() == 24)
|
if (m_textWidget->document()->cursorRow() == 24)
|
||||||
return;
|
return;
|
||||||
QUndoCommand *insertRowCommand = new InsertRowCommand(m_textWidget->document(), copyRow);
|
m_textWidget->document()->undoStack()->push(new InsertRowCommand(m_textWidget->document(), copyRow));
|
||||||
m_textWidget->document()->undoStack()->push(insertRowCommand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::deleteRow()
|
void MainWindow::deleteRow()
|
||||||
{
|
{
|
||||||
QUndoCommand *deleteRowCommand = new DeleteRowCommand(m_textWidget->document());
|
m_textWidget->document()->undoStack()->push(new DeleteRowCommand(m_textWidget->document()));
|
||||||
m_textWidget->document()->undoStack()->push(deleteRowCommand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::insertSubPage(bool afterCurrentSubPage, bool copyCurrentSubPage)
|
void MainWindow::insertSubPage(bool afterCurrentSubPage, bool copyCurrentSubPage)
|
||||||
{
|
{
|
||||||
QUndoCommand *insertSubPageCommand = new InsertSubPageCommand(m_textWidget->document(), afterCurrentSubPage, copyCurrentSubPage);
|
m_textWidget->document()->undoStack()->push(new InsertSubPageCommand(m_textWidget->document(), afterCurrentSubPage, copyCurrentSubPage));
|
||||||
m_textWidget->document()->undoStack()->push(insertSubPageCommand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::deleteSubPage()
|
void MainWindow::deleteSubPage()
|
||||||
|
|||||||
@@ -108,14 +108,11 @@ void PaletteDockWidget::selectColour(int colourIndex)
|
|||||||
{
|
{
|
||||||
const QColor newColour = QColorDialog::getColor(m_parentMainWidget->document()->currentSubPage()->CLUTtoQColor(colourIndex), this, "Select Colour");
|
const QColor newColour = QColorDialog::getColor(m_parentMainWidget->document()->currentSubPage()->CLUTtoQColor(colourIndex), this, "Select Colour");
|
||||||
|
|
||||||
if (newColour.isValid()) {
|
if (newColour.isValid())
|
||||||
QUndoCommand *setColourCommand = new SetColourCommand(m_parentMainWidget->document(), colourIndex, ((newColour.red() & 0xf0) << 4) | (newColour.green() & 0xf0) | ((newColour.blue() & 0xf0) >> 4));
|
m_parentMainWidget->document()->undoStack()->push(new SetColourCommand(m_parentMainWidget->document(), colourIndex, ((newColour.red() & 0xf0) << 4) | (newColour.green() & 0xf0) | ((newColour.blue() & 0xf0) >> 4)));
|
||||||
m_parentMainWidget->document()->undoStack()->push(setColourCommand);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaletteDockWidget::resetCLUT(int colourTable)
|
void PaletteDockWidget::resetCLUT(int colourTable)
|
||||||
{
|
{
|
||||||
QUndoCommand *resetCLUTCommand = new ResetCLUTCommand(m_parentMainWidget->document(), colourTable);
|
m_parentMainWidget->document()->undoStack()->push(new ResetCLUTCommand(m_parentMainWidget->document(), colourTable));
|
||||||
m_parentMainWidget->document()->undoStack()->push(resetCLUTCommand);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user