예제 #1
0
void ZoneMap::undo()
{
	if(m_editting)
		stopEdit();
	if(m_cEdit >= 0)
	{
		Edit::Tile _tile;
		m_editting = true;
		for(Uint16 i = 0; i < m_undoEdits[m_cEdit].m_tile.size(); i++)
		{
			_tile = m_undoEdits[m_cEdit].m_tile[i];
			setTile(_tile.layer, _tile.x, _tile.y, _tile.id);
		}
		if(m_undoEdits[m_cEdit].m_entity.id != -1)
			m_entities[m_undoEdits[m_cEdit].m_entity.id].m_pos = m_undoEdits[m_cEdit].m_entity.pos;
		m_cEdit--;
		m_editting = false;
	}
}
예제 #2
0
void LogViewer::on_deleteBtn_clicked()
{
    // display a popup asking for confirmation
    int rPopup = utils::popup("Permanently delete this record?", QMessageBox::Question,
                              QMessageBox::Yes | QMessageBox::No, QMessageBox::No, this);

    if(rPopup == QMessageBox::No) {
        // abort the delete
        return;
    }
    // else continue with the deletion

    log::Qso record = ui->qsoForm->buildQsoRecord();

    // make sure we have a valid ID
    if(!record.isValidExistingRecord()) {
        qCritical() << "Log Viewer: QSO record for delete does not have valid PK";
    } else {
        // good to delete
        if(!log::QsoLog::removeQso(record)) {
            qCritical() << "Log Viewer: failed to delete QSO record " << record.getId();

            utils::popup("Can't delete contact record: database failure",
                         QMessageBox::Critical,
                         QMessageBox::Ok, QMessageBox::Ok,
                         this);
        } else {
            qDebug() << "Log Viewer: successfully deleted QSO record " << record.getId();

            // refresh
            refreshLog();
        }
    }

    // stop the edit
    stopEdit();
}
예제 #3
0
void LogViewer::on_saveBtn_clicked()
{
    // get the updated record
    log::Qso record = ui->qsoForm->buildQsoRecord();

    // validate record
    if(!record.isValidExistingRecord()) {
        qCritical() << "Log Viewer: updated QSO record does not have valid PK";
    } else if(!log::QsoValidator::validateQso(record)) {
        qCritical() << "Log Viewer: updated QSO record is not valid";

        utils::popup("Can't update contact record: QSO record not valid",
                     QMessageBox::Warning,
                     QMessageBox::Ok, QMessageBox::Ok,
                     this,
                     log::QsoValidator::getLastError());
    } else {
        // good to update
        if(!log::QsoLog::updateQso(record)) {
            qCritical() << "Log Viewer: failed to update QSO record " << record.getId();

            utils::popup("Can't update contact record: database failure",
                         QMessageBox::Critical,
                         QMessageBox::Ok, QMessageBox::Ok,
                         this);
        } else {
            qDebug() << "Log Viewer: successfully updated QSO record " << record.getId();

            // refresh
            refreshLog();
        }
    }

    // stop the edit
    stopEdit();
}
예제 #4
0
void LogViewer::on_cancelBtn_clicked()
{
    // just stop the edit
    stopEdit();
}
 void FieldEditor::lostFocus()
 {
     qDebug() << "emitting stopEdit()";
     emit stopEdit();
 }