// A folder has been selected, get all images from this folder void MainWindow::on_folderSelection_clicked(const QModelIndex &index) { // Remove the previous image collection if (m_current_images != 0) { // Delete all images for (int i = 0 ; i < m_current_images->size() ; i++) { delete m_current_images->at(i); } for (int i = 0 ; i < m_suppressed_images->size() ; i++) { delete(m_suppressed_images)->at(i); } delete(m_current_images); delete(m_suppressed_images); } // Create the new collection m_current_dir = m_dirModel->filePath(index); m_current_images = retrievePictures(m_current_dir); displayPictures(m_current_images); // Set application elements enabled ui->PhotoTable->setEnabled(true); ui->addButton->setEnabled(true); ui->label->setEnabled(true); ui->searchBox->setEnabled(true); ui->searchResults->setEnabled(true); }
void MainWindow::on_addButton_clicked() { QListWidgetItem* searched_item = new QListWidgetItem( QIcon("delete-icon.png"), ui->searchBox->text()); ui->searchResults->addItem(searched_item); filter_results(searched_item->text()); m_user_tags.append(searched_item->text()); ui->searchBox->clear(); displayPictures(m_current_images); }
void MainWindow::on_searchResults_itemClicked(QListWidgetItem *item) { m_user_tags.removeOne(item->text()); for (int i = 0 ; i < m_suppressed_images->size() ; i++) { int j = 0; while ((j < m_user_tags.size()) && (m_suppressed_images->at(i)->m_tags.contains(m_user_tags.at(j)))) { j++; } if (j == m_user_tags.size()) { m_current_images->append(m_suppressed_images->at(i)); m_suppressed_images->removeAt(i); i--; } } delete ui->searchResults->takeItem(ui->searchResults->currentRow()); displayPictures(m_current_images); }
void MainWindow::resizeEvent(QResizeEvent* resizeEvent) { QMainWindow::resizeEvent(resizeEvent); if (m_current_dir.path() != "") displayPictures(m_current_images); }
bool TestingWidgetFacade::connectToTestingTaskWidget(QObject* testingtaskwidget) { if(!QObject::connect(this, SIGNAL(showTaskText(QString)), testingtaskwidget, SLOT(displayTaskText(QString)), Qt::AutoConnection)) { return 0; } if(!QObject::connect(this, SIGNAL(showTaskAnswers(QString)), testingtaskwidget, SLOT(displayTaskAnswers(QString)), Qt::AutoConnection)) { return 0; } if(!QObject::connect(this, SIGNAL(showTaskPicture(QString)), testingtaskwidget, SLOT(displayPicture(QString)), Qt::AutoConnection)) { return 0; } if(!QObject::connect(this, SIGNAL(showTaskPicture(QStringList)), testingtaskwidget, SLOT(displayPictures(QStringList)), Qt::AutoConnection)) { return 0; } if(!QObject::connect(this, SIGNAL(clearImages()), testingtaskwidget, SLOT(clearPictures()), Qt::AutoConnection)) { return 0; } if(!QObject::connect(this, SIGNAL(clearTestTask()), testingtaskwidget, SLOT(clearAll()), Qt::AutoConnection)) { return 0; } return 1; }