void ModulesManagementWidget::loadModules() { ui->modulesListWidget->clear(); QStringList list = modulesMgmt->getModulesList(); for (int i = 0; i < list.size(); i++) { DeleteableListItem *itemWid = new(std::nothrow) DeleteableListItem(list.at(i)); if (itemWid == NULL) { qFatal("Cannot allocate memory for DeleteableListItem X{"); } else { if (modulesMgmt->getModuleType(list.at(i)) == ModulesManagement::AUTO) { itemWid->setEnableDelete(false); } else { itemWid->setEnableDelete(true); } connect(itemWid, SIGNAL(itemDeleted(QString)), this, SLOT(unload(QString))); QListWidgetItem *item = new(std::nothrow) QListWidgetItem(); if (item == NULL) { qFatal("Cannot allocate memory for QListWidgetItem X{"); } else { ui->modulesListWidget->addItem(item); ui->modulesListWidget->setItemWidget(item, itemWid); } } } ui->modulesListWidget->setCurrentRow(0); ui->modulesListWidget->sortItems(); }
/****************************************************************************** * Delete a specified item from the list. */ void EventListViewBase::deleteEntry(EventListViewItemBase* item, bool setSize) { if (item) { delete item; if (setSize) resizeLastColumn(); emit itemDeleted(); } }
void DownloadManager::clearFinished() { for(int i = count() - 1; i >= 0; i--) { DownloadItem * item = m_items.at(i); if(item->isFinished()) { beginRemoveRows(QModelIndex(), i, i); item->deleteLater(); m_items.removeAt(i); endRemoveRows(); emit itemDeleted(i); } } }
LookAlikeMainPrivate::LookAlikeMainPrivate(LookAlikeMain *q) : QObject(q), m_currentAction(0), q_ptr(q) { // Less correct the problem with the DB first of all, if no other // application has dealt with it first. m_faceRecognitionResetter = new FaceRecognitionResetter(); if (!m_faceRecognitionResetter->isDBCorrected()) { m_faceRecognitionResetter->dealWithDB(1); } m_galleryModel = new GalleryModel(this); m_galleryModel->setFaceRecognitionEnabled(true); QSparqlConnection *connection = m_galleryModel->sparqlConnection(); m_trackerProvider = new TrackerContentProvider(connection, this); m_galleryModel->addContentProvider(m_trackerProvider); m_faceDatabaseProvider = new FaceDatabaseProvider(connection, this); m_faceTrackerProvider = new FaceTrackerProvider(connection, this); m_confirmedContactsListPage = new GalleryPeopleListPage(m_faceTrackerProvider->model()); m_proposedContactsListPage = new GalleryPeopleListPage(m_faceDatabaseProvider); m_gridPage = new GalleryGridPage(*m_galleryModel); m_fullScreenPage = new GalleryFullScreenPage(*m_galleryModel); m_confirmedContactsListPage->setStyleName("GalleryPage"); m_proposedContactsListPage->setStyleName("GalleryPage"); m_gridPage->setStyleName("GalleryPage"); m_fullScreenPage->setStyleName("GalleryPage"); MAction* allTabAction = new MAction("icon-m-toolbar-all-content-white", "", q); allTabAction->setLocation(MAction::ToolBarLocation); allTabAction->setCheckable(true); MAction* confirmedContactsTabAction = new MAction("icon-m-toolbar-known-people-white", "", q); confirmedContactsTabAction->setLocation(MAction::ToolBarLocation); confirmedContactsTabAction->setCheckable(true); MAction* proposedContactsAction = new MAction("icon-m-toolbar-unknown-people-white", "", q); proposedContactsAction->setLocation(MAction::ToolBarLocation); proposedContactsAction->setCheckable(true); MAction* landscapeTabAction = new MAction("icon-m-toolbar-no-people-white", "", q); landscapeTabAction->setLocation(MAction::ToolBarLocation); landscapeTabAction->setCheckable(true); QList<QAction*> actions; actions.append(allTabAction); actions.append(confirmedContactsTabAction); actions.append(proposedContactsAction); actions.append(landscapeTabAction); MToolBar* toolbar = new MToolBar(); toolbar->setStyleName("MToolbarTabStyleInverted"); toolbar->setOpacity(0.9); toolbar->setViewType(MToolBar::tabType); toolbar->addActions(actions); m_toolbarAction = new MWidgetAction(q); m_toolbarAction->setLocation(MAction::ToolBarLocation); m_toolbarAction->setWidget(toolbar); m_confirmFaceAction = new MAction("Confirm faces", q); m_confirmFaceAction->setLocation(MAction::ApplicationMenuLocation); m_deleteFaceAction = new MAction("Delete faces", q); m_deleteFaceAction->setLocation(MAction::ApplicationMenuLocation); m_aboutAction = new MAction("About", q); m_aboutAction->setLocation(MAction::ApplicationMenuLocation); const QPixmap *pixmap = MTheme::pixmap("icon-m-toolbar-view-menu-dimmed-white"); MImageWidget *menuImage = new MImageWidget(); menuImage->setImage(pixmap->toImage()); menuImage->setZoomFactor(1.f); menuImage->setMinimumWidth(88.f); MTheme::releasePixmap(pixmap); MWidgetAction* fakeAction= new MWidgetAction(q); fakeAction->setLocation(MAction::ToolBarLocation); fakeAction->setWidget(menuImage); m_confirmedContactsListPage->addAction(m_toolbarAction); m_confirmedContactsListPage->addAction(fakeAction); m_proposedContactsListPage->addAction(m_toolbarAction); m_proposedContactsListPage->addAction(fakeAction); connect(m_confirmedContactsListPage, SIGNAL(personSelected(QString,QString)), this, SLOT(onConfirmedContactSelected(QString,QString))); connect(m_proposedContactsListPage, SIGNAL(personSelected(QString,QString)), this, SLOT(onProposedContactPersonSelected(QString,QString))); connect(m_gridPage, SIGNAL(multiSelectionDone(QList<QUrl>)), this, SLOT(onMultiSelectionDone(QList<QUrl>))); connect(m_gridPage, SIGNAL(itemSelected(QUrl)), this, SLOT(onItemSelected(QUrl))); connect(m_fullScreenPage, SIGNAL(itemDeleted(QUrl)), m_faceDatabaseProvider, SLOT(update())); connect(m_trackerProvider, SIGNAL(dataChanged()), this, SLOT(onDataChanged())); connect(m_confirmFaceAction, SIGNAL(triggered()), this, SLOT(onConfirmFaceActionTriggered())); connect(m_deleteFaceAction, SIGNAL(triggered()), this, SLOT(onDeleteFaceActionTriggered())); connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(onAboutActionTriggered())); connect(allTabAction, SIGNAL(toggled(bool)), this, SLOT(onAllTabActionToggled(bool))); connect(confirmedContactsTabAction, SIGNAL(toggled(bool)), this, SLOT(onConfirmedContactTabActionToggled(bool))); connect(proposedContactsAction, SIGNAL(toggled(bool)), this, SLOT(onProposedContactTabActionToggled(bool))); connect(landscapeTabAction, SIGNAL(toggled(bool)), this, SLOT(onLandscapeTabActionToggled(bool))); connect(m_gridPage, SIGNAL(appeared()), this, SLOT(onGridPageAppeared())); connect(m_fullScreenPage, SIGNAL(appeared()), this, SLOT(onFullscreenPageAppeared())); connect(m_fullScreenPage, SIGNAL(loadingActiveItemFailed(QString)), m_fullScreenPage, SLOT(disappear())); connect(m_galleryModel, SIGNAL(galleryItemsRemoved(int,int)), this, SLOT(onGalleryItemsRemoved())); allTabAction->toggle(); }
void DeleteableListItem::onDelete() { emit itemDeleted(ui->textLabel->text()); deleteLater(); }