Пример #1
0
void
CBCommand::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (message.Is(JProcess::kFinished))
		{
		const JProcess::Finished* info =
			dynamic_cast<const JProcess::Finished*>(&message);
		assert( info != NULL );
		const JBoolean cancelled = JI2B(info->GetReason() != kJChildFinished);
		ProcessFinished(JI2B(info->Successful() && !cancelled), cancelled);
		}
	else if (sender == itsMakeDependCmd && message.Is(CBCommand::kFinished))
		{
		const CBCommand::Finished* info =
			dynamic_cast<const CBCommand::Finished*>(&message);
		assert( info != NULL );
		itsMakeDependCmd         = NULL;
		const JBoolean cancelled = info->Cancelled();
		ProcessFinished(JI2B(info->Successful() && !cancelled), cancelled);
		}
	else
		{
		JBroadcaster::Receive(sender, message);
		}
}
Пример #2
0
void
CBCommand::ReceiveWithFeedback
	(
	JBroadcaster*	sender,
	Message*		message
	)
{
	if (sender == itsOutputDoc && message->Is(CBExecOutputDocument::kFinished))
		{
		CBExecOutputDocument::Finished* info =
			dynamic_cast<CBExecOutputDocument::Finished*>(message);
		assert( info != NULL );
		ProcessFinished(info->Successful(), info->Cancelled());
		}
	else
		{
		JBroadcaster::ReceiveWithFeedback(sender, message);
		}
}
Пример #3
0
int CCropDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: UpdateOutput(); break;
        case 1: on_pushButtonSourceFolderBrowse_clicked(); break;
        case 2: on_pushButtonDestFolderBrowse_clicked(); break;
        case 3: on_pushButtonCrop_clicked(); break;
        case 4: on_pushButtonPauseResume_clicked(); break;
        case 5: on_pushButtonStop_clicked(); break;
        case 6: on_pushButtonClearOutput_clicked(); break;
        case 7: ProcessFinished((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QProcess::ExitStatus(*)>(_a[2]))); break;
        case 8: ProcessError((*reinterpret_cast< QProcess::ProcessError(*)>(_a[1]))); break;
        }
        _id -= 9;
    }
    return _id;
}
void
CBExecOutputDocument::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsRecordLink && message.Is(JMessageProtocolT::kMessageReady))
		{
		ReceiveRecord();
		}
	else if (sender == itsDataLink && message.Is(JAsynchDataReceiverT::kDataReady))
		{
		ReceiveData(message);
		}

	else if (sender == itsProcess && message.Is(JProcess::kFinished))
		{
		const JProcess::Finished* info =
			dynamic_cast<const JProcess::Finished*>(&message);
		assert( info != NULL );
		const JBoolean stayOpen = ProcessFinished(*info);

		// let somebody else start a new process

		itsClearWhenStartFlag = kJFalse;	// in case they call SetConnection() in ReceiveWithFeedback()
		Finished msg(info->Successful(), JI2B(info->GetReason() != kJChildFinished));
		BroadcastWithFeedback(&msg);
		itsClearWhenStartFlag = JI2B(itsUseCount == 0 && !msg.SomebodyIsWaiting());

		if (itsUseCount == 0 && !stayOpen && !ProcessRunning())
			{
			Close();
			}
		}

	else if (sender == itsPauseButton && message.Is(JXButton::kPushed))
		{
		ToggleProcessRunning();
		}
	else if (sender == itsStopButton && message.Is(JXButton::kPushed))
		{
		StopProcess();
		}
	else if (sender == itsKillButton && message.Is(JXButton::kPushed))
		{
		KillProcess();
		}

	else if (sender == itsEOFButton && message.Is(JXButton::kPushed))
		{
		if (!(itsCmdInput->GetText()).IsEmpty())
			{
			itsCmdInput->HandleKeyPress(kJReturnKey, JXKeyModifiers(GetDisplay()));
			}
		CloseOutFD();
		UpdateButtons();
		}

	else
		{
		CBTextDocument::Receive(sender, message);
		}
}