Example #1
0
EnterVacationDialog::EnterVacationDialog( QWidget* parent )
    : QDialog( parent )
    , m_ui( new Ui::EnterVacationDialog )
    , m_selectedTaskId( -1 )
{
    setWindowTitle( tr( "Enter Vacation" ) );

    m_ui->setupUi( this );
    m_ui->startDate->calendarWidget()->setFirstDayOfWeek( Qt::Monday );
    m_ui->startDate->calendarWidget()->setVerticalHeaderFormat( QCalendarWidget::ISOWeekNumbers );
    m_ui->endDate->calendarWidget()->setFirstDayOfWeek( Qt::Monday );
    m_ui->endDate->calendarWidget()->setVerticalHeaderFormat( QCalendarWidget::ISOWeekNumbers );
    //set next week as default range
    const QDate referenceDate = QDate::currentDate().addDays( 7 );
    m_ui->startDate->setDate( Charm::weekDayInWeekOf( Qt::Monday, referenceDate ) );
    m_ui->endDate->setDate( Charm::weekDayInWeekOf( Qt::Friday, referenceDate ) );
    connect( m_ui->startDate, SIGNAL(dateChanged(QDate)), this, SLOT(updateButtonStates()) );
    connect( m_ui->endDate, SIGNAL(dateChanged(QDate)), this, SLOT(updateButtonStates()) );
    connect( m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(okClicked()) );
    connect( m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()) );
    connect( m_ui->selectTaskButton, SIGNAL(clicked()), this, SLOT(selectTask()) );
    QSettings settings;
    settings.beginGroup( QLatin1String("EnterVacation") );
    m_ui->hoursSpinBox->setValue( settings.value( QLatin1String("workHours"), 8 ).toInt() );
    m_ui->minutesSpinBox->setValue( settings.value( QLatin1String("workMinutes"), 0 ).toInt() );
    m_selectedTaskId = settings.value( QLatin1String("selectedTaskId"), -1 ).toInt();
    //reset stored ID if task does not exist anymore:
    if ( !DATAMODEL->taskExists( m_selectedTaskId ) )
        m_selectedTaskId = -1;
    updateButtonStates();
    updateTaskLabel();
}
Example #2
0
void ActivityReportConfigurationDialog::slotExcludeTask()
{
    if ( selectTask( m_rootExcludeTask ) ) {
        const TaskTreeItem& item = DATAMODEL->taskTreeItem( m_rootExcludeTask );
        m_ui->labelExcludeTaskName->setText( DATAMODEL->fullTaskName( item.task() ) );
    } else {
        if ( m_rootExcludeTask == 0 )
            m_ui->checkBoxExcludeTasks->setChecked( false );
    }
}
bool doubleTouchThread::detectContact(skinContactList *_sCL)
{
    // Reset variables:
    cntctPosLink.resize(3,0.0);
    cntctPosWRF.resize(3,0.0);
    cntctNormDir.resize(3,0.0);
    cntctPressure = -1;
    cntctLinkNum  = -1;
    cntctSkinPart = SKIN_PART_UNKNOWN;

    // Search for a suitable contact:
    for(skinContactList::iterator it=_sCL->begin(); it!=_sCL->end(); it++)
    {
        printMessage(3,"skinContact: %s\n",it->toString(3).c_str());
        if( it -> getPressure() > 25 &&
            norm(it-> getNormalDir()) != 0.0)
        {
            for (size_t i = 0; i < skinParts.size(); i++)
            {
                if (skinParts[i] == it -> getSkinPart())
                {
                    cntctSkin     = *it;                    // Store the skinContact for eventual future use
                    cntctPosLink  = it -> getCoP();         // Get the position of the contact;
                    cntctLinkNum  = it -> getLinkNumber();  // Retrieve the link number of the contact;
                    cntctNormDir  = it -> getNormalDir();   // Normal direction of the contact
                    cntctPressure = it -> getPressure();    // Retrieve the pressure of the contact

                    cntctSkinPart = it -> getSkinPart();

                    if (selectTask())
                    {
                        cntctPosWRF = locateContact();
                        cntctH0     = findH0(cntctSkin);
                        return true;
                    }
                }
            }
        }
    }

    return false;
}