3 #include <QInputDialog>
5 #include "mainwindow.h"
8 //#define AVOID_INPUT_DIALOG 0
10 MainWindow::MainWindow()
11 : plman (this), settings (tr ("TomAmp"), "TomAmp")
13 audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
14 mediaObject = new Phonon::MediaObject(this);
16 mediaObject->setTickInterval(1000);
17 connect(mediaObject, SIGNAL(tick(qint64)), this, SLOT(tick(qint64)));
18 connect(mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)),
19 this, SLOT(stateChanged(Phonon::State,Phonon::State)));
20 connect(mediaObject, SIGNAL(currentSourceChanged(Phonon::MediaSource)),
21 this, SLOT(sourceChanged(Phonon::MediaSource)));
22 connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish()));
23 connect (&plman, SIGNAL (playlistChanged (int)), this, SLOT (playlistChanged(int)));
24 connect (&plman, SIGNAL (itemUpdated(int)), this, SLOT (itemUpdated (int)));
26 Phonon::createPath(mediaObject, audioOutput);
29 repeat = settings.value("repeat", false).toBool();
30 shuffle = settings.value("shuffle", false).toBool();
35 timeLcd->display("00:00");
36 plman.addStringList(settings.value("lastPlaylist").toStringList());
38 int curind = settings.value("currentIndex", -1).toInt ();
40 setItem (curind, false);
41 audioOutput->setVolume(settings.value("volume", .5).toReal());
44 MainWindow::~MainWindow()
46 settings.setValue("shuffle", shuffle);
47 settings.setValue("repeat", repeat);
48 settings.setValue("lastPlaylist", plman.playlistStrings());
49 settings.setValue("volume", audioOutput->volume());
50 settings.setValue("currentIndex", plman.indexOf(mediaObject->currentSource()));
51 for (int i = 0; i < musicTable->columnCount(); ++i)
53 QString lab = QString ("colWidth_%1").arg (i);
54 settings.setValue(lab, musicTable->columnWidth(i));
58 void MainWindow::addFiles()
60 QString folder = settings.value("LastFolder").toString();
62 folder = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
63 QStringList files = QFileDialog::getOpenFileNames(this, tr("Select Files To Add"),
69 QString dir = QFileInfo (files[0]).absoluteDir().absolutePath();
70 settings.setValue("LastFolder", dir);
72 foreach (QString string, files)
74 toadd.append (string);
76 plman.addStringList(toadd);
79 void MainWindow::addFolder()
81 QString folder = settings.value("LastFolder").toString();
83 folder = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
84 QString dir = QFileDialog::getExistingDirectory(this,
85 tr("Select Directory To Add"),
89 QStringList files = QDir (dir).entryList(filters, QDir::AllDirs);
91 files.removeAll("..");
93 bool recursive = false;
95 recursive = QMessageBox::question(this, "Add all folders", "Subfolders have been detected, add everything?", QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes;
96 plman.parseAndAddFolder(dir, recursive);
100 void MainWindow::addUrl()
102 #ifdef AVOID_INPUT_DIALOG
103 QString url = "http://war.str3am.com:7970";
105 QString url = QInputDialog::getText(this, "Get URL", "Please type in the stream URL");
109 plman.addStringList(toadd);
113 void MainWindow::about()
115 QMessageBox::information(this, tr("About TomAmp v0.1"),
116 tr("TomAmp is a simple playlist-based music player.\n\n"
117 "(c) 2010 Tamas Marki <tmarki@gmail.com>\n\n"
118 "Please send comments and bug reports to the above e-mail address.\n\n"
119 "Icons by deleket (http://www.deleket.com)"));
122 void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState */)
124 qDebug () << "State: " << newState;
127 case Phonon::ErrorState:
128 if (mediaObject->errorType() == Phonon::FatalError)
130 // QMessageBox::warning(this, tr("Fatal Error"),
131 // mediaObject->errorString() + mediaObject->currentSource().fileName() + ", " + mediaObject->currentSource().url().toString());
135 // QMessageBox::warning(this, tr("Error"),
136 // mediaObject->errorString());
140 case Phonon::PlayingState:
141 setWindowTitle(mediaObject->metaData().value("TITLE") + " - TomAmp");
142 pauseAction->setVisible(true);
143 playAction->setVisible (false);
144 playAction->setEnabled(false);
145 pauseAction->setEnabled(true);
146 stopAction->setEnabled(true);
147 lastPlayed = plman.indexOf(mediaObject->currentSource());
149 case Phonon::StoppedState:
150 stopAction->setEnabled(false);
151 playAction->setEnabled(true);
152 pauseAction->setVisible(false);
153 playAction->setVisible(true);
154 pauseAction->setEnabled(false);
155 timeLcd->display("00:00");
156 unhighlightRow(plman.indexOf(mediaObject->currentSource()));
158 case Phonon::PausedState:
159 pauseAction->setEnabled(false);
160 stopAction->setEnabled(true);
161 pauseAction->setVisible(false);
162 playAction->setVisible(true);
163 playAction->setEnabled(true);
164 qDebug () << "Queue size: " << mediaObject->queue().size ();
165 if (mediaObject->queue().size ())
167 /* mediaObject->setCurrentSource(mediaObject->queue()[0]);
168 musicTable->selectRow(plman.indexOf(mediaObject->currentSource()));*/
169 setItem (plman.indexOf(mediaObject->queue()[0]), true);
170 // mediaObject->play();
172 mediaObject->clearQueue();
174 case Phonon::BufferingState:
175 qDebug () << "Buffering";
182 void MainWindow::next()
184 bool wasPlaying = (mediaObject->state () == Phonon::PlayingState);
185 if (mediaObject->state () == Phonon::ErrorState)
187 qDebug () << "NEXT, repeat=" << repeat << ", shuffle=" << shuffle << ", ShuffleLis size=" << shuffleList.size ();
188 if (shuffleList.size() != plman.size())
189 qDebug () << "WHOA STRANGE SHUFFLE: " << shuffleList;
190 int index = plman.indexOf(mediaObject->currentSource());
191 qDebug () << "Current index is " << index;
194 qDebug () << "Shuffle next " << index;
195 index = shuffleList.indexOf(plman.indexOf(mediaObject->currentSource())) + 1;
196 while (index < shuffleList.size () && !plman.getItem(shuffleList[index]).playable)
199 qDebug () << "Index increase a " << index;
201 qDebug () << "Shuffle next 2 " << index;
202 if (index < shuffleList.size ())
204 setItem (index, wasPlaying);
209 while ((index) < shuffleList.size () && !plman.getItem(shuffleList[index]).playable)
211 qDebug () << "Index increase 2a " << index;
214 setItem (index, wasPlaying);
216 /* if (index >= shuffleList.size ())
217 wasPlaying = false;*/
223 qDebug () << "Normal next";
224 while ((index) < plman.size () && !plman.getItem(index).playable)
227 qDebug () << "Index increase " << index;
229 qDebug () << "Normal next 2 " << index;
230 if (index < plman.size())
232 setItem (index, wasPlaying);
236 qDebug () << "Repeat on";
238 while ((index) < plman.size () && !plman.getItem(index).playable)
241 qDebug () << "Index increase " << index;
243 setItem (index, wasPlaying);
245 /* if (index >= shuffleList.size ())
246 wasPlaying = false;*/
249 mediaObject->play();*/
250 qDebug () << "wasPlaying: " << wasPlaying << ", playbutton visible: " << playAction->isVisible();
253 void MainWindow::setItem(int i, bool doplay)
255 if (i < plman.size() && i >= 0)
258 unhighlightRow(lastPlayed);
261 qDebug () << "SetItem with shuffle, index = " << i << " real index is " << shuffleList[i];
262 qDebug () << "ShuffleList: " << shuffleList;
264 highlightRow(shuffleList[i]);
265 mediaObject->setCurrentSource(plman.at (shuffleList[i]));
266 // musicTable->selectRow (shuffleList[i]);
270 qDebug () << "SetItem without shuffle, index = " << i;
273 mediaObject->setCurrentSource(plman.at(i));
274 // musicTable->selectRow (i);
277 if (doplay && mediaObject->currentSource().type() != Phonon::MediaSource::Invalid)
281 void MainWindow::previous()
283 bool wasPlaying = (mediaObject->state () == Phonon::PlayingState);
284 if (mediaObject->state () == Phonon::ErrorState)
286 qDebug () << "PREVIOUS, repeat=" << repeat << ", shuffle=" << shuffle;
287 int index = plman.indexOf(mediaObject->currentSource());
288 qDebug () << "Current index is " << index;
291 qDebug () << "Shuffle next";
292 index = shuffleList.indexOf(plman.indexOf(mediaObject->currentSource())) - 1;
293 while (index >= 0 && !plman.getItem(shuffleList[index]).playable)
296 qDebug () << "Index increase a " << index;
298 qDebug () << "Shuffle next 2 " << index;
301 setItem (index, wasPlaying);
305 index = plman.size () - 1;
306 while (index >= 0 && !plman.getItem(shuffleList[index]).playable)
308 qDebug () << "Index increase 2a " << index;
311 setItem (index, wasPlaying);
314 wasPlaying = false;*/
320 qDebug () << "Normal next";
321 while ((index) >= 0 && !plman.getItem(index).playable)
324 qDebug () << "Index increase " << index;
326 qDebug () << "Normal next 2 " << index;
329 setItem (index, wasPlaying);
333 qDebug () << "Repeat on";
334 index = plman.size() - 1;
335 while ((index) >= 0 && !plman.getItem(index).playable)
338 qDebug () << "Index increase " << index;
340 setItem (index, wasPlaying);
343 wasPlaying = false;*/
346 mediaObject->play();*/
347 qDebug () << "wasPlaying: " << wasPlaying << ", playbutton visible: " << playAction->isVisible();
352 void MainWindow::highlightRow (int i)
354 for (int j = 0; j < 3; ++j)
356 QTableWidgetItem* item = musicTable->item(i, j);
359 QFont font = item->font();
361 font.setItalic(true);
367 void MainWindow::unhighlightRow (int i)
369 for (int j = 0; j < 3; ++j)
371 QTableWidgetItem* item = musicTable->item(i, j);
374 QFont font = item->font();
376 font.setItalic(false);
383 void MainWindow::tick(qint64 time)
385 QTime displayTime(0, (time / 60000) % 60, (time / 1000) % 60);
387 timeLcd->display(displayTime.toString("mm:ss"));
390 void MainWindow::tableClicked(int row, int /* column */)
392 // bool wasPlaying = mediaObject->state() == Phonon::PlayingState;
394 /* mediaObject->stop();
395 mediaObject->clearQueue();*/
397 if (row >= plman.size())
401 while (index < shuffleList.size () && !plman.getItem(index).playable)
405 if (plman.size() > index)
408 index = shuffleList.indexOf(index);
409 setItem (index, true);
410 // mediaObject->play();
415 while (index < plman.size () && !plman.getItem(index).playable)
419 if (plman.size() > index)
422 index = shuffleList.indexOf(index);
423 setItem (index, true);
424 // mediaObject->play();
430 void MainWindow::sourceChanged(const Phonon::MediaSource &source)
432 musicTable->selectRow(plman.indexOf(source));
433 timeLcd->display("00:00");
437 void MainWindow::aboutToFinish()
439 qDebug () << "Abouttotfinish";
440 int index = plman.indexOf(mediaObject->currentSource()) + 1;
443 index = shuffleList.indexOf(plman.indexOf(mediaObject->currentSource())) + 1;
444 if (index < shuffleList.size ())
446 mediaObject->enqueue(plman.at (shuffleList[index]));
450 mediaObject->enqueue(plman.at (shuffleList[0]));
456 if (plman.size() > index)
458 mediaObject->enqueue(plman.at(index));
459 qDebug () << "Enqueue " << index << " pfm " << mediaObject->prefinishMark();
463 mediaObject->enqueue(plman.at(0));
464 qDebug () << "Enqueue " << 0 << " pfm " << mediaObject->prefinishMark();
469 void MainWindow::finished()
471 qDebug () << "Finished";
474 void MainWindow::setupActions()
476 playAction = new QAction(QIcon (QPixmap (":images/play")), tr("Play"), this);
477 playAction->setShortcut(tr("Crl+P"));
478 playAction->setDisabled(true);
479 pauseAction = new QAction(QIcon (QPixmap (":images/pause")), tr("Pause"), this);
480 pauseAction->setShortcut(tr("Ctrl+A"));
481 pauseAction->setDisabled(true);
482 pauseAction->setVisible(false);
483 stopAction = new QAction(QIcon (QPixmap (":images/stop")), tr("Stop"), this);
484 stopAction->setShortcut(tr("Ctrl+S"));
485 stopAction->setDisabled(true);
486 nextAction = new QAction(QIcon (QPixmap (":images/next")), tr("Next"), this);
487 nextAction->setShortcut(tr("Ctrl+N"));
488 previousAction = new QAction(QIcon (QPixmap (":images/previous")), tr("Previous"), this);
489 previousAction->setShortcut(tr("Ctrl+R"));
490 repeatAction = new QAction(QIcon (QPixmap (":images/repeat")), tr("Repeat"), this);
491 repeatAction->setCheckable(true);
492 repeatAction->setChecked(repeat);
493 repeatAction->setShortcut(tr("Ctrl+I"));
494 shuffleAction = new QAction(QIcon (QPixmap (":images/shuffle")), tr("Shuffle"), this);
495 shuffleAction->setCheckable(true);
496 shuffleAction->setChecked(shuffle);
497 shuffleAction->setShortcut(tr("Ctrl+H"));
498 volumeAction = new QAction(QIcon (QPixmap (":images/volume")), tr("Volume"), this);
499 volumeAction->setCheckable(true);
500 volumeAction->setShortcut(tr("Ctrl+V"));
501 addFilesAction = new QAction(tr("Add &File"), this);
502 addFilesAction->setShortcut(tr("Ctrl+F"));
503 addFoldersAction = new QAction(tr("Add F&older"), this);
504 addFoldersAction->setShortcut(tr("Ctrl+O"));
505 addUrlAction = new QAction(tr("Add &Url"), this);
506 addUrlAction->setShortcut(tr("Ctrl+U"));
507 savePlaylistAction = new QAction (tr("Sa&ve Playlist"), this);
508 savePlaylistAction->setShortcut(tr ("Ctrl+V"));
509 loadPlaylistAction = new QAction (tr("&Load Playlist"), this);
510 loadPlaylistAction->setShortcut(tr("Ctrl+L"));
511 clearPlaylistAction = new QAction (tr("&Clear Playlist"), this);
512 clearPlaylistAction->setShortcut(tr("Ctrl+C"));
513 exitAction = new QAction(tr("E&xit"), this);
514 exitAction->setShortcut(tr("Ctrl+X"));
515 aboutAction = new QAction(tr("A&bout"), this);
516 aboutAction->setShortcut(tr("Ctrl+B"));
517 aboutQtAction = new QAction(tr("About &Qt"), this);
518 aboutQtAction->setShortcut(tr("Ctrl+Q"));
519 /* removeSelected = new QAction (tr("&Delete from playlist"));
520 removeSelected->setShortcut(tr ("Ctrl+D"));*/
522 connect(playAction, SIGNAL(triggered()), mediaObject, SLOT(play()));
523 connect(pauseAction, SIGNAL(triggered()), mediaObject, SLOT(pause()) );
524 connect(stopAction, SIGNAL(triggered()), mediaObject, SLOT(stop()));
525 connect(repeatAction, SIGNAL(triggered()), this, SLOT(repeatToggle()));
526 connect(shuffleAction, SIGNAL(triggered()), this, SLOT(shuffleToggle()));
527 connect(volumeAction, SIGNAL(triggered()), this, SLOT(volumeToggle()));
529 connect(addFilesAction, SIGNAL(triggered()), this, SLOT(addFiles()));
530 connect(addFoldersAction, SIGNAL(triggered()), this, SLOT(addFolder()));
531 connect(addUrlAction, SIGNAL(triggered()), this, SLOT(addUrl()));
532 connect (savePlaylistAction, SIGNAL (triggered()), this, SLOT (savePlaylist()));
533 connect (loadPlaylistAction, SIGNAL (triggered()), this, SLOT (loadPlaylist()));
534 connect (clearPlaylistAction, SIGNAL (triggered()), &plman, SLOT (clearPlaylist()));
535 connect (nextAction, SIGNAL(triggered()), this, SLOT(next()));
536 connect (previousAction, SIGNAL(triggered()), this, SLOT(previous()));
537 connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
538 connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
539 connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
540 // connect (removeSelected, SIGNAL (triggered()), this, SLOT (removeSelectedItem()));
543 void MainWindow::removeSelectedItem()
545 qDebug () << "Remove Selected!";
546 int row = musicTable->currentRow();
548 plman.removeItem(row);
551 void MainWindow::removeAllButSelectedItem()
553 qDebug () << "Remove Selected!";
554 int row = musicTable->currentRow();
557 QString uri = plman.getItem(row).uri;
560 plman.clearPlaylist();
561 plman.addStringList(lst);
565 void MainWindow::repeatToggle ()
568 qDebug() << "Repeat toggled to " << repeat;
569 settings.setValue("repeat", QVariant (repeat));
572 void MainWindow::shuffleToggle ()
575 settings.setValue("shuffle", QVariant (shuffle));
578 void MainWindow::volumeToggle ()
580 qDebug () << "Volumetoggle: " << volumeAction->isChecked();
581 volumeSlider->setVisible(volumeAction->isChecked());
584 void MainWindow::play()
590 void MainWindow::setupMenus()
592 QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
593 fileMenu->addAction(addFilesAction);
594 fileMenu->addAction(addFoldersAction);
595 fileMenu->addAction(addUrlAction);
596 fileMenu->addSeparator();
597 fileMenu->addAction(savePlaylistAction);
598 fileMenu->addAction(loadPlaylistAction);
599 fileMenu->addAction(clearPlaylistAction);
600 // fileMenu->addAction(exitAction);
602 QMenu *aboutMenu = menuBar()->addMenu(tr("&Help"));
603 aboutMenu->addAction(aboutAction);
604 aboutMenu->addAction(aboutQtAction);
607 void MainWindow::setupUi()
609 QToolBar *bar = new QToolBar;
611 bar->setOrientation(Qt::Vertical);
612 bar->setStyleSheet("padding:7px");
613 //bar->addAction(volumeAction);
615 seekSlider = new Phonon::SeekSlider(this);
616 seekSlider->setMediaObject(mediaObject);
618 volumeSlider = new Phonon::VolumeSlider(this);
619 volumeSlider->setAudioOutput(audioOutput);
620 volumeSlider->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
621 volumeSlider->setOrientation(Qt::Horizontal);
622 volumeSlider->setMuteVisible(false);
623 // volumeAddedAction = bar->addWidget(volumeSlider);
624 // volumeAddedAction->setVisible(false);
625 bar->addAction(playAction);
626 bar->addAction(pauseAction);
627 bar->addAction(stopAction);
628 bar->addAction(repeatAction);
629 bar->addAction(shuffleAction);
630 bar->addAction(nextAction);
631 bar->addAction(previousAction);
633 contextMenu = new QMenu (this);
634 removeSelected = contextMenu->addAction(tr ("Remove selected"));
635 removeAllButSelected = contextMenu->addAction(tr("Remove all but selected"));
636 connect (removeSelected, SIGNAL (triggered()), this, SLOT (removeSelectedItem()));
637 connect (removeAllButSelected, SIGNAL (triggered()), this, SLOT (removeAllButSelectedItem()));
640 timeLcd = new QLCDNumber;
643 headers << tr("Artist") << tr("Title") << tr("Album");
645 musicTable = new QTableWidget(0, 3);
646 musicTable->setHorizontalHeaderLabels(headers);
647 musicTable->setSelectionMode(QAbstractItemView::SingleSelection);
648 musicTable->setSelectionBehavior(QAbstractItemView::SelectRows);
649 connect(musicTable, SIGNAL(cellDoubleClicked(int,int)),
650 this, SLOT(tableClicked(int,int)));
651 connect(musicTable, SIGNAL(cellClicked(int,int)),
652 this, SLOT(cellClicked(int,int)));
653 /* for (int i = 0; i < 3; ++i)
655 if (!musicTable->horizontalHeaderItem(i))
657 musicTable->horizontalHeaderItem(i)->setBackgroundColor(QColor (128, 128, 255));;
658 musicTable->horizontalHeaderItem(i)->setForeground(QColor (255, 255, 255));
660 for (int i = 0; i < musicTable->columnCount(); ++i)
662 QString lab = QString ("colWidth_%1").arg (i);
663 int val = settings.value(lab, 0).toInt();
665 musicTable->setColumnWidth(i, val);
666 // settings.setValue(lab, musicTable->columnWidth(i));
670 QHBoxLayout *seekerLayout = new QHBoxLayout;
671 QToolBar* bar2 = new QToolBar;
672 bar2->addAction(volumeAction);
673 seekerLayout->addWidget(bar2);
674 seekerLayout->addWidget(volumeSlider);
675 seekerLayout->addWidget(seekSlider);
676 seekerLayout->addWidget(timeLcd);
678 QVBoxLayout *playbackLayout = new QVBoxLayout;
679 volumeSlider->hide ();
680 playbackLayout->addWidget(bar);
682 QVBoxLayout *seekAndTableLayout = new QVBoxLayout;
684 seekAndTableLayout->addWidget(musicTable);
685 seekAndTableLayout->addLayout(seekerLayout);
687 QHBoxLayout *mainLayout = new QHBoxLayout;
688 mainLayout->addLayout(seekAndTableLayout);
689 mainLayout->addLayout(playbackLayout);
691 QWidget *widget = new QWidget;
692 widget->setLayout(mainLayout);
694 setCentralWidget(widget);
695 setWindowTitle("TomAmp");
696 qDebug () << "cucc: " << musicTable->columnWidth(1);
699 void MainWindow::cellClicked(int /*row*/, int)
703 void MainWindow::contextMenuEvent (QContextMenuEvent*e)
705 qDebug () << "Context menu event!";
706 contextMenu->popup(e->globalPos());
710 void MainWindow::setupShuffleList()
713 int index = plman.indexOf(mediaObject->currentSource());
716 for (int i = 0; i < plman.size(); ++i)
722 shuffleList.append (index);
725 int ind = qrand () % tmp.size();
726 shuffleList.append(tmp[ind]);
729 qDebug () << shuffleList;
732 void MainWindow::savePlaylist ()
734 QString filename = QFileDialog::getSaveFileName(this, tr("Please select file name"), "", "Playlist Files (*.m3u)");
735 plman.loadPlaylist(filename);
738 void MainWindow::loadPlaylist ()
740 QString filename = QFileDialog::getOpenFileName(this, tr("Select playlist file to load"), "", "*.m3u");
741 plman.loadPlaylist (filename);
744 void MainWindow::playlistChanged(int from)
746 while (musicTable->rowCount() > from)
748 musicTable->removeRow(musicTable->rowCount () - 1);
751 for (int i = from; i < plman.size (); ++i)
753 if (firstGood < 0 && plman.getItem (i).playable)
755 int currentRow = musicTable->rowCount();
756 musicTable->insertRow(currentRow);
757 setRowFromItem (currentRow, plman.getItem(i));
759 if (plman.indexOf(mediaObject->currentSource()) < 0)
761 setItem (firstGood, false);
766 void MainWindow::setRowFromItem (int row, const PlaylistItem& item)
768 if (row >= musicTable->rowCount())
770 if (item.artist.isEmpty() && item.title.isEmpty())
772 QTableWidgetItem *item1 = new QTableWidgetItem(item.uri);
773 item1->setFlags(item1->flags() ^ Qt::ItemIsEditable);
774 musicTable->setItem(row, 1, item1);
778 QTableWidgetItem *item1 = new QTableWidgetItem(item.artist);
779 item1->setFlags(item1->flags() ^ Qt::ItemIsEditable);
780 musicTable->setItem(row, 0, item1);
781 QTableWidgetItem *item2 = new QTableWidgetItem(item.title);
782 item2->setFlags(item2->flags() ^ Qt::ItemIsEditable);
783 musicTable->setItem(row, 1, item2);
784 QTableWidgetItem *item3 = new QTableWidgetItem(item.album);
785 item3->setFlags(item3->flags() ^ Qt::ItemIsEditable);
786 musicTable->setItem(row, 2, item3);
790 void MainWindow::itemUpdated(int index)
792 if (plman.indexOf(mediaObject->currentSource()) < 0 && plman.getItem (index).playable)
794 setItem (index, false);
796 setRowFromItem (index, plman.getItem(index));
797 if (plman.indexOf(mediaObject->currentSource()) == index)
799 if (shuffle) index = shuffleList.indexOf(index);
800 setItem (index, false);