Exemple #1
0
// this slot handles auto-selection of items.
void FolderView::onAutoSelectionTimeout() {
  if(QApplication::mouseButtons() != Qt::NoButton)
    return;

  Qt::KeyboardModifiers mods = QApplication::keyboardModifiers();
  QPoint pos = view->viewport()->mapFromGlobal(QCursor::pos()); // convert to viewport coordinates
  QModelIndex index = view->indexAt(pos); // find out the hovered item
  QItemSelectionModel::SelectionFlags flags = (mode == DetailedListMode ? QItemSelectionModel::Rows : QItemSelectionModel::NoUpdate);
  QItemSelectionModel* selModel = view->selectionModel();

  if(mods & Qt::ControlModifier) { // Ctrl key is pressed
    if(selModel->isSelected(index) && index != lastAutoSelectionIndex_) {
      // unselect a previously selected item
      selModel->select(index, flags|QItemSelectionModel::Deselect);
      lastAutoSelectionIndex_ = QModelIndex();
    }
    else {
      // select an unselected item
      selModel->select(index, flags|QItemSelectionModel::Select);
      lastAutoSelectionIndex_ = index;
    }
    selModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); // move the cursor
  }
  else if(mods & Qt::ShiftModifier) { // Shift key is pressed
    // select all items between current index and the hovered index.
    QModelIndex current = selModel->currentIndex();
    if(selModel->hasSelection() && current.isValid()) {
      selModel->clear(); // clear old selection
      selModel->setCurrentIndex(current, QItemSelectionModel::NoUpdate);
      int begin = current.row();
      int end = index.row();
      if(begin > end)
        qSwap(begin, end);
      for(int row = begin; row <= end; ++row) {
        QModelIndex sel = model_->index(row, 0);
        selModel->select(sel, flags|QItemSelectionModel::Select);
      }
    }
    else { // no items are selected, select the hovered item.
      if(index.isValid()) {
        selModel->select(index, flags|QItemSelectionModel::SelectCurrent);
        selModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
      }
    }
    lastAutoSelectionIndex_ = index;
  }
  else if(mods == Qt::NoModifier) { // no modifier keys are pressed.
    if(index.isValid()) {
      // select the hovered item
      view->clearSelection();
      selModel->select(index, flags|QItemSelectionModel::SelectCurrent);
      selModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
    }
    lastAutoSelectionIndex_ = index;
  }

  autoSelectionTimer_->deleteLater();
  autoSelectionTimer_ = nullptr;
}
SceneInspector::SceneInspector(ProbeInterface *probe, QObject *parent)
  : SceneInspectorInterface(parent),
    m_propertyController(new PropertyController("com.kdab.GammaRay.SceneInspector", this)),
    m_clientConnected(false)
{
  Server::instance()->registerMonitorNotifier(Endpoint::instance()->objectAddress(objectName()), this, "clientConnectedChanged");

  registerGraphicsViewMetaTypes();
  registerVariantHandlers();

  connect(probe->probe(), SIGNAL(objectSelected(QObject*,QPoint)),
          SLOT(objectSelected(QObject*,QPoint)));

  ObjectTypeFilterProxyModel<QGraphicsScene> *sceneFilterProxy =
    new ObjectTypeFilterProxyModel<QGraphicsScene>(this);
  sceneFilterProxy->setSourceModel(probe->objectListModel());
  SingleColumnObjectProxyModel *singleColumnProxy = new SingleColumnObjectProxyModel(this);
  singleColumnProxy->setSourceModel(sceneFilterProxy);
  probe->registerModel("com.kdab.GammaRay.SceneList", singleColumnProxy);

  QItemSelectionModel* sceneSelection = ObjectBroker::selectionModel(singleColumnProxy);
  connect(sceneSelection, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
          this, SLOT(sceneSelected(QItemSelection)));

  m_sceneModel = new SceneModel(this);
  probe->registerModel("com.kdab.GammaRay.SceneGraphModel", m_sceneModel);
  m_itemSelectionModel = ObjectBroker::selectionModel(m_sceneModel);
  connect(m_itemSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
          this, SLOT(sceneItemSelected(QItemSelection)));

  if (singleColumnProxy->rowCount()) {
    sceneSelection->setCurrentIndex(singleColumnProxy->index(0, 0), QItemSelectionModel::ClearAndSelect);
  }
}
void FolderNavigationWidget::setCurrentFile(Core::IEditor *editor)
{
    if (!editor)
        return;

    const QString filePath = editor->document()->filePath().toString();
    // Try to find directory of current file
    bool pathOpened = false;
    if (!filePath.isEmpty())  {
        const QFileInfo fi(filePath);
        if (fi.exists())
            pathOpened = setCurrentDirectory(fi.absolutePath());
    }
    if (!pathOpened)  // Default to home.
        setCurrentDirectory(Utils::PathChooser::homePath());

    // Select the current file.
    if (pathOpened) {
        const QModelIndex fileIndex = m_fileSystemModel->index(filePath);
        if (fileIndex.isValid()) {
            QItemSelectionModel *selections = m_listView->selectionModel();
            const QModelIndex mainIndex = m_filterModel->mapFromSource(fileIndex);
            selections->setCurrentIndex(mainIndex, QItemSelectionModel::SelectCurrent
                                                 | QItemSelectionModel::Clear);
            m_listView->scrollTo(mainIndex);
        }
    }
}
Exemple #4
0
/**
 * Synchronizes the selection with the given stamp. Ignored when the stamp is
 * changing because of a selection change in the TilesetDock.
 */
