コード例 #1
0
ファイル: progressview.cpp プロジェクト: Daylie/Totem
void ProgressView::removeOneOldTask()
{
    for (QList<FutureProgress *>::iterator i = m_taskList.begin();
         i != m_taskList.end(); ++i)
    {
        if ((*i)->future().isFinished())
        {
            deleteTask(*i);//从view中删除就可以了
            i = m_taskList.erase(i);
            return;
        }
    }
    for (QList<FutureProgress *>::iterator i = m_taskList.begin();
         i != m_taskList.end(); ++i)
    {
        QString type = (*i)->type();

        int taskCount = 0;
        foreach (FutureProgress *p, m_taskList)
            if (p->type() == type)
                ++taskCount;

        if (taskCount > 1 && (*i)->future().isFinished())
        {
            deleteTask(*i);
            i = m_taskList.erase(i);
            return;
        }
    }

    FutureProgress *task = m_taskList.takeFirst();
    deleteTask(task);
}
コード例 #2
0
ファイル: busymode.cpp プロジェクト: stefanbeeman/end-of-days
int BusyMode_RunNewTaskWithName(int mode, busyworkerfunc_t worker, void* workerData, const char* taskName)
{
    BusyTask* task = newTask(mode, worker, workerData, taskName);
    int result = BusyMode_RunTask(task);
    deleteTask(task);
    return result;
}
コード例 #3
0
ファイル: main.c プロジェクト: orls/Tigger
int processCommand(char *args[], int optind){
	if(args[optind] != NULL){
		if(!strcmp(args[optind], "init")){
			if (COLOR_FLAG)
                                fprintf_blue(stdout, "Initializing Tigger in the current directory.\n");
                        else
                                printf("Initializing Tigger in the current directory.\n");
			return initialize(args, optind+1);
		}else if(!strcmp(args[optind], "new")){
			return addTask(args, optind+1);
		}else if(!strcmp(args[optind], "tasks")){
			return listTasks();
		}else if(!strcmp(args[optind], "tig")){
			printf("%s",tigger);
			return 1;
		}else if(!strcmp(args[optind], "completed")){
			return completedTasks();
		}else if(!strcmp(args[optind], "delete")){
			return deleteTask(args[optind+1]);
		}else if(!strcmp(args[optind], "today")){
			tiggerToday();   
			return 1;
		}
	}
	return 0;
}
コード例 #4
0
ファイル: main.c プロジェクト: arunkumarv31/rtos
void function_4 ( void )
{
  
  while (1)
  {   
	  changePriority ( "fun_one", 2 );
	  changePriority ( "fun_two", 3 );
	  changePriority ( "fun_three", 4 );
	  changePriority ( "fun_four", 5 );
	//  deleteTask  ( "fun_one" );
	//  deleteTask  ( "fun_two" );
	  deleteTask  ( "fun_three" );
	  deleteTask   ( "fun_four" );
      printf ( "fun_ffffffoooouuurrrr\n" );
      
  }
}
コード例 #5
0
ファイル: summarytree.cpp プロジェクト: DapperX/project-lemon
SummaryTree::SummaryTree(QWidget *parent) :
    QTreeWidget(parent)
{
    curContest = 0;
    addCount = 0;
    
    addTaskAction = new QAction(tr("Add a New Task"), this);
    addTestCaseAction = new QAction(tr("Add a Test Case"), this);
    addTestCasesAction = new QAction(tr("Add Test Cases ..."), this);
    deleteTaskAction = new QAction(tr("Delete Current Task"), this);
    deleteTestCaseAction = new QAction(tr("Delete Current Test Case"), this);
    deleteTaskKeyAction = new QAction(this);
    deleteTestCaseKeyAction = new QAction(this);
    
    deleteTaskKeyAction->setShortcutContext(Qt::WidgetShortcut);
    deleteTestCaseKeyAction->setShortcutContext(Qt::WidgetShortcut);
    deleteTaskKeyAction->setShortcut(QKeySequence::Delete);
    deleteTestCaseKeyAction->setShortcut(QKeySequence::Delete);
    deleteTaskKeyAction->setEnabled(false);
    deleteTestCaseKeyAction->setEnabled(false);
    addAction(deleteTaskKeyAction);
    addAction(deleteTestCaseKeyAction);
    
    connect(addTaskAction, SIGNAL(triggered()),
            this, SLOT(addTask()));
    connect(addTestCaseAction, SIGNAL(triggered()),
            this, SLOT(addTestCase()));
    connect(addTestCasesAction, SIGNAL(triggered()),
            this, SLOT(addTestCases()));
    connect(deleteTaskAction, SIGNAL(triggered()),
            this, SLOT(deleteTask()));
    connect(deleteTestCaseAction, SIGNAL(triggered()),
            this, SLOT(deleteTestCase()));
    connect(deleteTaskKeyAction, SIGNAL(triggered()),
            this, SLOT(deleteTask()));
    connect(deleteTestCaseKeyAction, SIGNAL(triggered()),
            this, SLOT(deleteTestCase()));
    connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
            this, SLOT(selectionChanged()));
    connect(this, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
            this, SLOT(itemChanged(QTreeWidgetItem*)));
}
コード例 #6
0
static bool handleDeleteTask(int size, const byte *msg, CONTEXT *context)
    {
    byte *expr = (byte *) &msg[1];
    byte id = evalWord8Expr(&expr, context);
    TASK *task;

    if ((task = findTask(id)) != NULL)
        {
        deleteTask(task);
        }
    return false;
    }
