Ejemplo n.º 1
0
/**
 * Saves the selected pictures.
 * First pops up a dialog box asking for the target dir. Then pops up 
 * a progress dialog for feedback.
 */
void MainWindow::saveSelected() 
{
    /* Select target */
    selectWorkDir();

    /* Create a progress dialog */
    QProgressDialog* progress = new QProgressDialog(
        i18n("Downloading ..."), i18n("Cancel"), 100, this, "progress", TRUE);
    progress->setCaption("Download");
    connect(GPMessenger::instance(),SIGNAL(progressChanged(int)),
            progress,SLOT(setProgress(int)));
    progress->setAutoReset(false);
    progress->setAutoClose(false); 
    progress->setProgress(0);
    KApplication::kApplication()->processEvents();
     
    /* Download all pictures */
    for (QIconViewItem *i = iconView->firstItem(); 
                    i && !progress->wasCancelled(); i = i->nextItem() ) {
        if (i->isSelected()) {
            /* Update progress dialog */
            progress->setLabelText(i18n("Downloading ") + i->text() + "...");

            /* Download picture */
            GPInterface::downloadPicture(i->text(),"/");
        }
    } 

    progress->setProgress(100);
    delete progress;
}
Ejemplo n.º 2
0
void MontageView::removeItem()
{
  QIconViewItem* item = currentItem(); 
  if( item ) {
    emit removedItem( item->text() );
    delete item;
    arrangeItemsInGrid();
  }
}
Ejemplo n.º 3
0
/**
 * Deletes the selected files (after asking for confirmation).
 */
void MainWindow::deleteSelected()
{
    if (KMessageBox::questionYesNo(this, 
        i18n("Are you sure you want to delete the selected pictures ?"), 
        i18n("Delete")) == KMessageBox::Yes) {

        try {
        for (QIconViewItem *i = iconView->firstItem();i; i=i->nextItem()) {
            if (i->isSelected()) {
                statusBar()->message(i18n("Deleting ") + i->text() + " ...");
                GPInterface::deletePicture(i->text(),"/");
                delete i;
                iconView->arrangeItemsInGrid();
            }
        }
        statusBar()->message(i18n("Done"));
        } catch (QString err) { 
            KMessageBox::error(this, err); 
            statusBar()->message(i18n("Error"), MESSAGE_TIME);
        }
    }
}
Ejemplo n.º 4
0
void MontageView::resetIcons()
{
  if( !m_dirty )
    return;

  m_dirty = false;

  // FixMe: This should be optimized by caching the old images instead
  for( QIconViewItem* item = firstItem(); item; item = item->nextItem() ) {
    QPixmap pm = *item->pixmap();
    QSize size = pm.size();
    QImage icon( item->text() );
    pm = icon.smoothScale( size );
  }

}
Ejemplo n.º 5
0
void IconViewEditor::applyClicked()
{
    QIconViewItem *i = 0;
    QValueList<PopulateIconViewCommand::Item> items;
    for ( i = preview->firstItem(); i; i = i->nextItem() ) {
	PopulateIconViewCommand::Item item;
	if ( i->pixmap() )
	    item.pix = *i->pixmap();
	item.text = i->text();
	items.append( item );
    }

    PopulateIconViewCommand *cmd = new PopulateIconViewCommand( tr( "Edit Items of '%1'" ).arg( iconview->name() ),
								formwindow, iconview, items );
    cmd->execute();
    formwindow->commandHistory()->addCommand( cmd );
}
Ejemplo n.º 6
0
IconViewEditor::IconViewEditor( QWidget *parent, QWidget *editWidget, FormWindow *fw )
    : IconViewEditorBase( parent, 0, TRUE ), formwindow( fw )
{
    connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) );
    iconview = (QIconView*)editWidget;

    itemText->setText( "" );
    itemText->setEnabled( FALSE );
    itemPixmap->setText( "" );
    itemChoosePixmap->setEnabled( FALSE );
    itemDeletePixmap->setEnabled( FALSE );

    QIconViewItem *i = 0;
    for ( i = iconview->firstItem(); i; i = i->nextItem() ) {
	(void)new QIconViewItem( preview, i->text(), *i->pixmap()  );
    }

    if ( preview->firstItem() )
	preview->setCurrentItem( preview->firstItem() );
}
Ejemplo n.º 7
0
void ClusterPalette::showUserClusterInformation(int electrodeGroupId) {
    //update the flag
    isInUserClusterInfoMode = true;

    iconView->setItemTextPos(QIconView::Right);
    iconView->setGridX(2500);
    iconView->arrangeItemsInGrid();

    QMap<int,ClusterUserInformation> clusterUserInformationMap = QMap<int,ClusterUserInformation>();
    doc->data().getClusterUserInformation(electrodeGroupId,clusterUserInformationMap);

    ItemColors& clusterColors = doc->clusterColors();
    int clusterId;
    ClusterUserInformation currentClusterInformation;

    for(QIconViewItem* item = iconView->firstItem(); item; item = item->nextItem()) {
        clusterId = clusterColors.itemId(item->index());

        QString clusterText = item->text();

        if(clusterId == 0) {
            clusterText.append(" - ").append("artefact");
        }
        else if(clusterId == 1) {
            clusterText.append(" - ").append("noise");
        }
        else {
            currentClusterInformation = clusterUserInformationMap[clusterId];
            bool first = true;

            if(currentClusterInformation.getStructure() != "") {
                first = false;
                clusterText.append(" - ").append(currentClusterInformation.getStructure());
            }
            if(currentClusterInformation.getType() != "") {
                if(!first) {
                    clusterText.append(", ").append(currentClusterInformation.getType());
                }
                else {
                    clusterText.append(" - ").append(currentClusterInformation.getType());
                    first = false;
                }
            }
            if(currentClusterInformation.getId() != "") {
                if(!first) {
                    clusterText.append(", ").append(currentClusterInformation.getId());
                }
                else {
                    clusterText.append(" - ").append(currentClusterInformation.getId());
                    first = false;
                }
            }
            if(currentClusterInformation.getQuality() != "") {
                if(!first) {
                    clusterText.append(", ").append(currentClusterInformation.getQuality());
                }
                else {
                    clusterText.append(" - ").append(currentClusterInformation.getQuality());
                    first = false;
                }
            }
            if(currentClusterInformation.getNotes() != "") {
                if(!first) {
                    clusterText.append(", ").append(currentClusterInformation.getNotes());
                }
                else {
                    clusterText.append(" - ").append(currentClusterInformation.getNotes());
                    first = false;
                }
            }
        }
        item->setText(clusterText);
    }
    iconView->setWordWrapIconText(false);
    iconView->adjustSize();
}