void ConsoleWidget::setProcess(QIODevice *process) { if(m_process) m_process->disconnect(this); m_process = process; setReadOnly(!m_process); if(!m_process) return; clear(); connect(m_process, SIGNAL(readyRead()), this, SLOT(readStandardOut())); }
QTerminal::QTerminal(QWidget *parent, Qt::WindowFlags f) : QTextEdit(parent) { setWindowFlags(f); cmdStr = ""; shell = new QProcess(); shell->setProcessChannelMode(QProcess::MergedChannels); QObject::connect(shell, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOut())); QObject::connect(shell, SIGNAL(readyReadStandardError()), this, SLOT(readStandardErr())); shell->start("cmd.exe", QStringList() << "", QIODevice::ReadWrite); //this->insertPlainText("TERMINAL VERY ALPHA QUALITY ON WIN32!\r\n"); // This var protects against mouse interference with the cursor curCursorLoc = this->textCursor(); inputCharCount = 0; histLocation = -1; tempCmd = ""; }