void TilesetDock::selectTilesInStamp(const TileStamp &stamp)
{
    if (mEmittingStampCaptured)
        return;

    QSet<Tile*> processed;
    QMap<QItemSelectionModel*, QItemSelection> selections;

    for (const TileStampVariation &variation : stamp.variations()) {
        const TileLayer &tileLayer = *variation.tileLayer();
        for (const Cell &cell : tileLayer) {
            if (Tile *tile = cell.tile) {
                if (processed.contains(tile))
                    continue;

                processed.insert(tile); // avoid spending time on duplicates

                Tileset *tileset = tile->tileset();
                int tilesetIndex = mTilesets.indexOf(tileset->sharedPointer());
                if (tilesetIndex != -1) {
                    TilesetView *view = tilesetViewAt(tilesetIndex);
                    if (!view->model()) // Lazily set up the model
                        setupTilesetModel(view, tileset);

                    const TilesetModel *model = view->tilesetModel();
                    const QModelIndex modelIndex = model->tileIndex(tile);
                    QItemSelectionModel *selectionModel = view->selectionModel();
                    selections[selectionModel].select(modelIndex, modelIndex);
                }
            }
        }
    }

    if (!selections.isEmpty()) {
        mSynchronizingSelection = true;

        // Mark captured tiles as selected
        for (auto i = selections.constBegin(); i != selections.constEnd(); ++i) {
            QItemSelectionModel *selectionModel = i.key();
            const QItemSelection &selection = i.value();
            selectionModel->select(selection, QItemSelectionModel::SelectCurrent);
        }

        // Show/edit properties of all captured tiles
        mMapDocument->setSelectedTiles(processed.toList());

        // Update the current tile (useful for animation and collision editors)
        auto first = selections.begin();
        QItemSelectionModel *selectionModel = first.key();
        const QItemSelection &selection = first.value();
        const QModelIndex currentIndex = selection.first().topLeft();
        if (selectionModel->currentIndex() != currentIndex)
            selectionModel->setCurrentIndex(currentIndex, QItemSelectionModel::NoUpdate);
        else
            currentChanged(currentIndex);

        mSynchronizingSelection = false;
    }
}
// Refreshner.
void drumkv1widget_elements::refresh (void)
{
	if (m_pModel == NULL)
		return;

	QItemSelectionModel *pSelectionModel = QTreeView::selectionModel();
	const QModelIndex& index = pSelectionModel->currentIndex();

	m_pModel->reset();

	pSelectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
}
Exemple #6
0
void ObjectTypesEditor::addObjectType()
{
    const QModelIndex newIndex = mObjectTypesModel->addNewObjectType();

    // Select and focus the new row and ensure it is visible
    QItemSelectionModel *sm = mUi->objectTypesTable->selectionModel();
    sm->select(newIndex,
               QItemSelectionModel::ClearAndSelect |
               QItemSelectionModel::Rows);
    sm->setCurrentIndex(newIndex, QItemSelectionModel::Current);
    mUi->objectTypesTable->edit(newIndex);
}
// Refreshner.
void qtractorMidiEventListView::refresh (void)
{
	if (m_pListModel == NULL)
		return;

	QItemSelectionModel *pSelectionModel = QTreeView::selectionModel();

	const QModelIndex& index = pSelectionModel->currentIndex();

	m_pListModel->reset();

	pSelectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
}
Exemple #8
0
void HWMapContainer::setupStaticMapsView()
{
    if(m_staticViewSetup) return;
    m_staticViewSetup = true;

    m_staticMapModel->loadMaps();
    staticMapList->setModel(m_staticMapModel);
    staticMapList->setEditTriggers(QAbstractItemView::NoEditTriggers);
    QItemSelectionModel * staticSelectionModel = staticMapList->selectionModel();
    connect(staticSelectionModel,
            SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)),
            this,
            SLOT(staticMapChanged(const QModelIndex &, const QModelIndex &)));
    staticSelectionModel->setCurrentIndex(m_staticMapModel->index(0, 0), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent);
}
void ModelDescriptorListWidget::selectRow(int row)
{
    QModelIndex rootIndex = this->rootIndex();
    if(rootIndex.isValid()) {
        QItemSelectionModel *selectionModel = this->selectionModel();
        QSortFilterProxyModel *proxyModel = this->proxyModel();
        if(row < proxyModel->rowCount(rootIndex)) {
            selectionModel->clear();
            QModelIndex index = proxyModel->index(row, 0, rootIndex);
            if(index.isValid()) {
                selectionModel->setCurrentIndex(index, QItemSelectionModel::SelectCurrent);
            }
        }
    }
}
void ModelDescriptorListWidget::selectRow(const QUuid &uid)
{
    QItemSelectionModel *selectionModel = this->selectionModel();
    if(selectionModel) {
        selectionModel->clear();
        QModelIndex selectedIndex = findIndex(uid);
        if(selectedIndex.isValid()) {
            QModelIndex selectedIndexParent = selectedIndex.parent();
            if(selectedIndexParent.isValid()) {
                expand(selectedIndexParent);
            }

            selectionModel->setCurrentIndex(selectedIndex, QItemSelectionModel::SelectCurrent);
        }
    }
}
void TreeComboBox::showPopup()
{
    QComboBox::showPopup();
    // now clean up things we want different
    QItemSelectionModel *sm = view()->selectionModel();
    sm->clearSelection();
    view()->setSelectionMode( m_selectionmode );
    view()->setSelectionBehavior( QAbstractItemView::SelectRows );
    foreach ( const QModelIndex &i, m_currentIndexes ) {
        if ( i.isValid() ) {
            sm->select( i, QItemSelectionModel::Select | QItemSelectionModel::Rows );
        }
    }
    if ( ! sm->selectedRows().contains( sm->currentIndex() ) ) {
        sm->setCurrentIndex( sm->selectedRows().value( 0 ), QItemSelectionModel::NoUpdate );
    }
}
void LandmarkBrowser::on_deleteCategoriesButton_clicked()
{
    QItemSelectionModel *selection  = categoryTable->selectionModel();
    QModelIndexList selectedIndexes = selection->selectedRows();

    QList<QLandmarkCategoryId> deleteIds;

    QLandmarkCategoryId id;
    QModelIndex index;
    bool alreadyWarned = false;
    while(selectedIndexes.count() > 0) {
        index = selectedIndexes.takeLast();
        id.setManagerUri(manager->managerUri());
        id.setLocalId(categoryTable->item(index.row(),1)->text());
        if (manager->isReadOnly(id)) {
            if (!alreadyWarned) {
                QMessageBox::warning(this,"Warning", "Cannot delete a global category", QMessageBox::Ok, QMessageBox::NoButton);
                alreadyWarned = true;
            }

            selection->setCurrentIndex(index, QItemSelectionModel::Deselect);
            categoryTable->setSelectionModel(selection);

        } else {
            deleteIds.append(id);
            categoryTable->removeRow(index.row());
        }

        selectedIndexes = categoryTable->selectionModel()->selectedRows();
    }

    if (deleteIds.count() == 0)
        return;

    categoryRemove->setCategoryIds(deleteIds);
    categoryRemove->start();
#ifdef Q_OS_SYMBIAN
    categoryRemove->waitForFinished(30);
#endif
}
void QgsSvgMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
{
  if ( layer->layerType() != "SvgMarker" )
    return;

  // layer type is correct, we can do the cast
  mLayer = static_cast<QgsSvgMarkerSymbolLayerV2*>( layer );

  // set values

  QAbstractItemModel* m = viewImages->model();
  QItemSelectionModel* selModel = viewImages->selectionModel();
  for ( int i = 0; i < m->rowCount(); i++ )
  {
    QModelIndex idx( m->index( i, 0 ) );
    if ( m->data( idx ).toString() == mLayer->path() )
    {
      selModel->select( idx, QItemSelectionModel::SelectCurrent );
      selModel->setCurrentIndex( idx, QItemSelectionModel::SelectCurrent );
      setName( idx );
      break;
    }
  }



  spinSize->setValue( mLayer->size() );
  spinAngle->setValue( mLayer->angle() );

  // without blocking signals the value gets changed because of slot setOffset()
  spinOffsetX->blockSignals( true );
  spinOffsetX->setValue( mLayer->offset().x() );
  spinOffsetX->blockSignals( false );
  spinOffsetY->blockSignals( true );
  spinOffsetY->setValue( mLayer->offset().y() );
  spinOffsetY->blockSignals( false );

  setGuiForSvg( mLayer );

}
void BookmarkDialog::selectBookmarkFolder(const QString &folderName)
{
    if (folderName.isEmpty())
        return;

    if (folderName == tr("Bookmarks")) {
        ui.treeView->clearSelection();
        return;
    }

    QStandardItemModel *model = bookmarkManager->treeBookmarkModel();
    QList<QStandardItem*> list = model->findItems(folderName,
        Qt::MatchCaseSensitive | Qt::MatchRecursive, 0);
    if (!list.isEmpty()) {
        const QModelIndex &index = model->indexFromItem(list.at(0));
        QItemSelectionModel *model = ui.treeView->selectionModel();
        if (model) {
            model->setCurrentIndex(proxyModel->mapFromSource(index),
                QItemSelectionModel::ClearAndSelect);
        }
    }
}
void SatellitesDialog::filterListByGroup(int index)
{
	if (index < 0)
		return;
	
	QString groupId = ui->groupFilterCombo->itemData(index).toString();
	if (groupId == "all")
		filterModel->setSecondaryFilters(QString(), SatNoFlags);
	else if (groupId == "[displayed]")
		filterModel->setSecondaryFilters(QString(), SatDisplayed);
	else if (groupId == "[undisplayed]")
		filterModel->setSecondaryFilters(QString(), SatNotDisplayed);
	else if (groupId == "[newlyadded]")
		filterModel->setSecondaryFilters(QString(), SatNew);
	else if (groupId == "[orbiterror]")
		filterModel->setSecondaryFilters(QString(), SatError);
	else
	{
		filterModel->setSecondaryFilters(groupId, SatNoFlags);
	}
	
	if (ui->satellitesList->model()->rowCount() <= 0)
		return;
	
	QItemSelectionModel* selectionModel = ui->satellitesList->selectionModel();
	QModelIndex first;
	if (selectionModel->hasSelection())
	{
		first = selectionModel->selectedRows().first();
	}
	else
	{
		// Scroll to the top
		first = ui->satellitesList->model()->index(0, 0);
	}
	selectionModel->setCurrentIndex(first, QItemSelectionModel::NoUpdate);
	ui->satellitesList->scrollTo(first);
}
void QgsSvgSelectorWidget::setSvgPath( const QString& svgPath )
{
  QString updatedPath( "" );

  // skip possible urls, excepting those that may locally resolve
  if ( !svgPath.contains( "://" ) || ( svgPath.contains( "file://", Qt::CaseInsensitive ) ) )
  {
    QString resolvedPath = QgsSymbolLayerV2Utils::symbolNameToPath( svgPath.trimmed() );
    if ( !resolvedPath.isNull() )
    {
      updatedPath = resolvedPath;
    }
  }

  mCurrentSvgPath = updatedPath;

  mFileLineEdit->blockSignals( true );
  mFileLineEdit->setText( updatedPath );
  mFileLineEdit->blockSignals( false );

  mImagesListView->selectionModel()->blockSignals( true );
  QAbstractItemModel* m = mImagesListView->model();
  QItemSelectionModel* selModel = mImagesListView->selectionModel();
  for ( int i = 0; i < m->rowCount(); i++ )
  {
    QModelIndex idx( m->index( i, 0 ) );
    if ( m->data( idx ).toString() == svgPath )
    {
      selModel->select( idx, QItemSelectionModel::SelectCurrent );
      selModel->setCurrentIndex( idx, QItemSelectionModel::SelectCurrent );
      mImagesListView->scrollTo( idx );
      break;
    }
  }
  mImagesListView->selectionModel()->blockSignals( false );
}
void BookmarkDialog::addNewFolder()
{
    QItemSelectionModel *model = ui.treeView->selectionModel();
    const QModelIndexList &list = model->selection().indexes();

    QModelIndex index;
    if (!list.isEmpty())
        index = list.at(0);

    QModelIndex newFolder =
        bookmarkManager->addNewFolder(proxyModel->mapToSource(index));
    if (newFolder.isValid()) {
        ui.treeView->expand(index);
        const QModelIndex &index = proxyModel->mapFromSource(newFolder);
        model->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect);

        ui.bookmarkFolders->clear();
        ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders());

        const QString &name = index.data().toString();
        ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name));
    }
    ui.treeView->setFocus();
}
void QgsGeometryValidationDock::gotoPreviousError()
{
  QItemSelectionModel *selectionModel = mErrorListView->selectionModel();
  selectionModel->setCurrentIndex( mGeometryValidationModel->index( selectionModel->currentIndex().row() - 1, 0, QModelIndex() ), QItemSelectionModel::ClearAndSelect );
}
Exemple #19
0
void KWQTableView::nextCell()
{
  QItemSelectionModel * selModel = selectionModel();
  QModelIndexList indexes = selModel->selectedIndexes();
  QModelIndex currentIndex = selModel->currentIndex();

  int currentRow = currentIndex.row();
  int currentColumn = currentIndex.column();
  int newRow = currentRow;
  int newColumn = currentColumn;

  if (indexes.count() == 1) //one cell selected
  {
    switch(Prefs::enterMove())
    {
     case 0: //down
        if (currentRow == (model()->rowCount() - 1))
        {
          model()->insertRows(model()->rowCount(), 1, QModelIndex());
          newRow++;
        } else
          newRow++;
        break;

     case 1: //right
        if (currentRow == (model()->rowCount() - 1) && currentColumn == 1)
        {
          model()->insertRows(model()->rowCount(), 1, QModelIndex());
          newRow++;
          newColumn = 0;
        } else {
          if (currentColumn == 0)
            newColumn++;
          else {
            newRow++;
            newColumn--;
          }
        }
        break;

      case 2: //no move
        //do nothing
        break;

    }

    QModelIndex newIndex = model()->index(newRow, newColumn);
    selModel->clear();
    selModel->setCurrentIndex(newIndex, QItemSelectionModel::SelectCurrent);
  }
  else if (indexes.count() > 1) //a larger selection, move within it
  {
    QModelIndex topLeft = indexes.first();
    QModelIndex bottomRight = indexes.last();

    int tr = topLeft.row();
    int lc = topLeft.column();
    int br = bottomRight.row();
    int rc = bottomRight.column();

    switch(Prefs::enterMove())
    {
      case 0:
        if (currentRow == br)
        {
          newRow = tr;
          if (currentColumn < rc)
            newColumn = rc;
          else
            newColumn = lc;
        }
        else
          if (currentRow < br)
            newRow++;
        break;
      case 1:
        if (currentColumn == rc)
        {
          newColumn = lc;
          if (currentRow < br)
            newRow++;
          else
            newRow = tr;
        }
        else
          newColumn++;
        break;
      case 2:
        //do nothing
        break;
    }

    QModelIndex newIndex = model()->index(newRow, newColumn);
    selModel->setCurrentIndex(newIndex, QItemSelectionModel::Current);
  }

  if (newColumn != currentColumn)
    updateKeyboardLayout();
}
Exemple #20
0
void LocalView::slot_rmdir()
{
    QString dir_name;
    
    QItemSelectionModel *ism = this->curr_item_view->selectionModel();
    // QModelIndexList mil;
    QModelIndex cidx, idx;

    if (ism == 0 || !ism->hasSelection()) {
        qDebug()<<"SelectedIndexes count :"<< ism->hasSelection() << " why no item selected????";
        QMessageBox::critical(this, tr("Warning..."), tr("No item selected"));
        return;
    }    
    
    // mil = ism->selectedIndexes();
    cidx = ism->currentIndex();
    idx = ism->model()->index(cidx.row(), 0, cidx.parent());
    
    QModelIndex midx = idx;
    QModelIndex aim_midx = (this->curr_item_view == this->uiw->treeView) 
        ? this->dir_file_model->mapToSource(midx): midx;

    //检查所选择的项是不是目录
    if (!this->model->isDir(aim_midx)) {
        QMessageBox::critical(this, tr("Warning..."), tr("The selected item is not a directory."));
        return ;
    }
    // qDebug()<<QDir(this->model->filePath(aim_midx)).count();
    if (QDir(this->model->filePath(aim_midx)).count() > 2) {
        QMessageBox::critical(this, tr("Warning..."), tr("Selected director not empty."));
        return;
    }

    QModelIndex tree_midx = this->dir_file_model->mapFromSource(aim_midx);
    QModelIndex pidx = aim_midx.parent();
    int it_row = tree_midx.row();
    QModelIndex nidx = tree_midx.parent();
    QString next_select_path;
    
    if (this->dir_file_model->rowCount(nidx) == 1) {
        // goto parent 
        next_select_path = this->dir_file_model->filePath(nidx);
    } else if (it_row == this->dir_file_model->rowCount(nidx)-1) {
        // goto privious
        next_select_path = this->dir_file_model->filePath(this->dir_file_model->index(it_row-1, 0, nidx));
    } else if (it_row > this->dir_file_model->rowCount(nidx)-1) {
        // not possible
    } else if (it_row < this->dir_file_model->rowCount(nidx)-1) {
        // goto next
        next_select_path = this->dir_file_model->filePath(this->dir_file_model->index(it_row+1, 0, nidx));
    } else {
        // not possible
    }

    Q_ASSERT(!next_select_path.isEmpty());
    
    if (this->model->rmdir(aim_midx)) {
        if (this->curr_item_view == this->uiw->treeView) {
            // this->slot_dir_tree_item_clicked(tree_midx.parent());
            // A: if has next sible, will select next sible
            // B: if has priv sible, will select privious sible
            // C: if no next and no priv, will select parent 

            // ism = this->curr_item_view->selectionModel();
            idx = ism->currentIndex();
            qDebug()<<idx<<this->dir_file_model->filePath(idx);

            // set selection and go on
            ism->clearSelection();
            QItemSelection *selection = new QItemSelection();
                                                           
            // ism->select(this->dir_file_model->index(next_select_path), QItemSelectionModel::Select | QItemSelectionModel::Current  | QItemSelectionModel::Rows);
            ism->setCurrentIndex(this->dir_file_model->index(next_select_path), QItemSelectionModel::Select | QItemSelectionModel::Current  | QItemSelectionModel::Rows);

            idx = ism->currentIndex();
            qDebug()<<idx<<this->dir_file_model->filePath(idx);

            this->slot_dir_tree_item_clicked(this->dir_file_model->index(next_select_path));
        }
    } else {
        QMessageBox::critical(this, tr("Warning..."),
                              tr("Delete directory faild. Maybe the directory is not empty."));
    }

    // if (!QDir().rmdir(this->model->filePath(aim_midx))) {
    //     QMessageBox::critical(this, tr("Warning..."), tr("Delete directory faild. Mayby the directory is not empty."));
    // } else {
    //     this->slot_refresh_directory_tree();
    // }
}
void FileRenamerDlgImpl::reloadTable()
{
    {
        bool bVa (false);
        bool bErr (false); // it's error if any file lacks ID3V2
        const deque<const Mp3Handler*>& vpHndl (m_pHndlrListModel->getHandlerList());
        if (vpHndl.empty())
        {
            accept();
            return;
        }

        int n (cSize(vpHndl));
        CB_ASSERT (n > 0);
        string strArtist ("\1");
        for (int i = 0; i < n; ++i)
        {
            const Mp3Handler* pHndl (vpHndl[i]);
            const Id3V2StreamBase* pId3V2 (pHndl->getId3V2Stream());
            if (0 == pId3V2)
            {
                bErr = true;
            }
            else
            {
                if ("\1" == strArtist)
                {
                    strArtist = pId3V2->getArtist();
                }
                else
                {
                    if (strArtist != pId3V2->getArtist())
                    {
                        bVa = true;
                    }
                }
            }
        }

        if (bErr)
        {
            m_eState = "\1" == strArtist ? ERR : bVa ? VARIOUS_ERR : SINGLE_ERR;
        }
        else
        {
            m_eState = bVa ? VARIOUS : SINGLE;
        }
    }

    selectPattern();

    m_pHndlrListModel->emitLayoutChanged();
    const Mp3Handler* p (m_pHndlrListModel->getHandlerList().at(0)); // !!! it was supposed to close the window if nothing remained
    if (!m_bUseCurrentView) { m_pCrtDirTagEdtE->setText(toNativeSeparators(convStr(p->getDir()))); }
    //m_pCrtDirTagEdtE->hide();
    //setWindowTitle("MP3 Diags - " + convStr(p->getDir()) + " - File renamer");

    QItemSelectionModel* pSelModel (m_pCurrentAlbumG->selectionModel());
    pSelModel->clear();
    pSelModel->setCurrentIndex(m_pHndlrListModel->index(0, 0), QItemSelectionModel::SelectCurrent);

    resizeUi();
}