コード例 #7
0
void MainWindow::on_deleteButton_clicked()
{
    QListWidget *list = ui->taskList;
    for (QListWidgetItem *item : list->selectedItems())
    {
        bool hasId = false;
        int id = item->data(Qt::UserRole).toInt(&hasId);
        if (hasId)
        {
            deleteTask(id);
        }
        list->takeItem(list->row(item));
        delete item;
    }
}
コード例 #8
0
ファイル: TaskWidget.cpp プロジェクト: vincepii/Tasks
TaskWidget::TaskWidget(std::string id, std::string content, QWidget *parent)
    : QWidget(parent)
{
    ui.setupUi(this);

    id_ = id;
    content_ = content;

    // make the connections
    connect(ui.synchToolButton, SIGNAL(clicked()), this, SLOT(synchronizeTask()));
    connect(ui.deleteToolButton, SIGNAL(clicked()), this, SLOT(deleteTask()));
    connect(ui.taskLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(markContentChanged(const QString&)));
    connect(ui.taskLineEdit, SIGNAL(editingFinished()), this, SLOT(contentEditFinished()));

}
コード例 #9
0
ファイル: CSoftManager.cpp プロジェクト: ray-x/SMonitor
//下载发生错误,需要进行重试,重试三次,间隔时间分别是30s、60s、120s
void CSoftManager::downloadErrorOccer(const QString&key, const QString& msg)
{
	emit downloadErrorOccured(key, msg);
	{
		QMutexLocker locker(&m_TaskListMutex);
		//首先清除之前的下载对象
		if(m_pDownloadTaskList.contains(key))
		{
			delete m_pDownloadTaskList.value(key);
			m_pDownloadTaskList.remove(key);
		}
	}
	
	//首次下载重启时间为间隔30s
	int interval = 30;
	QMutexLocker locker(&m_reStartListMutex);
	if(m_reStartTask.contains(key))
		interval = m_reStartTask.value(key).second * 2;

	if(interval < 240)
	{//次数未达到3次
		int id = startTimer(interval * 1000);

		if(!m_reStartTask.contains(key))
			m_reStartTask.insert(key, qMakePair(id, interval));
		else
			m_reStartTask[key] = qMakePair(id, interval);

		qDebug() << QString::fromLocal8Bit("下载失败,下载任务将在%1秒之后重启").arg(interval);
		emit redownloadCountdown(0, key, interval);
	}
	else
	{//次数达到三次,直接删除任务,不再自动重试
		m_reStartTask.remove(key);

		int nState = -1;
		{
			QMutexLocker locker(&m_SrcListMutex);
			if(m_pSrcTask.contains(key))
				nState = m_pSrcTask.value(key).state;
		}

		deleteTask(key, false);
		
		//提交重试下载失败信号
		emit redownloadErrorOccered(key, nState);
	}
}
コード例 #10
0
CTaskManage1::CTaskManage1(QWidget *parent)
	: QDialog(parent)
{
	setupUi(this);
	connect(pbNewTask, SIGNAL(clicked()),this, SLOT(addTask()));
	//connect(pbNewXaclTask,SIGNAL(clicked()),this, SLOT(addXaclTask()));
	connect(pbDeleteTask, SIGNAL(clicked()),this, SLOT(deleteTask()));
	connect(pbQueryTask, SIGNAL(clicked()),this, SLOT(queryTask()));

	model=new QSqlTableModel(this);
	model->setTable("taskinfo");
	model->select();
	tvTask->setItemDelegate(new CTaskDelegate(0));
	tvTask->setModel(model);
	tvTask->setColumnWidth(1,130);
}
コード例 #11
0
static bool handleReset(int size, const byte *msg, CONTEXT *context)
    {
    while(firstTask != NULL)
        {
        deleteTask(firstTask);
        }
    runningTask = NULL;
    // Clear any stored task in EEPROM
    if (EEPROM[ 0 ] == 'H')
        {
        EEPROM[ 0 ] = 0;
        EEPROM[ 1 ] = 0;
        EEPROM[ 2 ] = 0;
        EEPROM[ 3 ] = 0;
        }
    return false;
    }
