void TaskQueue::wakeThread() { if (!_thread) { _thread = new QThread(); _worker = new TaskQueueWorker(this); _worker->moveToThread(_thread); connect(this, SIGNAL(taskAdded()), _worker, SLOT(onTaskAdded())); connect(_worker, SIGNAL(taskProcessed()), this, SLOT(onTaskProcessed())); _thread->start(); } if (_stopTimer) _stopTimer->stop(); emit taskAdded(); }
void XcodebuildParser::stdOutput(const QString &line) { const QString lne = rightTrimmed(line); if (m_buildRe.indexIn(lne) > -1) { m_xcodeBuildParserState = InXcodebuild; m_lastTarget = m_buildRe.cap(2); m_lastProject = m_buildRe.cap(3); return; } if (m_xcodeBuildParserState == InXcodebuild || m_xcodeBuildParserState == UnknownXcodebuildState) { if (m_successRe.indexIn(lne) > -1) { m_xcodeBuildParserState = OutsideXcodebuild; return; } if (m_replacingSignatureRe.indexIn(lne) > -1) { Task task(Task::Warning, QCoreApplication::translate("ProjectExplorer::XcodebuildParser", "Replacing signature"), Utils::FileName::fromString(m_replacingSignatureRe.cap(1)), /* filename */ -1, /* line */ Constants::TASK_CATEGORY_COMPILE); taskAdded(task); return; } IOutputParser::stdError(line); } else { IOutputParser::stdOutput(line); } }
void ControllerTests::initTestCase () { QFileInfo file( m_localPath ); if ( file.exists() ) { qDebug() << "test database file exists, deleting"; QDir dir( file.absoluteDir() ); QVERIFY( dir.remove( file.fileName() ) ); } m_configuration.installationId = 1; m_configuration.user.setId( 1 ); m_configuration.localStorageType = CHARM_SQLITE_BACKEND_DESCRIPTOR; m_configuration.localStorageDatabase = m_localPath; m_configuration.newDatabase = true; auto controller = new Controller; m_controller = controller; // connect( controller, SIGNAL(currentEvents(EventList)), // SLOT(slotCurrentEvents(EventList)) ); connect( controller, SIGNAL(definedTasks(TaskList)), SLOT(slotDefinedTasks(TaskList)) ); connect( controller, SIGNAL(taskAdded(Task)), SLOT(slotTaskAdded(Task)) ); connect( controller, SIGNAL(taskUpdated(Task)), SLOT(slotTaskUpdated(Task)) ); connect( controller, SIGNAL(taskDeleted(Task)), SLOT(slotTaskDeleted(Task)) ); }
IOutputParser *IOutputParser::takeOutputParserChain() { IOutputParser *parser = m_parser; disconnect(parser, SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat)), this, SLOT(outputAdded(QString,ProjectExplorer::BuildStep::OutputFormat))); disconnect(parser, SIGNAL(addTask(ProjectExplorer::Task)), this, SLOT(taskAdded(ProjectExplorer::Task))); m_parser = 0; return parser; }
TaskId TaskQueue::addTask(TaskPtr task) { { QMutexLocker lock(&_tasksToProcessMutex); _tasksToProcess.push_back(task); } if (!_thread) { _thread = new QThread(); _worker = new TaskQueueWorker(this); _worker->moveToThread(_thread); connect(this, SIGNAL(taskAdded()), _worker, SLOT(onTaskAdded())); connect(_worker, SIGNAL(taskProcessed()), this, SLOT(onTaskProcessed())); _thread->start(); } if (_stopTimer) _stopTimer->stop(); emit taskAdded(); return task->id(); }
bool Controller::addTask( const Task& task ) { qDebug() << Q_FUNC_INFO << "adding task" << task.id() << "to parent" << task.parent(); if ( m_storage->addTask( task ) ) { updateSubscriptionForTask( task ); emit taskAdded( task ); return true; } else { Q_ASSERT( false ); // impossible return false; } }
void TaskManager::windowAdded(WId w ) { NETWinInfo info(qt_xdisplay(), w, qt_xrootwin(), NET::WMWindowType | NET::WMPid | NET::WMState ); #ifdef KDE_3_2 NET::WindowType windowType = info.windowType(NET_ALL_TYPES_MASK); #else NET::WindowType windowType = info.windowType(); #endif // ignore NET::Tool and other special window types if (windowType != NET::Normal && windowType != NET::Override && windowType != NET::Unknown && windowType != NET::Dialog) return; // ignore windows that want to be ignored by the taskbar if ((info.state() & NET::SkipTaskbar) != 0) { _skiptaskbar_windows.push_front( w ); // remember them though return; } Window transient_for_tmp; if (XGetTransientForHint(qt_xdisplay(), (Window) w, &transient_for_tmp)) { WId transient_for = (WId) transient_for_tmp; // check if it's transient for a skiptaskbar window if (_skiptaskbar_windows.contains(transient_for)) return; // lets see if this is a transient for an existing task if (transient_for != qt_xrootwin() && transient_for != 0 ) { Task* t = findTask(transient_for); if (t) { if (t->window() != w) { t->addTransient(w); // kdDebug() << "TM: Transient " << w << " added for Task: " << t->window() << endl; } return; } } } Task* t = new Task(w, this); _tasks.append(t); // kdDebug() << "TM: Task added for WId: " << w << endl; emit taskAdded(t); }
void IOutputParser::appendOutputParser(IOutputParser *parser) { if (!parser) return; if (m_parser) { m_parser->appendOutputParser(parser); return; } m_parser = parser; connect(parser, SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat)), this, SLOT(outputAdded(QString,ProjectExplorer::BuildStep::OutputFormat)), Qt::DirectConnection); connect(parser, SIGNAL(addTask(ProjectExplorer::Task)), this, SLOT(taskAdded(ProjectExplorer::Task)), Qt::DirectConnection); }
void TaskModel::init() { Q_ASSERT(tasks_.isEmpty()); const QHash<TaskId, Task> tasks = storageEngines_.syncTasks(); foreach (const Task & task, tasks) { tasks_[task.getId()] = task; emit taskAdded(task); if (task.isOverdue()) { overdueTasks_ << task.getId(); if (overdueTasks_.size() == 1) emit hasOverdueTasks(true); } }
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)) ); }
void XcodebuildParser::stdError(const QString &line) { const QString lne = rightTrimmed(line); if (m_failureRe.indexIn(lne) > -1) { ++m_fatalErrorCount; m_xcodeBuildParserState = UnknownXcodebuildState; // unfortunately the m_lastTarget, m_lastProject might not be in sync Task task(Task::Error, QCoreApplication::translate("ProjectExplorer::XcodebuildParser", "Xcodebuild failed."), Utils::FileName(), /* filename */ -1, /* line */ Constants::TASK_CATEGORY_COMPILE); taskAdded(task); return; } if (m_xcodeBuildParserState == OutsideXcodebuild) { // also forward if UnknownXcodebuildState ? IOutputParser::stdError(line); return; } }
TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate) { d->m_defaultHandler = 0; d->m_model = new Internal::TaskModel(this); d->m_filter = new Internal::TaskFilterModel(d->m_model); d->m_listview = new Internal::TaskView; d->m_listview->setModel(d->m_filter); d->m_listview->setFrameStyle(QFrame::NoFrame); d->m_listview->setWindowTitle(tr("Issues")); d->m_listview->setSelectionMode(QAbstractItemView::SingleSelection); Internal::TaskDelegate *tld = new Internal::TaskDelegate(this); d->m_listview->setItemDelegate(tld); d->m_listview->setWindowIcon(QIcon(QLatin1String(Constants::ICON_WINDOW))); d->m_listview->setContextMenuPolicy(Qt::ActionsContextMenu); d->m_listview->setAttribute(Qt::WA_MacShowFocusRect, false); d->m_taskWindowContext = new Internal::TaskWindowContext(d->m_listview); d->m_taskHub = taskhub; Core::ICore::addContextObject(d->m_taskWindowContext); connect(d->m_listview->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), tld, SLOT(currentChanged(QModelIndex,QModelIndex))); connect(d->m_listview, SIGNAL(activated(QModelIndex)), this, SLOT(triggerDefaultHandler(QModelIndex))); d->m_contextMenu = new QMenu(d->m_listview); connect(d->m_contextMenu, SIGNAL(triggered(QAction*)), this, SLOT(contextMenuEntryTriggered(QAction*))); d->m_listview->setContextMenuPolicy(Qt::CustomContextMenu); connect(d->m_listview, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); d->m_filterWarningsButton = createFilterButton(d->m_model->taskTypeIcon(Task::Warning), tr("Show Warnings"), this, SLOT(setShowWarnings(bool))); d->m_categoriesButton = new QToolButton; d->m_categoriesButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_FILTER))); d->m_categoriesButton->setToolTip(tr("Filter by categories")); d->m_categoriesButton->setProperty("noArrow", true); d->m_categoriesButton->setAutoRaise(true); d->m_categoriesButton->setPopupMode(QToolButton::InstantPopup); d->m_categoriesMenu = new QMenu(d->m_categoriesButton); connect(d->m_categoriesMenu, SIGNAL(aboutToShow()), this, SLOT(updateCategoriesMenu())); connect(d->m_categoriesMenu, SIGNAL(triggered(QAction*)), this, SLOT(filterCategoryTriggered(QAction*))); d->m_categoriesButton->setMenu(d->m_categoriesMenu); connect(d->m_taskHub, SIGNAL(categoryAdded(Core::Id,QString,bool)), this, SLOT(addCategory(Core::Id,QString,bool))); connect(d->m_taskHub, SIGNAL(taskAdded(ProjectExplorer::Task)), this, SLOT(addTask(ProjectExplorer::Task))); connect(d->m_taskHub, SIGNAL(taskRemoved(ProjectExplorer::Task)), this, SLOT(removeTask(ProjectExplorer::Task))); connect(d->m_taskHub, SIGNAL(taskLineNumberUpdated(uint,int)), this, SLOT(updatedTaskLineNumber(uint,int))); connect(d->m_taskHub, SIGNAL(taskFileNameUpdated(uint,QString)), this, SLOT(updatedTaskFileName(uint,QString))); connect(d->m_taskHub, SIGNAL(tasksCleared(Core::Id)), this, SLOT(clearTasks(Core::Id))); connect(d->m_taskHub, SIGNAL(categoryVisibilityChanged(Core::Id,bool)), this, SLOT(setCategoryVisibility(Core::Id,bool))); connect(d->m_taskHub, SIGNAL(popupRequested(bool)), this, SLOT(popup(bool))); connect(d->m_taskHub, SIGNAL(showTask(uint)), this, SLOT(showTask(uint))); }