bool GCEdificabile::acquistaVia(GCPlayer *p) { try { p->preleva(valore); } catch (ECC_CapitaleInsufficiente) { QString msg(core->getGiocatoreCorrente()->getName()); msg.append(" non ha denaro sufficiente per acquistare "); msg.append(core->getCasellaCorrente()->getName()); msg.append(". Transazione annullata."); core->setMessagge(msg); return false; } QString msg(core->getGiocatoreCorrente()->getName()); msg.append(" ha acquistato "); msg.append(core->getCasellaCorrente()->getName()); msg.append(" al costo di "); msg.append(QString::number(valore)); core->setMessagge(msg); proprietario = p; p->addPossedimento(this); setTask(0); core->aggiornaAzioni(task); return true; }
void kbdTimerTask(const TaskParameter param) { // kbdTimerTask is periodic task; set kbdTimerTask task setTimerTaskMS(&kbdTimerTask, 0, KBD_TIMER_TASK_PERIOD); // if no registered handlers if (!m_handlersCnt) return; // if no pressed keys uint08 kbdPin = KBD_PIN; MASK_CLEAR(kbdPin, !KBD_MASK); // clear all except mask MASK_TOGGLE(kbdPin, KBD_MASK); // toggle pins so "key pressed" = 1 if (!kbdPin) return; // find handler for pressed key uint08 thisKeyHandlerPos = 0; for (; thisKeyHandlerPos < m_handlersCnt; ++thisKeyHandlerPos) { if (GBI(kbdPin, m_keys[thisKeyHandlerPos])) // this key pressed break; } // if there is no handler for this key if (thisKeyHandlerPos >= m_handlersCnt) return; setTask(m_handlers[thisKeyHandlerPos], m_keys[thisKeyHandlerPos]); }
PersonInfo::PersonInfo(const LocalizedString &name, const LocalizedString &task, const QString &email, const QString &web) { d = new PersonInfoData; setName(name); setTask(task); setEmail(email); setWeb(web); }
Task::Task(AbstractGroupableItem *abstractItem, Applet *applet) : QObject(applet), m_applet(applet), m_abstractItem(NULL), m_taskType(OtherType), m_validateTimer(0) { setTask(abstractItem); connect(this, SIGNAL(destroyed()), m_applet, SLOT(cleanup())); }
void TaskManagementMainTab::resetSession(QString message) { taskState::removeCookie(); state->taskState->taskFile = ""; taskLoginWidget->setResponse(message); setTask("Current: "); setActiveUser("Logged in as: "); emit setDescriptionSignal("Category description: "); emit setDescriptionSignal("Task comment: "); emit hideSignal(); taskLoginWidget->show(); }
int main(void) { struct myArgs asdf; Task *t = setTask((void *) runme, (void *) &asdf); printf("%d %d %d\n", asdf.i, asdf.j, asdf.k); execute(t); printf("%d %d %d\n", asdf.i, asdf.j, asdf.k); }
void TaskDeadline::stringToTask(std::string content) { std::istringstream input(content); std::string taskDesc; std::string dateTime; DateTime deadline; std::string statusString; bool status; std::getline(input, taskDesc); std::getline(input, dateTime); input >> statusString; if (statusString == STATUS_TRUE){ status = true; } else{ status = false; } deadline.dataFromString(dateTime); setTask(status, taskDesc, deadline); }
void flightTask(void) { static time_t last = 100; // Don't begin immediately if ((getSystemTime() - last) >= QUADDELAY) { last = getSystemTime(); Error e = orientationTask(); REPORTERROR(e); if (state & STATE_PID) { pidTask(); } else { pidOutput[0] = pidOutput[1] = 0; } setTask(); motorTask(); uint32_t diff = getSystemTime() - last; if (++countFlightTask >= QUADFREQ) { countFlightTask = 1; sumFlightTask = diff; } else { sumFlightTask += diff; } } }
Icon::Icon(TaskManager::AbstractGroupableItem *abstractItem, Launcher *launcher, Job *job, Applet *parent) : QGraphicsWidget(parent), m_applet(parent), m_task(NULL), m_launcher(NULL), m_glowEffect(NULL), m_layout(new QGraphicsLinearLayout(this)), m_animationTimeLine(new QTimeLine(1000, this)), m_jobAnimationTimeLine(NULL), m_itemType(TypeOther), m_factor(parent->initialFactor()), m_animationProgress(-1), m_jobsProgress(0), m_jobsAnimationProgress(0), m_dragTimer(0), m_highlightTimer(0), m_menuVisible(false), m_demandsAttention(false), m_jobsRunning(false), m_isVisible(true), m_isPressed(false) { setObjectName("FancyTasksIcon"); setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); setAcceptsHoverEvents(true); setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); setFlag(QGraphicsItem::ItemIsFocusable); setLayout(m_layout); m_visualizationPixmap = NULL; m_thumbnailPixmap = NULL; m_animationTimeLine->setFrameRange(0, 100); m_animationTimeLine->setUpdateInterval(50); m_animationTimeLine->setCurveShape(QTimeLine::LinearCurve); m_layout->setOrientation((m_applet->location() == Plasma::LeftEdge || m_applet->location() == Plasma::RightEdge)?Qt::Vertical:Qt::Horizontal); m_layout->addStretch(); m_layout->addStretch(); if (abstractItem) { setTask(abstractItem); } else if (launcher) { setLauncher(launcher); } else if (job) { addJob(job); } connect(this, SIGNAL(destroyed()), m_applet, SLOT(updateSize())); connect(this, SIGNAL(hoverMoved(QGraphicsWidget*, qreal)), m_applet, SLOT(itemHoverMoved(QGraphicsWidget*, qreal))); connect(this, SIGNAL(hoverLeft()), m_applet, SLOT(hoverLeft())); connect(m_applet, SIGNAL(sizeChanged(qreal)), this, SLOT(setSize(qreal))); connect(m_applet, SIGNAL(sizeChanged(qreal)), this, SIGNAL(sizeChanged(qreal))); connect(m_animationTimeLine, SIGNAL(finished()), this, SLOT(stopAnimation())); connect(m_animationTimeLine, SIGNAL(frameChanged(int)), this, SLOT(progressAnimation(int))); }
void BoostBuildParser::stdOutput(QString const& rawLine) { setToolsetParser(findToolset(rawLine)); QString const line = rightTrimmed(rawLine).replace(rxTestFileLineN_, QLatin1String("\\1:\\2")); if (!toolsetName_.isEmpty() && line.startsWith(toolsetName_)) lineMode_ = Toolset; else if (line.startsWith(QLatin1String("testing")) || line.startsWith(QLatin1String("(failed-as-expected)"))) lineMode_ = Testing; else if (line.startsWith(QLatin1String("common"))) lineMode_ = Common; // TODO: Why forwarding stdOutput to ProjectExplorer::IOutputParser::stdError? // Because of a bug (or feature?) in Boost.Build: // stdout and stderr not forwarded to respective channels // https://svn.boost.org/trac/boost/ticket/9485 if (lineMode_ == Toolset) { ProjectExplorer::IOutputParser::stdError(line); } else if (lineMode_ == Testing) { if (rxTestPassed_.indexIn(line) > -1) { BBPM_QDEBUG(rxTestPassed_.capturedTexts()); // TODO: issue #3 ProjectExplorer::Task task(ProjectExplorer::Task::Unknown , rxTestPassed_.cap(0) , Utils::FileName::fromString(rxTestPassed_.cap(1)) , -1 // line , ProjectExplorer::Constants::TASK_CATEGORY_COMPILE); setTask(task); lineMode_ = Common; } else if (rxTestFailed_.indexIn(line) > -1) { BBPM_QDEBUG(rxTestFailed_.capturedTexts()); // Report summary task for "...failed testing.capture-output /myfile.run" ProjectExplorer::Task task(ProjectExplorer::Task::Error , rxTestFailed_.cap(0) , Utils::FileName::fromString(rxTestFailed_.cap(1)) , -1 // line , ProjectExplorer::Constants::TASK_CATEGORY_COMPILE); setTask(task); lineMode_ = Common; } else if (rxTestFailedAsExpected_.indexIn(line) > -1) { BBPM_QDEBUG(rxTestFailedAsExpected_.capturedTexts()); // TODO: Handling of "(failed-as-expected)" is not great, might be confusing. // Boost.Build spits out compile command first, so compilation errors arrive // and are parsed immediately (issue tasks are created) // due to lineMode_==Toolset. // Then, "(failed-as-expected)" status arrives and there seem to be no way to // look back and clear all the issue tasks created for compilation errors. // TODO: Ask Volodya if b2 could announce "testing." before compile command // for a compile-time test. QString fileName(rxTestFailedAsExpected_.cap(1)); if (rxTestFileObj_.indexIn(fileName)) fileName = rxTestFileObj_.cap(1) + QLatin1String(".cpp");// FIXME:hardcoded ext // ATM, we can only indicate in UI that test failed-as-expected ProjectExplorer::Task task(ProjectExplorer::Task::Error , rxTestFailedAsExpected_.cap(0) , Utils::FileName::fromString(fileName) , -1 // line , ProjectExplorer::Constants::TASK_CATEGORY_COMPILE); setTask(task); lineMode_ = Common; } else { // Parses compilation errors of run-time tests, creates issue tasks ProjectExplorer::IOutputParser::stdError(line); } } else { doFlush(); ProjectExplorer::IOutputParser::stdOutput(line); } }
void TaskManagementMainTab::startNewTaskButtonClicked() { CURLcode code; long httpCode; FILE *tasknml; struct httpResponse header; auto postdata = QString("csrfmiddlewaretoken=%0&data=<currentTask>%1</currentTask>").arg(taskState::CSRFToken(), state->taskState->taskFile); QDir taskDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/tasks"); taskDir.mkpath("."); state->taskState->taskFile = taskDir.absolutePath() + "/task.tmp.nml"; tasknml = fopen(state->taskState->taskFile.toUtf8().constData(), "w"); if (tasknml == nullptr) { statusLabel->setText("<font color='red'>Failed to get new task. No write permission in this folder.</font>"); return; } auto url = state->taskState->host + "/knossos/newTask/"; header.length = 0; header.content = (char *)calloc(1, header.length + 1); setCursor(Qt::WaitCursor); httpResponse response; response.length = 0; response.content = (char *)calloc(1, 10240); bool success = taskState::httpFileGET(url.toUtf8().data(), postdata.toUtf8().data(), &response, &header, &httpCode, state->taskState->cookieFile.toUtf8().data(), &code, 5); setCursor(Qt::ArrowCursor); if(success == false) { resetSession(QString("<font color='red'>Could not find session cookie. Please login again.</font><br />%0").arg(response.content)); return; } if(code != CURLE_OK) { setResponse(QString("<font color='red'>Request failed. Please check your connection.</font><br />%0").arg(response.content)); taskState::removeCookie(); free(header.content); return; } if(httpCode == 400) { setResponse(QString("<font color='red'>Current task not finished or no new task available.</font><br />%0").arg(response.content)); QFile(state->taskState->taskFile).remove(); free(header.content); return; } else if(httpCode == 403) { setResponse(QString("<font color='red'>You are not authenticated. Permission denied.</font><br />%0").arg(response.content)); QFile(state->taskState->taskFile).remove(); free(header.content); return; } else if(httpCode != 200){ setResponse(QString("<font color='red'>Error received from server.</font><br />%0").arg(response.content)); QFile(state->taskState->taskFile).remove(); free(header.content); return; } fwrite(response.content, 1, response.length, tasknml); fclose(tasknml); // 200 - success. Retrieve the filename from response header and rename the previously created tmp.nml char filename[1024] = {}; if (taskState::copyInfoFromHeader(filename, &header, "filename")) { QFile tmpFile(state->taskState->taskFile); tmpFile.rename(filename); state->taskState->taskFile = tmpFile.fileName(); } // get task name char taskname[1024] = {}; taskState::copyInfoFromHeader(taskname, &header, "taskname"); state->taskState->taskName = taskname; setTask(state->taskState->taskName); // get task category description and task comment QByteArray descriptionBuffer(8192, '\0'); QByteArray commentBuffer(8192, '\0'); taskState::copyInfoFromHeader(descriptionBuffer.data(), &header, "description"); taskState::copyInfoFromHeader(commentBuffer.data(), &header, "comment"); QString description = QByteArray::fromBase64(descriptionBuffer); QString comment = QByteArray::fromBase64(commentBuffer); QMessageBox prompt; prompt.setWindowFlags(Qt::WindowStaysOnTopHint); prompt.setIcon(QMessageBox::Information); prompt.setWindowTitle(state->taskState->taskName); prompt.setText(QString("<p style='width:200px;'><b>Category %1:</b> %2<br><br><b>Task %3:</b> %4</p>") .arg(taskState::getCategory()) .arg(description) .arg(taskState::getTask()) .arg(comment)); prompt.addButton("Ok", QMessageBox::ActionRole); // closes prompt by default prompt.resize(400, 300); prompt.exec(); emit setDescriptionSignal(description); emit setCommentSignal(comment); emit loadSkeletonSignal(state->taskState->taskFile); setResponse("<font color='green'>Loaded task successfully.</font>"); free(header.content); }
App::App(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { showFullScreen = false; setCaption("IQNotes"); toolbar = new QPEToolBar(this); toolbar->setVerticalStretchable(false); toolbar->setHorizontalStretchable(false); setToolBarsMovable(false); multiTB = new QToolButton(toolbar); // File menu filePopupMenu = new QPopupMenu(this); menu = new QPEMenuBar(this); int fileID; fileID = menu->insertItem("File", filePopupMenu); #ifndef DEMO newID = filePopupMenu->insertItem("New", this, SLOT(newFile()), SHIFT+Key_N); openID = filePopupMenu->insertItem("Open", this, SLOT(openFile()), SHIFT+Key_O); saveID = filePopupMenu->insertItem("Save", this, SLOT(saveFile()), SHIFT+Key_S); // file->insertItem("Save as", this, SLOT(saveAsFile())); closeID = filePopupMenu->insertItem("Close", this, SLOT(closeFileMenu())); filePopupMenu->insertSeparator(); #endif filePopupMenu->insertItem("Quit", this, SLOT(goodBye())); // Tree menu treePopupMenu = new QPopupMenu(this); treeID = menu->insertItem("Tree", treePopupMenu); searchA = new QAction("Search", ToolBarIcon::prepare("iqnotes/find"), QString::null, Key_F, this, 0 ); connect(searchA, SIGNAL(activated()), this, SLOT(search())); // searchA->addTo(toolbar); searchA->addTo(treePopupMenu); multiTB->setIconSet(ToolBarIcon::prepare("iqnotes/find")); connect(multiTB, SIGNAL(clicked()), this, SLOT(search())); // toolbar->addSeparator(); // no room for this treePopupMenu->insertSeparator(); quickAddA = new QAction("Quick add", ToolBarIcon::prepare("iqnotes/quick_add"), QString::null, Key_Q, this, 0 ); connect(quickAddA, SIGNAL(activated()), this, SLOT(quickAdd())); quickAddA->addTo(toolbar); quickAddA->addTo(treePopupMenu); addBeforeA = new QAction("Add before", ToolBarIcon::prepare("iqnotes/add_before"), QString::null, 0, this, 0 ); connect(addBeforeA, SIGNAL(activated()), this, SLOT(addBefore())); addBeforeA->addTo(toolbar); addBeforeA->addTo(treePopupMenu); addAfterA = new QAction("Add after", ToolBarIcon::prepare("iqnotes/add_after"), QString::null, Key_A, this, 0 ); connect(addAfterA, SIGNAL(activated()), this, SLOT(addAfter())); addAfterA->addTo(toolbar); addAfterA->addTo(treePopupMenu); addChildA = new QAction("Add child", ToolBarIcon::prepare("iqnotes/add_child"), QString::null, Key_E, this, 0 ); connect(addChildA, SIGNAL(activated()), this, SLOT(addChild())); addChildA->addTo(toolbar); addChildA->addTo(treePopupMenu); treePopupMenu->insertSeparator(); sortID = treePopupMenu->insertItem("Sort", this, SLOT(sort())); treePopupMenu->insertSeparator(); expandTreeID = treePopupMenu->insertItem("Expand tree", this, SLOT(expandTree())); collapseTreeID = treePopupMenu->insertItem("Collapse tree", this, SLOT(collapseTree())); treePopupMenu->insertSeparator(); taskListPopupMenu = new QPopupMenu(this); taskListPopupMenu->insertItem("From whole tree", this, SLOT(taskListWholeTree())); taskListPopupMenu->insertItem("From current note down", this, SLOT(taskListCurrent())); eventListPopupMenu = new QPopupMenu(this); eventListPopupMenu->insertItem("From whole tree", this, SLOT(eventListWholeTree())); eventListPopupMenu->insertItem("From current note down", this, SLOT(eventListCurrent())); taskListID = treePopupMenu->insertItem("Task list", taskListPopupMenu); eventListID = treePopupMenu->insertItem("Event list", eventListPopupMenu); treePopupMenu->insertSeparator(); reminderID = treePopupMenu->insertItem("Reminder", this, SLOT(showReminder())); toolbar->addSeparator(); /* closeSearchTreeA = new QAction("Close search tree", Resource::loadPixmap("iqnotes/close_search_tree"), QString::null, 0, this, 0 ); connect(closeSearchTreeA, SIGNAL(activated()), this, SLOT(closeSearchTree())); closeSearchTreeA->addTo(tree);*/ // Note menu notePopupMenu = new QPopupMenu(this); noteID = menu->insertItem("Note", notePopupMenu); renameNoteID = notePopupMenu->insertItem("Rename", this, SLOT(renameNote()), Key_R); editA = new QAction("Edit", ToolBarIcon::prepare("iqnotes/edit"), QString::null, Key_Return, this, 0 ); editA->setToolTip("Edit note"); connect(editA, SIGNAL(activated()), this, SLOT(editNote())); editA->addTo(toolbar); editA->addTo(notePopupMenu); cutA = new QAction("Cut", ToolBarIcon::prepare("iqnotes/bin"), QString::null, Key_X, this, 0 ); cutA->setToolTip("Cut note"); connect(cutA, SIGNAL(activated()), this, SLOT(cutNote())); cutA->addTo(toolbar); cutA->addTo(notePopupMenu); copyNotePopupMenu = new QPopupMenu(this); copyNotePopupMenu->insertItem("Only current note", this, SLOT(copyNoteOnlyCurrent())); copyNotePopupMenu->insertItem("Current note and down", this, SLOT(copyNoteCurrentAndDown())); copyNoteID = notePopupMenu->insertItem("Copy", copyNotePopupMenu); pasteNotePopupMenu = new QPopupMenu(this); pasteNotePopupMenu->insertItem("Before", this, SLOT(pasteNoteBefore())); pasteNotePopupMenu->insertItem("After", this, SLOT(pasteNoteAfter()), SHIFT+Key_A); pasteNotePopupMenu->insertItem("As child", this, SLOT(pasteNoteChild()), SHIFT+Key_E); pasteNoteID = notePopupMenu->insertItem("Paste", pasteNotePopupMenu); notePopupMenu->insertSeparator(); setPictureA = new QAction("Set picture", ToolBarIcon::prepare("iqnotes/set_picture"), QString::null, CTRL+Key_P, this, 0); setPictureA->setToolTip("Set picture"); connect(setPictureA, SIGNAL(activated()), this, SLOT(setPicture())); //setPictureA->addTo(toolbar); setPictureA->addTo(notePopupMenu); notePopupMenu->insertSeparator(); setTaskA = new QAction("Set task", ToolBarIcon::prepare("iqnotes/set_task"), QString::null, CTRL+Key_T, this, 0); setTaskA->setToolTip("Set task"); connect(setTaskA, SIGNAL(activated()), this, SLOT(setTask())); //setTaskA->addTo(toolbar); setTaskA->addTo(notePopupMenu); setEventA = new QAction("Set event", ToolBarIcon::prepare("iqnotes/set_event"), QString::null, CTRL+Key_E, this, 0); setEventA->setToolTip("Set event"); connect(setEventA, SIGNAL(activated()), this, SLOT(setEvent())); //setEventA->addTo(toolbar); setEventA->addTo(notePopupMenu); unsetTaskEventID = notePopupMenu->insertItem("Unset", this, SLOT(unsetTaskEvent())); notePopupMenu->insertSeparator(); setReminderID = notePopupMenu->insertItem("Set reminder", this, SLOT(setReminder())); unsetReminderID = notePopupMenu->insertItem("Unset reminder", this, SLOT(unsetReminder())); // View menu viewPopupMenu = new QPopupMenu(this); viewID = menu->insertItem("View", viewPopupMenu); toolbar->addSeparator(); hideNoteA = new QAction("Hide note", ToolBarIcon::prepare("iqnotes/hide_note"), QString::null, Key_1, this, 0 ); hideNoteA->setToolTip("Hide note"); connect(hideNoteA, SIGNAL(activated()), this, SLOT(hideNote())); hideNoteA->addTo(toolbar); hideNoteA->addTo(viewPopupMenu); hideTreeA = new QAction("Hide tree", ToolBarIcon::prepare("iqnotes/hide_tree"), QString::null, Key_2, this, 0 ); hideTreeA->setToolTip("Hide tree"); connect(hideTreeA, SIGNAL(activated()), this, SLOT(hideTree())); hideTreeA->addTo(toolbar); hideTreeA->addTo(viewPopupMenu); halfViewA = new QAction("Half view", ToolBarIcon::prepare("iqnotes/half_view"), QString::null, Key_3, this, 0 ); halfViewA->setToolTip("Half view"); connect(halfViewA, SIGNAL(activated()), this, SLOT(halfView())); halfViewA->addTo(toolbar); halfViewA->addTo(viewPopupMenu); /* viewPopupMenu->insertSeparator(); toggleToolBarID = viewPopupMenu->insertItem("Toggle toolbar", this, SLOT(toggleToolBar())); toggleFullScreenID = viewPopupMenu->insertItem("Toggle fullscreen", this, SLOT(toggleFullScreen())); */ // Options menu optionsPopupMenu = new QPopupMenu(this); optionsID = menu->insertItem("Options", optionsPopupMenu); optionsPopupMenu->insertItem("Define new entry", this, SLOT(defineNewEntry())); optionsPopupMenu->insertItem("Change entry", this, SLOT(changeEntry())); optionsPopupMenu->insertItem("Delete entry", this, SLOT(deleteEntry())); optionsPopupMenu->insertSeparator(); optionsPopupMenu->insertItem("Preferences", this, SLOT(preferenc())); // Help menu helpPopupMenu = new QPopupMenu(this); menu->insertItem("Help", helpPopupMenu); helpPopupMenu->insertItem("About", this, SLOT(about())); addToolBar(toolbar); IQApp = this; // notes = new Notes(this, "bla"); setCentralWidget(notes); connect(notes, SIGNAL(emptyNoteTree()), this, SLOT(isEmptyNoteTree())); connect(notes, SIGNAL(noEmptyNoteTree()), this, SLOT(isNotEmptyNoteTree())); connect(notes, SIGNAL(searchTreeShown()), this, SLOT(searchTreeShown())); connect(notes, SIGNAL(searchTreeClosed()), this, SLOT(searchTreeClosed())); connect(notes, SIGNAL(taskListShown()), this, SLOT(taskListShown())); connect(notes, SIGNAL(taskListClosed()), this, SLOT(taskListClosed())); connect(notes, SIGNAL(eventListShown()), this, SLOT(eventListShown())); connect(notes, SIGNAL(eventListClosed()), this, SLOT(eventListClosed())); connect(notes, SIGNAL(reminderShown()), this, SLOT(reminderShown())); connect(notes, SIGNAL(reminderClosed()), this, SLOT(reminderClosed())); connect(notes, SIGNAL(noteModified(bool)), this, SLOT(setModified(bool))); readConfig(); changeFont(); noNoteTree(); }
void ParallelHelperClient::runTaskInParallel(RefPtr<SharedTask<void ()>> task) { setTask(task); doSomeHelping(); finish(); }