コード例 #12
0
ファイル: gsmModem.c プロジェクト: WarrenDGreenway/pygmyos
u8 handler_ATAT( u8 *ucBuffer )
{
    u8 *ucSubString;
    
    ucSubString = getNextSubString( ucBuffer, WHITESPACE|PUNCT );
    if( ucSubString ){
        if( isStringSame( ucSubString, (u8*)AT_OK ) ||
            isStringSame( ucSubString, (u8*)AT_ERROR ) || 
            isStringSame( ucSubString, (u8*)AT_MWI ) ){
            print( MODEM_COM, "\rRadio On\r" );
            deleteTask( "AT", 0 );
        
            return( TRUE );
        } // if
    } // if
    
    return( FALSE );
}
コード例 #13
0
ファイル: CharmConstants.cpp プロジェクト: KDAB/Charm
void connectControllerAndModel( Controller* controller, CharmDataModel* model )
{
    QObject::connect( controller, SIGNAL(eventAdded(Event)),
                      model, SLOT(addEvent(Event)) );
    QObject::connect( controller, SIGNAL(eventModified(Event)),
                      model, SLOT(modifyEvent(Event)) );
    QObject::connect( controller, SIGNAL(eventDeleted(Event)),
                      model, SLOT(deleteEvent(Event)) );
    QObject::connect( controller, SIGNAL(allEvents(EventList)),
                      model, SLOT(setAllEvents(EventList)) );
    QObject::connect( controller, SIGNAL(definedTasks(TaskList)),
                      model, SLOT(setAllTasks(TaskList)) );
    QObject::connect( controller, SIGNAL(taskAdded(Task)),
                      model, SLOT(addTask(Task)) );
    QObject::connect( controller, SIGNAL(taskUpdated(Task)),
                      model, SLOT(modifyTask(Task)) );
    QObject::connect( controller, SIGNAL(taskDeleted(Task)),
                      model, SLOT(deleteTask(Task)) );
}
コード例 #14
0
ファイル: progressview.cpp プロジェクト: Daylie/Totem
void ProgressView::removeOldTasks(const QString &type, bool keepOne)
{
    //当希望保留一个时,firstFound为false就可以了。
    bool firstFound = !keepOne;
    QList<FutureProgress *>::iterator i = m_taskList.end();
    while (i != m_taskList.begin())
    {
        --i;
        if ((*i)->type() == type)
        {
            if (firstFound && ((*i)->future().isFinished() || (*i)->future().isCanceled()))
            {
                deleteTask(*i);
                i = m_taskList.erase(i);
            }
            firstFound = true;
        }
    }
}
コード例 #15
0
ファイル: test_lookup.c プロジェクト: kalloc/tester
void timerDNSTask(int fd, short action, void *arg) {

    struct Task *task = arg;
    struct DNSTask *dnstask = (struct DNSTask *) task->poll;

    /*
        if (task->LObjId == 1151) raise(SIGTRAP);
     */

    if (task->isEnd) {
        evtimer_del(&task->time_ev);
        deleteTask(task);
        return;
    }
    setNextTimer(task);
    debug("LobjId:%d, Role %s, Hostname %s", task->LObjId, getRoleText(dnstask->role), task->Record.HostName);
    if (task->resolv and task->resolv->NSIP) {
        makeDNSTask(dnstask);
    }

}
コード例 #16
0
ファイル: main.c プロジェクト: glocklueng/stm32f100rb-gy521
int main(){
	u8 res;
	initRCC();
	initGPIO();
	initTIM2();
	initUSART3();
	initI2C1();

	__enable_irq();                       // глобальное включение прерывания

	// I2C1_tx(0xD0,0x6B,0x00);
	// I2C1_tx(0xD0,0x1B,0xE0);
	// I2C1_tx(0xD0,0x1C,0xE0);
	read_I2C1(GY521_ADRESS,WHO_I_AM);
	// read_data_acc();
	green_on();
	while(1){
	    while(!number_of_tasks)
	        {}
	    (*buffer_of_tasks[head_of_tasks])();
	    deleteTask();
	    }
	return 0;
}
コード例 #17
0
ファイル: mainwindow.cpp プロジェクト: woronin/kumir2
 void MainWindowTask::setup()
 {
     ui->setupUi(this);
     ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);
     settings = new QSettings("NIISI RAS","Kumir 1.9");
     setWindowIcon(QIcon(":/taskEdit.ico"));
     settings->setIniCodec("UTF-8");
     lastFiles=settings->value("RescentFiles").toStringList();
     customMenu.hide();
     connect(ui->loadCurs,SIGNAL(activated()),this,SLOT(loadCourse()));
     connect(ui->actionSave,SIGNAL(activated()),this,SLOT(saveCourse()));
     connect(ui->treeView,SIGNAL(clicked(QModelIndex)),this,SLOT(showText(QModelIndex)));
     connect(ui->treeView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(startEdit(QModelIndex)));
    //   connect(ui->do_task,SIGNAL(triggered()),this,SLOT(startTask()));
       qDebug()<<"Check Connect tttttttttttttttttt";
       //connect(ui->checkTask,SIGNAL(triggered()),this,SLOT(checkTask()));
      //connect(ui->actionReset,SIGNAL(triggered()),this,SLOT(resetTask()));
        connect(ui->actionClose,SIGNAL(triggered()),this,SLOT(Close()));
        //   connect(ui->actionTested,SIGNAL(triggered()),this,SLOT(returnTested()));
           connect(ui->treeView,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(customContextMenuRequested(QPoint)));

           customMenu.addAction(ui->actionAdd);
           customMenu.addAction(ui->actionRemove);
           customMenu.addAction(ui->actionEdit);
           customMenu.addAction(ui->addDeep);
       customMenu.addSeparator();
       customMenu.addAction(ui->actionup);
       customMenu.addAction(ui->actionDown);
       customMenu.addAction(ui->actionMakeSection);
       customMenu.addMenu(ui->menuMove);
        connect(ui->zadRb,SIGNAL(clicked(bool)),this,SLOT(setType()));
        connect(ui->nodeRb,SIGNAL(clicked(bool)),this,SLOT(setType()));




       connect(ui->actionup,SIGNAL(triggered()),this,SLOT(moveUp()));
       connect(ui->actionDown,SIGNAL(triggered()),this,SLOT(moveDown()));
           connect(ui->actionAdd,SIGNAL(triggered()),this,SLOT(addTask()));
            connect(ui->addDeep,SIGNAL(triggered()),this,SLOT(addDeepTask()));
           connect(ui->actionSaveK,SIGNAL(triggered()),this,SLOT(saveKurs()));
            connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(saveKursAs()));
           connect(ui->actionRemove,SIGNAL(triggered()),this,SLOT(deleteTask()));
           connect(ui->actionMakeSection,SIGNAL(triggered()),this,SLOT(makeSection()));
           newDialog=new newKursDialog();
           connect(ui->actionNewK,SIGNAL(triggered()),this,SLOT(newKurs()));
           editDialog = new EditDialog(this);
           connect(ui->actionEdit,SIGNAL(triggered()),this,SLOT(editTask()));
           //ui->menuKurs->menuAction()->setVisible(false);
          // ui->menuKurs->menuAction()->setEnabled(false);
           setEditTaskEnabled(false);
           ui->treeView->setSelectionMode(QAbstractItemView::SingleSelection);
           editRoot=new QLineEdit(ui->treeView);
           editRoot->hide();
           connect(editRoot,SIGNAL(editingFinished ()),this,SLOT(endRootEdit()));
           connect(ui->remIspButt,SIGNAL(pressed()),this,SLOT(remSelIsp()));
           connect(ui->addIspButt,SIGNAL(pressed()),this,SLOT(addIsp()));
           connect(ui->ispList,SIGNAL(clicked(QModelIndex)),this,SLOT(showFields()));
           connect(ui->fieldsList,SIGNAL(clicked(QModelIndex)),this,SLOT(fieldClick()));
           connect(ui->remFieldButt,SIGNAL(pressed()),this,SLOT(remField()));
           connect(ui->addFieldButt,SIGNAL(pressed()),this,SLOT(addField()));
           connect(ui->actionS,SIGNAL(triggered()),this,SLOT(saveBaseKurs()));
           connect(ui->selFileButt,SIGNAL(pressed()),this,SLOT(setPrg()));
           connect(ui->prgEdit,SIGNAL(textChanged(QString)),this,SLOT(prgLineChange()));
           connect(ui->editFButt,SIGNAL(pressed()),this,SLOT(editFile()));
           connect(ui->menuMove,SIGNAL(aboutToShow()),this,SLOT(createMoveMenu()));

         //  QMessageBox::information( 0, "", trUtf8("Setup add "), 0,0,0);
           ui->ispSel->addItem("Robot");
           ui->ispSel->addItem(trUtf8("Водолей"));
           ui->actionup->setIcon(QIcon(":/arrow_up.png"));
           ui->actionDown->setIcon(QIcon(":/arrow_down.png"));
           changed=false;
