void ConsoleOutput::startComment(QTextStream &out,AnsiColor color){
  out.setFieldWidth(indent);
  out.setFieldAlignment(QTextStream::AlignRight);
  out << " ";
  out.setFieldWidth(0);
#ifndef _WIN32
  out << "\033[0;" << color << "m";
#endif
  out.setFieldAlignment(QTextStream::AlignLeft);
  out.setFieldWidth(20);
  out.setPadChar(' ');
}
Exemple #2
0
void MainWindow::aboutLicense() {
    QDialog *dialog = new QDialog( this );

    QFile file( ":/GPL" );
    if(!file.open( QIODevice::ReadOnly | QIODevice::Text ))
        qCritical( "GPL LicenseFile not found" );

    QTextStream out ( &file );
    out.setFieldAlignment ( QTextStream::AlignCenter );

    QTextEdit *qteLicense = new QTextEdit ( dialog );
        qteLicense->setText ( out.readAll ());
        qteLicense->setReadOnly ( 1 );
    QPushButton *qpbClose = new QPushButton ( IconLoader::Load( "window-close" ), tr( "&Close" ), dialog );
        connect( qpbClose, SIGNAL( clicked()), dialog, SLOT( deleteLater()));

    qglDialog = new QGridLayout( dialog );
        qglDialog->addWidget( qteLicense, 0, 0 );
        qglDialog->addWidget( qpbClose, 1, 0, Qt::AlignRight );

        dialog->setLayout( qglDialog);
        dialog->setWindowTitle( "GNU General Public License" );
        dialog->setFixedSize( 550, 400 );
        dialog->exec();
}
Exemple #3
0
static void printOptions(QTextStream& s, const QMap<QString, QString>& options) {
    QMap<QString, QString>::const_iterator it = options.constBegin();
    s.setFieldAlignment(QTextStream::AlignLeft);
    for (; it != options.constEnd(); ++it) {
        s << "  --";
        s.setFieldWidth(38);
        s << it.key() << it.value();
        s.setFieldWidth(0);
        s << endl;
    }
}
// Write data + helpers
void FormattedTouchstone::WriteData(FormattedNetworkData &network, QTextStream &snpFile) {
    // Choose data format
    GetWriteFormat(network);

    snpFile.setRealNumberPrecision(PRECISION);
    for (uint currentFreq = 0; currentFreq < network.points(); currentFreq++) {
        snpFile.setFieldAlignment(QTextStream::AlignLeft);
        snpFile.setFieldWidth(COLUMNWIDTH);
        snpFile << network.x()[currentFreq];
        FormattedComplexMatrix2D::iterator row_iter = network.y()[currentFreq].begin();
        WriteRow(network, snpFile, *row_iter);
        row_iter++;
        for (; row_iter != network.y()[currentFreq].end(); row_iter++) {
            snpFile.setFieldAlignment(QTextStream::AlignLeft);
            snpFile.setFieldWidth(COLUMNWIDTH);
            snpFile << " "; // tab past frequency column for subsequent rows
            WriteRow(network, snpFile, *row_iter);
        }
    }
}
void QWSHexDump::sideviewDump(int at)
{
    if (dirty) {
        dirty = false;
        ++at;
        sideview[at] = '\0';
        int currentWidth = (2 * at) + (at / clustering) - (at%clustering?0:1);
        int missing = qMax(dataWidth - currentWidth, 0);
        while (missing--)
            *outstrm << ' ';

        *outstrm << " [";
        outstrm->setPadChar(' ');
        outstrm->setFieldWidth(wrap);
        outstrm->setFieldAlignment( QTextStream::AlignLeft );
        *outstrm << sideview;
        *outstrm << ']';
    }
}
void FormattedTouchstone::WriteRow(FormattedNetworkData &network, QTextStream &snpFile, FormattedComplexRowVector &row) {
    uint columnsWritten = 1;
    uint const COLUMNSPERLINE = 4;
    FormattedComplexRowVector::iterator column_iter = row.begin();
    for (; column_iter != row.end(); column_iter++) {
        (*WriteDatum)(snpFile, *column_iter);
        // add delimiter
        if (columnsWritten == network.numberOfPorts()) {
            snpFile.setFieldWidth(0);
            snpFile << endl;
            snpFile.setFieldWidth(COLUMNWIDTH);
        }
        else if (columnsWritten % COLUMNSPERLINE == 0) {
            snpFile.setFieldWidth(0);
            snpFile << endl;
            snpFile.setFieldAlignment(QTextStream::AlignLeft);
            snpFile.setFieldWidth(COLUMNWIDTH);
            snpFile << " ";
        }
        columnsWritten++;
    }
}
void FormattedTouchstone::WriteDB(QTextStream &snpFile, FormattedComplex &datum) {
    snpFile.setFieldAlignment(QTextStream::AlignLeft);
    snpFile.setFieldWidth(COLUMNWIDTH);
    snpFile << datum.dB();
    snpFile << datum.angle_deg();
}
void FormattedTouchstone::WriteRI(QTextStream &snpFile, FormattedComplex &datum) {
    snpFile.setFieldAlignment(QTextStream::AlignLeft);
    snpFile.setFieldWidth(COLUMNWIDTH);
    snpFile << datum.real();
    snpFile << datum.imaginary();
}