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"; }
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); };
void MainWindow::initial() { my_sync_widget->setWindowModality(Qt::WindowModal); my_sync_widget->hide(); connect(my_sync_widget, SIGNAL(getSaveFile(QString&)), this, SLOT(syncSaveFile(QString&))); connect(my_sync_widget, SIGNAL(enableServiceButton(QString&)), this, SLOT(serviceAdded(QString&))); connect(this, SIGNAL(syncClickEmit()), my_sync_widget, SLOT(syncFiles())); connect(my_sync_widget, SIGNAL(openXml(QString&)), this, SLOT(openXmlRecv(QString&))); connect(my_sync_widget, SIGNAL(dboxAuthResult(bool)), this, SLOT(dboxAuthStatus(bool))); connect(my_sync_widget, SIGNAL(dboxRecvResult(bool)), this, SLOT(dboxRecvStatus(bool))); connect(my_sync_widget, SIGNAL(dboxSendResult(bool)), this, SLOT(dboxSendStatus(bool))); connect(my_sync_widget, SIGNAL(googleAuthResult(bool)), this, SLOT(googleAuthStatus(bool))); connect(my_sync_widget, SIGNAL(googleRecvResult(bool)), this, SLOT(googleRecvStatus(bool))); connect(my_sync_widget, SIGNAL(googleSendResult(bool)), this, SLOT(googleSendStatus(bool))); fileMenu = menuBar()->addMenu(tr("&File")); newList = new QAction( tr("&New lists..."), this ); newList->setShortcuts(QKeySequence::New); fileMenu->addAction(newList); connect(newList, SIGNAL(triggered()), this->my_task_list,SLOT(new_list())); fileMenu->addSeparator(); loadAction = new QAction(tr("&Open XML..."), this); loadAction->setShortcuts(QKeySequence::Open); fileMenu->addAction(loadAction); connect(loadAction, SIGNAL(triggered()), this, SLOT(loadFile())); saveAction = new QAction( tr("&Save..."), this ); saveAction->setShortcuts(QKeySequence::Save); fileMenu->addAction(saveAction); connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile())); saveAsAction = new QAction( tr("&Save as..."), this ); //saveAsAction->setShortcuts(QKeySequence::SaveAs); fileMenu->addAction(saveAsAction); connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveasFile())); fileMenu->addSeparator(); printAction = new QAction(tr("&Print"),this); printAction->setShortcuts(QKeySequence::Print); fileMenu->addAction(printAction); connect(printAction, SIGNAL(triggered()), this,SLOT(print())); fileMenu->addSeparator(); exitAction = new QAction(tr("&Exit"), this); fileMenu->addAction(exitAction); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); OptMenu = menuBar()->addMenu(tr("&Options")); change_font = new QAction(tr("&Change Font"),this); OptMenu->addAction(change_font); display_note = new QAction(tr("&Display/Hide Note"), this); OptMenu->addAction(display_note); search_for= new QAction(tr("&Search"),this); search_for->setShortcut(QKeySequence::Find); OptMenu->addAction(search_for); connect(search_for,SIGNAL(triggered()),this,SLOT(search_start())); Template = menuBar()->addMenu(tr("&Template")); new_grocery = new QAction(tr("&Groceries"),this); Template->addAction(new_grocery); new_week_task = new QAction(tr("&Weekly Task"),this); Template->addAction(new_week_task); Sync = menuBar()->addMenu(tr("&Sync Menu")); new_service = new QAction(tr("&Add Service"), this); Sync->addAction(new_service); sync_service = new QAction(tr("&Sync Services (On)"), this); Sync->addAction(sync_service); sync_service_off = new QAction(tr("&Sync Services Off"), this); Sync->addAction(sync_service_off); send_service = new QAction(tr("&Send Current File"), this); Sync->addAction(send_service); get_service = new QAction(tr("&Get Dropbox Files"), this); Sync->addAction(get_service); send_service_gtask = new QAction(tr("&Send Current File (GTask)"), this); Sync->addAction(send_service_gtask); get_service_gtask = new QAction(tr("&Get GTask Files"), this); Sync->addAction(get_service_gtask); sync_service->setDisabled(true); send_service->setDisabled(true); sync_service_off->setDisabled(true); get_service->setDisabled(true); send_service_gtask->setDisabled(true); get_service_gtask->setDisabled(true); addTask = new QPushButton( tr("Add Task") ); delTask = new QPushButton( tr("Delete") ); editTask = new QPushButton( tr("Edit Task") ); pop_up = new QPushButton(tr("Pop Task Up")); move_down = new QPushButton(tr("Move Task Down")); search_button = new QPushButton(tr("Search")); QWidget *main_widget = new QWidget; QVBoxLayout *main_layout = new QVBoxLayout; QHBoxLayout *button_layout1 = new QHBoxLayout; QHBoxLayout *button_layout2 = new QHBoxLayout; //here is the list name area //main_layout->addWidget( new QLabel(tr("Lists name")),0,Qt::AlignCenter ); //main_layout->addWidget(my_task_list->lists_name); this->my_task_list->setColumnCount(5); QStringList tmp_l; tmp_l << "Name" << "Note" << "Tag" << "Due Date" << "Status"; this->my_task_list->setHeaderLabels(tmp_l ); this->my_task_list->setEditTriggers(QAbstractItemView::DoubleClicked); this->my_task_list->setSelectionMode(QAbstractItemView::SingleSelection); this->my_task_list->setSelectionBehavior(QAbstractItemView::SelectRows); //here is the table content /*QStandardItemModel *tmp_mod = my_task_list->mod; tmp_mod->setColumnCount(4); tmp_mod->setHeaderData(0, Qt::Horizontal, tr("Name")); tmp_mod->setHeaderData(1,Qt::Horizontal, tr("Note")); tmp_mod->setHeaderData(2,Qt::Horizontal, tr("Due date")); tmp_mod->setHeaderData(3,Qt::Horizontal, tr("Status")); my_task_list->table->setModel(tmp_mod); my_task_list->table->setEditTriggers(QAbstractItemView::DoubleClicked); my_task_list->table->setSelectionMode(QAbstractItemView::SingleSelection); my_task_list->table->setSelectionBehavior(QAbstractItemView::SelectRows);*/ /*QTreeWidgetItem* task_child = new QTreeWidgetItem(this->my_task_list,0); task_child->setText(0,"a"); this->my_task_list->addTopLevelItem(task_child); QTreeWidgetItem* task_child1 = new QTreeWidgetItem(task_child,1); task_child1->setText(0,"1"); QTreeWidgetItem* task_child2 = new QTreeWidgetItem(task_child,1); task_child2->setText(0,"2"); QTreeWidgetItem* task_child3 = new QTreeWidgetItem(task_child,1); task_child3->setText(0,"3"); task_child->addChild(task_child1); task_child->addChild(task_child2); task_child->addChild(task_child3); QTreeWidgetItem* task_child4 = new QTreeWidgetItem(task_child,1); task_child4->setText(0,"0"); task_child->insertChild(-2,task_child4); */ main_layout->addWidget( new QLabel(tr("Current Lists")),0,Qt::AlignCenter ); main_layout->addWidget(this->my_task_list); button_layout1->addWidget(addTask); button_layout1->addWidget(delTask); button_layout1->addWidget(editTask); button_layout2->addWidget(pop_up); button_layout2->addWidget(move_down); button_layout2->addWidget(search_button); main_layout->addLayout(button_layout1); main_layout->addLayout(button_layout2); main_widget->setLayout(main_layout); main_widget->setMinimumSize(520,500); this->setCentralWidget(main_widget); //connection connect(addTask, SIGNAL(clicked()), this->my_task_list,SLOT(addTask())); connect(delTask, SIGNAL(clicked()), this->my_task_list,SLOT(delTask())); connect(editTask, SIGNAL(clicked()), this->my_task_list, SLOT(editTask())); connect(display_note, SIGNAL(triggered()), this->my_task_list, SLOT(show_hide_Note()));//the action one in the menu connect(change_font, SIGNAL(triggered()), this->my_task_list, SLOT(changeFont())); connect(pop_up, SIGNAL(clicked()), this->my_task_list, SLOT(pop_up())); connect(move_down, SIGNAL(clicked()), this->my_task_list, SLOT(move_down())); connect(new_grocery, SIGNAL(triggered()), this->my_task_list, SLOT(grocery())); connect(new_week_task, SIGNAL(triggered()), this->my_task_list, SLOT(week_task())); connect(new_service, SIGNAL(triggered()), this, SLOT(newServiceClick())); connect(sync_service, SIGNAL(triggered()), this, SLOT(syncClick())); connect(sync_service_off, SIGNAL(triggered()), this, SLOT(syncClickOff())); connect(send_service, SIGNAL(triggered()), this->my_sync_widget, SLOT(sendFiles())); connect(get_service, SIGNAL(triggered()), this->my_sync_widget, SLOT(getFiles())); connect(send_service_gtask, SIGNAL(triggered()), this->my_sync_widget, SLOT(sendFilesGTask())); connect(get_service_gtask, SIGNAL(triggered()), this->my_sync_widget, SLOT(getFilesGTask())); connect(search_button, SIGNAL(clicked()), this, SLOT(search_start())); }
void MainWindowTask::startEdit(const QModelIndex & index ) { showText(index); editTask(); }
void task_list::editTask() { //QItemSelectionModel *select_model = table->selectionModel(); //QModelIndexList idx = select_model->selectedRows(); QModelIndex i; QString name; QString note; QString tag; QDate due; QString status; if(currentItem()==NULL) { return; } int location = -1; for(int i=0; i<this->topLevelItemCount();i++) { if(this->currentItem() == this->topLevelItem(i)) { location = i; break; } } if( location==-1 && this->currentItem()->type()==1 ) {//we get a child node and we need to update it. name = this->currentItem()->text(NAME_COL); tag = this->currentItem()->text(TAG_COL); note = this->currentItem()->text(NOTE_COL); QString tmp_str = this->currentItem()->text(DATE_COL); due = QDate::fromString(tmp_str, "yyyy-MM-dd"); } if(!name.isEmpty()) { task_dial t_dial; t_dial.setWindowTitle( tr("Edit Task") ); t_dial.task_name->setText(name); t_dial.task_tag->setText(tag); t_dial.h_edit->textEdit->setHtml(note); t_dial.due_t->setDate(due); if(t_dial.exec()) { QString task_name = t_dial.task_name->text(); QString task_tag = t_dial.task_tag->text(); QString task_note_html = t_dial.h_edit->textEdit->toHtml(); QDate due_time = t_dial.due_t->date(); QString task_note_plain = t_dial.h_edit->textEdit->toPlainText(); task_note_html.remove("<meta name=\"qrichtext\" content=\"1\" />"); editTask(task_name, task_tag, task_note_html, due_time, status, task_note_plain); } } }
void TaskWidgetItem::setItemInfo() { m_completed = new Plasma::CheckBox(this); m_completed->setChecked(m_todo->isCompleted()); m_completed->setMaximumSize(25, 25); m_layout->addItem(m_completed, 0, 0); connect(m_completed, SIGNAL(toggled(bool)), SLOT(setCompleted(bool))); if (m_todo->hasDueDate()) { m_date = new Plasma::IconWidget(this); m_date->setOrientation(Qt::Horizontal); m_date->setText(m_todo->dtDue().toString(KDateTime::LocalDate)); m_date->setMaximumHeight(15); setColorForDate(); m_layout->addItem(m_date, 0, 1); } m_name = new Plasma::IconWidget(this); m_name->setText(m_todo->summary()); m_name->setOrientation(Qt::Horizontal); m_name->setMaximumHeight(15); if (m_completed->isChecked()) { m_name->setIcon(KIcon("dialog-ok")); } if (m_date) { m_layout->addItem(m_name, 1, 1); } else { m_layout->addItem(m_name, 0, 1); } Plasma::ToolTipContent content(m_todo->summary(), m_todo->description()); if (m_todo->isCompleted()) { content.setImage(KIcon("dialog-ok")); } else { content.setImage(KIcon("edit-delete")); } Plasma::ToolTipManager::self()->setContent(m_name, content); connect(m_name, SIGNAL(clicked()), SLOT(editTask())); if (m_date) { Plasma::ToolTipManager::self()->setContent(m_date, content); connect(m_date, SIGNAL(clicked()), SLOT(editTask())); } setMaxWidth(((TaskWidget*)parentWidget())->taskWidth()); }
void TaskCheckBox::mousePressEvent(QMouseEvent *event) { if(event->button() == Qt::LeftButton){ // click button left emit editTask(row); } }
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"; }