UIPlaylist::UIPlaylist(MehdiaPlayer* parent)
{
	this->parent = parent;

	widgetPlaylist = new QListWidget;

	buttonDel = new QPushButton("Remove");
	buttonDel->setFixedHeight(30);

	buttonClear = new QPushButton("Clear");
	buttonClear->setFixedHeight(30);

	buttonSave = new QPushButton("Save");
	buttonSave->setFixedHeight(30);


	// Layout
	layout = new QVBoxLayout();

	layoutControlPL = new QHBoxLayout;
	layoutControlPL->addWidget(buttonDel);
	layoutControlPL->addWidget(buttonClear);
	layoutControlPL->addWidget(buttonSave);
	layoutControlPL->setAlignment(Qt::AlignCenter);

	connect(buttonDel, SIGNAL(clicked()), SLOT(delItem()));
	connect(buttonClear, SIGNAL(clicked()), SLOT(buttonClearPlaylist()));
	connect(buttonSave, SIGNAL(clicked()), SLOT(savePlaylist()));
	connect(widgetPlaylist, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(playlistDoubleClicked()));

	layout->addWidget(widgetPlaylist);
	layout->addLayout(layoutControlPL);
	setLayout(layout);
}
Beispiel #2
0
PlaylistPanel::PlaylistPanel() {
	setupUi(this);

	// Random and such
	connect(MPD::instance(), SIGNAL(randomUpdated(bool)), randomButton, SLOT(setChecked(bool)));
	connect(MPD::instance(), SIGNAL(repeatUpdated(bool)), repeatButton, SLOT(setChecked(bool)));
	connect(Config::instance(), SIGNAL(autoAddSongsChanged(bool)), dynamicButton, SLOT(setChecked(bool)));
	connect(randomButton, SIGNAL(toggled(bool)), MPD::instance(), SLOT(setRandom(bool)));
	connect(repeatButton, SIGNAL(toggled(bool)), MPD::instance(), SLOT(setRepeat(bool)));
	dynamicButton->setChecked(Config::instance()->autoAddSongs());
	connect(dynamicButton, SIGNAL(toggled(bool)), Config::instance(), SLOT(setAutoAddSongs(bool)));

	// Button clicks
	connect(cropButton, SIGNAL(clicked()), playlistView, SLOT(cropItems()));
	connect(removeButton, SIGNAL(clicked()), playlistView, SLOT(removeItems()));
	connect(saveAsButton, SIGNAL(clicked()), playlistView, SLOT(savePlaylist()));
	connect(clearButton, SIGNAL(clicked()), MPD::instance(), SLOT(clearPlaylist()));
	connect(shuffleButton, SIGNAL(clicked()), MPD::instance(), SLOT(shufflePlaylist()));

	// Toggle actions
	connect(playlistView, SIGNAL(toggleActions(bool)), removeButton, SLOT(setEnabled(bool)));
	connect(playlistView, SIGNAL(toggleActions(bool)), cropButton, SLOT(setEnabled(bool)));
	
	// Filter
	connect(filter, SIGNAL(textChanged(const QString &)), this, SLOT(updateFilter(const QString &)));
}
Beispiel #3
0
void MainWindow::createActions()
{
    _openM3UAct = new QAction( tr( "M3U-&Playlist öffnen" ), this );
    _openM3UAct->setShortcut( tr( "Ctrl+O" ) );
    _openM3UAct->setStatusTip( tr( "Öffnet die Playlist zur Erstellung des Covers" ) );

    _saveCoverAct = new QAction( tr( "Cover speichern" ), this);
    _saveCoverAct->setShortcut( tr( "Ctrl+S" ) );
    _saveCoverAct->setStatusTip( tr( "Speichert das aktuelle Cover") );
    _saveCoverAct->setDisabled(TRUE);

    _savePlaylistAct = new QAction( tr( "Playlist als Text speichern" ), this);
    _savePlaylistAct->setShortcut( tr( "Ctrl+P" ) );
    _savePlaylistAct->setStatusTip( tr( "Speichert die aktuelle Playlist") );
    _savePlaylistAct->setDisabled(TRUE);

    _formatAlignmentAct = new QAction(tr( "Anordnung..." ),this);
    _formatAlignmentAct->setShortcut(tr ("Ctrl+A"));
    _formatAlignmentAct->setStatusTip(tr( "Anordnung der Einzelcover" ));
    _formatAlignmentAct->setDisabled(TRUE);

    _formatSizeColorAct = new QAction(tr("Größe und Farbe..."),this);
    _formatSizeColorAct->setStatusTip(tr("Einstellung von Größen und Farben"));
    _formatSizeColorAct->setDisabled(TRUE);

    _toolTextAct = new QAction(tr("Text..."),this);


    connect(_openM3UAct, SIGNAL(triggered()), this, SLOT(openM3UFile()));
    connect(_saveCoverAct, SIGNAL(triggered()), this, SLOT(saveCover()));
    connect(_savePlaylistAct, SIGNAL(triggered()), this, SLOT(savePlaylist()));
    connect(_formatAlignmentAct, SIGNAL(triggered()), this, SLOT(formatAlignment()));
    connect(_formatSizeColorAct, SIGNAL(triggered()), this, SLOT(setSizeColor()));
    connect(_toolTextAct, SIGNAL(triggered()), this, SLOT(setText()));
}
NewPlaylistWidget::NewPlaylistWidget( QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::NewPlaylistWidget )
{
    ui->setupUi( this );

    m_saveButton = new QPushButton( tr( "&Create Playlist" ) );
    m_saveButton->setDefault( true );
    m_saveButton->setEnabled( false );

    ui->buttonBox->addButton( m_saveButton, QDialogButtonBox::AcceptRole );

    connect( ui->titleEdit, SIGNAL( textChanged( QString ) ), SLOT( onTitleChanged( QString ) ) );
    connect( ui->tagEdit, SIGNAL( textChanged( QString ) ), SLOT( onTagChanged() ) );
    connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( savePlaylist() ) );
    connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( cancel() ) );

    m_suggestionsModel = new PlaylistModel( ui->suggestionsView );
    ui->suggestionsView->setPlaylistModel( m_suggestionsModel );
    ui->suggestionsView->overlay()->setEnabled( false );

    connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( updateSuggestions() ) );

    ui->titleEdit->setFocus();
}
Beispiel #5
0
Player::~Player()
{
    savePlaylist(RECENTPLAYLIST);
    delete _ui;
    delete _player;
    Scrobbler::destroy();
    DataBase::destroy();
    Settings::destroy();
}
Beispiel #6
0
void Player::savePlaylist()
{
    QString fileName = QFileDialog::getSaveFileName(this, tr("Select file"), QDir::homePath(), "*.plst");
    if (fileName.isEmpty())
        return;
    if (!fileName.endsWith(".plst"))
        fileName.append(".plst");
    if (!savePlaylist(fileName))
        QMessageBox::critical(this, tr("Error!"), tr("Failed to save playlist!"));
}
void MusicPlayer::loadNextFile()
{
    if(fileLoadingList.isEmpty())
    {
        savePlaylist();
        return;
    }

    QString string = fileLoadingList.first();
    fileLoadingList.pop_front();
    Phonon::MediaSource source(string);
    metaInformationResolver->setCurrentSource(source);
}
Beispiel #8
0
void KNMusicPlaylistManager::savePlaylistList()
{
    //Check out the directory existence.
    if(KNUtil::ensurePathValid(m_playlistDirPath).isEmpty())
    {
        //We cannot save it to a invalid path.
        return;
    }
    //Get the playlist list file.
    QFile playlistListFile(m_playlistDirPath + PlaylistListFileName);
    //Check the existence and try to open the file in write only mode.
    if(!playlistListFile.open(QIODevice::WriteOnly))
    {
        //Return back.
        return;
    }
    //Generate the playlist file path content.
    QJsonArray playlistPaths;
    //Save all the file path of the playlist models in the playlist model list
    //to the playlist paths array.
    for(int i=0; i<m_playlistList->rowCount(); ++i)
    {
        //Get the playlist model.
        KNMusicPlaylistModel *model=m_playlistList->playlist(i);
        //Check the model first.
        if(model)
        {
            //Check the model is changed, or the playlist file doesn't exist.
            if(model->changed() || (!QFileInfo::exists(model->filePath())))
            {
                //Save the changed model.
                savePlaylist(model);
            }
            //Output the file path of model to json array.
            playlistPaths.append(model->filePath());
        }
    }
    //Generate the playlist list root object.
    QJsonObject playlistListObject;
    //Output basic information to the root object.
    playlistListObject.insert("Version", PlaylistListVersion);
    playlistListObject.insert("Playlists", playlistPaths);
    //Generate the document for the root object.
    //Write the data to file.
    playlistListFile.write(QJsonDocument(playlistListObject).toJson());
    //Close the playlist list file.
    playlistListFile.close();
}
Beispiel #9
0
LRESULT CPlayList::OnBnClickedBtnSavepl(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	unsigned int selFilter = 0;
	_TCHAR szFilter[] = _T("Tedplay playlists (*.pls)\0"
											"*.pls\0"
								"All Files (*.*)\0*.*\0\0");
	WTL::CFileDialog wndFileDialog(FALSE, NULL, NULL, 
		OFN_PATHMUSTEXIST | OFN_EXPLORER, szFilter, m_hWnd);

	wndFileDialog.m_ofn.nFilterIndex = selFilter;
	if (IDOK == wndFileDialog.DoModal() ) {
		LPTSTR sFileName = wndFileDialog.m_ofn.lpstrFile;
		selFilter = wndFileDialog.m_ofn.nFilterIndex;
		savePlaylist(sFileName);
	}
	return 0;
}
Beispiel #10
0
PlaylistWindow::PlaylistWindow()
        : QWidget( 0, "PlaylistWindow", Qt::WGroupLeader )
        , KXMLGUIClient()
        , m_lastBrowser( 0 )
{
    s_instance = this;

    // Sets caption and icon correctly (needed e.g. for GNOME)
    kapp->setTopWidget( this );

    KActionCollection* const ac = actionCollection();
    const EngineController* const ec = EngineController::instance();

    ac->setAutoConnectShortcuts( false );
    ac->setWidget( this );

    new K3bExporter();

    KStdAction::configureToolbars( kapp, SLOT( slotConfigToolBars() ), ac );
    KStdAction::keyBindings( kapp, SLOT( slotConfigShortcuts() ), ac );
    KStdAction::keyBindings( kapp, SLOT( slotConfigGlobalShortcuts() ), ac, "options_configure_globals" );
    KStdAction::preferences( kapp, SLOT( slotConfigAmarok() ), ac );
    KStdAction::quit( kapp, SLOT( quit() ), ac );
    KStdAction::open( this, SLOT(slotAddLocation()), ac, "playlist_add" )->setText( i18n("&Add Media...") );
    KStdAction::save( this, SLOT(savePlaylist()), ac, "playlist_save" )->setText( i18n("&Save Playlist As...") );
    KStdAction::showMenubar( this, SLOT(slotToggleMenu()), ac );

    new KAction( i18n("Play Media..."), "fileopen", 0, this, SLOT(slotPlayMedia()), ac, "playlist_playmedia" );
    new KAction( i18n("Play Audio CD"), "cdaudio_unmount", 0, this, SLOT(playAudioCD()), ac, "play_audiocd" );
    new KAction( i18n("Script Manager"), "pencil", 0, this, SLOT(showScriptSelector()), ac, "script_manager" );
    new KAction( i18n("Queue Manager"), "goto", 0, this, SLOT(showQueueManager()), ac, "queue_manager" );
    new KAction( i18n("Statistics"), amaroK::icon( "info" ), 0, this, SLOT(showStatistics()), ac, "statistics" );

    ac->action( "options_configure_globals" )->setText( i18n( "Configure &Global Shortcuts..." ) );

    new KAction( i18n( "Previous Track" ), amaroK::icon( "back" ), 0, ec, SLOT( previous() ), ac, "prev" );
    new KAction( i18n( "Play" ), amaroK::icon( "play" ), 0, ec, SLOT( play() ), ac, "play" );
    new KAction( i18n( "Pause" ), amaroK::icon( "pause" ), 0, ec, SLOT( pause() ), ac, "pause" );
    new KAction( i18n( "Next Track" ), amaroK::icon( "next" ), 0, ec, SLOT( next() ), ac, "next" );

    {
        KAction *gah = new KAction( i18n( "Toggle Focus" ), "reload", CTRL+Key_Tab,
            this, SLOT( slotToggleFocus() ), ac, "toggle_focus" );
        KPopupMenu asdf;
        gah->plug( &asdf );
        gah->unplug( &asdf );
    }

    new amaroK::MenuAction( ac );
    new amaroK::StopAction( ac );
    new amaroK::PlayPauseAction( ac );
    new amaroK::AnalyzerAction( ac );
    new amaroK::RepeatAction( ac );
    new amaroK::RandomAction( ac );
    new amaroK::FavorAction( ac );
    new amaroK::VolumeAction( ac );

    if( K3bExporter::isAvailable() )
        new amaroK::BurnMenuAction( ac );

    if( AmarokConfig::playlistWindowSize().isValid() ) {
        // if first ever run, use sizeHint(), and let
        // KWin place us otherwise use the stored values
        resize( AmarokConfig::playlistWindowSize() );
        move( AmarokConfig::playlistWindowPos() );
    }
}
Beispiel #11
0
Playlist::Playlist(PlaylistWidget::ListTypes listType, QString title, quint64 hash, QObject *parent) :
    QObject(parent)
{
    m_listType = listType;
    m_sTitle = title;
    m_bCustomTitle = false;

    m_Settings = Settings::instance();
    connect(m_Settings, SIGNAL(changed()), SLOT(onSettingsChanged()));

    m_bLoadingState = false;
    m_bShuffleList = m_Settings->getValue("player/shuffle").toInt() > 1 ? true : false;

    m_LastTrack = 0;

    m_bLoadMeta = false;
    m_bUseMeta = false;

    m_bTitleByContent = m_Settings->getValue("playlist/tabs_by_content").toBool();

    m_Auth = Auth::instance();
    connect(m_Auth, SIGNAL(authComplete()), SLOT(update()));


    // Set hash
    if(hash == 0) {
        QDateTime *time = new QDateTime(QDateTime::currentDateTime());
        m_Hash = time->toMSecsSinceEpoch();
        m_bNewly = true;
    } else {
        m_Hash = hash;
        m_bNewly = false;
    }

    // Create playlist widget
    m_listWidget = new PlaylistWidget(m_listType);
    connect(this, SIGNAL(trackAdded()), m_listWidget, SLOT(trackAdded()));
    connect(m_listWidget, SIGNAL(trackActivate(Track*)), SLOT(trackActivate(Track*)));

    // Connect key events
    connect(m_listWidget, SIGNAL(skQueue()), SLOT(addToQueue()));
    connect(m_listWidget, SIGNAL(skRemove()), SLOT(removeTrack()));
    connect(m_listWidget, SIGNAL(skDownload()), SLOT(downloadTrack()));

    // Create object of parser
    m_Parser = new Parser(this);
    connect(m_Parser, SIGNAL(newTrack(Track*)), SLOT(addTrack(Track*)));
    connect(m_Parser, SIGNAL(busy()), SLOT(parserBusy()));
    connect(m_Parser, SIGNAL(free()), SLOT(parserFree()));
    connect(m_Parser, SIGNAL(savePlaylist()), SLOT(save()));
    connect(m_Parser, SIGNAL(busy()), m_listWidget, SLOT(showLoading()));
    connect(m_Parser, SIGNAL(free()), m_listWidget, SLOT(hideLoading()));

    // Create actions parser
    m_vkActions = VkActions::instance();
    connect(m_vkActions, SIGNAL(message(QString,QString)), SIGNAL(message(QString,QString)));

    switch(m_listType) {
        case PlaylistWidget::Search:
            connect(m_listWidget, SIGNAL(searchChanged(QString)), SLOT(searchChanged(QString)));
            connect(m_listWidget, SIGNAL(loadMore()), m_Parser, SLOT(loadMoreResults()));
        break;
        case PlaylistWidget::AudioLib:
            connect(m_listWidget->friendsList(), SIGNAL(friendSelected(QString,QString,QString)), SLOT(librarySelected(QString,QString,QString)));
            connect(m_listWidget, SIGNAL(refresh()), SLOT(refresh()));
        break;
        case PlaylistWidget::Suggestions:
            connect(m_listWidget, SIGNAL(loadMore()), m_Parser, SLOT(loadMoreResults()));
            connect(m_listWidget, SIGNAL(refresh()), SLOT(refresh()));
        break;
        case PlaylistWidget::DbSearch:
            connect(m_listWidget, SIGNAL(searchChanged(QString)), SLOT(searchChanged(QString)));
            connect(m_listWidget, SIGNAL(newTrack(Track*)), SLOT(addTrack(Track*)));
            connect(m_listWidget, SIGNAL(clearList()), SLOT(clearList()));
        break;
    }

    m_Model = new QStandardItemModel(this);

    m_ProxyModel = new QSortFilterProxyModel(this);
    m_ProxyModel->setSourceModel(m_Model);
    m_ProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    m_ProxyModel->setFilterKeyColumn(2);

    m_listWidget->setModel(m_ProxyModel);

    connect(m_listWidget, SIGNAL(listSearchChanged(QString)), SLOT(setListSearch(QString)));

    createMenus();

    load();

    if(type() == PlaylistWidget::AudioLib &&
       m_bNewly &&
       m_Settings->getValue("playlist/autoload_library").toBool()
       )
        librarySelected(m_Auth->vkId(), "0", tr("My Library"));

    // Actions on newly created plalylists
    if(m_bNewly) {
        switch(m_listType) {
            case PlaylistWidget::Search:
                m_listWidget->focusOnSearch();
            break;
            case PlaylistWidget::AudioLib:
            if(m_Settings->getValue("playlist/autoload_library").toBool())
                librarySelected(m_Auth->vkId(), "0", tr("My Library"));
            break;
            case PlaylistWidget::Suggestions:
                refresh();
            break;
            case PlaylistWidget::DbSearch:
                // Unused
            break;
        }
    }
}
Beispiel #12
0
void TinyMainWindow::on_action_playlist_quick_save_2_triggered()
{
	if (savePlaylist("_quick_save_2_", true)) {
		showNotify(tr("Quick Save 2 was completed"));
	}
}
Beispiel #13
0
Player::Player(QWidget *parent):
    QMainWindow(parent),
    _ui(new Ui::Player),
    _player(new Phonon::MediaObject(this)),
    _audioOutput(new Phonon::AudioOutput(Phonon::MusicCategory, this)),
    _trayIcon(new QSystemTrayIcon(this)),
    _isStopped(false),
    _isPaused(false),
    _artistToPlaylistAction(new QAction(tr("Add to playlist"), this)),
    _artistsMenu(new QMenu(this)),
    _albumToPlaylistAction(new QAction(tr("Add to playlist"), this)),
    _albumsMenu(new QMenu(this)),
    _trackToPlaylistAction(new QAction(tr("Add to playlist"), this)),
    _tracksMenu(new QMenu(this)),
    _removeTrackAction(new QAction(tr("Remove track"), this)),
    _playlistMenu(new QMenu(this)),
    _playAction(new QAction(tr("Play"), this)),
    _pauseAction(new QAction(tr("Pause"), this)),
    _playNextAction(new QAction(tr("Play next"), this)),
    _playPrevAction(new QAction(tr("Play previous"), this)),
    _stopAction(new QAction(tr("Stop"), this)),
    _trayMenu(new QMenu(this)),
    _lastFMDialog(new LastFMAuthDialog(this))
{
    _ui->setupUi(this);
    this->setWindowIcon(QIcon(":/icon.png"));
    this->setWindowTitle(qApp->applicationName());
    _ui->pauseButton->setHidden(true);
    fixHeader(_ui->tracks->horizontalHeader());
    fixHeader(_ui->playlist->horizontalHeader());
    _ui->tracks->verticalHeader()->setDefaultSectionSize(_ui->artists->sizeHintForRow(0) + 4);
    _ui->playlist->verticalHeader()->setDefaultSectionSize(_ui->artists->sizeHintForRow(0) + 4);

    _ui->previousButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaSkipBackward));
    _ui->playButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaPlay));
    _ui->pauseButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaPause));
    _ui->stopButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaStop));
    _ui->nextButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaSkipForward));

    _playPrevAction->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaSkipBackward));
    _playAction->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaPlay));
    _pauseAction->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaPause));
    _pauseAction->setVisible(false);
    _stopAction->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaStop));
    _playNextAction->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaSkipForward));
    _ui->actionQuit->setIcon(qApp->style()->standardIcon(QStyle::SP_DialogCloseButton));
    _trayMenu->addAction(_playAction);
    _trayMenu->addAction(_pauseAction);
    _trayMenu->addAction(_playPrevAction);
    _trayMenu->addAction(_playNextAction);
    _trayMenu->addAction(_stopAction);
    _trayMenu->addAction(_ui->actionQuit);

    _trayIcon->setContextMenu(_trayMenu);
    _trayIcon->setIcon(QIcon(":/icon.png"));
    _trayIcon->show();

    Phonon::createPath(_player, _audioOutput);
    _ui->seekSlider->setMediaObject(_player);
    _ui->volumeSlider->setAudioOutput(_audioOutput);

    _artistsMenu->addAction(_artistToPlaylistAction);
    _albumsMenu->addAction(_albumToPlaylistAction);
    _tracksMenu->addAction(_trackToPlaylistAction);
    _playlistMenu->addAction(_removeTrackAction);

    connect(_ui->actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(_ui->actionAdd_directory, SIGNAL(triggered()), this, SLOT(addDirToLibrary()));
    connect(_ui->actionAdd_files, SIGNAL(triggered()), this, SLOT(addFilesToLibrary()));
    connect(_ui->actionClear_playlist, SIGNAL(triggered()), this, SLOT(clearPlaylist()));
    connect(_ui->actionLoad_playlist, SIGNAL(triggered()), this, SLOT(loadPlaylist()));
    connect(_ui->actionSave_playlist, SIGNAL(triggered()), this, SLOT(savePlaylist()));
    connect(_ui->nextButton, SIGNAL(clicked()), this, SLOT(playNext()));
    connect(_ui->playButton, SIGNAL(clicked()), this, SLOT(play()));
    connect(_ui->tracks, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(playSelected()));
    connect(_ui->playlist, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(playSelected()));
    connect(_ui->stopButton, SIGNAL(clicked()), this, SLOT(stop()));
    connect(_ui->pauseButton, SIGNAL(clicked()), this, SLOT(pause()));
    connect(_ui->stopButton, SIGNAL(clicked()), _player, SLOT(stop()));
    connect(_ui->previousButton, SIGNAL(clicked()), this, SLOT(playPrevious()));
    connect(_playAction, SIGNAL(triggered()), this, SLOT(play()));
    connect(_pauseAction, SIGNAL(triggered()), _player, SLOT(pause()));
    connect(_stopAction, SIGNAL(triggered()), _player, SLOT(stop()));
    connect(_playNextAction, SIGNAL(triggered()), this, SLOT(playNext()));
    connect(_playPrevAction, SIGNAL(triggered()), this, SLOT(playPrevious()));
    connect(_ui->artists, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showArtistsContextMenu(const QPoint &)));
    connect(_ui->albums, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showAlbumsContextMenu(const QPoint &)));
    connect(_ui->tracks, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showTracksContextMenu(const QPoint &)));
    connect(_ui->playlist, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showPlaylistContextMenu(const QPoint &)));
    connect(DataBase::instance(), SIGNAL(albumsUpdated()), this, SLOT(updateAlbums()));
    connect(DataBase::instance(), SIGNAL(artistsUpdated()), this, SLOT(updateArtists()));
    connect(DataBase::instance(), SIGNAL(tracksUpdated()), this, SLOT(updateTracks()));
    connect(_ui->artists, SIGNAL(currentRowChanged(int)), this, SLOT(updateAlbums()));
    connect(_ui->albums, SIGNAL(currentRowChanged(int)), this, SLOT(updateTracks()));
    connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
    connect(_player, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(stateChanged(Phonon::State,Phonon::State)));
    connect(_player, SIGNAL(tick(qint64)), this, SLOT(tick(qint64)));
    connect(_player, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64)));
    connect(_player, SIGNAL(finished()), this, SLOT(trackFinished()));
    connect(_ui->actionSettings, SIGNAL(triggered()), _lastFMDialog, SLOT(show()));
    connect(_ui->actionScrobbling, SIGNAL(toggled(bool)), this, SLOT(scrobblingToggled(bool)));
    connect(Settings::instance(), SIGNAL(scrobblingChanged(bool)), _ui->actionScrobbling, SLOT(setChecked(bool)));

    _allArtists = _ui->artists->item(0);
    _allArtists->setText(ALL);
    _allAlbums = _ui->albums->item(0);
    _allAlbums->setText(ALL);

    loadPlaylist(RECENTPLAYLIST);

    _ui->actionScrobbling->setChecked(Settings::instance()->isScrobblingEnabled());
    _ui->actionSettings->setEnabled(Settings::instance()->isScrobblingEnabled());
    scrobblingToggled(Settings::instance()->isScrobblingEnabled());
}