isTeacher=true;
       onTask=false;
       cursFile="";
createRescentMenu();
       //ui->textBrowser->setVisible(false);
 };
コード例 #18
0
ファイル: progressview.cpp プロジェクト: Daylie/Totem
void ProgressView::removeTask(FutureProgress *task)
{
    m_taskList.removeAll(task);
    deleteTask(task);
}
コード例 #19
0
ファイル: CSoftManager.cpp プロジェクト: ray-x/SMonitor
void CSoftManager::decompressError(const QString& key, bool bDeleteFile)
{
	m_bIsInstalling = false;
	ClientLogger->AddLog(QString::fromLocal8Bit("[%1]解压失败").arg(key));
	//清除之前解压线程
	{
		QMutexLocker locker(&m_DecpListMutex);
		if(m_pDecpTaskList.contains(key))
		{
			//delete m_pDecpTaskList.value(key);
			m_pDecpTaskList.remove(key);
		}
	}

	int nState = -1;
	{
		QMutexLocker locker(&m_SrcListMutex);
		if(m_pSrcTask.contains(key))
			nState = m_pSrcTask.value(key).state;
	}

	deleteTask(key, bDeleteFile);
	//提交重试下载失败信号
	emit redownloadErrorOccered(key, nState);
	return;
	
	qDebug() << QString::fromLocal8Bit("解压失败");
	emit decompressErrorOccured(key);

	//如果已下载文件还存在,则重新解压,如果不存在,则重新下载
	QString fileName = QFileInfo(m_pSrcTask.value(key).srcPath).fileName();
	if(CMisc::IsFileExist(m_pSrcTask.value(key).tempPath + "/" + fileName))
	{
		QMutexLocker locker(&m_reDecompressListMutex);
		//首次下载重启时间为间隔30s
		int interval = 30;
		if(m_reDecompressTask.contains(key))
			interval = m_reDecompressTask.value(key).second * 2;

		if(interval < 240)
		{//次数未达到3次
			int id = startTimer(interval * 1000);
			m_reDecompressTask.insert(key, qMakePair(id, interval));
			qDebug() << QString::fromLocal8Bit("解压失败,解压任务将在%1秒之后重启").arg(interval);
			emit redownloadCountdown(1, key, interval);
		}
		else
		{//次数达到三次,直接删除任务,不再自动重试

			ClientLogger->AddLog(QString::fromLocal8Bit("软件[%1] 重试安装次数到三次 不再自动重试").arg(key));
			m_reDecompressTask.remove(key);

			int nState = -1;
			{
				QMutexLocker locker(&m_SrcListMutex);
				if(m_pSrcTask.contains(key))
					nState = m_pSrcTask.value(key).state;
			}

			deleteTask(key, true);
			m_bIsInstalling = false;

			//提交重试下载失败信号
			emit redownloadErrorOccered(key, nState);
		}
	}
	else
	{
		deleteTask(key, false);
		m_bIsInstalling = false;

		//开启下载流程
		AddTask(m_pSrcTask.value(key));
	}
}
コード例 #20
0
ファイル: busymode.cpp プロジェクト: stefanbeeman/end-of-days
int BusyMode_RunTasks(BusyTask* tasks, int numTasks)
{
    const char* currentTaskName = NULL;
    BusyTask* task;
    int i, mode;
    int result = 0;

    if(BusyMode_Active())
    {
        App_Error("BusyMode: Internal error, already busy...");
        exit(1); // Unreachable.
    }

    if(!tasks || numTasks <= 0) return result; // Hmm, no work?

    // Pick the first task.
    task = tasks;

    int initialMode = task->mode;
    preBusySetup(initialMode);

    // Process tasks.
    for(i = 0; i < numTasks; ++i, task++)
    {
        // If no new task name is specified, continue using the name of the previous task.
        if(task->name)
        {
            if(task->name[0])
                currentTaskName = task->name;
            else // Clear the name.
                currentTaskName = NULL;
        }

        mode = task->mode;
        /// @todo Kludge: Force BUSYF_STARTUP here so that the animation of one task
        ///       is not drawn on top of the last frame of the previous.
        if(numTasks > 1)
        {
            mode |= BUSYF_STARTUP;
        }
        // kludge end

        // Null tasks are not processed (implicit success).
        if(!task->worker) continue;

        /**
         * Process the work.
         */
#ifdef __CLIENT__
        // Is the worker updating its progress?
        if(task->maxProgress > 0)
            Con_InitProgress2(task->maxProgress, task->progressStart, task->progressEnd);
#endif
        // Invoke the worker in a new thread.
        /// @todo Kludge: Presently a temporary local task is needed so that we can modify
        ///       the task name and mode flags.
        { BusyTask* tmp = newTask(mode, task->worker, task->workerData, currentTaskName);
        result = runTask(tmp);
        // We are now done with this task.
        deleteTask(tmp);

        if(result) break;
        }
        // kludge end.
    }

    postBusyCleanup();

    return result;
}
コード例 #21
0
static void reviewLoop (const std::vector <std::string>& uuids, unsigned int limit, bool autoClear)
{
  auto width = getWidth ();
  unsigned int reviewed = 0;

  // If a limit was specified ('review 10'), then it should override the data
  // set size, if it is smaller.
  unsigned int total = uuids.size ();
  if (limit)
    total = std::min (total, limit);

  if (total == 0)
  {
    std::cout << reviewNothing ();
    return;
  }

  std::cout << reviewStart (width);

  unsigned int current = 0;
  while (current < total &&
         (limit == 0 || reviewed < limit))
  {
    // Run 'info' report for task.
    auto uuid = uuids[current];

    // Display banner for this task.
    std::string dummy;
    std::string description;
    execute ("task",
             {"_get", uuid + ".description"},
             dummy,
             description);

    std::string response;
    bool repeat;
    do
    {
      repeat = false;
      std::cout << banner (current + 1, total, width, Lexer::trimRight (description, "\n"));

      // Use 'system' to run the command and show the output.
      std::string command = "task " + uuid + " information";
      system (command.c_str ());

      // Display prompt, get input.
      response = getResponse (menu ());

           if (response == "e") { editTask (uuid);                                   }
      else if (response == "m") { modifyTask (uuid);          repeat = true;         }
      else if (response == "s") { std::cout << "Skipped\n\n"; ++current;             }
      else if (response == "c") { completeTask (uuid);        ++current; ++reviewed; }
      else if (response == "d") { deleteTask (uuid);          ++current; ++reviewed; }
      else if (response == "")  { reviewTask (uuid);          ++current; ++reviewed; }
      else if (response == "r") { reviewTask (uuid);          ++current; ++reviewed; }
      else if (response == "q") { break;                                             }

      else
      {
        std::cout << format ("Command '{1}' is not recognized.", response) << "\n";
      }

      // Note that just hitting <Enter> yields an empty command, which does
      // nothing but advance to the next task.

      if (autoClear)
        std::cout << "\033[2J\033[0;0H";
    }
    while (repeat);

    if (response == "q")
      break;
  }

  std::cout << "\n"
            << format ("End of review. {1} out of {2} tasks reviewed.", reviewed, total)
            << "\n\n";
}
コード例 #22
0
ファイル: taeval.cpp プロジェクト: Dunni/taeval
QString TAEval::serveRequest(QString request, QString data)
{
    //Then find the request here and delegate the data to the SQL to query the required info.
    if(request.compare("loginRequest") == 0){
       qDebug() << "Login Request being processed" << endl;
       QString l = accessControl.logIn(data);
       if(l.contains("Instructor"))
       {
           return QString("Instructor");
       }
       if(l.contains("TA"))
       {
           return QString("TA");
       }
       if(l.contains("loggedin"))
       {
           return QString("loggedin");
       }
       else
           return QString("false");

    }
    else if (request.compare("semesterRequest") == 0) {

        qDebug() << "Semester Request being processed" << endl;
        StringList *semesters;

        if(getSemesters(data, semesters))
        {
            QString result = listToString(*semesters);
            delete semesters;
            return result.isEmpty() ? "false" : result;
        }

    }
    else if (request.compare("coursesRequest") == 0) {

        qDebug() << "Courses Request being processed" << endl;
        QStringList info = data.split("|");
        qDebug() <<  info.at(0) + " " + info.at(1) << endl;
        CourseList* c;

        if(getCourses(info.at(0), c, info.at(0), info.at(1)))
        {
            QString stringOfCourses = Course::listToString(*c);
            qDebug() << stringOfCourses << endl;
            delete c;
            return (stringOfCourses.isEmpty()) ? "false" : stringOfCourses;
        }

    }
    else if (request.compare("tasRequest") == 0) {

        qDebug() << "TAs Request being processed" << endl;
        QStringList info = data.split("|");
        qDebug() << "Inst here is: " + info.at(0) + " and " + info.at(1) << endl;
        TAList* t;

        if(getTAs(info.at(0), info.at(1), t))
        {
            QString stringOfTAs = TA::listToString(*t);delete t;
            qDebug() << stringOfTAs << endl;
            return (stringOfTAs.isEmpty()) ? "false" : stringOfTAs;
        }

    }
    else if (request.compare("taskRequest") == 0) {

        qDebug() << "Task Request being processed" << endl;
        QStringList info = data.split("|");
        qDebug() << "Inst here is: " + info.at(0) + " and " + info.at(1) << " and " << info.at(2) << endl;
        TaskList* taskList;
        if(getTasks(info.at(0), info.at(1), info.at(2), taskList))
        {
            QString stringOfTask = Task::listToString(*taskList);
            delete taskList;
            qDebug() << stringOfTask << endl;
            return (stringOfTask.isEmpty()) ? "false" : stringOfTask;
        }
        else
            return "false";

    }
    else if (request.compare("taskCreateRequest") == 0) {
        qDebug() << "Create Task Request being processed" << endl;

        QStringList info = data.split("|");

        qDebug() << "Inst here is: " + info.at(0) + " and " +
                    info.at(1) << " and " << info.at(2) + " and " +
                 info.at(3) << " and " << info.at(4) << + " and " +
                 info.at(5) << endl;

        QStringList begDateList = info.at(4).split("-");
        QStringList dueDateList = info.at(5).split("-");

        QDate begDate(begDateList.at(0).toInt(), begDateList.at(1).toInt(), begDateList.at(2).toInt());
        QDate dueDate(dueDateList.at(0).toInt(), dueDateList.at(1).toInt(), dueDateList.at(2).toInt());

        return createTask(info.at(0), info.at(1), info.at(2), info.at(3), begDate, dueDate) ? "true" : "false";
    }
    else if (request.compare("taskEditRequest") == 0) {
        qDebug() << "Edit Task Request being processed" << endl;

        QStringList info = data.split("|");

        qDebug() << "Inst here is: " + info.at(0) + " and " +
                    info.at(1) + " and " + info.at(2) + " and " +
                    info.at(3) + "and " + info.at(4) << endl;

        QStringList begDateList = info.at(2).split("-");
        QStringList dueDateList = info.at(3).split("-");

        QDate begDate(begDateList.at(0).toInt(), begDateList.at(1).toInt(), begDateList.at(2).toInt());
        QDate dueDate(dueDateList.at(0).toInt(), dueDateList.at(1).toInt(), dueDateList.at(2).toInt());


        return editTask(info.at(0), info.at(1), begDate, dueDate, QString(info.at(4))) ? "true" : "false";
    }
    else if (request.compare("taskDeleteRequest") == 0){

        qDebug() << "DELETE Task Request being processed" << endl;
        QStringList info = data.split("|");
        qDebug() << "Inst here is: " + info.at(0) + " and " +
                    info.at(1) << endl;

        return deleteTask(info.at(0), QString(info.at(1))) ? "true" : "false";
    }
    else if (request.compare("editEvalRequest") == 0){

        qDebug() << "Edit Evail Request being processed" << endl;
        QStringList info = data.split("|");

        return enterEvaluation(info.at(0), info.at(1).toInt(), info.at(2), info.at(3).toInt()) ? "true" : "false";
    }
    else if (request.compare("logOutRequest") == 0){

        qDebug() << "LogOut Request being processed" << endl;
        QStringList info = data.split("|");
        qDebug() << "Inst here is: " + info.at(0) << endl;

        return accessControl.logOut(info.at(0)) ? "true" : "false";
    }

    qDebug() <<  "Request Failed" << endl;
    return "false";
}