Example #1
0
void TasksTab::OnBnClickedButtonEdit2()
{
	HTREEITEM hItem = m_Tree.GetSelectedItem();
	if( !hItem ) return;

	DWORD_PTR dw = m_Tree.GetItemData( hItem ); 
	Task* itemData = (Task*)dw;
	if( itemData != NULL ) {					
		UpdateData(TRUE);
		
		itemData->setName( m_NameValue );
		itemData->setDescription( m_DescriptionValue );
		itemData->setManhours( atoi( m_MHValue ) );
		itemData->clearStaff();
		for( int i=0; i < m_AssignList.GetCount(); i++ ) {
			DWORD_PTR dw = m_AssignList.GetItemData( i );
			if( dw != NULL ) {				
				Personnel* staff = (Personnel*)dw;
				itemData->addStaff( staff );				
			}
		}
		
		UpdateData( FALSE );
	}

	ReloadTaskTree();
}
Example #2
0
void TasksView::addTaskHelper( const Task& parent )
{
    ViewFilter* filter = Application::instance().model().taskModel();
    Task task;
    int suggestedId = parent.isValid() ? parent.id() : 1;
    if ( parent.isValid() ) {
        task.setParent( parent.id() );
        // subscribe if the parent is subscribed:
        task.setSubscribed( parent.subscribed()
                            || CONFIGURATION.taskPrefilteringMode == Configuration::TaskPrefilter_SubscribedOnly
                            || CONFIGURATION.taskPrefilteringMode == Configuration::TaskPrefilter_SubscribedAndCurrentOnly );
    }
    // yeah, daredevil!
    while ( filter->taskIdExists( suggestedId ) ) ++suggestedId;
    TaskIdDialog dialog( filter, this );
    dialog.setSuggestedId( suggestedId );
    if ( dialog.exec() ) {
        task.setId( dialog.selectedId() );
        task.setName( dialog.taskName() );
        CommandAddTask* cmd = new CommandAddTask( task, this );
        emit emitCommand( cmd );
        if ( parent.isValid() ) {
            const QModelIndex parentIdx = filter->indexForTaskId( parent.id() );
            m_treeView->setExpanded( parentIdx, true );
        }
    }
}
void SqLiteStorageTests::deleteTaskWithEventsTest()
{
    // make a task
    const int TaskId = 1;
    const QString Task1Name( "Task-Name" );
    Task task;
    task.setId( TaskId );
    task.setName( Task1Name );
    task.setValidFrom( QDateTime::currentDateTime() );
    QVERIFY( m_storage->deleteAllTasks() );
    QVERIFY( m_storage->deleteAllEvents() );
    QVERIFY( m_storage->getAllTasks().size() == 0 );
    QVERIFY( m_storage->addTask( task ) );
    QVERIFY( m_storage->getAllTasks().size() == 1 );
    Task task2;
    task2.setId( 2 );
    task2.setName( "Task-2-Name" );
    QVERIFY( m_storage->addTask( task2 ) );
    QVERIFY( m_storage->getAllTasks().size() == 2 );

    // create 3 events, 2 for task 1, and one for another one
    {
        Event event = m_storage->makeEvent();
        QVERIFY( event.isValid() );
        event.setTaskId( task.id() );
        event.setUserId( 1 );
        event.setReportId( 42 );
        const QString EventComment( "Event-Comment" );
        event.setComment( EventComment );
        QVERIFY( m_storage->modifyEvent( event ) );
    }
    {
        Event event = m_storage->makeEvent();
        QVERIFY( event.isValid() );
        event.setTaskId( task.id() );
        event.setUserId( 1 );
        event.setReportId( 43 );
        const QString EventComment( "Event-Comment 2" );
        event.setComment( EventComment );
        QVERIFY( m_storage->modifyEvent( event ) );
    }
    // this is the event that is supposed to remain in the DB:
    Event event = m_storage->makeEvent();
    QVERIFY( event.isValid() );
    event.setTaskId( task2.id() );
    event.setUserId( 1 );
    event.setReportId( 43 );
    const QString EventComment( "Event-Comment 2" );
    event.setComment( EventComment );
    QVERIFY( m_storage->modifyEvent( event ) );

    // verify task database entries
    QVERIFY( m_storage->deleteTask( task ) );
    EventList events = m_storage->getAllEvents();
    QVERIFY( events.count() == 1 );
    QVERIFY( events.first() == event );
}
Example #4
0
Task* createTask(int i, bool preemptable, float par)
{
  Task* j = new Task();

  // - set task's name
  stringstream jNameStr;
  jNameStr << "J_" << i;
  j->setName( jNameStr.str() );

  // - set preemptability
  j->setPr(preemptable);

  // - set task's arrival time
  j->setA(0);

  // - set task's deadline
  // Task period
  int tp = 1 + rand() % 10;

  //  Max # of repeating periods = maxR
  int maxR = L/tp; // floor of the division. not necessary due to dividing two ints. NOTE: we added the division by 2 in order to create tasks with greater freedom values (d-a-m). m:task length

   //  # of repeating periods = R
  int R = 1 + rand() % maxR;          //gives a number in [1,maxR]

  // Randomly deadline assigning
  if(L-tp*R == 0)
    j->setD( tp*R );
  else
    {
      int maxFreedom = 5; // max. possible freedom.
      int freedom = min( rand()%(L - tp*R), maxFreedom); 
      j->setD( freedom + tp*R ); //deadline = duration plus L-tp*R arasinda random bir sayi.
    }

  // - set task's load profile
  //  average power of sinosoid: aS
  float aS = 0.5 + rand01();
  float bS = (par-1)*aS;

  stringstream lNameStr;
  lNameStr << "L_" << i;
  Signal<double>* l = new Signal<double>(lNameStr.str(), tp*R, 0);

  for( int n=0; n<tp*R; n++)
    {
      // calculate value at n
      double val = aS + bS * sin (2 * M_PI * n / tp);
      l->setValueAt(n, val);
    }

  j->setL(l);

  return j;
}
Example #5
0
void QwwTaskPanel::insertTask(int index, QWidget * task, const QIcon & icon, const QString & label) {
    if (!task) return;
    Task *tsk = new Task(task);
    tsk->setToggleIcon(m_toggleIcon);
    if (label.isNull())
        tsk->setName(task->windowTitle());
    else {
        tsk->setName(label);
        task->setWindowTitle(label);
    }
    if (icon.isNull()) {
        tsk->setIcon(task->windowIcon());
    } else {
        tsk->setIcon(icon);
        task->setWindowIcon(icon);
    }
    static_cast<QBoxLayout*>(m_panel->layout())->insertWidget(index, tsk);
    m_tasks.insert(index, tsk);

    if (m_tasks.count()==1) {
        setCurrentIndex(0);
    }
     tsk->show();
}
Example #6
0
void TasksTab::OnBnClickedButtonNew()
{
	Task *newTask = new Task();
	newTask->setName( "Unnamed Task" );
	newTask->setDescription( "Unnamed Task Description" );

	HTREEITEM hItem = m_Tree.GetSelectedItem();
	if( !hItem ) {
		taskContainer->push_back( newTask );
	} else {
		DWORD_PTR dw = m_Tree.GetItemData( hItem ); //get item data
		Task* ItemData = (Task*)dw;
		if( ItemData != NULL ) {
			ItemData->addTask( newTask );
		}
	}	

	ReloadTaskTree();
}
Example #7
0
Task TaskEditor::getTask() const
{
    Task newTask = m_task;
    newTask.setName( m_ui->lineEditName->text() );
    newTask.setTrackable( m_ui->checkBoxTrackable->isChecked() );
    if( m_ui->checkBoxTopLevel->isChecked() ) {
        newTask.setParent( 0 );
    }
    if( m_ui->checkBoxFrom->isChecked() ) {
        newTask.setValidFrom( QDateTime() );
    } else {
        newTask.setValidFrom( m_ui->dateEditFrom->dateTime() );
    }
    if( m_ui->checkBoxUntil->isChecked() ) {
        newTask.setValidUntil( QDateTime() );
    } else {
        newTask.setValidUntil( m_ui->dateEditTo->dateTime() );
    }
    return newTask;
}
TaskList XmlSerializationTests::tasksToTest()
{
    // set up test candidates:
    TaskList tasks;
    Task task;
    task.setName( "A task" );
    task.setId( 42 );
    task.setParent( 4711 );
    task.setSubscribed( true );
    task.setValidFrom( QDateTime::currentDateTime() );
    Task task2;
    task2.setName( "Another task" );
    task2.setId( -1 );
    task2.setParent( 1000000000 );
    task2.setSubscribed( false );
    task2.setValidUntil( QDateTime::currentDateTime() );
    Task task3;

    tasks << Task() << task << task2;
    return tasks;
}
Example #9
0
Task Task::fromXml(const QDomElement& element, int databaseSchemaVersion)
{   // in case any task object creates trouble with
    // serialization/deserialization, add an object of it to
    // void XmlSerializationTests::testTaskSerialization()
    if ( element.tagName() != tagName() ) {
        throw XmlSerializationException( QObject::tr( "Task::fromXml: judging from the tag name, this is not a task tag") );
    }

    Task task;
    bool ok;
    task.setName(element.text());
    task.setId(element.attribute(TaskIdElement).toInt(&ok));
    if (!ok)
        throw XmlSerializationException( QObject::tr( "Task::fromXml: invalid task id") );
    task.setParent(element.attribute(TaskParentId).toInt(&ok));
    if (!ok)
        throw XmlSerializationException( QObject::tr( "Task::fromXml: invalid parent task id") );
    task.setSubscribed(element.attribute(TaskSubscribed).toInt(&ok) == 1);
    if (!ok)
        throw XmlSerializationException( QObject::tr( "Task::fromXml: invalid subscription setting") );
    if( databaseSchemaVersion > CHARM_DATABASE_VERSION_BEFORE_TASK_EXPIRY ) {
        if ( element.hasAttribute( TaskValidFrom ) ) {
            QDateTime start = QDateTime::fromString( element.attribute( TaskValidFrom ), Qt::ISODate );
            if ( !start.isValid() ) throw XmlSerializationException( QObject::tr( "Task::fromXml: invalid valid-from date" ) );
            task.setValidFrom( start );
        }
        if ( element.hasAttribute( TaskValidUntil ) ) {
            QDateTime end = QDateTime::fromString( element.attribute( TaskValidUntil ), Qt::ISODate );
            if ( !end.isValid() ) throw XmlSerializationException( QObject::tr( "Task::fromXml: invalid valid-until date" ) );
            task.setValidUntil( end );
        }
    }
    if ( databaseSchemaVersion > CHARM_DATABASE_VERSION_BEFORE_TRACKABLE ) {
        task.setTrackable(element.attribute(TaskTrackable, QLatin1String("1")).toInt(&ok) == 1);
        if (!ok)
            throw XmlSerializationException( QObject::tr( "Task::fromXml: invalid trackable settings") );
    }
    return task;
}
Example #10
0
void ProjectTester::startNotEarlier()
{
    Project project;
    project.setId( project.uniqueNodeId() );
    project.registerNodeId( &project );
    project.setConstraintStartTime( DateTime::fromString( "2011-01-01T00:00:00" ) );
    project.setConstraintEndTime( DateTime::fromString( "2011-01-12T00:00:00" ) );

    createCalendar( project );

    ResourceGroup *g = createWorkResources( project, 1 );

    Task *t = project.createTask();
    t->setName( "T1" );
    project.addTask( t, &project );
    t->estimate()->setUnit( Duration::Unit_h );
    t->estimate()->setExpectedEstimate( 1.0 );
    t->estimate()->setType( Estimate::Type_Effort );
    createRequest( t, g->resourceAt( 0 ) );

    t->setConstraint( Node::StartNotEarlier );
    t->setConstraintStartTime( DateTime::fromString( "2011-01-02T11:00:00" ) );

    ScheduleManager *sm = project.createScheduleManager( "Test Plan" );
    project.addScheduleManager( sm );

    QString s = "Calculate forward, Task: StartNotEarlier ------------------------------";
    qDebug()<<s;
    Debug::print( t, s );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( project, sm, true/*nothread*/ );
    }

    Debug::print( &project, s );
    Debug::print( t, s );

    QVERIFY( t->startTime() >= t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 1, 0 ) );

    s = "Calculate forward, 2 Tasks ------------------------------";
    qDebug()<<s;

    Task *t2 = project.createTask();
    t2->setName( "T2" );
    project.addTask( t2, &project );
    t2->estimate()->setUnit( Duration::Unit_d );
    t2->estimate()->setExpectedEstimate( 7.0 );
    t2->estimate()->setType( Estimate::Type_Effort );

    createRequest( t2, g->resourceAt( 0 ) );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( project, sm, true/*nothread*/ );
    }

    Debug::print( &project, s );
    Debug::print( t, s );
    Debug::print( t2, s );

    QVERIFY( t->startTime() >= t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 1, 0 ) );

    s = "Calculate backward, 2 Tasks ------------------------------";
    qDebug()<<s;

    sm->setSchedulingDirection( true );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( project, sm, true/*nothread*/ );
    }

    Debug::print( &project, s );
    Debug::print( t, s );
    Debug::print( t2, s );
    Debug::printSchedulingLog( *sm, s );
    
    QVERIFY( t->startTime() >= t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 1, 0 ) );
}
Example #11
0
void ProjectTester::oneTask()
{
    QDate today = QDate::fromString( "2012-02-01", Qt::ISODate );
    QDate tomorrow = today.addDays( 1 );
    QDate yesterday = today.addDays( -1 );
    QTime t1( 9, 0, 0 );
    QTime t2 ( 17, 0, 0 );
    int length = t1.msecsTo( t2 );

    Task *t = m_project->createTask();
    t->setName( "T1" );
    m_project->addTask( t, m_project );
    t->estimate()->setUnit( Duration::Unit_d );
    t->estimate()->setExpectedEstimate( 1.0 );
    t->estimate()->setType( Estimate::Type_Duration );

    ScheduleManager *sm = m_project->createScheduleManager( "Test Plan" );
    m_project->addScheduleManager( sm );
    

    QString s = "Calculate forward, Task: Fixed duration ------------------------------";
    qDebug()<<s;

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }
    Debug::printSchedulingLog( *sm, s );
    Debug::print( m_project, s );
    Debug::print( t, s );

    QCOMPARE( t->startTime(), m_project->startTime() );
    QCOMPARE( t->endTime(), DateTime(t->startTime().addDays( 1 )) );

    s = "Calculate forward, Task: Length --------------------------------------";
    qDebug()<<s;

    t->estimate()->setCalendar( m_calendar );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( m_calendar, s );
    Debug::print( m_project, s, true );

    QCOMPARE( t->startTime(), m_calendar->firstAvailableAfter( m_project->startTime(), m_project->endTime() ) );
    QCOMPARE( t->endTime(), DateTime( t->startTime().addMSecs( length ) ) );

    s = "Calculate forward, Task: Effort --------------------------------------";
    qDebug()<<s;

    ResourceGroup *g = new ResourceGroup();
    m_project->addResourceGroup( g );
    Resource *r = new Resource();
    r->setAvailableFrom( QDateTime( yesterday, QTime(), Qt::LocalTime ) );
    r->setCalendar( m_calendar );
    m_project->addResource( g, r );

    ResourceGroupRequest *gr = new ResourceGroupRequest( g );
    t->addRequest( gr );
    ResourceRequest *rr = new ResourceRequest( r, 100 );
    gr->addResourceRequest( rr );
    t->estimate()->setType( Estimate::Type_Effort );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( t, s );

    QCOMPARE( t->startTime(), m_calendar->firstAvailableAfter( m_project->startTime(), m_project->endTime() ) );
    QCOMPARE( t->endTime(), DateTime( t->startTime().addMSecs( length ) ) );


    s = "Calculate forward, Task: MustStartOn --------------------------------------";
    qDebug()<<s;

    t->setConstraint( Node::MustStartOn );
    t->setConstraintStartTime( DateTime( tomorrow, t1 ) );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( t, s );

    QCOMPARE( t->startTime(), t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 8, 0 ) );

    s = "Calculate backward, Task: MustStartOn --------------------------------------";
    qDebug()<<s;

    sm->setSchedulingDirection( true );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( t, s );
    Debug::printSchedulingLog( *sm, s );

    QCOMPARE( t->startTime(), t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 8, 0 ) );

    s = "Calculate backward, Task: StartNotEarlier --------------------------------------";
    qDebug()<<s;

    t->setConstraint( Node::StartNotEarlier );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( t, s );

    QCOMPARE( t->startTime(), t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 8, 0 ) );

    s = "Calculate forward, Task: StartNotEarlier --------------------------------------";
    qDebug()<<s;

    sm->setSchedulingDirection( false );
    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( t, s );

    QCOMPARE( t->startTime(), t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 8, 0 ) );

    s = "Calculate forward, Task: MustFinishOn --------------------------------------";
    qDebug()<<s;

    t->setConstraint( Node::MustFinishOn );
    t->setConstraintEndTime( DateTime( tomorrow, t2 ) );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( t, s );

    QCOMPARE( t->endTime(), t->constraintEndTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 8, 0 ) );

    s = "Calculate backward, Task: MustFinishOn --------------------------------------";
    qDebug()<<s;

    sm->setSchedulingDirection( true );
    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( t, s );

    QCOMPARE( t->endTime(), t->constraintEndTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 8, 0 ) );

    s = "Calculate backward, Task: FinishNotLater --------------------------------------";
    qDebug()<<s;

    t->setConstraint( Node::FinishNotLater );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( t, s );

    QCOMPARE( t->endTime(), t->constraintEndTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 8, 0 ) );

    s = "Calculate forward, Task: FinishNotLater --------------------------------------";
    qDebug()<<s;

    sm->setSchedulingDirection( false );
    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( m_project, s, true );

    QVERIFY( t->endTime() <= t->constraintEndTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 8, 0 ) );

    s = "Calculate forward, Task: FixedInterval --------------------------------------";
    qDebug()<<s;

    t->setConstraint( Node ::FixedInterval );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( t, s );

    QCOMPARE( t->startTime(), t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->constraintEndTime() );

    s = "Calculate backward, Task: FixedInterval --------------------------------------";
    qDebug()<<s;

    sm->setSchedulingDirection( true );
    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( *m_project, sm, true/*nothread*/ );
    }

    Debug::print( t, s );

    QCOMPARE( t->startTime(), t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->constraintEndTime() );

}
void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    {
        Task task;
        task.setName(index.data(Task::NameRole).toString());
        task.setDescription(index.data(Task::DescriptionRole).toString());
        task.setPriority(index.data(Task::PriorityRole).toInt());
        task.setDeadlineTime(index.data(Task::DeadlineRole).toDateTime());
        task.setCompleted(index.data(Task::CompleteStatusRole).toBool());
        task.setPrivate(index.data(Task::PrivateRole).toBool());
        task.setCreateDate(index.data(Task::CreatedRole).toDate());
        task.setRepeatType((Task::RepeatType)index.data(Task::RepeatRole).toInt());

        QImage priorityImage(task.priorityIcon());




        QColor taskTextColor;
        if (option.state & QStyle::State_Selected)
        {
            if (task.deadlineTime()<QDateTime::currentDateTime() && task.deadlineTime().isValid() && !task.completed())
            {
                QColor bgColor(255,65,204);
                QBrush brush(bgColor);



                painter->fillRect(option.rect, brush);

            } else
            QStyledItemDelegate::paint(painter, option, index);
        } else if (task.deadlineTime()<QDateTime::currentDateTime() && task.deadlineTime().isValid() && !task.completed())
        {
            QColor bgColor(255,91,91);
            QBrush brush(bgColor);

            painter->fillRect(option.rect, brush);
        }

        else {
            QBrush brush = (index.row()%2)?option.palette.base():option.palette.alternateBase();
            taskTextColor.setRgb(255-brush.color().red(),
                                 255-brush.color().green(),
                                 255-brush.color().blue());

            painter->fillRect(option.rect, brush);
            }
            painter->save();
            QFont taskFont = getTaskFont(option);
            QFont descriptionFont = getDescriptionFont(option);
            QFont dateFont = getDateFont(option);
            QFont timeFont = getTimeFont(option);

            QFontMetrics fmTaskFont(taskFont);
            QFontMetrics fmDescriptionFont(descriptionFont);
            QFontMetrics fmDateFont(dateFont);
            int dateWidth=fmDateFont.width(task.deadlineTime().date().toString(Qt::SystemLocaleShortDate));

            painter->setPen(Qt::black);

            painter->setFont(taskFont);
            QRect nameRect=option.rect.adjusted(priorityImage.width(),4, -dateWidth-10,0);
            painter->drawText(nameRect,Qt::AlignHCenter, fmTaskFont.elidedText(task.name(),Qt::ElideRight,nameRect.width()-70,0));


            QRect descriptionRect=option.rect.adjusted(priorityImage.width(),30,-dateWidth-10,0);
            painter->setFont(descriptionFont);

            painter->drawText(descriptionRect,Qt::AlignHCenter,
                              fmDescriptionFont.elidedText(task.description().replace("\n"," "),Qt::ElideRight,descriptionRect.width()));


            painter->drawImage(option.rect.adjusted(0,3,-(option.rect.width()-priorityImage.width()),-(option.rect.height()-priorityImage.height())),priorityImage);
            if (task.completed()%2==1)
            {
                QImage completeImage=QImage(":/icons/task-complete");
                painter->drawImage(option.rect.adjusted(10,10,-(option.rect.width()-priorityImage.width()+10),-(option.rect.height()-priorityImage.height())-10),completeImage);
            }
            if ((int)task.repeatType()>0)
            {
                QImage completeImage=QImage(":/icons/clock");
                painter->drawImage(option.rect.adjusted(priorityImage.width(),5,-(option.rect.width()-completeImage.width()),-(option.rect.height()-completeImage.height())),completeImage);
            }

            painter->setFont(dateFont);

            painter->drawText(option.rect.adjusted((option.rect.width()-dateWidth-10),8,0,0),Qt::AlignHCenter,task.deadlineTime().date().toString(Qt::SystemLocaleShortDate));

            painter->setFont(timeFont);
            painter->drawText(option.rect.adjusted((option.rect.width()-dateWidth-10),20,0,0),Qt::AlignHCenter,task.deadlineTime().time().toString(Qt::SystemLocaleShortDate));

            if (task.isPrivate() && !task.completed())
            {
                QImage privateImage(":/icons/private");
                painter->drawImage(option.rect.adjusted(10,10,-(option.rect.width()-priorityImage.width()+10),-(option.rect.height()-priorityImage.height())-10),privateImage);
            }
            painter->restore();

        }
}