Back to index

fet  5.18.0
Public Slots | Public Member Functions | Public Attributes
SecondMinDaysDialog Class Reference

#include <addactivityform.h>

List of all members.

Public Slots

void yesPressed ()

Public Member Functions

 SecondMinDaysDialog (QWidget *p, int minD, double weight)
 ~SecondMinDaysDialog ()

Public Attributes

double weight
QLineEdit * percText

Detailed Description

Definition at line 77 of file addactivityform.h.


Constructor & Destructor Documentation

SecondMinDaysDialog::SecondMinDaysDialog ( QWidget *  p,
int  minD,
double  weight 
)

Definition at line 433 of file addactivityform.cpp.

                                                                       :QDialog(p)
{
       weight=-1;

       QString l=tr
        ("You selected min days between activities %1 (above 1) and weight %2 (under 100.0). "
         "Would you like to add also a second constraint to ensure that almost certainly the "
         "distance between activities is at least %3 (%1-1) days? If yes, please select weight (recommended "
         "95.0%-100.0%) and click Yes. If no, please click No (only one constraint will be added)").arg(CustomFETString::number(minD)).arg(w).arg(minD-1);
       l+="\n\n";
       l+=tr("(Yes means to add an additional constraint min %1 days between activities, weight 0.0%-100.0%. "
         "If you say Yes, you will have 2 constraints min days added for current activities. "
         "Adding the second constraint might lead to impossible timetables if the condition is "
         "too tight, but you can remove the second constraint at any time).").arg(minD-1);
       l+="\n\n";
       l+=tr("Note: 95% is usually enough for min days constraints referring to same activities. "
         "The weights are cumulated if referring to the same activities. If you have 2 constraints with say 95%"
         " (say min n days and min n-1 days), "
         "the min n days constraint is skipped with probability 5%, then min n-1 days constraint is skipped with "
         "probability 0.25%=5%*5%, so you'll get in 99.75% cases the min n-1 days constraint respected.");
       l+="\n\n";
       l+=tr("Recommended answer is Yes, 95% (or higher).");

       setWindowTitle(tr("Add a second constraint or not?"));
                            
       QVBoxLayout* vl=new QVBoxLayout(this);
       
       QPlainTextEdit* la=new QPlainTextEdit();
       la->setPlainText(l);
       la->setReadOnly(true);

       vl->addWidget(la);
                            
       QPushButton* yes=new QPushButton(tr("Yes"));
       yes->setDefault(true);
       
       QPushButton* no=new QPushButton(tr("No"));

       QLabel* percLabel=new QLabel(this);
       percLabel->setText("Percentage");
       percText=new QLineEdit(this);
       percText->setText("95.0");
       
       //QHBoxLayout* hl2=new QHBoxLayout(vl);
       QHBoxLayout* hl2=new QHBoxLayout();
       vl->addLayout(hl2);
       
       QLabel* minDaysLabel=new QLabel(this);
       minDaysLabel->setText("Min days");
       QSpinBox* minDaysSpinBox=new QSpinBox(this);
       minDaysSpinBox->setMinimum(minD-1);
       minDaysSpinBox->setMaximum(minD-1);
       minDaysSpinBox->setValue(minD-1);
       minDaysSpinBox->setEnabled(false);

       hl2->addStretch(1);
       hl2->addWidget(minDaysLabel);
       hl2->addWidget(minDaysSpinBox);
       
       hl2->addStretch(1);
       hl2->addWidget(percLabel);
       hl2->addWidget(percText);
       
       //QHBoxLayout* hl=new QHBoxLayout(vl);
       QHBoxLayout* hl=new QHBoxLayout();
       vl->addLayout(hl);
       
       hl->addStretch(1);
       hl->addWidget(yes);
       hl->addWidget(no);
       
       connect(yes, SIGNAL(clicked()), this, SLOT(yesPressed()));
       connect(no, SIGNAL(clicked()), this, SLOT(reject()));
       
       int ww=this->sizeHint().width();
       if(ww>1000)
              ww=1000;
       if(ww<590)
              ww=590;

       int hh=this->sizeHint().height();
       if(hh>650)
              hh=650;
       if(hh<380)
              hh=380;
       
       this->resize(ww, hh);
       centerWidgetOnScreen(this);
       restoreFETDialogGeometry(this);
}

Here is the call graph for this function:

Definition at line 528 of file addactivityform.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 533 of file addactivityform.cpp.

{
       double wt;
       QString tmp=percText->text();
       weight_sscanf(tmp, "%lf", &wt);
       if(wt<0.0 || wt>100.0){
              QMessageBox::warning(this, tr("FET information"),
                     tr("Invalid weight (percentage) - must be >=0 and <=100.0"));
              return;
       }
       weight=wt;
       accept();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 85 of file addactivityform.h.

Definition at line 84 of file addactivityform.h.


The documentation for this class was generated from the following files: