Exemplo n.º 1
0
/**
  * User clicked the header
  * Sorting is disable when starting a new search to avoid annoying automatic moving in the list when adding new items
  * So enable it when the user really wants to sort results
  */
void SearchListView::headerClicked(int i)
{
    if (!isSortingEnabled()) {
        setSortingEnabled(true);
        sortItems(i, Qt::AscendingOrder);
    }
}
Exemplo n.º 2
0
void TableWidget::insertBlankRow(){

    int ind = currentRow()+1;
    if(ind==-1){
        return;
    }
    bool enabled = isSortingEnabled();
    setSortingEnabled(false);
    int n = rowCount();
    //QList<int> inds;inds<<0<<1<<2<<5;
    QAction *action = qobject_cast<QAction *>(sender());
    ColumnType t = static_cast<ColumnType>(action->data().toInt());
    QList<int> inds;
    if(t==ORIGIN){
        inds = originCols_;
        qDebug()<<"origin columns";
    }else if(t==RESULT){
        qDebug()<<"result columns";
        inds = resultCols_;
    }else{
        QMessageBox::critical(this,"","Bug, unknown columntype in TableWidget::insertBlankRow");
        return;
    }

    for(int i=0;i<inds.size();i++){
        int col = inds[i];
        QList<TableWidgetItem*> tmp;
        for(int row=ind;row<n;row++){
            tmp << (TableWidgetItem*)takeItem( row, col );
        }
        int row = ind+1;
        for(int j=0;j<tmp.size();j++){
            if(row>=rowCount()){
                setRowCount(row+1);
                setNonEditable( row+1, row+1 );
            }
            setItem( row, col, tmp.at(j) );
            //qDebug()<<i<<j;
            row++;
        }
        //blank item
        TableWidgetItem *newItem = new TableWidgetItem;
        newItem->setFlags( newItem->flags() &= ~Qt::ItemIsEditable );
        setItem( ind, col, newItem );
    }
    setSortingEnabled(enabled);
    //nFiles=nFiles+1;

    for(int i=0;i<rowCount();i++){
        item(i,CURRENT_TITLE)->setFlags( item(i,CURRENT_TITLE)->flags() &= ~Qt::ItemIsEditable );
        item(i,CURRENT_TITLE)->setFlags( item(i,CURRENT_TITLE)->flags() &= ~Qt::ItemIsEditable );
    }

}
Exemplo n.º 3
0
TableWidget::TableWidget(QWidget *parent) : QTableWidget(parent){

    originCols_ <<0<<1<<2<<5;
    resultCols_ <<3<<4;

    resizeColumnAction = new QAction(tr("Auto resize columns"), this); resizeColumnAction->setCheckable(true);
    resizeRowAction = new QAction(tr("Auto resize rows"), this); resizeRowAction->setCheckable(true);
    matchByTrackAction = new QAction(tr("Match by track"), this); matchByTrackAction->setData( MATCH_BY_TRACK ); matchByTrackAction->setCheckable(true);
    matchByTitleAction = new QAction(tr("Match by title"), this); matchByTitleAction->setData( MATCH_BY_TITLE ); matchByTitleAction->setCheckable(true);
    dontMatchAction = new QAction(tr("Do not match"), this); dontMatchAction->setData( DONT_MATCH ); dontMatchAction->setCheckable(true);
    matchByTrackTitleAction = new QAction(tr("Match by track, then title, then title to filename"), this); matchByTrackTitleAction->setData( MATCH_BY_TRACK_TITLE ); matchByTrackTitleAction->setCheckable(true);
    matchByTitleTrackAction = new QAction(tr("Match by title, then track, then title to filename"), this); matchByTitleTrackAction->setData( MATCH_BY_TITLE_TRACK ); matchByTitleTrackAction->setCheckable(true);
    matchByFileNameAction = new QAction(tr("Match title to filename"), this); matchByFileNameAction->setData( MATCH_BY_FILE_NAME ); matchByFileNameAction->setCheckable(true);

    //context menu
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &)));
    contextMenu(QPoint(), true ); //initialize actions

    //verticla header context menu
    this->verticalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this->verticalHeader(), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(verticalContextMenu(const QPoint &)));
    verticalContextMenu(QPoint(), true ); //initialize actions

    connect( this, SIGNAL( cellChanged( int, int )  ), this, SLOT( updateCell(int, int) ) );

    settings = Global::guiSettings();

    resizeColumns( settings->value("SearchDialog/autoResizeColumns",true).toBool() );
    resizeColumnAction->setChecked( settings->value("SearchDialog/autoResizeColumns",true).toBool() );
    resizeRows( settings->value("SearchDialog/autoResizeRows",false).toBool() );
    resizeRowAction->setChecked( settings->value("SearchDialog/autoResizeRows",false).toBool() );
    setSortingEnabled( settings->value("SearchDialog/sortingEnabled",true).toBool() );
    if( isSortingEnabled() ){
        int sortColumn = settings->value("SearchDialog/sortColumn",CURRENT_TRACK).toInt();
        Qt::SortOrder sortOrder = (Qt::SortOrder)settings->value("SearchDialog/sortOrder", Qt::AscendingOrder ).toInt();
        sortByColumn( sortColumn, sortOrder );
        horizontalHeader()->setSortIndicator(sortColumn, sortOrder);
        horizontalHeader()->setSortIndicatorShown(true);
        horizontalHeader()->setClickable(true);
    }
    matchByTrackAction->setChecked( settings->value("SearchDialog/matchByTrack",false).toBool() );
    matchByTitleAction->setChecked( settings->value("SearchDialog/matchByTitle",false).toBool() );
    dontMatchAction->setChecked( settings->value("SearchDialog/dontMacth",true).toBool() );
    matchByTrackTitleAction->setChecked( settings->value("SearchDialog/matchByTrackTitle",true).toBool() );
    matchByTitleTrackAction->setChecked( settings->value("SearchDialog/matchByTitleTrack",false).toBool() );
    matchByFileNameAction->setChecked( settings->value("SearchDialog/matchByFileName",false).toBool() );

    this->horizontalHeader()->setStretchLastSection(true);
    this->verticalHeader()->setStretchLastSection(true);

}
Exemplo n.º 4
0
void Playlist::appendTracks( const QList<Track*> tracks )
{
    // a week attempt to speed up the setItemWidget time issue
    setUpdatesEnabled(false);
    bool doSort = isSortingEnabled();
    setSortingEnabled(false);
    hide();

    appendTracks( tracks,(PlaylistItem*)lastChild());

    setSortingEnabled(doSort);
    setUpdatesEnabled(true);
    show();
}
Exemplo n.º 5
0
void TableWidget::deleteCells(){

    bool enabled = isSortingEnabled();
    setSortingEnabled(false);
    QModelIndexList indexes = selectionModel()->selectedIndexes();
    for(int i=0;i<indexes.size();i++){
        int row = indexes[i].row();
        int column = indexes[i].column();
        //if( item(row,column) && !originCols_.contains(column) ){
        if( item(row,column)->flags().testFlag(Qt::ItemIsEditable) ){
            item(row,column)->setText("");
            //delete takeItem(row,column);
            //TableWidgetItem *newItem = new TableWidgetItem;
            //newItem->setFlags( newItem->flags() &= ~Qt::ItemIsEditable );
            //setItem( row, column, newItem );
        }
    }
    setSortingEnabled(enabled);    
}
Exemplo n.º 6
0
void TableWidget::paste(){

    QList<QTableWidgetSelectionRange> ranges = selectedRanges();
    if(ranges.size()==0){
        return;
    }
    QTableWidgetSelectionRange range = ranges[0];
    if(range.leftColumn()<TITLE || range.rightColumn()<TITLE){
        QMessageBox::information(this, tr("Discogs dialog"), tr("Pasting in the three first columns is not allowed") );
        return;
    }
    QString str = QApplication::clipboard()->text();
    qDebug()<<"clipboard: ";
    qDebug()<<str;
    QStringList rows = str.split('\n');
    int numRows = rows.count();
    int numColumns = rows.first().count('\t') + 1;
    if( range.rowCount() * range.columnCount() != 1
            && (range.rowCount() != numRows
                || range.columnCount() != numColumns)) {
        QMessageBox::information(this, tr("Discogs dialog"),
                                 tr("The information cannot be pasted because the copy "
                                    "and paste areas aren't the same size."));
        return;
    }
    bool enabled = isSortingEnabled();
    setSortingEnabled(false);
    for(int i=0; i<numRows; ++i) {
        QStringList columns = rows[i].split('\t');
        for(int j=0; j<numColumns; ++j) {
            int row = range.topRow() +i;
            int column = range.leftColumn() +j;
            if(row < rowCount() && column < columnCount()){
                if(!item(row,column)){
                    TableWidgetItem *item = new TableWidgetItem;
                    setItem(row,column,item);
                }
                item(row,column)->setText(columns[j]);
            }
        }
    }
    setSortingEnabled(enabled);
}
Exemplo n.º 7
0
int QListWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QListView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 22)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 22;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = count(); break;
        case 1: *reinterpret_cast< int*>(_v) = currentRow(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isSortingEnabled(); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 1: setCurrentRow(*reinterpret_cast< int*>(_v)); break;
        case 2: setSortingEnabled(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 3;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemplo n.º 8
0
void TableWidget::setNonEditable( int startrow, int stoprow ){

    bool enabled = isSortingEnabled();
    setSortingEnabled(false);
    for(int i=0;i<TITLE;i++){
        for(int j=startrow;j<stoprow;j++){
            if( j>=rowCount() ){
                continue;
            }
            if( !item(j,i) ){
                TableWidgetItem *item = new TableWidgetItem;
                item->setFlags( item->flags() &= ~Qt::ItemIsEditable );
                setItem( j, i, item );
            }else{
                item(j,i)->setFlags( item(j,i)->flags() &= ~Qt::ItemIsEditable );
            }
        }
    }
    setSortingEnabled(enabled);

}
Exemplo n.º 9
0
void TableWidget::moveRow( int from, int to, ColumnType t ){
    //move current row to row

    int n = rowCount();
    if( n==0 ){
        return;
    }
    if( from<0 || to<0	|| from>=n || to>=n || from==to ){
        return;
    }
    QList<int> inds;
    if(t==ORIGIN){
        inds = originCols_;
        qDebug()<<"moving origin columns";
    }else{
        qDebug()<<"moving result columns";
        inds = resultCols_;
    }
    QTableWidgetItem* currItem = this->currentItem();
    bool enabled = isSortingEnabled();
    setSortingEnabled(false);
    for(int i=0;i<inds.size();i++){
        int col = inds[i];
        QList<TableWidgetItem*> tmp;
        for(int row=0;row<n;row++){
            tmp << (TableWidgetItem*)takeItem( row, col );
        }
        qDebug()<<"moving column "<<col<<" from "<<from<<"to "<<to;
        tmp.insert( to, tmp.takeAt(from) );
        for(int row=0;row<n;row++){
            setItem( row, col, tmp.at(row) );
        }
    }
    setSortingEnabled(enabled);
    if(enabled){
        QMessageBox::warning(this,"Move row","Sorting is enabled, so moving a row might not have any effect");
    }
    this->setCurrentItem(currItem);
}
Exemplo n.º 10
0
void QQuestionsTableWidget::addQuestionRow()
{
    bool restore_sort = false;
    if (isSortingEnabled())
    {
        setSortingEnabled(false);
        restore_sort = true;
    }
    insertRow(rowCount());
    for (unsigned int i = 0; i < 1 + CHOICE_COUNT; i++)
        setItem(rowCount() - 1,i,new QTableWidgetItem());
    QComboBox * combobox = new QComboBox();
    for (unsigned int i = 1; i <= CHOICE_COUNT; i++)
        combobox -> addItem(QString::number(i));
    setCellWidget(rowCount() - 1, 1 + CHOICE_COUNT,combobox);
    setItem(rowCount() - 1, 1 + CHOICE_COUNT,new QComboBoxTableItem());
    if (RATING)
    {

        connect(combobox,SIGNAL(currentIndexChanged(int)),this,SIGNAL(signalNeedSave()));
        combobox = new QComboBox();
        for (unsigned int i = 1; i <= RATING; i++)
            combobox -> addItem(QString::number(i));
        setCellWidget(rowCount() - 1,1 + CHOICE_COUNT + 1,combobox);
        setItem(rowCount() - 1, 1 + CHOICE_COUNT + 1,new QComboBoxTableItem());
    }
    connect(combobox,SIGNAL(currentIndexChanged(int)),this,SIGNAL(signalNeedSave()));

    if (restore_sort)
    {
        setSelectionMode(QAbstractItemView::SingleSelection);
        setCurrentCell(rowCount()-1,0);
        setSelectionMode(QAbstractItemView::ExtendedSelection);
        setSortingEnabled(true);
    }
}
Exemplo n.º 11
0
int QTreeView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractItemView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: expanded((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 1: collapsed((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 2: hideColumn((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: showColumn((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 4: expand((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 5: collapse((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 6: resizeColumnToContents((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: sortByColumn((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 8: expandAll(); break;
        case 9: collapseAll(); break;
        case 10: expandToDepth((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 11: columnResized((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 12: columnCountChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 13: columnMoved(); break;
        case 14: reexpand(); break;
        case 15: rowsRemoved((*reinterpret_cast< const QModelIndex(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 16: d_func()->_q_endAnimatedOperation(); break;
        case 17: d_func()->_q_modelAboutToBeReset(); break;
        case 18: d_func()->_q_sortIndicatorChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Qt::SortOrder(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 19;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = autoExpandDelay(); break;
        case 1: *reinterpret_cast< int*>(_v) = indentation(); break;
        case 2: *reinterpret_cast< bool*>(_v) = rootIsDecorated(); break;
        case 3: *reinterpret_cast< bool*>(_v) = uniformRowHeights(); break;
        case 4: *reinterpret_cast< bool*>(_v) = itemsExpandable(); break;
        case 5: *reinterpret_cast< bool*>(_v) = isSortingEnabled(); break;
        case 6: *reinterpret_cast< bool*>(_v) = isAnimated(); break;
        case 7: *reinterpret_cast< bool*>(_v) = allColumnsShowFocus(); break;
        case 8: *reinterpret_cast< bool*>(_v) = wordWrap(); break;
        case 9: *reinterpret_cast< bool*>(_v) = isHeaderHidden(); break;
        case 10: *reinterpret_cast< bool*>(_v) = expandsOnDoubleClick(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setAutoExpandDelay(*reinterpret_cast< int*>(_v)); break;
        case 1: setIndentation(*reinterpret_cast< int*>(_v)); break;
        case 2: setRootIsDecorated(*reinterpret_cast< bool*>(_v)); break;
        case 3: setUniformRowHeights(*reinterpret_cast< bool*>(_v)); break;
        case 4: setItemsExpandable(*reinterpret_cast< bool*>(_v)); break;
        case 5: setSortingEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 6: setAnimated(*reinterpret_cast< bool*>(_v)); break;
        case 7: setAllColumnsShowFocus(*reinterpret_cast< bool*>(_v)); break;
        case 8: setWordWrap(*reinterpret_cast< bool*>(_v)); break;
        case 9: setHeaderHidden(*reinterpret_cast< bool*>(_v)); break;
        case 10: setExpandsOnDoubleClick(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 11;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemplo n.º 12
0
int QListWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QListView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: itemPressed((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 1: itemClicked((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 2: itemDoubleClicked((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 3: itemActivated((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 4: itemEntered((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 5: itemChanged((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 6: currentItemChanged((*reinterpret_cast< QListWidgetItem*(*)>(_a[1])),(*reinterpret_cast< QListWidgetItem*(*)>(_a[2]))); break;
        case 7: currentTextChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 8: currentRowChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 9: itemSelectionChanged(); break;
        case 10: scrollToItem((*reinterpret_cast< const QListWidgetItem*(*)>(_a[1])),(*reinterpret_cast< QAbstractItemView::ScrollHint(*)>(_a[2]))); break;
        case 11: scrollToItem((*reinterpret_cast< const QListWidgetItem*(*)>(_a[1]))); break;
        case 12: clear(); break;
        case 13: d_func()->_q_emitItemPressed((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 14: d_func()->_q_emitItemClicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 15: d_func()->_q_emitItemDoubleClicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 16: d_func()->_q_emitItemActivated((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 17: d_func()->_q_emitItemEntered((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 18: d_func()->_q_emitItemChanged((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 19: d_func()->_q_emitCurrentItemChanged((*reinterpret_cast< const QModelIndex(*)>(_a[1])),(*reinterpret_cast< const QModelIndex(*)>(_a[2]))); break;
        case 20: d_func()->_q_sort(); break;
        case 21: d_func()->_q_dataChanged((*reinterpret_cast< const QModelIndex(*)>(_a[1])),(*reinterpret_cast< const QModelIndex(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 22;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = count(); break;
        case 1: *reinterpret_cast< int*>(_v) = currentRow(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isSortingEnabled(); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 1: setCurrentRow(*reinterpret_cast< int*>(_v)); break;
        case 2: setSortingEnabled(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 3;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemplo n.º 13
0
void TableWidget::showAlbumInfo( const Album &a ){

    int n = std::max( a.songs().size(), this->rowCount() );
    setRowCount(n);
    bool enabled = isSortingEnabled();
    setSortingEnabled(false);

    //delete old results
    for(int i=0;i<rowCount();i++){
        delete takeItem(i,TITLE);
        delete takeItem(i,TRACK);
    }

    int k=0;
    QList<Song> leftOverSongs;
    QList<Song> songs = a.songs();
    while( songs.size()>0 ){
        int row;
        //qDebug()<<a.songs[0].title;
        if(matchByTrackAction->isChecked()){
            row = matchResult( songs[0].track(), CURRENT_TRACK );
        }else if(matchByTitleAction->isChecked()){
            row = matchResult( songs[0].title(), CURRENT_TITLE );
        }else if(matchByTitleTrackAction->isChecked()){
            row = matchResult( songs[0].title(), CURRENT_TITLE );
            if(row==-1){
                row = matchResult( songs[0].track(), CURRENT_TRACK );
            }
            if(row==-1){
                row = matchResult( songs[0].title(), FILE_NAME );
            }
        }else if(matchByTrackTitleAction->isChecked()){
            row = matchResult( songs[0].track(), CURRENT_TRACK );
            if(row==-1){
                row = matchResult( songs[0].title(), CURRENT_TITLE );
            }
            if(row==-1){
                row = matchResult( songs[0].title(), FILE_NAME );
            }
        }else if(matchByFileNameAction->isChecked()){
            row = matchResult( songs[0].title(), FILE_NAME );
        }else if(dontMatchAction->isChecked()){;
            row = k;
            k++;
        }else{
            row = k;
            k++;
        }
        if(row==-1){
            leftOverSongs.append(songs[0]);
            songs.removeAt(0);
            continue;
        }

        TableWidgetItem *newItem = new TableWidgetItem;
        newItem->setText(songs[0].title());
        QFont f = newItem->font();f.setPointSize(10);
        newItem->setFont(f);
        setItem(row, TITLE, newItem);

        TableWidgetItem *newItem1 = new TableWidgetItem;
        newItem1->setText(songs[0].track());
        newItem1->setFont(f);
        setItem(row, TRACK, newItem1);

        songs.removeAt(0);
    }
    for(int i=0;i<leftOverSongs.size();i++){
        int n = rowCount();
        int row=n+1;
        for(int j=0;j<n;j++){
            if(!item(j,TITLE)){
                row=j;
                break;
            }
        }
        qDebug()<<leftOverSongs[i].title()<<" leftover, put in row "<<row;
        TableWidgetItem *newItem = new TableWidgetItem;
        newItem->setText(leftOverSongs[i].title());
        QFont f = newItem->font();f.setPointSize(10);
        newItem->setFont(f);
        setItem(row, TITLE, newItem);

        TableWidgetItem *newItem1 = new TableWidgetItem;
        newItem1->setText(leftOverSongs[i].track());
        newItem1->setFont(f);
        setItem(row, TRACK, newItem1);
    }
    setSortingEnabled(enabled);
    setNonEditable( 0, n );
}