Example #1
0
void
MapAgent::clear_map(UAS_Pointer<UAS_Common> &lib)
{
  if(lib->lid() == f_doc_ptr->lid())
  {
    clear_it();
    f_doc_ptr = NULL;
  }
}
qm_plistview::qm_plistview(QWidget *parent)
{
    setParent(parent);

    if (objectName().isEmpty())
        setObjectName("plist_view");

    // initVars
    dropBeforeIndex = -1;
    line = new QWidget(viewport());
    line->hide();
    line->setAutoFillBackground(true);
    QPalette pal = line->palette();
    pal.setColor(line->backgroundRole(), QColor("#5f8ba9"));
    line->setPalette(pal);
    setDragDropMode(QAbstractItemView::DragDrop);
    setDropIndicatorShown(false);
    setDragEnabled(true);

    current_songPos = -1;
    current_songID = -1;
    current_status = 0;
    b_panel_max = false;
    b_streamplaying = false;
    b_waspurged = true;
    b_mpd_connected = false;
    col_default_fg = this->palette().color(QPalette::Foreground);
    col_played_fg  = QColor("#70707A");
    col_playing_fg = QColor("#003070");

    //setupUI
    setRootIsDecorated(false);
    setItemsExpandable (false);
    setUniformRowHeights(true);
    setAllColumnsShowFocus(true);
    setSelectionMode(ExtendedSelection);
    sortByColumn (-1); // no sorting
    setColumnCount(6);
    QStringList labels;
    labels << "#" << " " << " " + tr("artist") + " " << " " + tr("title") + " " << " " + tr("m:s") + " " << " " + tr("album : nr") + " ";
    setHeaderLabels(labels);
    headerItem()->setIcon(1, QIcon(":/tr_trackplayed.png"));
    QObject::connect( this, SIGNAL( itemDoubleClicked (QTreeWidgetItem *, int)), this, SLOT( on_item_dclicked(QTreeWidgetItem *)));

    context_menu = new QMenu();
    this->setContextMenuPolicy(Qt::DefaultContextMenu);

    a_clearlist = new QAction(context_menu);
    a_clearlist->setText(tr("Clear list"));
    a_clearlist->setIcon(QIcon(":/tr_redcross.png"));
    QObject::connect( a_clearlist, SIGNAL( triggered() ), this, SLOT( clear_it() ) );
    context_menu->addAction(a_clearlist);

    a_delsel = new QAction(context_menu);
    a_delsel->setText(tr("Remove selected"));
    a_delsel->setIcon(QIcon(":/tr_delete.png"));
    QObject::connect( a_delsel, SIGNAL( triggered() ), this, SLOT( delete_it() ) );
    context_menu->addAction(a_delsel);

    QAction *purge = new QAction(context_menu);
    purge->setText(tr("Purge played"));
    purge->setIcon(QIcon(":/tr_purge.png"));
    QObject::connect( purge, SIGNAL( triggered() ), this, SLOT( purge_it() ) );
    context_menu->addAction(purge);
    context_menu->addSeparator();

    a_playreset = new QAction(context_menu);
    a_playreset->setText(tr("Reset status"));
    a_playreset->setIcon(QIcon(":/tr_played_reset"));
    QObject::connect( a_playreset, SIGNAL( triggered() ), this, SLOT( reset_played() ) );
    context_menu->addAction(a_playreset);

    a_shuffle = new QAction(context_menu);
    a_shuffle->setText(tr("Shuffle list"));
    a_shuffle->setIcon(QIcon(":/tr_shuffle.png"));
    QObject::connect( a_shuffle, SIGNAL( triggered() ), this, SLOT( shuffle_it() ) );
    context_menu->addAction(a_shuffle);
    context_menu->addSeparator();

    a_savelist = new QAction(context_menu);
    a_savelist->setText(tr("Save list"));
    a_savelist->setIcon(QIcon(":/tr_save.png"));
    QObject::connect( a_savelist, SIGNAL( triggered() ), this, SLOT( save_it() ) );
    context_menu->addAction(a_savelist);

    a_savesel = new QAction(context_menu);
    a_savesel->setText(tr("Save selected"));
    a_savesel->setIcon(QIcon(":/tr_saveselect.png"));
    QObject::connect( a_savesel, SIGNAL( triggered() ), this, SLOT( save_selected() ) );
    context_menu->addAction(a_savesel);
/*    context_menu->addSeparator();

    a_loadlist = new QAction(context_menu);
    a_loadlist->setText(tr("Reload list"));
    a_loadlist->setIcon(QIcon(":/menu_load.png"));
    QObject::connect( a_loadlist, SIGNAL( triggered() ), this, SLOT( reload_playlist() ) );
    context_menu->addAction(a_loadlist); */
}