X-Git-Url: https://vcs.maemo.org/git/?p=tomamp;a=blobdiff_plain;f=tomamp%2Fmainwindow.cpp;h=349cce58d4bd95316b2b75510dd7609959cfc621;hp=8bcd24f7a789ce7be5a826e70da318212d3bc808;hb=55a1e2fa6172d8ca69c06a9b99e449717cb2d9c1;hpb=1469415b19b7f32ccc5f4cdde5049892ae1cfa30 diff --git a/tomamp/mainwindow.cpp b/tomamp/mainwindow.cpp index 8bcd24f..349cce5 100644 --- a/tomamp/mainwindow.cpp +++ b/tomamp/mainwindow.cpp @@ -782,32 +782,35 @@ void MainWindow::setRowFromItem (int row, const PlaylistItem& item) if (!musicTable->cellWidget(row, 3)) { - QToolBar* bar = new QToolBar; - QLabel* up = new QLabel; - up->setText(QString::fromUtf8("▲")); - up->setStyleSheet("padding-right:3px;"); - up->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - bar->addWidget(up); - QLabel* down = new QLabel; - down->setText(QString::fromUtf8("▼")); - down->setStyleSheet("padding-right:3px;"); - bar->addWidget(down); - QLabel* del = new QLabel; - del->setText(QString::fromUtf8("╳")); - del->setStyleSheet("padding-right:3px;"); - bar->addWidget(del); - down->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - bar->setProperty("row", row); - musicTable->setCellWidget(row, 3, bar); - connect (up, SIGNAL (linkActivated (const QString&)), this, SLOT (buttonUp ())); - connect (down, SIGNAL (linkActivated (const QString&)), this, SLOT (buttonDown ())); - connect (del, SIGNAL (linkActivated (const QString&)), this, SLOT (buttonDel ())); + QLabel* label = new QLabel; + label->setText(QString::fromUtf8("▲ ▼ ╳ i")); + label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + label->setProperty("row", row); + musicTable->setCellWidget(row, 3, label); + connect (label, SIGNAL (linkActivated (const QString&)), this, SLOT (playlistControl (const QString&))); +/* connect (down, SIGNAL (linkActivated (const QString&)), this, SLOT (buttonDown ())); + connect (del, SIGNAL (linkActivated (const QString&)), this, SLOT (buttonDel ()));*/ } } -void MainWindow::buttonUp() +void MainWindow::playlistControl (const QString& con) { - int i = sender()->parent()->property("row").toInt(); + int i = sender ()->property("row").toInt(); + qDebug () << "Playlist control: " << con << " on " << i; + if (con == "up") + buttonUp(i); + else if (con == "down") + buttonDown(i); + else if (con == "del") + buttonDel (i); + else + QMessageBox::information(this, tr ("Coming up..."), tr ("This feature is not implemented yet.")); +} + + +void MainWindow::buttonUp(int i) +{ + //int i = sender()->parent()->property("row").toInt(); qDebug () << "Presses up on " << i; if (i) { @@ -820,9 +823,8 @@ void MainWindow::buttonUp() } } -void MainWindow::buttonDown() +void MainWindow::buttonDown(int i) { - int i = sender()->parent()->property("row").toInt(); qDebug () << "Presses down on " << i; if (i < plman.size() - 1) { @@ -835,9 +837,8 @@ void MainWindow::buttonDown() } } -void MainWindow::buttonDel() +void MainWindow::buttonDel(int i) { - int i = sender()->parent()->property("row").toInt(); qDebug () << "Presses del on " << i; if (i < plman.size()) {