void B9Terminal::makeProjectorConnections() { // should be called any time we create a new projector object if(pProjector==NULL)return; connect(pProjector, SIGNAL(keyReleased(int)),this, SLOT(getKey(int))); connect(this, SIGNAL(sendStatusMsg(QString)),pProjector, SLOT(setStatusMsg(QString))); connect(this, SIGNAL(sendGrid(bool)),pProjector, SLOT(setShowGrid(bool))); connect(this, SIGNAL(sendCPJ(CrushedPrintJob*)),pProjector, SLOT(setCPJ(CrushedPrintJob*))); connect(this, SIGNAL(sendXoff(int)),pProjector, SLOT(setXoff(int))); connect(this, SIGNAL(sendYoff(int)),pProjector, SLOT(setYoff(int))); }
void B9Terminal::makeProjectorConnections() { // 创建任何一个新的投影机对象时调用 if(pProjector==NULL)return; connect(pProjector, SIGNAL(keyReleased(int)),this, SLOT(getKey(int))); connect(this, SIGNAL(sendStatusMsg(QString)),pProjector, SLOT(setStatusMsg(QString))); connect(this, SIGNAL(sendGrid(bool)),pProjector, SLOT(setShowGrid(bool))); connect(this, SIGNAL(sendCPJ(CrushedPrintJob*)),pProjector, SLOT(setCPJ(CrushedPrintJob*))); connect(this, SIGNAL(sendXoff(int)),pProjector, SLOT(setXoff(int))); connect(this, SIGNAL(sendYoff(int)),pProjector, SLOT(setYoff(int))); }
void B9Terminal::onScreenCountChanged(int iCount){ QString sVideo = "Disconnected or Primary Monitor"; if(pProjector) { delete pProjector; pProjector = NULL; if(pPrinterComm->getProjectorStatus()==B9PrinterStatus::PS_ON) if(!isEnabled())emit signalAbortPrint("Print Aborted: Connection to Projector Lost or Changed During Print Cycle"); } pProjector = new B9Projector(true, 0,Qt::WindowStaysOnTopHint); makeProjectorConnections(); int i=iCount; int screenCount = m_pDesktop->screenCount(); QRect screenGeometry; if(m_bUsePrimaryMonitor) { screenGeometry = m_pDesktop->screenGeometry(0); } else{ for(i=screenCount-1;i>= 0;i--) { screenGeometry = m_pDesktop->screenGeometry(i); if(screenGeometry.width() == pPrinterComm->getNativeX() && screenGeometry.height() == pPrinterComm->getNativeY()) { //Found the projector! sVideo = "Connected to Monitor: " + QString::number(i+1); m_bNeedsWarned = true; break; } } } if(i<=0||m_bUsePrimaryMonitor)m_bPrimaryScreen = true; else m_bPrimaryScreen = false; emit updateProjectorOutput(sVideo); pProjector->setShowGrid(true); pProjector->setCPJ(NULL); emit sendStatusMsg("B9Creator - Idle"); pProjector->setGeometry(screenGeometry); if(!m_bPrimaryScreen){ pProjector->showFullScreen(); // Only show it if it is a secondary monitor pProjector->hide(); activateWindow(); // if not using primary monitor, take focus back to here. } else if(m_bPrintPreview||(pPrinterComm->getProjectorStatus() != B9PrinterStatus::PS_OFF && pPrinterComm->getProjectorStatus() != B9PrinterStatus::PS_COOLING && pPrinterComm->getProjectorStatus() != B9PrinterStatus::PS_UNKNOWN)) { // if the projector is not turned off, we better put up the blank screen now! pProjector->showFullScreen(); } //else warnSingleMonitor(); }
void B9Terminal::on_pushButtonProjPower_toggled(bool checked) { // User has changed the commanded projector power setting ui->pushButtonProjPower->setChecked(checked); if(checked) ui->pushButtonProjPower->setText("ON"); else ui->pushButtonProjPower->setText("OFF"); pPrinterComm->cmdProjectorPowerOn(checked); emit(setProjectorPowerCmd(checked)); // if m_bPrimaryScreen is true, we need to show it before turning on projector! if(m_bPrimaryScreen) onScreenCountChanged(); emit sendStatusMsg("B9Creator - Projector status: TURN ON"); // We always close the vat when powering up if(checked){ emit onBC_CurrentVatPercentOpen(0); emit on_spinBoxVatPercentOpen_editingFinished(); } }
void B9Terminal::on_pushButtonProjPower_toggled(bool checked) { //用户改变了投影机电源设置 ui->pushButtonProjPower->setChecked(checked); if(checked) ui->pushButtonProjPower->setText("ON"); else ui->pushButtonProjPower->setText("OFF"); pPrinterComm->cmdProjectorPowerOn(checked); emit(setProjectorPowerCmd(checked)); // 如果m_bPrimaryScreen是真的,我们需要在打开投影机之前显示它! if(m_bPrimaryScreen) onScreenCountChanged(); emit sendStatusMsg("B9Creator - Projector status: TURN ON"); // 我们始终通电时关闭Vat if(checked){ emit onBC_CurrentVatPercentOpen(0); emit on_spinBoxVatPercentOpen_editingFinished(); } }
B9Print::B9Print(B9Terminal *pTerm, QWidget *parent) : QDialog(parent), ui(new Ui::B9Print) { m_pTerminal = pTerm; if(m_pTerminal == NULL) qFatal("FATAL Call to B9Creator with null B9Terminal Pointer"); ui->setupUi(this); //清除旧信息 ui->lineEditSerialStatus->setText(""); ui->lineEditProjectorOutput->setText(""); m_iTbase = m_iTover = 0; m_iTattach = 0; m_iNumAttach = 1; m_iXOff = m_iYOff =0; m_iPrintState = PRINT_NO; m_iPaused = PAUSE_NO; m_bAbort = false; m_sAbortMessage = "Unknown Abort"; m_iCurLayerNumber = 0; m_dLayerThickness = 0.0; m_iLastLayer = 0; connect(m_pTerminal, SIGNAL(updateConnectionStatus(QString)), this, SLOT(on_updateConnectionStatus(QString))); connect(m_pTerminal, SIGNAL(updateProjectorOutput(QString)), this, SLOT(on_updateProjectorOutput(QString))); connect(m_pTerminal, SIGNAL(updateProjectorStatus(QString)), this, SLOT(on_updateProjectorStatus(QString))); connect(m_pTerminal, SIGNAL(updateProjector(B9PrinterStatus::ProjectorStatus)), this, SLOT(on_updateProjector(B9PrinterStatus::ProjectorStatus))); connect(m_pTerminal, SIGNAL(signalAbortPrint(QString)), this, SLOT(on_pushButtonAbort_clicked(QString))); connect(m_pTerminal, SIGNAL(PrintReleaseCycleFinished()), this, SLOT(exposeTBaseLayer())); connect(m_pTerminal, SIGNAL(pausePrint()), this, SLOT(on_pushButtonPauseResume_clicked())); connect(m_pTerminal, SIGNAL(sendStatusMsg(QString)),this, SLOT(setProjMessage(QString))); QString sTime = QDateTime::currentDateTime().toString("hh:mm"); ui->lcdNumberTime->setDigitCount(9); ui->lcdNumberTime->display(sTime); }
void B9Terminal::onBC_ProjStatusChanged() { QString sText = "UNKNOWN"; switch (pPrinterComm->getProjectorStatus()){ case B9PrinterStatus::PS_OFF: ui->pushButtonProjPower->setEnabled(true); sText = "OFF"; break; case B9PrinterStatus::PS_TURNINGON: ui->pushButtonProjPower->setEnabled(false); sText = "TURN ON"; break; case B9PrinterStatus::PS_WARMING: ui->pushButtonProjPower->setEnabled(true); sText = "WARM UP"; break; case B9PrinterStatus::PS_ON: ui->pushButtonProjPower->setEnabled(true); emit(ProjectorIsOn()); sText = "ON"; break; case B9PrinterStatus::PS_COOLING: ui->pushButtonProjPower->setEnabled(false); sText = "COOL DN"; break; case B9PrinterStatus::PS_TIMEOUT: ui->pushButtonProjPower->setEnabled(false); sText = "TIMEOUT"; if(!isEnabled())emit signalAbortPrint("Timed out while attempting to turn on projector. Check Projector's Power Cord and RS-232 cable."); break; case B9PrinterStatus::PS_FAIL: ui->pushButtonProjPower->setEnabled(false); sText = "FAIL"; if(!isEnabled())emit signalAbortPrint("Lost Communications with Projector. Possible Causes: Manually powered off, Power Failure, Cord Disconnected or Projector Lamp Failure"); break; case B9PrinterStatus::PS_UNKNOWN: ui->pushButtonProjPower->setEnabled(true); default: sText = "UNKNOWN"; break; } // Update the power button state if(pPrinterComm->isProjectorPowerCmdOn()){ pProjector->show(); activateWindow(); ui->pushButtonProjPower->setChecked(true); ui->pushButtonProjPower->setText("ON"); } else{ pProjector->hide(); activateWindow(); ui->pushButtonProjPower->setChecked(false); ui->pushButtonProjPower->setText("OFF"); } if(!isEnabled())emit sendStatusMsg("B9Creator - Projector status: "+sText); if(!isEnabled())emit updateProjectorStatus(sText); if(!isEnabled())emit updateProjector(pPrinterComm->getProjectorStatus()); ui->lineEditProjState->setText(sText); sText = "UNKNOWN"; int iLH = pPrinterComm->getLampHrs(); if(iLH >= 0 && (pPrinterComm->getProjectorStatus()==B9PrinterStatus::PS_ON|| pPrinterComm->getProjectorStatus()==B9PrinterStatus::PS_WARMING|| pPrinterComm->getProjectorStatus()==B9PrinterStatus::PS_COOLING))sText = QString::number(iLH); ui->lineEditLampHrs->setText(sText); }
void B9Terminal::onScreenCountChanged(int iCount){ QString sVideo = "Disconnected or Primary Monitor"; if(pProjector) { delete pProjector; pProjector = NULL; if(pPrinterComm->getProjectorStatus()==B9PrinterStatus::PS_ON) if(!isEnabled())emit signalAbortPrint("Print Aborted: Connection to Projector Lost or Changed During Print Cycle"); } pProjector = new B9Projector(true, 0,Qt::WindowStaysOnTopHint); makeProjectorConnections(); int i=iCount; int screenCount = m_pDesktop->screenCount(); QRect screenGeometry; if(m_bUsePrimaryMonitor) { screenGeometry = m_pDesktop->screenGeometry(0); } else{ for(i=screenCount-1;i>= 0;i--) { screenGeometry = m_pDesktop->screenGeometry(i); if(screenGeometry.width() == pPrinterComm->getNativeX() && screenGeometry.height() == pPrinterComm->getNativeY()) { //发现投影机! sVideo = "Connected to Monitor: " + QString::number(i+1); m_bNeedsWarned = true; break; } } } if(i<=0||m_bUsePrimaryMonitor)m_bPrimaryScreen = true; else m_bPrimaryScreen = false; emit updateProjectorOutput(sVideo); pProjector->setShowGrid(true); pProjector->setCPJ(NULL); emit sendStatusMsg("B9Creator - Idle"); pProjector->setGeometry(screenGeometry); if(!m_bPrimaryScreen){ pProjector->showFullScreen(); // 只显示它,如果它是一个辅助监视器 pProjector->hide(); activateWindow(); // 如果不使用主显示器,采取焦点回到这里。 } else if(m_bPrintPreview||(pPrinterComm->getProjectorStatus() != B9PrinterStatus::PS_OFF && pPrinterComm->getProjectorStatus() != B9PrinterStatus::PS_COOLING && pPrinterComm->getProjectorStatus() != B9PrinterStatus::PS_UNKNOWN)) { // 如果投影机不会关闭,我们最好设置黑屏 if(getIsVirtualDevice()) { screenGeometry.setY(20); screenGeometry.setWidth(1024); screenGeometry.setHeight(768); pProjector->setGeometry(screenGeometry); pProjector->show(); }else{ pProjector->showFullScreen(); } } //else warnSingleMonitor(); }