Example #1
0
valveDialog::valveDialog(unit *theValve, bool first, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::valveDialog)
{
    ui->setupUi(this);

    setWindowTitle("Define the valve");

    myUnit = theValve;
    if(myUnit->idunit == 62)//throttle
        ui->thermoBox->hide();
    else if(myUnit->idunit == 63)//thermo
        ui->throttleBox->hide();


    if(myUnit->idunit==63)
    {
        if(spnumber>3)
        {
            for(int i =0;i<spnumber;i++)
            {
                if(i!=myUnit->myNodes[0]->ndum-1&&i!=myUnit->myNodes[1]->ndum-1&&i!=myUnit->myNodes[2]->ndum-1)
                    ui->sensorBox->insertItem(0,QString::number(i+1));
            }
        }
        else
            ui->sensorBox->insertItem(0,"N/A");
    }


    if(!first)
    {
        ui->coefLine->setText(QString::number(myUnit->ht,'g',4));
        ui->lawLine->setText(QString::number(myUnit->devl,'g',4));
        if(myUnit->idunit==63)
        {
            ui->temperatureLine->setText(QString::number(myUnit->devg,'g',4));
            ui->temperatureUnitLine->setText(globalpara.unitname_temperature);
            int foundIndex = 0;
            for(int i = 0; i < ui->sensorBox->count();i++)
            {
                if(int(myUnit->devl)==ui->sensorBox->itemText(i).toInt())
                    foundIndex = i;
            }
            ui->sensorBox->setCurrentIndex(foundIndex);
        }
    }

    QLayout *mainLayout = layout();
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);


    QRegExp regExp("[-.0-9]+$");
    QRegExpValidator *regExpValidator = new QRegExpValidator(regExp,this);

    ui->coefLine->setValidator(regExpValidator);
    ui->lawLine->setValidator(regExpValidator);
    ui->temperatureLine->setValidator(regExpValidator);
}
MainWindow::MainWindow()
{
    m_main = new MainArea();
    QGraphicsView* view = new QGraphicsView(m_main, this);
    view->setOptimizationFlags( QGraphicsView::DontClipPainter |
                                QGraphicsView::DontSavePainterState |
                                QGraphicsView::DontAdjustForAntialiasing );
//    view->setViewportUpdateMode( QGraphicsView::FullViewportUpdate );
    view->setCacheMode( QGraphicsView::CacheBackground );
    view->setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
    view->setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
    setCentralWidget(view);

    setupActions();

#ifndef Q_OS_QNX
    QLayout* l = layout();
    Q_ASSERT(l);
    l->setSizeConstraint(QLayout::SetFixedSize);

    // setup status bar
    KStatusBar* bar = statusBar();
    Q_ASSERT(bar);
    m_time_label = new QLabel("");
    bar->addPermanentWidget(m_time_label);

    m_balls_label = new QLabel("");
    bar->addWidget(m_balls_label);
//     bar->setItemAlignment(STATUSBAR_BALLS, Qt::AlignLeft);
#endif

    connect(m_main, SIGNAL(changeGameTime(int)), this, SLOT(setGameTime(int)));
    connect(m_main, SIGNAL(changeBallNumber(int)), this, SLOT(setBallNumber(int)));
    connect(m_main, SIGNAL(changeState(bool)), this, SLOT(changeState(bool)));
    connect(m_main, SIGNAL(pause(bool)), this, SLOT(pause(bool)));

#ifndef Q_OS_QNX
    stateChanged("playing", KXMLGUIClient::StateReverse);
#endif
    connect(m_main, SIGNAL(starting()), this, SLOT(newGame()));
    connect(m_main, SIGNAL(gameOver(int)), this, SLOT(gameOver(int)));

#ifndef Q_OS_QNX
    KGameDifficulty::init(this, this, SLOT(difficultyChanged(KGameDifficulty::standardLevel)));
    KGameDifficulty::setRestartOnChange(KGameDifficulty::RestartOnChange);
    KGameDifficulty::addStandardLevel(KGameDifficulty::Easy);
    KGameDifficulty::addStandardLevel(KGameDifficulty::Medium);
    KGameDifficulty::addStandardLevel(KGameDifficulty::Hard);
    KGameDifficulty::setLevel(KGameDifficulty::standardLevel(KollisionConfig::gameDifficulty()));
#endif

#ifdef Q_OS_QNX
    //setMinimumSize(m_main->sceneRect().size().toSize());
#endif
}
Example #3
0
void WWidgetGroup::setup(QDomNode node, const SkinContext& context) {
    setContentsMargins(0, 0, 0, 0);

    // Set background pixmap if available
    if (context.hasNode(node, "BackPath")) {
        setPixmapBackground(context.getSkinPath(context.selectString(node, "BackPath")));
    }

    QLayout* pLayout = NULL;
    if (context.hasNode(node, "Layout")) {
        QString layout = context.selectString(node, "Layout");
        if (layout == "vertical") {
            pLayout = new QVBoxLayout();
            pLayout->setSpacing(0);
            pLayout->setContentsMargins(0, 0, 0, 0);
            pLayout->setAlignment(Qt::AlignCenter);
        } else if (layout == "horizontal") {
            pLayout = new QHBoxLayout();
            pLayout->setSpacing(0);
            pLayout->setContentsMargins(0, 0, 0, 0);
            pLayout->setAlignment(Qt::AlignCenter);
        }
    }

    if (pLayout && context.hasNode(node, "SizeConstraint")) {
        QMap<QString, QLayout::SizeConstraint> constraints;
        constraints["SetDefaultConstraint"] = QLayout::SetDefaultConstraint;
        constraints["SetFixedSize"] = QLayout::SetFixedSize;
        constraints["SetMinimumSize"] = QLayout::SetMinimumSize;
        constraints["SetMaximumSize"] = QLayout::SetMaximumSize;
        constraints["SetMinAndMaxSize"] = QLayout::SetMinAndMaxSize;
        constraints["SetNoConstraint"] = QLayout::SetNoConstraint;

        QString sizeConstraintStr = context.selectString(node, "SizeConstraint");
        if (constraints.contains(sizeConstraintStr)) {
            pLayout->setSizeConstraint(constraints[sizeConstraintStr]);
        } else {
            qDebug() << "Could not parse SizeConstraint:" << sizeConstraintStr;
        }
    }

    if (pLayout) {
        setLayout(pLayout);
    }
}
tableSelectParaDialog::tableSelectParaDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::tableSelectParaDialog)
{
    ui->setupUi(this);
    setWindowFlags(Qt::Tool);
    setWindowModality(Qt::ApplicationModal);
    setWindowTitle("Setup new table");

    inputModel = new QStringListModel;
    outputModel = new QStringListModel;

    ui->inputList->setEditTriggers(QAbstractItemView::NoEditTriggers);
    ui->outputList->setEditTriggers(QAbstractItemView::NoEditTriggers);

    ui->runssb->setValue(10);

    QLayout *mainLayout = layout();
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);

}
Example #5
0
altervDialog::altervDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::altervDialog)
{
    ui->setupUi(this);
    ui->enterValueGB->setDisabled(true);
    ui->firstRowSB->setValue(1);
    ui->lastRowSB->setValue(alvRowCount);
    ui->enterValueCB->setChecked(true);
    ui->firstValueLE->setText(QString::number(0));
    ui->lastValueLE->setText(QString::number(0));

    QRegExp regExp("[-.0-9]+$");
    QRegExpValidator *regExpValidator = new QRegExpValidator(regExp,this);
    ui->firstValueLE->setValidator(regExpValidator);
    ui->lastValueLE->setValidator(regExpValidator);

    setWindowFlags(Qt::Tool);
    QLayout *mainLayout = layout();
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);

}
Example #6
0
editUnitDialog::editUnitDialog(unit* myUnit, QWidget *parent):
QDialog(parent),ui(new Ui::editUnitDialog)
{
    ui->setupUi(this);

    tempUnit = myUnit;
    setWindowFlags(Qt::Tool);
    setWindowModality(Qt::ApplicationModal);
    setWindowTitle("Component Parameters");
    QString label;
    label.append("Please define parameters for component #");
    label.append(QString::number(tempUnit->nu));
    label.append(" ,a ");
    label.append(tempUnit->unitName);

    if(tempUnit->idunit==31||tempUnit->idunit==32||tempUnit->idunit==33)
        ui->DevBox->hide();

    ui->titleLabel->setText(label);
    ui->methodValueUnit->setText("");

    ui->HTBox->setStyleSheet("QGroupBox{ background-color:rgb(144, 202, 119); border: 1px solid black; }");
    ui->PinchBox->setStyleSheet("QGroupBox{ background-color:rgb(129, 198, 221); border: 1px solid black; }");
    ui->DevBox->setStyleSheet("QGroupBox{ background-color:rgb(233, 182, 77); border: 1px solid black; }");
    ui->COPBox->setStyleSheet("QGroupBox{ background-color:rgb(228, 135, 67); border: 1px solid black; }");
    ui->mergeBox->setStyleSheet("QGroupBox{ background-color:rgb(255, 102, 102); border: 1px solid black; }");

    QLayout *mainLayout = layout();
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);

    switch(tempUnit->iht)
    {
    case(0):
    {
        ui->HeatSpecifiedButton->setChecked(true);
        ui->methodValueUnit->setText(globalpara.unitname_heatquantity);
        break;
    }case(1):
    {
        ui->UAButton->setChecked(true);
        ui->methodValueUnit->setText(globalpara.unitname_UAvalue);
        break;
    }case(2):
    {
        ui->NTUButton->setChecked(true);
        ui->methodValueUnit->setText("");
        break;
    }case(3):
    {
        ui->EFFButton->setChecked(true);
        ui->methodValueUnit->setText("");
        break;
    }case(4):
    {
        ui->CATButton->setChecked(true);
        ui->methodValueUnit->setText(globalpara.unitname_temperature);
        break;
    }case(5):
    {
        ui->LMTDButton->setChecked(true);
        ui->methodValueUnit->setText(globalpara.unitname_temperature);
        break;
    }case(6):
    {
        ui->skipMethodButton->setChecked(true);
        break;
    }
    }

    ui->htLineEdit->setText(QString::number(tempUnit->ht,'g',4));
    switch(tempUnit->ipinch)
    {
    case(-1):
    {
        ui->ColdEndButton->setChecked(true);
        break;
    }case(1):
    {
        ui->HotEndButton->setChecked(true);
        break;
    }case(0):
    {
        ui->progDecideButton->setChecked(true);
        break;
    }
    }

    ui->devlLineEdit->setText(QString::number(tempUnit->devl));
    ui->devgLineEdit->setText(QString::number(tempUnit->devg));

    switch(tempUnit->icop)
    {
    case(-1):
    {
        ui->DenominatorButton->setChecked(true);
        break;
    }case(1):
    {
        ui->NumeratorButton->setChecked(true);
        break;
    }case(0):
    {
        ui->NeitherButton->setChecked(true);
        break;
    }
    }


    if(int(tempUnit->idunit/10)==16)
    {
        qDebug()<<"LDDC adiabatic!";
        ui->PinchBox->hide();
        ui->DevBox->hide();
        ui->UAButton->hide();
        ui->CATButton->hide();
        ui->LMTDButton->hide();
        ui->HeatSpecifiedButton->hide();
        ui->skipMethodButton->setText("Finite Difference Method");
    }
    if(int(tempUnit->idunit/10)==17)
    {
        qDebug()<<"LDDC cool!";
        ui->UAButton->hide();
        ui->NTUButton->hide();
        ui->EFFButton->hide();
        ui->CATButton->hide();
        ui->skipMethodButton->hide();
        ui->HeatSpecifiedButton->hide();
        ui->LMTDButton->hide();
        ui->skipMethodButton->setChecked(true);
        ui->PinchBox->hide();
        ui->Tempdevlabel->setText("NTU for heat and mass transfer");
        ui->liquidsidelabel->setText("NTU_mass:");
        ui->vaporsidelabel->setText("NTU_heat:");
    }
    if(int(tempUnit->idunit/10)==18)
    {
        qDebug()<<"LDDC adiabatic reg!";
        ui->UAButton->hide();
        ui->NTUButton->hide();
        ui->EFFButton->hide();
        ui->CATButton->hide();
        ui->HeatSpecifiedButton->hide();
        ui->LMTDButton->hide();
        ui->skipMethodButton->setText("Finite Difference Method");
        ui->skipMethodButton->setChecked(true);
        ui->PinchBox->hide();
        ui->DevBox->hide();
    }

    ui->mergeBox->setHidden(true);
    for(int i = 0; i < tempUnit->usp;i++)
    {
        if(tempUnit->myNodes[i]->isinside&&tempUnit->idunit!=103)
        {
            ui->mergeLabel->setText("Merge sp#"+QString::number(tempUnit->myNodes[i]->ndum)
                                 +" and sp#"+QString::number(tempUnit->myNodes[tempUnit->mergedOutPoint-1]->ndum)+" into one state point?");
            ui->mergeBox->setHidden(false);
            ui->mergeYesButton->setChecked(false);
            ui->mergeNoButton->setChecked(true);
            if(tempUnit->myNodes[i]->insideLinked||tempUnit->insideMerged)
            {
                ui->mergeYesButton->setChecked(true);
                ui->mergeNoButton->setChecked(false);
            }
        }
    }
    QRegExp regExp("[-.0-9]+$");
    QRegExpValidator *regExpValidator = new QRegExpValidator(regExp,this);
    ui->htLineEdit->setValidator(regExpValidator);
    ui->devgLineEdit->setValidator(regExpValidator);
    ui->devlLineEdit->setValidator(regExpValidator);
}
Example #7
0
KSSH::KSSH(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);

    QLayout *lay;
    lay = layout();
    if (lay)
        lay->setSizeConstraint(QLayout::SetFixedSize);

    opt = false;
    mopt = false;

    editorF->hide();

    QSize s = size();

    QPoint p(s.width(), s.height());
    QPoint po = pos();
    QDesktopWidget *d = QApplication::desktop();
    int w = d->width();                   // returns desktop width
    int h = d->height ();                  // returns desktop height
    int x = 0, y = 0;
    if ((p + po).x()>w)
        po.setX(x = w-p.x());
    if ((p + po).y()>h)
        po.setY(y = h-p.y());

    if (x<0)
        po.setX(0);
    if (y<0)
        po.setY(0);

    move(po);
    optionsGB->hide();
    moreF->hide();

    adjustSize();

    compUser = new KCompletion();
    userCB->setCompletionObject(compUser);

    compHost = new KCompletion();

    hostCB->setCompletionObject(compHost);

    hostCB->setFocus();

    connect(hostCB, SIGNAL(editTextChanged(const QString&)), this, SLOT(userFor(const QString&)));

    connect(compHost, SIGNAL(match(const QString&)), this, SLOT(userFor(const QString&)));

    userCB->insertItem(1, "");
    hostCB->insertItem(2, "");

    loadHosts();

    loadOptions("DefaultConfig");

    connect(aboutPB, SIGNAL(clicked()), this, SLOT(about()));
    connect(optionsPB, SIGNAL(clicked()), this, SLOT(options()));
    connect(morePB, SIGNAL(clicked()), this, SLOT(moreOptions()));

    connect(hostTB, SIGNAL(clicked()), this, SLOT(hostEditor()));
    connect(userTB, SIGNAL(clicked()), this, SLOT(userEditor()));
    connect(cancelPB, SIGNAL(clicked()), this, SLOT(cancelEditor()));
    connect(okPB, SIGNAL(clicked()), this, SLOT(okEditor()));

    connect(connectPB, SIGNAL(clicked()), this, SLOT(ssh()));
    connect(savePB, SIGNAL(clicked()), this, SLOT(saveAsDefault()));
    connect(quitPB, SIGNAL(clicked()), this, SLOT(exitHandler()));

    KConfigGroup general_group = KGlobal::config()->group("General");

    int fi = hostCB->findText(general_group.readEntry("LastHost"));
    if (fi)
        hostCB->setCurrentIndex(fi);

    int def = KGlobalSettings::completionMode();
    int mode = general_group.readEntry("HostCompletionMode", def);
    hostCB->setCompletionMode((KGlobalSettings::Completion) mode);

    mode = general_group.readEntry("UserCompletionMode", def);
    userCB->setCompletionMode((KGlobalSettings::Completion)mode);
    setWindowIcon(KIcon("kssh.png"));
}