Exemple #1
0
void NewGameTab::filterImages(const QStringList& filter)
{
	// Filter items
	QListWidgetItem* item;
	int count = m_images->count();
	for (int i = 0; i < count; ++i) {
		item = m_images->item(i);
		item->setHidden(!filter.contains(item->data(ImageRole).toString()));
	}

	// Select next item if current item was hidden
	item = m_images->currentItem();
	if (!item || item->isHidden()) {
		int count = m_images->count();
		for (int i = 0; i < count; ++i) {
			item = m_images->item(i);
			if (!item->isHidden()) {
				item->setSelected(true);
				m_images->setCurrentItem(item);
				break;
			}
		}
	}

	// Disable tag button if no images are visible
	item = m_images->currentItem();
	m_tag_action->setEnabled(item && !item->isHidden());
}
//OK pressed
void UpdateAvailiableDialog::on_buttonBox_accepted()
{
    QListWidgetItem *AppItem = ui->listWidget->item(0);
    QListWidgetItem *UpdateItem = ui->listWidget->item(1);
    //check if any updates are selected
    bool UpdateApp = (!AppItem->isHidden() && AppItem->checkState() == Qt::Checked);
    bool UpdateUpdater = (!UpdateItem->isHidden() && UpdateItem->checkState() == Qt::Checked);

    emit Update(UpdateApp,UpdateUpdater);
}
Exemple #3
0
void NewGameTab::editImageProperties()
{
	QListWidgetItem* item = m_images->currentItem();
	if (!item || item->isHidden()) {
		return;
	}

	QString filename = item->data(ImageRole).toString();
	ImagePropertiesDialog dialog(item->icon(), item->text(), m_image_tags, filename, window());
	if (dialog.exec() == QDialog::Accepted) {
		// Update name
		item->setText(dialog.name());
		if (item->text() != item->data(NameRole).toString()) {
			item->setData(NameRole, item->text());

			QSettings details(Path::image("details"), QSettings::IniFormat);
			details.setValue(filename + "/Name", item->text());
			emit imageRenamed(filename, item->text());

			m_images->sortItems();
			m_images->scrollToItem(item);
		}

		// Update tags
		item->setData(TagsRole, m_image_tags->tags(item->data(ImageRole).toString()));
		updateToolTip(item);

	}
}
Exemple #4
0
std::vector<App::DocumentObject*> TaskFeaturePick::buildFeatures() {

    int index = 0;
    std::vector<App::DocumentObject*> result;
    auto activeBody = PartDesignGui::getBody(false);
    if (!activeBody)
        return result;
    auto activePart = PartDesignGui::getPartFor(activeBody, false);

    for (std::vector<featureStatus>::const_iterator st = statuses.begin(); st != statuses.end(); st++) {
        QListWidgetItem* item = ui->listWidget->item(index);

        if(item->isSelected() && !item->isHidden()) {

            QString t = item->text();
            t = t.left(t.indexOf(QString::fromLatin1("(")) - 1);
            auto obj = App::GetApplication().getActiveDocument()->getObject(t.toLatin1().data());

            //build the dependend copy or reference if wanted by the user
            if(*st == otherBody  ||
               *st == otherPart  ||
               *st == notInBody ) {

                if(!ui->radioXRef->isChecked()) {
                    auto copy = makeCopy(obj, "", ui->radioIndependent->isChecked());

                    if(*st == otherBody)
                        activeBody->addFeature(copy);
                    else if(*st == otherPart) {
                        auto oBody = PartDesignGui::getBodyFor(obj, false);
                        if(!oBody)
                            activePart->addObject(copy);
                        else
                            activeBody->addFeature(copy);
                    }
                    else if(*st == notInBody) {
                        activeBody->addFeature(copy);
                        // doesn't supposed to get here anything but sketch but to be on the safe side better to check
                        if (copy->getTypeId().isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) {
                            Sketcher::SketchObject *sketch = static_cast<Sketcher::SketchObject*>(copy);
                            PartDesignGui::fixSketchSupport(sketch);
                        }
                    }
                    result.push_back(copy);
                }
                else
                    result.push_back(obj);
            }
            else
                result.push_back(obj);

            break;
        }

        index++;
    }

    return result;
}
void ImHistoryBrowser::getSelectedItems(std::list<uint32_t> &items)
{
    QList<QListWidgetItem*> itemWidgets = ui.listWidget->selectedItems();

    QList<QListWidgetItem*>::iterator it;
    for (it = itemWidgets.begin(); it != itemWidgets.end(); ++it) {
        QListWidgetItem *item = *it;
        if (item->isHidden()) {
            continue;
        }
        items.push_back(item->data(ROLE_MSGID).toString().toInt());
    }
}
Exemple #6
0
void EffectsListView::filterList(int pos)
{
    QListWidgetItem *item;
    for (int i = 0; i < m_effectsList->count(); i++) {
        item = m_effectsList->item(i);
        if (pos == 0) item->setHidden(false);
        else if (item->data(Qt::UserRole).toInt() == pos) item->setHidden(false);
        else item->setHidden(true);
    }
    item = m_effectsList->currentItem();
    if (item) {
        if (item->isHidden()) {
            int i;
            for (i = 0; i < m_effectsList->count() && m_effectsList->item(i)->isHidden(); i++) /*do nothing*/;
            m_effectsList->setCurrentRow(i);
        } else m_effectsList->scrollToItem(item);
    }
}
void AlbumCoverManager::FetchAlbumCovers() {
  for (int i = 0; i < ui_->albums->count(); ++i) {
    QListWidgetItem* item = ui_->albums->item(i);
    if (item->isHidden()) continue;
    if (item->icon().cacheKey() != no_cover_icon_.cacheKey()) continue;

    quint64 id =
        cover_fetcher_->FetchAlbumCover(item->data(Role_ArtistName).toString(),
                                        item->data(Role_AlbumName).toString());
    cover_fetching_tasks_[id] = item;
    jobs_++;
  }

  if (!cover_fetching_tasks_.isEmpty()) ui_->fetch->setEnabled(false);

  progress_bar_->setMaximum(jobs_);
  progress_bar_->show();
  abort_progress_->show();
  fetch_statistics_ = CoverSearchStatistics();
  UpdateStatusText();
}
void ObjectExplorer::objectTextEdited(const QString& text)
{
  QListWidgetItem * item = nullptr;
  for(int i=0; i<mObjectList->count(); i++){
    item = mObjectList->item(i);
    item->setHidden(!item->text().contains(text, Qt::CaseInsensitive));
  }

  QList<QListWidgetItem *> items;
  items = mGroupList->selectedItems();
  if(items.size()){
    for(int i=0; i<items.size(); i++){
      item = items.at(i);
    }
  }
  else{
    for(int i=0; i<mGroupList->count(); i++){
      item = mGroupList->item(i);
      if(!item->isHidden()){
        items.push_back(item);
      }
    }
  }

  bool match = false;
  for(int i=0; i<mObjectList->count(); i++){
    if(!mObjectList->item(i)->isHidden()){
      for(int j=0; j<items.size(); j++){
        match = false;
        if(items.at(j)->text() == mObjectList->item(i)->whatsThis()){
          match = true;
          break;
        }
      }
      if(!match){
        mObjectList->item(i)->setHidden(true);
      }
    }
  }
}
void AlbumCoverManager::ExportCovers() {
  AlbumCoverExport::DialogResult result = cover_export_->Exec();

  if (result.cancelled_) {
    return;
  }

  DisableCoversButtons();

  cover_exporter_->SetDialogResult(result);

  for (int i = 0; i < ui_->albums->count(); ++i) {
    QListWidgetItem* item = ui_->albums->item(i);

    // skip hidden and coverless albums
    if (item->isHidden() ||
        item->icon().cacheKey() == no_cover_icon_.cacheKey()) {
      continue;
    }

    cover_exporter_->AddExportRequest(ItemAsSong(item));
  }

  if (cover_exporter_->request_count() > 0) {
    progress_bar_->setMaximum(cover_exporter_->request_count());
    progress_bar_->show();
    abort_progress_->show();

    cover_exporter_->StartExporting();
  } else {
    QMessageBox msg;
    msg.setWindowTitle(tr("Export finished"));
    msg.setText(tr("No covers to export."));
    msg.exec();
  }
}
std::vector<App::DocumentObject*> TaskFeaturePick::buildFeatures()
{
    int index = 0;
    std::vector<App::DocumentObject*> result;
    try {
        auto activeBody = PartDesignGui::getBody(false);
        if (!activeBody)
            return result;

        auto activePart = PartDesignGui::getPartFor(activeBody, false);

        for (std::vector<featureStatus>::const_iterator st = statuses.begin(); st != statuses.end(); st++) {
            QListWidgetItem* item = ui->listWidget->item(index);

            if (item->isSelected() && !item->isHidden()) {
                QString t = item->data(Qt::UserRole).toString();
                auto obj = App::GetApplication().getDocument(documentName.c_str())->getObject(t.toLatin1().data());

                //build the dependent copy or reference if wanted by the user
                if (*st == otherBody || *st == otherPart || *st == notInBody) {
                    if (!ui->radioXRef->isChecked()) {
                        auto copy = makeCopy(obj, "", ui->radioIndependent->isChecked());

                        if (*st == otherBody) {
                            activeBody->addObject(copy);
                        }
                        else if (*st == otherPart) {
                            auto oBody = PartDesignGui::getBodyFor(obj, false);
                            if (!oBody)
                                activePart->addObject(copy);
                            else
                                activeBody->addObject(copy);
                        }
                        else if (*st == notInBody) {
                            activeBody->addObject(copy);
                            // doesn't supposed to get here anything but sketch but to be on the safe side better to check
                            if (copy->getTypeId().isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) {
                                Sketcher::SketchObject *sketch = static_cast<Sketcher::SketchObject*>(copy);
                                PartDesignGui::fixSketchSupport(sketch);
                            }
                        }
                        result.push_back(copy);
                    }
                    else {
                        result.push_back(obj);
                    }
                }
                else {
                    result.push_back(obj);
                }

                break;
            }

            index++;
        }
    }
    catch (const Base::Exception& e) {
        e.ReportException();
    }
    catch (Py::Exception& e) {
        // reported by code analyzers
        e.clear();
        Base::Console().Warning("Unexpected PyCXX exception\n");
    }
    catch (const boost::exception&) {
        // reported by code analyzers
        Base::Console().Warning("Unexpected boost exception\n");
    }

    return result;
}