2 * SomePlayer - An alternate music player for Maemo 5
3 * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "playerform.h"
21 #include "ui_playerform.h"
23 #include "player/player.h"
26 #include "trackrenderer.h"
28 #include "playlistdialog.h"
29 #include "edittagsdialog.h"
30 #include <QSpacerItem>
33 using namespace SomePlayer::DataObjects;
34 using namespace SomePlayer::Playback;
35 using namespace SomePlayer::Storage;
37 inline void __fill_list(QStandardItemModel *_model, Playlist playlist) {
39 QList<Track> tracks = playlist.tracks();
40 int count = tracks.count();
41 _model->setRowCount(count);
42 _model->setColumnCount(2);
44 for (int i = 0; i < count; i++) {
45 TrackMetadata meta = tracks.at(i).metadata();
46 time.setHMS(0, meta.length()/60, meta.length() % 60);
47 QString t = meta.title()+"#_#"+meta.artist()+"#_#"+meta.album()+"#_#"+time.toString("mm:ss");
48 _model->setItem(i, 1, new QStandardItem(t));
52 PlayerForm::PlayerForm(Library* lib, QWidget *parent) :
54 ui(new Ui::PlayerForm)
58 _icons_theme = config.getValue("ui/iconstheme").toString();
59 _player = new Player(this);
62 if (_player->random()) {
63 ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_on.png"));
65 ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_off.png"));
67 if (_player->repeat() == REPEAT_ALL) {
68 ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_all.png"));
69 } else if (_player->repeat() == REPEAT_NO){
70 ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_off.png"));
72 ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_one.png"));
75 _fscreen_button = new QPushButton(this);
76 _fscreen_button->setFlat(true);
77 _fscreen_button->setIcon(QIcon(":/icons/"+_icons_theme+"/fullscreen.png"));
78 _fscreen_button->setCheckable(true);
79 _fscreen_button->setMinimumSize(70, 70);
80 _fscreen_button->setMaximumSize(70, 70);
81 _fscreen_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
82 _fscreen_button->hide();
84 ui->volumeSlider->setMinimum(0);
85 ui->volumeSlider->setMaximum(100);
86 ui->volumeSlider->setValue(config.getValue("playback/volume").toInt());
87 _player->setVolume(ui->volumeSlider->value());
88 ui->volumeSlider->hide();
89 ui->seekSlider->setEnabled(false);
90 ui->progressLayout->removeItem(ui->seekSpacer);
91 _tools_widget = new ToolsWidget(this);
92 ui->toolsLayout->insertWidget(0, _tools_widget);
93 _tools_widget->hide();
94 _model = new QStandardItemModel(0, 2, this);
95 ui->playlistView->setModel(_model);
96 _context_menu = new QMenu(ui->playlistView);
97 QAction *clear_playlist = _context_menu->addAction("Clear playlist");
98 QAction *delete_action = _context_menu->addAction("Delete");
99 QAction *add_to_favorites = _context_menu->addAction("Add to favorites");
100 QAction *enqueue_action = _context_menu->addAction("Enqueue");
101 QAction *add_to_playlists = _context_menu->addAction("Add to playlists");
102 QAction *edit_tags = _context_menu->addAction("Edit tags");
104 _track_renderer = new TrackRenderer(this);
105 _track_renderer->setActiveRow(-1);
106 _track_renderer->setSearchRow(-1);
107 ui->playlistView->setItemDelegateForColumn(1, _track_renderer);
108 ui->playlistView->setItemDelegateForColumn(0, _track_renderer);
110 _tag_resolver = new TagResolver(this);
112 connect(ui->libraryButton, SIGNAL(clicked()), this, SLOT(_library()));
113 connect(ui->viewButton, SIGNAL(clicked()), this, SLOT(_toggle_view()));
114 connect(ui->playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(_process_click(QModelIndex)));
115 connect(ui->playpauseButton, SIGNAL(clicked()), _player, SLOT(toggle()));
116 connect(ui->nextButton, SIGNAL(clicked()), _player, SLOT(next()));
117 connect(ui->stopButton, SIGNAL(clicked()), _player, SLOT(stop()));
118 connect(ui->prevButton, SIGNAL(clicked()), _player, SLOT(prev()));
119 connect(_player, SIGNAL(trackChanged(Track)), this, SLOT(_track_changed(Track)));
120 connect(_player, SIGNAL(tick(int,int)), this, SLOT(_tick(int,int)));
121 connect(ui->randomButton, SIGNAL(clicked()), this, SLOT(_toggle_random()));
122 connect(ui->repeatButton, SIGNAL(clicked()), this, SLOT(_toggle_repeat()));
123 connect(ui->seekSlider, SIGNAL(sliderMoved(int)), _player, SLOT(seek(int)));
124 connect(ui->volumeSlider, SIGNAL(sliderMoved(int)), _player, SLOT(setVolume(int)));
125 connect(ui->playlistView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(_custom_context_menu_requested(QPoint)));
126 connect(clear_playlist, SIGNAL(triggered()), this, SIGNAL(clearPlaylist()));
127 connect(delete_action, SIGNAL(triggered()), this, SLOT(_delete_track()));
128 connect(enqueue_action, SIGNAL(triggered()), this, SLOT(_enqueue_track()));
129 connect(add_to_favorites, SIGNAL(triggered()), this, SLOT(_add_to_favorites()));
130 connect(add_to_playlists, SIGNAL(triggered()), this, SLOT(_add_to_playlists()));
131 connect(edit_tags, SIGNAL(triggered()), this, SLOT(_edit_tags()));
132 connect(_player, SIGNAL(stateChanged(PlayerState)), this, SLOT(_state_changed(PlayerState)));
133 connect(_player, SIGNAL(trackDone(Track)), _lib, SLOT(updateTrackCount(Track)));
134 connect(_tag_resolver, SIGNAL(decoded(Track)), this, SLOT(_track_decoded(Track)));
135 connect(ui->volumeButton, SIGNAL(clicked()), this, SLOT(_toggle_volume()));
136 connect(ui->moreButton, SIGNAL(clicked()), this, SLOT(_tools_widget_toggle()));
137 connect(_tools_widget, SIGNAL(search(QString)), this, SLOT(search(QString)));
138 connect(_tools_widget, SIGNAL(nextSearch()), this, SLOT(nextItem()));
139 connect(_tools_widget, SIGNAL(prevSearch()), this, SLOT(prevItem()));
140 connect(_tools_widget, SIGNAL(toggleFullscreen(bool)), this, SIGNAL(fullscreen(bool)));
141 connect(_tools_widget, SIGNAL(toggleFullscreen(bool)), _fscreen_button, SLOT(setChecked(bool)));
142 connect(_fscreen_button, SIGNAL(clicked(bool)), this, SIGNAL(fullscreen(bool)));
143 connect(_fscreen_button, SIGNAL(clicked(bool)), _tools_widget, SLOT(setFullscreenState(bool)));
144 ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playback.png"));
145 _top_gradient = ui->topWidget->styleSheet();
146 _bottom_gradient = ui->bottomWidget->styleSheet();
149 _dbusadaptor = new DBusAdaptop(_player);
150 QDBusConnection connection = QDBusConnection::sessionBus();
151 bool ret = connection.registerService(_SERVICE_NAME_);
152 ret = connection.registerObject("/", _player);
155 PlayerForm::~PlayerForm()
160 void PlayerForm::_library() {
164 void PlayerForm::reload(bool reread) {
166 _current_playlist = _lib->getCurrentPlaylist();
167 _player->setPlaylist(_current_playlist);
168 __fill_list(_model, _current_playlist);
169 ui->playlistView->setColumnWidth(0, 50);
173 void PlayerForm::_toggle_view() {
174 int index = ui->stackedWidget->currentIndex();
175 index = (!index % 2);
177 ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playlist.png"));
178 ui->moreButton->hide();
179 _fscreen_button->show();
181 ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playback.png"));
182 ui->moreButton->show();
183 _fscreen_button->hide();
185 ui->stackedWidget->setCurrentIndex(index);
188 void PlayerForm::_process_click(QModelIndex index) {
189 if (index.column() == 1) {
190 int id = index.row();
192 _player->setTrackId(id);
194 _track_renderer->setActiveRow(id);
196 _custom_context_menu_requested(ui->playlistView->rect().center());
200 void PlayerForm::_track_changed(Track track) {
201 int id = _current_playlist.tracks().indexOf(track);
202 QModelIndex index = _model->index(id, 0);
203 ui->playlistView->setCurrentIndex(index);
204 ui->playlistView->scrollTo(index);
205 _track_renderer->setActiveRow(id);
206 ui->playlistView->hide();
207 ui->playlistView->show();
208 _display_track(track);
211 void PlayerForm::_display_track(Track track) {
212 ui->countLabel->setText(QString("%1/%2").
213 arg(_current_playlist.tracks().indexOf(track)+1).
214 arg(_current_playlist.tracks().count()));
215 ui->titleLabel->setText(QString("<h3>%1</h3>").arg(track.metadata().title()));
216 ui->artistAlbumLabel->setText(QString("<b>%1</b><br/>%2").
217 arg(track.metadata().artist()).
218 arg(track.metadata().album()));
219 ui->seekSlider->setMinimum(0);
220 ui->seekSlider->setMaximum(track.metadata().length());
221 _tick(0, track.metadata().length());
224 void PlayerForm::_tick(int done, int all) {
225 _time->setHMS(0, all/60, all%60);
226 ui->allTimeLabel->setText(_time->toString("mm:ss"));
227 _time->setHMS(0, done/60, done%60);
228 ui->doneTimeLabel->setText(_time->toString("mm:ss"));
229 ui->seekSlider->setValue(done);
232 void PlayerForm::_slider_released() {
233 _player->seek(ui->seekSlider->value());
236 void PlayerForm::_custom_context_menu_requested(const QPoint &pos) {
237 _context_menu->exec(pos);
240 void PlayerForm::_delete_track() {
241 QList<QModelIndex> idx = ui->playlistView->selectionModel()->selectedIndexes();
244 int id = idx.first().row();
245 int aid = _track_renderer->activeRow();
247 _track_renderer->setActiveRow(aid-1);
248 } else if (aid == id) {
249 _track_renderer->setActiveRow(-1);
251 _current_playlist.removeTrackAt(id);
252 _lib->saveCurrentPlaylist(_current_playlist);
256 void PlayerForm::_enqueue_track() {
257 QList<QModelIndex> idx = ui->playlistView->selectionModel()->selectedIndexes();
260 int id = idx.first().row();
261 _player->enqueue(id);
264 void PlayerForm::_add_to_favorites() {
265 QList<QModelIndex> idx = ui->playlistView->selectionModel()->selectedIndexes();
268 int id = idx.first().row();
269 _lib->addToFavorites(_current_playlist.tracks().at(id));
272 void PlayerForm::_state_changed(PlayerState state) {
273 if (state == PLAYER_PLAYING) {
274 ui->playpauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/pause.png"));
275 ui->seekSlider->setEnabled(true);
277 if (state == PLAYER_STOPPED) {
278 ui->seekSlider->setValue(0);
279 ui->doneTimeLabel->setText("00:00");
280 ui->seekSlider->setEnabled(false);
282 ui->playpauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/play.png"));
286 void PlayerForm::_toggle_random() {
287 _player->toggleRandom();
288 if (_player->random()) {
289 ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_on.png"));
291 ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_off.png"));
295 void PlayerForm::_toggle_repeat() {
296 _player->toggleRepeat();
297 if (_player->repeat() == REPEAT_ALL) {
298 ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_all.png"));
299 } else if (_player->repeat() == REPEAT_NO){
300 ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_off.png"));
302 ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_one.png"));
306 void PlayerForm::search(QString pattern) {
307 _search_pattern = pattern;
308 _search_current_id = -1;
312 void PlayerForm::nextItem() {
313 QString data = _model->index(_search_current_id, 1).data().toString();
314 for (int i = _search_current_id+1; i < _model->rowCount(); i++) {
315 data = _model->index(i, 1).data().toString();
316 if (data.contains(_search_pattern, Qt::CaseInsensitive)) {
317 _search_current_id = i;
321 QModelIndex id = _model->index(_search_current_id, 1);
322 _track_renderer->setSearchRow(_search_current_id);
323 ui->playlistView->scrollTo(id);
324 ui->playlistView->hide();
325 ui->playlistView->show();
328 void PlayerForm::prevItem() {
329 QString data = _model->index(_search_current_id, 1).data().toString();
330 for (int i = _search_current_id-1; i >= 0; i--) {
331 data = _model->index(i, 1).data().toString();
332 if (data.contains(_search_pattern, Qt::CaseInsensitive)) {
333 _search_current_id = i;
337 QModelIndex id = _model->index(_search_current_id, 1);
338 _track_renderer->setSearchRow(_search_current_id);
339 ui->playlistView->scrollTo(id);
340 ui->playlistView->hide();
341 ui->playlistView->show();
344 void PlayerForm::cancelSearch() {
345 _search_pattern = "";
346 _track_renderer->setSearchRow(-1);
347 ui->playlistView->scrollTo(_model->index(_track_renderer->activeRow(), 1));
348 ui->playlistView->hide();
349 ui->playlistView->show();
352 void PlayerForm::addFiles(QList<QString> files) {
353 _tag_resolver->decode(files);
356 void PlayerForm::_track_decoded(Track track) {
357 _current_playlist.addTrack(track);
358 __fill_list(_model, _current_playlist);
359 ui->playlistView->setColumnWidth(0, 50);
360 _lib->saveCurrentPlaylist(_current_playlist);
361 _player->setPlaylist(_current_playlist);
364 void PlayerForm::_add_to_playlists() {
365 QList<QModelIndex> idx = ui->playlistView->selectionModel()->selectedIndexes();
368 int id = idx.first().row();
370 QList<QString> names = _lib->getPlaylistsNames();
371 names.removeOne(_CURRENT_PLAYLIST_SUBST_);
372 PlaylistDialog dialog(names, this);
373 if (dialog.exec() == QDialog::Accepted) {
374 QList<QString> selected = dialog.selected();
375 foreach (QString name, selected) {
376 Playlist pl = _lib->getPlaylist(name);
377 pl.addTrack(_current_playlist.tracks().at(id));
378 _lib->savePlaylist(pl);
383 void PlayerForm::_edit_tags() {
384 QList<QModelIndex> idx = ui->playlistView->selectionModel()->selectedIndexes();
387 Track track = _current_playlist.tracks().at(idx.first().row());
389 EditTagsDialog dialog(this);
390 dialog.setTrackMetadata(track.metadata());
391 if (dialog.exec() == QDialog::Accepted) {
392 track.setMetadata(dialog.meta());
393 _lib->updateTrackMetadata(track);
395 emit refreshLibrary();
399 void PlayerForm::stop() {
403 void PlayerForm::_toggle_volume() {
404 if (ui->volumeSlider->isVisible()) {
405 ui->volumeSlider->hide();
407 ui->volumeSlider->show();
408 ui->volumeSlider->setValue(_player->volume());
412 void PlayerForm::_volume_changed() {
413 int value = ui->volumeSlider->value();
414 _player->setVolume(value);
417 void PlayerForm::landscapeMode() {
418 ui->progressLayout->removeItem(ui->seekSpacer);
419 ui->progressLayout->insertWidget(1, ui->seekSlider);
420 ui->progressWidget->setVisible(false);
424 ui->topWidget->hide();
425 ui->bottomWidget->hide();
427 ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_0);
428 ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_1);
429 ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_2);
430 ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_3);
431 ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_4);
432 ui->bhorizontalLayout->addWidget(ui->libraryButton);
433 ui->bhorizontalLayout->addItem(ui->chorizontalSpacer_0);
434 ui->bhorizontalLayout->addWidget(ui->viewButton);
435 ui->bhorizontalLayout->addItem(ui->chorizontalSpacer_1);
436 ui->bhorizontalLayout->addWidget(ui->randomButton);
437 ui->bhorizontalLayout->addWidget(ui->repeatButton);
438 ui->bhorizontalLayout->addItem(ui->chorizontalSpacer_2);
439 ui->bhorizontalLayout->addWidget(ui->prevButton);
440 ui->bhorizontalLayout->addWidget(ui->playpauseButton);
441 ui->bhorizontalLayout->addWidget(ui->nextButton);
442 ui->bhorizontalLayout->addWidget(ui->stopButton);
443 ui->bhorizontalLayout->addItem(ui->chorizontalSpacer_3);
444 ui->bhorizontalLayout->addWidget(ui->moreButton);
445 ui->bhorizontalLayout->addWidget(_fscreen_button);
446 ui->bhorizontalLayout->addItem(ui->chorizontalSpacer_4);
447 ui->bhorizontalLayout->addWidget(ui->volumeButton);
449 if (_tools_widget->isVisible()) {
450 ui->moreButton->setIcon(QIcon(":/icons/"+_icons_theme+"/more.png"));
452 ui->moreButton->setIcon(QIcon(":/icons/"+_icons_theme+"/unmore.png"));
456 void PlayerForm::portraitMode() {
457 ui->progressLayout->insertSpacerItem(1, ui->seekSpacer);
458 ui->progressWidget->layout()->addWidget(ui->seekSlider);
459 ui->progressWidget->setVisible(true);
461 ui->topWidget->show();
462 ui->bottomWidget->show();
466 ui->topWidget->layout()->removeItem(ui->thorizontalSpacer_0);
467 ui->topWidget->layout()->removeItem(ui->thorizontalSpacer_1);
468 ui->topWidget->layout()->removeItem(ui->thorizontalSpacer_2);
469 ui->topWidget->layout()->removeItem(ui->thorizontalSpacer_3);
470 ui->topWidget->layout()->addWidget(ui->prevButton);
471 ui->topWidget->layout()->addItem(ui->thorizontalSpacer_0);
472 ui->topWidget->layout()->addWidget(ui->stopButton);
473 ui->topWidget->layout()->addItem(ui->thorizontalSpacer_1);
474 ui->topWidget->layout()->addWidget(ui->playpauseButton);
475 ui->topWidget->layout()->addItem(ui->thorizontalSpacer_2);
476 ui->topWidget->layout()->addWidget(ui->nextButton);
477 ui->topWidget->layout()->addItem(ui->thorizontalSpacer_3);
478 ui->topWidget->layout()->addWidget(ui->moreButton);
479 ui->topWidget->layout()->addWidget(_fscreen_button);
480 ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_0);
481 ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_1);
482 ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_2);
483 ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_3);
484 ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_4);
486 ui->bottomWidget->layout()->removeItem(ui->bhorizontalSpacer_0);
487 ui->bottomWidget->layout()->removeItem(ui->bhorizontalSpacer_1);
488 ui->bottomWidget->layout()->removeItem(ui->bhorizontalSpacer_2);
489 ui->bottomWidget->layout()->removeItem(ui->bhorizontalSpacer_3);
490 ui->bottomWidget->layout()->addWidget(ui->libraryButton);
491 ui->bottomWidget->layout()->addItem(ui->bhorizontalSpacer_0);
492 ui->bottomWidget->layout()->addWidget(ui->viewButton);
493 ui->bottomWidget->layout()->addItem(ui->bhorizontalSpacer_1);
494 ui->bottomWidget->layout()->addWidget(ui->randomButton);
495 ui->bottomWidget->layout()->addItem(ui->bhorizontalSpacer_2);
496 ui->bottomWidget->layout()->addWidget(ui->repeatButton);
497 ui->bottomWidget->layout()->addItem(ui->bhorizontalSpacer_3);
498 ui->bottomWidget->layout()->addWidget(ui->volumeButton);
500 if (_tools_widget->isVisible()) {
501 ui->moreButton->setIcon(QIcon(":/icons/"+_icons_theme+"/unmore.png"));
503 ui->moreButton->setIcon(QIcon(":/icons/"+_icons_theme+"/more.png"));
507 void PlayerForm::_tools_widget_toggle() {
508 if (_tools_widget->isVisible()) {
509 ui->moreButton->setIcon(QIcon(landscape ? ":/icons/"+_icons_theme+"/unmore.png" : ":/icons/"+_icons_theme+"/more.png"));
510 _tools_widget->hide();
511 _tools_widget->reset();
514 ui->moreButton->setIcon(QIcon(landscape ? ":/icons/"+_icons_theme+"/more.png" : ":/icons/"+_icons_theme+"/unmore.png"));
515 _tools_widget->show();
516 _tools_widget->setFocus();
520 void PlayerForm::updateIcons() {
522 _icons_theme = config.getValue("ui/iconstheme").toString();
523 _tools_widget->updateIcons();
524 _track_renderer->updateIcons();
525 ui->libraryButton->setIcon(QIcon(":/icons/"+_icons_theme+"/library.png"));
526 if (_tools_widget->isVisible()) {
527 ui->moreButton->setIcon(QIcon(landscape ? ":/icons/" + _icons_theme + "/unmore.png" : ":/icons/" + _icons_theme + "/more.png"));
529 ui->moreButton->setIcon(QIcon(landscape ? ":/icons/" + _icons_theme + "/more.png" : ":/icons/" + _icons_theme + "/unmore.png"));
531 ui->nextButton->setIcon(QIcon(":/icons/"+_icons_theme+"/next.png"));
532 ui->stopButton->setIcon(QIcon(":/icons/"+_icons_theme+"/stop.png"));
533 ui->prevButton->setIcon(QIcon(":/icons/"+_icons_theme+"/prev.png"));
534 ui->volumeButton->setIcon(QIcon(":/icons/"+_icons_theme+"/volume.png"));
535 if (_player->state() == PLAYER_PLAYING) {
536 ui->playpauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/pause.png"));
538 ui->playpauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/play.png"));
540 if (ui->stackedWidget->currentIndex()) {
541 ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playlist.png"));
543 ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playback.png"));
545 if (_player->repeat() == REPEAT_ALL) {
546 ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_all.png"));
547 } else if (_player->repeat() == REPEAT_NO){
548 ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_off.png"));
550 ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_one.png"));
552 if (_player->random()) {
553 ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_on.png"));
555 ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_off.png"));
559 void PlayerForm::checkGradient() {
561 if (config.getValue("ui/gradient").toString() == "yes") {
562 ui->bottomWidget->setStyleSheet(_bottom_gradient);
563 ui->topWidget->setStyleSheet(_top_gradient);
565 ui->topWidget->setStyleSheet("");
566 ui->bottomWidget->setStyleSheet("");
570 void PlayerForm::play(Track track) {
572 int id = _current_playlist.tracks().indexOf(track);
574 _player->setTrackId(id);